(file) Return to LanguageTag.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 karl  1.2 //%2006////////////////////////////////////////////////////////////////////////
  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.
 11 karl  1.2 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12           // EMC Corporation; Symantec 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_LanguageTag_h
 35           #define Pegasus_LanguageTag_h
 36           
 37           #include <Pegasus/Common/Config.h>
 38           #include <Pegasus/Common/String.h>
 39           #include <Pegasus/Common/Linkage.h>
 40           
 41           PEGASUS_NAMESPACE_BEGIN
 42           
 43           class LanguageTagRep;
 44           
 45 kumpf 1.3 /**
 46 kumpf 1.1     This class specifies a language in a standard form (based on RFC 3066),
 47               including the special language range "*".  Note:  This class may be
 48               extended to support RFC 3066bis in the future.
 49            */
 50           class PEGASUS_COMMON_LINKAGE LanguageTag
 51           {
 52           public:
 53           
 54               /**
 55                   Constructs an uninitialized LanguageTag object.  A method
 56                   invocation on an uninitialized LanguageTag object will
 57                   result in the throwing of an UninitializedObjectException.  An
 58                   uninitialized object may be converted into an initialized object only
 59                   by using the assignment operator with an initialized object.
 60                */
 61               LanguageTag();
 62           
 63               /**
 64                   Constructs a LanguageTag object from a language tag String.
 65                   The syntax of the language tag String is validated, but the subtags
 66                   are not verified to be values registered with ISO or IANA.
 67 kumpf 1.1         @param languageTag A String containing a language tag (for example,
 68                   "en-US").
 69                   @exception Exception if the syntax of the language tag String is not
 70                   valid.
 71                */
 72               LanguageTag(const String& languageTagString);
 73           
 74               /**
 75                   Copy constructor.
 76                   @param languageTag The LanguageTag object to copy.
 77                */
 78               LanguageTag(const LanguageTag& languageTag);
 79           
 80               /**
 81                   Destructor.
 82                */
 83               ~LanguageTag();
 84           
 85               /**
 86                   Assignment operator.
 87                   @param languageTag The LanguageTag object to copy.
 88 kumpf 1.1      */
 89               LanguageTag& operator=(const LanguageTag& languageTag);
 90           
 91               /**
 92                   Gets the language value, if present.
 93                   @return A String containing the language value for this LanguageTag
 94                   object if the primary subtag is two or three characters in length,
 95                   an empty String otherwise.
 96                   @exception UninitializedObjectException if the LanguageTag
 97                   has not been initialized.
 98                */
 99               String getLanguage() const;
100           
101               /**
102                   Gets the country code from the second subtag, if present.
103                   @return A String containing the country code for this LanguageTag
104                   object if the primary subtag is two or three characters in length
105                   and the second subtag is two characters in length, an empty String
106                   otherwise.
107                   @exception UninitializedObjectException if the LanguageTag
108                   has not been initialized.
109 kumpf 1.1      */
110               String getCountry() const;
111           
112               /**
113                   Gets the language variant, if applicable.  The language variant
114                   includes all the subtags after the country code (if present) or
115                   language value (if present).
116                   @return A String containing the language variant for this LanguageTag
117                   object if the primary subtag is two or three characters in length,
118                   an empty String otherwise.
119                   @exception UninitializedObjectException if the LanguageTag
120                   has not been initialized.
121                */
122               String getVariant() const;
123           
124               /**
125                   Returns a String representation of the language tag.
126                   @return A String representing the LanguageTag object in RFC 3066
127                   syntax (for example, "language-country-variant").
128                   @exception UninitializedObjectException if the LanguageTag has not
129                   been initialized.
130 kumpf 1.1      */
131               String toString() const;
132           
133               /**
134                   Tests LanguageTag objects for equality.  Comparisons are
135                   case-insensitive.  Distinct but equivalent language tags are not
136                   considered equal.  Language range matching is not performed.
137                   @param languageTag A LanguageTag object to be compared.
138                   @return True if the language tags differ only in case, false otherwise.
139                   @exception UninitializedObjectException if either of the
140                   LanguageTags has not been initialized.
141                */
142               Boolean operator==(const LanguageTag& languageTag) const;
143           
144               /**
145                   Tests LanguageTag objects for inequality.  Comparisons are
146                   case-insensitive.  Distinct but equivalent language tags are not
147                   considered equal.  Language range matching is not performed.
148                   @param languageTag A LanguageTag object to be compared.
149                   @return True if the language tags differ in more than just case,
150                   false otherwise.
151 kumpf 1.1         @exception UninitializedObjectException if either of the
152                   LanguageTags has not been initialized.
153                */
154               Boolean operator!=(const LanguageTag& languageTag) const;
155           
156           private:
157               LanguageTagRep* _rep;
158           };
159           
160           PEGASUS_NAMESPACE_END
161           
162           #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2