2 kumpf 1.1 //
3 // 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 // IBM Corp.; EMC Corporation, The Open Group.
7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
13 kumpf 1.1 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 kumpf 1.1 #ifndef Pegasus_ContentLanguageList_h
35 #define Pegasus_ContentLanguageList_h
36
37 #include <Pegasus/Common/Config.h>
38 #include <Pegasus/Common/LanguageTag.h>
39
40 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
41
42 PEGASUS_NAMESPACE_BEGIN
43
44 class ContentLanguageListRep;
45
46 //////////////////////////////////////////////////////////////
47 //
48 // ContentLanguageList
49 //
50 //////////////////////////////////////////////////////////////
51
52 /** <I><B>Experimental Interface</B></I><BR>
53 This class represents a list of content languages (such as may appear
54 in an HTTP Content-Language header value). It is managed as a list of
55 kumpf 1.1 LanguageTag objects.
56 */
57 class PEGASUS_COMMON_LINKAGE ContentLanguageList
58 {
59 public:
60
61 /**
62 Constructs an empty ContentLanguageList object.
63 */
64 ContentLanguageList();
65
66 /**
67 Copy constructor.
68 @param contentLanguages The ContentLanguageList object to copy.
69 */
70 ContentLanguageList(const ContentLanguageList& contentLanguages);
71
72 /**
73 Destructor.
74 */
75 ~ContentLanguageList();
76 kumpf 1.1
77 /**
78 Assignment operator.
79 @param contentLanguages The ContentLanguageList object to copy.
80 */
81 ContentLanguageList& operator=(const ContentLanguageList& contentLanguages);
82
83 /**
84 Returns the number of LanguageTags in the ContentLanguageList object.
85 @return Integer size of the ContentLanguageList list.
86 */
87 Uint32 size() const;
88
89 /**
90 Accesses a LanguageTag at a specified index.
91 @param index Integer index of the LanguageTag to access.
92 Valid indices range from 0 to size()-1.
93 @return The LanguageTag corresponding to the specified index.
94 @exception IndexOutOfBoundsException If the specified index is out of
95 range.
96 */
97 kumpf 1.1 LanguageTag getLanguageTag(Uint32 index) const;
98
99 /**
100 Appends a LanguageTag to the ContentLanguageList object.
101 @param languageTag The LanguageTag to append.
102 */
103 void append(const LanguageTag& languageTag);
104
105 /**
106 Removes the specified LanguageTag from the ContentLanguageList object.
107 @param index Integer index of the LanguageTag to remove.
108 @exception IndexOutOfBoundsException If the specified index is out of
109 range.
110 */
111 void remove(Uint32 index);
112
113 /**
114 Finds the specified LanguageTag in the ContentLanguageList object and
115 returns its index.
116 @param languageTag The LanguageTag to find.
117 @return Integer index of the LanguageTag, if found; otherwise
118 kumpf 1.1 PEG_NOT_FOUND.
119 */
120 Uint32 find(const LanguageTag& languageTag) const;
121
122 /**
123 Removes all the LanguageTags from the ContentLanguageList object.
124 */
125 void clear();
126
127 /**
128 Tests ContentLanguageList objects for equality.
129 @param contentLanguages A ContentLanguageList object to be compared.
130 @return True if the ContentLanguageList objects contain the same
131 LanguageTags in the same order, false otherwise.
132 */
133 Boolean operator==(const ContentLanguageList& contentLanguages) const;
134
135 /**
136 Tests ContentLanguageList objects for inequality.
137 @param contentLanguages A ContentLanguageList object to be compared.
138 @return False if the ContentLanguageList objects contain the same
139 kumpf 1.1 LanguageTags in the same order, true otherwise.
140 */
141 Boolean operator!=(const ContentLanguageList& contentLanguages) const;
142
143 private:
144 ContentLanguageListRep *_rep;
145 };
146
147 PEGASUS_NAMESPACE_END
148
149 #endif // PEGASUS_USE_EXPERIMENTAL_INTERFACES
150
151 #endif
|