Debian Codegraph @

apps/converters/ivdowngrade/SoText2V2.c++

raw
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1995-96 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | Classes:
44 | SoText2V2
45 |
46 | Authors: Alan Norton
47 |
48 ______________ S I L I C O N G R A P H I C S I N C . ____________
49 _______________________________________________________________________
50 */
51
52 #include <Inventor/actions/SoWriteAction.h>
53 #include "SoText2V2.h"
54
55 char* convToAscii(const SbString& str);
56
57 SO_NODE_SOURCE(SoText2V2);
58
59 ////////////////////////////////////////////////////////////////////////
60 //
61 // Description:
62 // init that class!
63 //
64 void
65 SoText2V2::initClass()
66 //
67 ////////////////////////////////////////////////////////////////////////
68 {
69 SO__NODE_INIT_CLASS(SoText2V2, "Text2", SoText2);
70
71 // Tell the type system whenever it wants to create something
72 // of type SoText2 to create a SoText2V2
73 SoType::overrideType(
74 SoText2::getClassTypeId(), &SoText2V2::createInstance);
75 }
76
77 ////////////////////////////////////////////////////////////////////////
78 //
79 // Description:
80 // Constructor
81 //
82 SoText2V2::SoText2V2()
83 //
84 ////////////////////////////////////////////////////////////////////////
85 {
86 SO_NODE_CONSTRUCTOR(SoText2V2);
87
88 // This is a built in node in all versions of Inventor
89 isBuiltIn = TRUE;
90 }
91
92 ////////////////////////////////////////////////////////////////////////
93 //
94 // Description:
95 // Destructor
96 //
97 SoText2V2::~SoText2V2()
98 //
99 ////////////////////////////////////////////////////////////////////////
100 {
101
102 }
103
104 ////////////////////////////////////////////////////////////////////////
105 //
106 // Description:
107 // write the alternate rep for this node
108 // We need to convert nonstandard (e.g. UTF-8) characters to legitimate
109 // ascii values.
110 //
111 void
112 SoText2V2::write(SoWriteAction *action)
113 //
114 ////////////////////////////////////////////////////////////////////////
115 {
116 // We don't to trigger notification during writing.
117 enableNotify(FALSE);
118
119 SoOutput *out = action->getOutput();
120
121 // Not in write-reference counting phase
122 if (out->getStage() != SoOutput::COUNT_REFS) {
123 if (! string.isDefault()) {
124 // go through every string in the field, make sure it's ascii
125 for (int i= 0; i< string.getNum(); i++)
126 string.set1Value(i, convToAscii( string[i]));
127 }
128 }
129
130 SoText2::write(action);
131 }