2 * Copyright (c) 1999-2000, Eric Moon.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions, and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include "StringContent.h"
35 #include "ImportContext.h"
39 __USE_CORTEX_NAMESPACE
41 // -------------------------------------------------------- //
42 // EXPORT [not implemented]
43 // -------------------------------------------------------- //
45 void StringContent::xmlExportBegin(
46 ExportContext
& context
) const {
47 context
.reportError("StringContent: no export");
49 void StringContent::xmlExportAttributes(
50 ExportContext
& context
) const {
51 context
.reportError("StringContent: no export");
53 void StringContent::xmlExportContent(
54 ExportContext
& context
) const {
55 context
.reportError("StringContent: no export");
57 void StringContent::xmlExportEnd(
58 ExportContext
& context
) const {
59 context
.reportError("StringContent: no export");
62 // -------------------------------------------------------- //
64 // -------------------------------------------------------- //
66 void StringContent::xmlImportBegin(
67 ImportContext
& context
) {}
69 void StringContent::xmlImportAttribute(
72 ImportContext
& context
) {}
74 void StringContent::xmlImportContent(
77 ImportContext
& context
) {
78 content
.Append(data
, length
);
81 void StringContent::xmlImportChild(
83 ImportContext
& context
) {
84 context
.reportError("StringContent: child not expected");
87 void StringContent::xmlImportComplete(
88 ImportContext
& context
) {
90 // chomp leading/trailing whitespace
91 if(content
.Length() == 0)
95 for(; last
< content
.Length() && isspace(content
[last
]); ++last
) {}
97 content
.Remove(0, last
);
99 last
= content
.Length() - 1;
101 for(; from
> 0 && isspace(content
[from
]); --from
) {}
103 content
.Remove(from
+1, last
-from
);
106 // END -- StringContent.cpp --