2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: ExternalId.h /main/1 1996/07/29 16:51:56 cde-hp $ */
24 // Copyright (c) 1994 James Clark
25 // See the file COPYING for copying permission.
27 #ifndef ExternalId_INCLUDED
28 #define ExternalId_INCLUDED 1
40 namespace SP_NAMESPACE {
45 class SP_API PublicId {
69 Boolean getOwnerType(OwnerType &) const;
70 Boolean getOwner(StringC &) const;
71 Boolean getTextClass(TextClass &) const;
72 Boolean getUnavailable(Boolean &) const;
73 Boolean getDescription(StringC &) const;
74 Boolean getLanguage(StringC &) const;
75 Boolean getDesignatingSequence(StringC &) const;
76 Boolean getDisplayVersion(StringC &) const;
77 // If it's not a valid formal public identifier, return 0
78 // and set error, otherwise return 1.
79 // charset describes the character set to use for parsing the
81 Boolean init(Text &, const CharsetInfo &, Char space,
82 const MessageType1 *&error);
83 const StringC &string() const;
84 const Text &text() const;
86 static Boolean nextField(Char solidus,
89 const Char *&fieldStart,
91 static Boolean lookupTextClass(const StringC &, const CharsetInfo &,
93 static const char *const textClasses[];
95 PackedBoolean formal_;
99 PackedBoolean unavailable_;
100 StringC description_;
101 StringC languageOrDesignatingSequence_;
102 PackedBoolean haveDisplayVersion_;
103 StringC displayVersion_;
107 class SP_API ExternalId {
110 const StringC *systemIdString() const;
111 const StringC *publicIdString() const;
112 const StringC &effectiveSystemId() const;
113 const Text *systemIdText() const;
114 const Text *publicIdText() const;
115 const PublicId *publicId() const;
116 void setSystem(Text &);
117 void setEffectiveSystem(StringC &);
118 // If it's not a valid formal public identifier, return 0
119 // and set error, otherwise return 1.
120 // charset describes the character set to use for parsing the
122 Boolean setPublic(Text &, const CharsetInfo &, Char space,
123 const MessageType1 *&error);
124 void setLocation(const Location &);
125 // location of keyword
126 const Location &location() const;
128 PackedBoolean haveSystem_;
129 PackedBoolean havePublic_;
133 StringC effectiveSystem_;
137 const StringC &PublicId::string() const
139 return text_.string();
143 const Text &PublicId::text() const
149 const StringC *ExternalId::systemIdString() const
151 return haveSystem_ ? &system_.string() : 0;
155 const StringC *ExternalId::publicIdString() const
157 return havePublic_ ? &public_.string() : 0;
161 const Text *ExternalId::systemIdText() const
163 return haveSystem_ ? &system_ : 0;
167 const Text *ExternalId::publicIdText() const
169 return havePublic_ ? &public_.text() : 0;
173 const PublicId *ExternalId::publicId() const
175 return havePublic_ ? &public_ : 0;
179 const Location &ExternalId::location() const
185 const StringC &ExternalId::effectiveSystemId() const
187 return effectiveSystem_;
191 void ExternalId::setEffectiveSystem(StringC &str)
193 str.swap(effectiveSystem_);
200 #endif /* not ExternalId_INCLUDED */