Parser.h

Go to the documentation of this file.
00001 #ifndef __PARSER_H__
00002 #define __PARSER_H__
00003 
00004 /*
00005 
00006 $Header$
00007 
00008 */
00009 
00010 #include "String.h"
00011 #include "StringList.h"
00012 
00013 // Errors.
00014 static const char *const ERROR_PARSER_GENERAL = "Error parsing String '%s'.";
00015 
00016 using namespace std;
00017 
00018 typedef enum
00019 {
00020   CASE_SENSITIVE,
00021   CASE_INSENSITIVE
00022 } CaseSensitivity;
00023 
00024 static const char *const PARSER_DELIMITERS         = " \r\n\t=";
00025 static const char *const PARSER_ADDRESS_DELIMITERS = ":";
00026 
00027 static const char PARSER_QUOT = '\'';
00028 
00029 namespace Parser
00030 {
00031 
00032   int getValue(const String &str, const String &key, String &value, const CaseSensitivity caseSensitive = CASE_INSENSITIVE,
00033                const unsigned int maxValueSize = 0);
00034   int split(const String &str, StringList &values, const unsigned int maxValuesNum = 0,
00035             const String &delimiters = PARSER_DELIMITERS, const bool combineDelimiters = true);
00036   int split(char *str, char **values, unsigned int maxValuesNum, unsigned int &valuesNum, const char *delimiters = PARSER_DELIMITERS);
00037   String join(const StringList &values, const String &delimiter = " ");
00038   String join(const char *tokens[], const unsigned int tokensNum, const char *delimiter = " ");
00039   int parseAddress(const String &str, String &ip, String &port);
00040 
00041 }
00042 
00043 #endif

Generated on Thu Sep 6 20:11:25 2007 for Pylon Application Platform by  doxygen 1.5.1