cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

parse.h (2703B)


      1/*
      2 * Licensed to the Apache Software Foundation (ASF) under one
      3 * or more contributor license agreements.  See the NOTICE file
      4 * distributed with this work for additional information
      5 * regarding copyright ownership.  The ASF licenses this file
      6 * to you under the Apache License, Version 2.0 (the
      7 * "License"); you may not use this file except in compliance
      8 * with the License.  You may obtain a copy of the License at
      9 *
     10 *   http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing,
     13 * software distributed under the License is distributed on an
     14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     15 * KIND, either express or implied.  See the License for the
     16 * specific language governing permissions and limitations
     17 * under the License.
     18 */
     19
     20#ifndef GUACENC_PARSE_H
     21#define GUACENC_PARSE_H
     22
     23#include "config.h"
     24
     25#include <guacamole/timestamp.h>
     26
     27/**
     28 * Parses a string into a single integer. Only positive integers are accepted.
     29 * The input string may be modified during parsing. A value will be stored in
     30 * the provided int pointer only if valid.
     31 *
     32 * @param arg
     33 *     The string to parse.
     34 *
     35 * @param i
     36 *     A pointer to the integer in which the parsed value of the given string
     37 *     should be stored.
     38 *
     39 * @return
     40 *     Zero if parsing was successful, non-zero if the provided string was
     41 *     invalid.
     42 */
     43int guacenc_parse_int(char* arg, int* i);
     44
     45/**
     46 * Parses a string of the form WIDTHxHEIGHT into individual width and height
     47 * integers. The input string may be modified during parsing. Values will be
     48 * stored in the provided width and height pointers only if the given
     49 * dimensions are valid.
     50 *
     51 * @param arg
     52 *     The string to parse.
     53 *
     54 * @param width
     55 *     A pointer to the integer in which the parsed width component of the
     56 *     given string should be stored.
     57 *
     58 * @param height
     59 *     A pointer to the integer in which the parsed height component of the
     60 *     given string should be stored.
     61 *
     62 * @return
     63 *     Zero if parsing was successful, non-zero if the provided string was
     64 *     invalid.
     65 */
     66int guacenc_parse_dimensions(char* arg, int* width, int* height);
     67
     68/**
     69 * Parses a guac_timestamp from the given string. The string is assumed to
     70 * consist solely of decimal digits with an optional leading minus sign. If the
     71 * given string contains other characters, the behavior of this function is
     72 * undefined.
     73 *
     74 * @param str
     75 *     The string to parse, which must contain only decimal digits and an
     76 *     optional leading minus sign.
     77 *
     78 * @return
     79 *     A guac_timestamp having the same value as the provided string.
     80 */
     81guac_timestamp guacenc_parse_timestamp(const char* str);
     82
     83#endif
     84
     85