1 karl 1.12 //%2005////////////////////////////////////////////////////////////////////////
|
2 karl 1.6 //
|
3 karl 1.11 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.6 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.11 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.12 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.6 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
13 // of this software and associated documentation files (the "Software"), to
14 // deal in the Software without restriction, including without limitation the
15 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 // sell copies of the Software, and to permit persons to whom the Software is
17 // furnished to do so, subject to the following conditions:
18 //
19 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
20 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //==============================================================================
|
29 humberto 1.7 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_LanguageElementContainer_h
33 #define Pegasus_LanguageElementContainer_h
34
35
36 #include <cstdlib>
37 #include <cctype>
|
38 kumpf 1.9
39 #ifdef PEGASUS_OS_HPUX
40 # ifdef HPUX_IA64_NATIVE_COMPILER
41 # include <iostream>
42 # else
43 # include <iostream.h>
44 # endif
45 #else
46 # include <iostream>
47 #endif
48
|
49 humberto 1.7 #include <Pegasus/Common/Linkage.h>
50 #include <Pegasus/Common/Config.h>
51 #include <Pegasus/Common/String.h>
52 #include <Pegasus/Common/Array.h>
53 #include <Pegasus/Common/LanguageElement.h>
54 //#include <Pegasus/Common/LanguageParser.h>
|
55 chuck 1.5
56 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
|
57 humberto 1.7
58 PEGASUS_NAMESPACE_BEGIN
59
60 class LanguageElementContainerRep;
61
62 //////////////////////////////////////////////////////////////
63 //
64 // LanguageElementContainer::
65 //
66 //////////////////////////////////////////////////////////////
67
|
68 denise.eckstein 1.10 /** <I><B>Experimental Interface</B></I><BR>
69 * This class is a container class for LanguageElement
|
70 humberto 1.7 */
71 class PEGASUS_COMMON_LINKAGE LanguageElementContainer{
72
73 public:
74
|
75 kumpf 1.13 /** This member is used to represent an empty LanguageElementContainer. Using this
|
76 humberto 1.7 member avoids construction of an empty LanguageElementContainer
77 (e.g., LanguageElementContainer()).
|
78 kumpf 1.13 */
79 static const LanguageElementContainer EMPTY;
|
80 humberto 1.7
81 /**
82 * Default Constructor
83 */
|
84 kumpf 1.13 LanguageElementContainer();
85
86 /**
87 * Constructor
88 * @param container Array<LanguageElement> - contructs the object with the elements in the array
89 */
90 LanguageElementContainer(const Array<LanguageElement> & container);
91
92 /** Copy Constructor
93 * @param rhs LanguageElementContainer
94 */
95 LanguageElementContainer(const LanguageElementContainer &rhs);
96
97 /**
98 * Destructor
99 */
100 virtual ~LanguageElementContainer();
101
102 /**
103 * Deep copy
104 * @param rhs LanguageElementContainer
105 kumpf 1.13 */
106 LanguageElementContainer& operator=(const LanguageElementContainer &rhs);
107
108 /** Gets an AcceptLanguageElement object at position index
109 * @param index int position of AcceptLanguageElement
110 * @return AcceptLanguageElement
111 */
112 LanguageElement getLanguageElement(Uint32 index) const;
113
114 /** Gets all AcceptLanguageElement objects in the container
115 * @return Array<AcceptLanguageElement>
116 */
117 Array<LanguageElement> getAllLanguageElements() const;
118
119 /** Returns the String representation of this container
120 * @return String
121 */
122 virtual String toString() const;
123
124 /**
125 * Returns the length of the LanguageElementContainer object.
126 kumpf 1.13 * @return Length of the container.
|
127 humberto 1.7 */
128 Uint32 size() const;
129
|
130 kumpf 1.13 /**
131 * True if the container has element (case INSENSITIVE match of element's language fields
132 * @param LanguageElement element
133 * @return Boolean
134 */
135 Boolean contains(LanguageElement element)const;
136
137 /**
138 * Resets this object's iterator, should be called once before using itrNext()
139 */
140 void itrStart();
141
142 /**
143 * Returns the next element in the container
144 * Callers should call itrStart() ONCE before making calls to this function and
145 * anytime callers want the iterator reset to the beginning of the container.
146 * @return LanguageElement - the next element the container or LanguageElement::EMPTY_REF
147 * if the end of the container has been reached.
148 */
149 LanguageElement itrNext();
150
151 kumpf 1.13 /**
152 * Removes the element at index from the container.
153 * @param index Uint32 - position of the element in the container to remove
154 */
155 void remove(Uint32 index);
156
157 /**
158 * Removes the element matching the parameter, returns -1 if not found
159 * @param element LanguageElement - element to remove
160 * @return int -1 if element not found, otherwise returns the position of element before the remove.
161 */
162 Uint32 remove(const LanguageElement &element);
163
164 /**
165 * Clears the container of all elements
166 */
167 void clear();
168
169 void append(LanguageElement element);
170
171 /**
172 kumpf 1.13 * Equality based on language fields only
173 */
174 Boolean operator==(const LanguageElementContainer &rhs)const;
175
176 /**
177 * Inequality based on language fields only
178 */
179 Boolean operator!=(const LanguageElementContainer &rhs)const;
180
181 /**
182 * Finds the element in the container and returns its position.
183 * @param element LanguageElement - element to find
184 * @return int index of element if found, otherwise -1
185 */
186 //int find(LanguageElement element)const;
|
187 humberto 1.7
188 protected:
189
|
190 kumpf 1.13 LanguageElementContainerRep *_rep;
191
192
|
193 humberto 1.7 }; // end LanguageElementContainer
194
195 PEGASUS_NAMESPACE_END
|
196 chuck 1.5
197 #endif // PEGASUS_USE_EXPERIMENTAL_INTERFACE
|
198 humberto 1.7
199 #endif
|