Commit Graph
82 Commits
Author SHA1 Message Date
Glenn Maynard cefa128034 change XNode children to a vector.
This means the order of children is preserved.

It also means the name of each node isn't duplicated.  This was
an opportunity for an inconsistent XNode tree.  Nodes can now be
renamed after being inserted into a tree.

Searching for children by name isn't efficient.  Use attributes for that.
2007-02-12 01:52:18 +00:00
Glenn Maynard 62b5c145db remove SetTextValue 2007-02-11 07:40:45 +00:00
Glenn Maynard b0430161b9 Merge text values into attributes; use TEXT_ATTRIBUTE_NAME for
the text value.

This means that FOREACH_Attr will iterate over the text value.
Compare with TEXT_ATTRIBUTE_NAME if you explicitly don't want
that.

This is simpler; an XNode branches out in two places--attributes
and children--instead of three.

It also means that nodes without any text data actually don't
have any text data--the attribute simply doesn't exist.  The
*TextValue functions are also no longer needed, though some
are left in now for compatibility (and maybe convenience).
2007-02-11 07:27:29 +00:00
Glenn Maynard fb8e73ac58 SetValue, etc -> SetTextValue 2007-02-11 06:26:06 +00:00
Glenn Maynard b9e277d0e7 GetValue: return XNodeValue * 2007-02-11 00:33:53 +00:00
Steve Checkoway 424f04219b Simplify. There is no need for a SAFE_DELETE since attribute and children data structures are clear()ed. 2007-02-04 13:23:24 +00:00
Glenn Maynard f588a033a8 avoid ambiguity with template AppendAttr 2006-10-09 05:13:08 +00:00
Glenn Maynard 3cae60d6fd Currently, expression handling in XML is spotting and inconsistent.
Each actor type needs to evaluate attributes; only a few do.  Strings
are handled with the "@foo()" notation.

Instead, after loading an XML file for loading as an actor,
precompile all XML attributes as Lua expressions.

The primary difference to code is:
 - previously, Attr="string" would act as a string if it was being
   read as one.  Now, specify Attr='"string"'.  Attr="@string" is
   a shorthand.  (note that @strings will not be parsed as Lua
   strings, so can not use Lua escape characters)
 - previously, Attr="@func()" would evaluate func(), and the value
   of the attribute would be the return value of the function.  This
   was only supported for a few attributes.  Now, say Attr="func()",
   and this will work for all fields.
 - Attributes of other types are unchanged, except that all attributes
   may be Lua expressions, eg. Width="SCREEN_WIDTH".
 - Attributes names ending with "Command" are special, like metrics.
   Prefix "%" to disable this.

