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 PEGASUS_NAMESPACE_BEGIN
41
42 class ContentLanguageListRep;
43
44 //////////////////////////////////////////////////////////////
45 //
46 // ContentLanguageList
47 //
48 //////////////////////////////////////////////////////////////
49
|
51 kumpf 1.1 This class represents a list of content languages (such as may appear
52 in an HTTP Content-Language header value). It is managed as a list of
53 LanguageTag objects.
54 */
55 class PEGASUS_COMMON_LINKAGE ContentLanguageList
56 {
57 public:
58
59 /**
60 Constructs an empty ContentLanguageList object.
61 */
62 ContentLanguageList();
63
64 /**
65 Copy constructor.
66 @param contentLanguages The ContentLanguageList object to copy.
67 */
68 ContentLanguageList(const ContentLanguageList& contentLanguages);
69
70 /**
71 Destructor.
72 kumpf 1.1 */
73 ~ContentLanguageList();
74
75 /**
76 Assignment operator.
77 @param contentLanguages The ContentLanguageList object to copy.
78 */
79 ContentLanguageList& operator=(const ContentLanguageList& contentLanguages);
80
81 /**
82 Returns the number of LanguageTags in the ContentLanguageList object.
83 @return Integer size of the ContentLanguageList list.
84 */
85 Uint32 size() const;
86
87 /**
88 Accesses a LanguageTag at a specified index.
89 @param index Integer index of the LanguageTag to access.
90 Valid indices range from 0 to size()-1.
91 @return The LanguageTag corresponding to the specified index.
92 @exception IndexOutOfBoundsException If the specified index is out of
93 kumpf 1.1 range.
94 */
95 LanguageTag getLanguageTag(Uint32 index) const;
96
97 /**
98 Appends a LanguageTag to the ContentLanguageList object.
99 @param languageTag The LanguageTag to append.
100 */
101 void append(const LanguageTag& languageTag);
102
103 /**
104 Removes the specified LanguageTag from the ContentLanguageList object.
105 @param index Integer index of the LanguageTag to remove.
106 @exception IndexOutOfBoundsException If the specified index is out of
107 range.
108 */
109 void remove(Uint32 index);
110
111 /**
112 Finds the specified LanguageTag in the ContentLanguageList object and
113 returns its index.
114 kumpf 1.1 @param languageTag The LanguageTag to find.
115 @return Integer index of the LanguageTag, if found; otherwise
116 PEG_NOT_FOUND.
117 */
118 Uint32 find(const LanguageTag& languageTag) const;
119
120 /**
121 Removes all the LanguageTags from the ContentLanguageList object.
122 */
123 void clear();
124
125 /**
126 Tests ContentLanguageList objects for equality.
127 @param contentLanguages A ContentLanguageList object to be compared.
128 @return True if the ContentLanguageList objects contain the same
129 LanguageTags in the same order, false otherwise.
130 */
131 Boolean operator==(const ContentLanguageList& contentLanguages) const;
132
133 /**
134 Tests ContentLanguageList objects for inequality.
135 kumpf 1.1 @param contentLanguages A ContentLanguageList object to be compared.
136 @return False if the ContentLanguageList objects contain the same
137 LanguageTags in the same order, true otherwise.
138 */
139 Boolean operator!=(const ContentLanguageList& contentLanguages) const;
140
141 private:
142 ContentLanguageListRep *_rep;
143 };
144
145 PEGASUS_NAMESPACE_END
146
147 #endif
|