libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / apps / cortex / Persistence / StringContent.cpp
blob6a87b80afb8ed5cebfa0d6883805f358191b130c
1 /*
2 * Copyright (c) 1999-2000, Eric Moon.
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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.
32 // StringContent.cpp
34 #include "StringContent.h"
35 #include "ImportContext.h"
37 #include <cctype>
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 // -------------------------------------------------------- //
63 // IMPORT
64 // -------------------------------------------------------- //
66 void StringContent::xmlImportBegin(
67 ImportContext& context) {}
69 void StringContent::xmlImportAttribute(
70 const char* key,
71 const char* value,
72 ImportContext& context) {}
74 void StringContent::xmlImportContent(
75 const char* data,
76 uint32 length,
77 ImportContext& context) {
78 content.Append(data, length);
81 void StringContent::xmlImportChild(
82 IPersistent* child,
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)
92 return;
94 int32 last = 0;
95 for(; last < content.Length() && isspace(content[last]); ++last) {}
96 if(last > 0)
97 content.Remove(0, last);
99 last = content.Length() - 1;
100 int32 from = last;
101 for(; from > 0 && isspace(content[from]); --from) {}
102 if(from < last)
103 content.Remove(from+1, last-from);
106 // END -- StringContent.cpp --