This brings XML handling in line with metric handling.  (This is an intermediary
step; I have another idea that follows from this that should eliminate the annoying
"'foo'"/"@foo".)
2006-10-09 00:49:30 +00:00
Glenn Maynard fc2ddf5d3d unneeded 2006-10-06 06:42:30 +00:00
Glenn Maynard ba82cc8002 m_Value -> base pointer 2006-10-06 06:38:46 +00:00
Glenn Maynard 6808723b85 XNodeValue base class, Copy() 2006-10-06 06:26:53 +00:00
Steve Checkoway 24a147c74b Fix warning. 2006-10-03 03:37:31 +00:00
Glenn Maynard cacef7b54b cause compiler error if trying to use undefined operator= 2006-10-03 02:39:17 +00:00
Glenn Maynard 7988da5c68 remove DateTime binding; at least for now, keep XNode binding to basic types 2006-10-03 00:15:28 +00:00
Glenn Maynard 1a89ddfccd pointer to attributes 2006-10-03 00:07:01 +00:00
Glenn Maynard 30d91df8f4 XML attribute fields and string fields are the same. Use
a type, so we don't duplicate everything for both.
2006-10-02 22:47:16 +00:00
Glenn Maynard 4d2feecc35 fix compile 2006-10-02 22:42:24 +00:00
Glenn Maynard 30d8823a44 allow removing without deleting (detaching) 2006-10-02 06:36:07 +00:00
Glenn Maynard 6db05d676a SetName 2006-10-02 06:34:10 +00:00
Glenn Maynard f0fe542b2f remove bool overload. It's being used instead of the RString one for string constants. 2006-10-02 06:25:28 +00:00
Glenn Maynard 5f0e8a7167 GetName, GetValue 2006-10-02 06:02:54 +00:00
Glenn Maynard 19e7328d78 move XML loading and saving into XmlFileUtil, reducing XNode
to a data structure
2006-10-02 05:53:56 +00:00
Glenn Maynard f8e3807996 fix AppendChild("string", RString) calls bool overload 2006-10-02 05:44:57 +00:00
Steve Checkoway 65007cf941 ctor that takes the name. 2006-10-01 14:46:28 +00:00
Steve Checkoway b22b7972aa Simplify. 2006-10-01 14:24:19 +00:00
Steve Checkoway b7ce93ffad Simplify. 2006-10-01 14:02:24 +00:00
Steve Checkoway f73100705b Simplify. 2006-10-01 13:55:01 +00:00
Steve Checkoway 01cd66bd0f DISP_OPT -> XMLDisplayOptions. 2006-10-01 13:07:20 +00:00
Steve Checkoway 6651be1203 Always true. 2006-10-01 13:00:20 +00:00
Steve Checkoway 08155c351a Simplify. 2006-10-01 12:52:00 +00:00
Steve Checkoway d778966fc6 The existence of an error is signaled by error_string being nonempty. 2006-10-01 12:39:50 +00:00
Steve Checkoway c89900e2c1 Always true. 2006-10-01 12:29:14 +00:00
Steve Checkoway 9f9f61579c Unused. 2006-10-01 12:22:28 +00:00
Steve Checkoway 45a5b01c87 Unused. 2006-10-01 12:16:03 +00:00
Steve Checkoway fbe0626a68 Cleanup. 2006-10-01 12:09:19 +00:00
Glenn Maynard 5d6e7427e0 fix invalid deref 2006-06-08 06:11:32 +00:00
Chris Danford 7dea392550 CString -> RString 2005-12-27 23:43:49 +00:00
Chris Danford 353e0c5b6e break up arch stuff into smaller .cpp files to fix smpackage build and not pull in unnecessary stuff 2005-12-16 04:16:09 +00:00
Chris Danford 100ce95f14 don't pass DISPLAY_OPT as a pointer to avoid NULL pointer deref 2005-11-22 21:14:48 +00:00
Glenn Maynard a2a6dd73d8 cleanup 2005-10-11 11:11:03 +00:00
Glenn Maynard 64d9c29568 Simplify: store attributes in a simple map<CString,CString>, not in an object.
Makes attributes lighter.
2005-10-11 10:24:07 +00:00
Glenn Maynard 489bb9b3ed cleanup 2005-10-11 09:37:18 +00:00
Glenn Maynard fc6e0a2571 Multiple attributes with the same name aren't allowed in XML. (grr, ugly)
Add copy ctor.
2005-10-11 09:35:53 +00:00
Glenn Maynard 1c5ce3bf8b use CString 2005-09-06 18:25:16 +00:00
Glenn Maynard e676f9449d remove unused escaping stuff (don't think this is even part of XML) 2005-09-05 23:22:15 +00:00
Glenn Maynard 852558eb06 replace slow entity parsing code 2005-09-04 23:05:58 +00:00
Glenn Maynard 7c88d5ed88 cleanup 2005-09-04 21:59:00 +00:00
Glenn Maynard 286c008b41 optimize: take CString&, not char*; passing char* causes a CString to be
constructed from it when we use it, which is a waste, since it often comes from
a CString already
cleanup
2005-09-04 05:12:48 +00:00
Glenn Maynard e8182daf16 cleanups 2005-09-03 08:28:43 +00:00
Glenn Maynard eb05db1305 cleanup, optimize 2005-08-26 19:13:08 +00:00