sipxportlib  Version 3.3
UtlNameValueTokenizer.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2004-2007 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
9 // Licensed to SIPfoundry under a Contributor Agreement.
10 //
11 // $$
13 
14 
15 #ifndef _UtlNameValueTokenizer_h_
16 #define _UtlNameValueTokenizer_h_
17 
18 // SYSTEM INCLUDES
19 // APPLICATION INCLUDES
20 #include "utl/UtlString.h"
21 
22 // DEFINES
23 #define NEWLINE '\n'
24 #define CARRIAGE_RETURN '\r'
25 #define CARRIAGE_RETURN_NEWLINE "\r\n"
26 
27 // MACROS
28 // EXTERNAL FUNCTIONS
29 // EXTERNAL VARIABLES
30 // CONSTANTS
31 // STRUCTS
32 // TYPEDEFS
33 // FORWARD DECLARATIONS
34 
37 {
38 /* //////////////////////////// PUBLIC //////////////////////////////////// */
39 public:
40 
41 /* ============================ CREATORS ================================== */
42 
44  UtlNameValueTokenizer(const char* multiLineText, int textLength = -1);
45 
47  virtual
49 
50 /* ============================ MANIPULATORS ============================== */
51 
53  static
54  int findNextLineTerminator(const char* text, int length,
55  int* nextLineIndex);
68  static
69  UtlBoolean getSubField(const char* textField,
70  int subfieldIndex,
71  const char* subfieldSeparator,
72  UtlString* subfieldText,
73  int* lastCharIndex = NULL);
74 
75  static
76  UtlBoolean getSubField(const char* textField,
77  int textFieldLength,
78  int subfieldIndex,
79  const char* subfieldSeparators,
80  const char*& subfieldPtr,
81  int& subFieldLength,
82  int* lastCharIndex);
83 
84  UtlBoolean getNextPair(char separator, UtlString* name, UtlString* value);
85 
86 /* ============================ ACCESSORS ================================= */
87 
88 /* ============================ INQUIRY =================================== */
89 
91  int getProcessedIndex();
92 
93 /* //////////////////////////// PROTECTED ///////////////////////////////// */
94 protected:
95 
96 /* //////////////////////////// PRIVATE /////////////////////////////////// */
97 private:
98 
99  const char* textPtr;
100  int textLen;
101  int bytesConsumed;
102 
104  UtlNameValueTokenizer(const UtlNameValueTokenizer& rNameValueTokenizer);
105 
107  UtlNameValueTokenizer& operator=(const UtlNameValueTokenizer& rhs);
108 };
109 
110 /* ============================ INLINE METHODS ============================ */
111 
112 #endif // _UtlNameValueTokenizer_h_
UtlBoolean getNextPair(char separator, UtlString *name, UtlString *value)
Definition: UtlNameValueTokenizer.cpp:184
UtlBoolean isAtEnd()
Definition: UtlNameValueTokenizer.cpp:257
#define NULL
Definition: UtlDefs.h:29
static int findNextLineTerminator(const char *text, int length, int *nextLineIndex)
Finds the index to the next line terminator.
Definition: UtlNameValueTokenizer.cpp:49
Definition: UtlString.h:48
virtual ~UtlNameValueTokenizer()
Destructor.
Definition: UtlNameValueTokenizer.cpp:43
UtlNameValueTokenizer(const char *multiLineText, int textLength=-1)
Constructor.
Definition: UtlNameValueTokenizer.cpp:30
Parses name value pairs from multiple lines of text.
Definition: UtlNameValueTokenizer.h:36
int UtlBoolean
Definition: UtlDefs.h:41
static UtlBoolean getSubField(const char *textField, int subfieldIndex, const char *subfieldSeparator, UtlString *subfieldText, int *lastCharIndex=NULL)
Definition: UtlNameValueTokenizer.cpp:154
int getProcessedIndex()
Definition: UtlNameValueTokenizer.cpp:251