1 /*
2  * MFString.h
3  *
4  * Copyright (C) 1999 Stephen F. White
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program (see the file "COPYING" for details); if
18  * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19  * Cambridge, MA 02139, USA.
20  */
21 
22 #pragma once
23 
24 #include "FieldValue.h"
25 
26 class ElementList;
27 
28 class MFString : public MFieldValue {
29 public:
30                         MFString();
31                         MFString(const MFString &string);
32                         MFString(MyString *value);
33                         MFString(MyString value);
34                         MFString(StringArray *values);
35     virtual            ~MFString();
36 
getType()37     virtual int         getType() const { return MFSTRING; }
getTypeName()38     virtual const char *getTypeName() const { return "MFString"; }
39     virtual MyString    getString(int index, int stride) const;
40 
41     virtual int         write4FieldPipe(int filedes, int indent) const;
42 
43     virtual int         writeCWonderlandArt(int filedes,
44                                             const char* variableName,
45                                             int languageFlag) const;
46 
47     virtual int         writeDataC(int filedes, int i, int languageFlag) const;
48     virtual int         writeRaw(int filedes, int indent) const;
49 
50     virtual int         writeData(int filedes, int i) const;
51     virtual int         writeDataXml(int filedes, int i) const;
52 
53     virtual const char *getTypeC(int languageFlag) const;
54 
55     virtual bool        readLine(int index, char *line);
56 
getNumbersPerType(void)57     virtual int         getNumbersPerType(void) const { return 0; }
58 
59     virtual bool        equals(const FieldValue *value) const;
60     virtual FieldValue *copy();
61 
getSFSize()62     virtual int         getSFSize() const { return m_value.size(); }
63     virtual FieldValue *getSFValue(int index) const;
64     virtual void        setSFValue(int index, FieldValue *value);
65     virtual void        setSFValue(int index, const char* value);
66 
getValues()67     const MyString     *getValues() const { return m_value.getData(); }
getValue(int i)68     MyString            getValue(int i) const { return m_value[i]; }
getSize()69     int                 getSize() const { return m_value.size(); }
setValue(int index,MyString value)70     void                setValue(int index, MyString value)
71                            { m_value[index] = value; }
72 
73     virtual void        insertSFValue(int index, FieldValue *value);
74     virtual void        insertSFValue(int index, const char* value);
removeSFValue(long index)75     virtual void        removeSFValue(long index) { m_value.remove(index); }
76 
77     MyString            getEcmaScriptComment(MyString name, int flags) const;
78 
79     FieldValue         *getRandom(Scene *scene, int nodeType);
80 private:
81     StringArray         m_value;
82 };
83