Commit Graph

115 Commits

Author SHA1 Message Date
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
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 662f006c0e cleanup 2006-10-06 06:46:17 +00:00
Glenn Maynard 9826c3c298 delete
simplify; this is a map, not a multimap
2006-10-06 06:44:33 +00:00
Glenn Maynard 6edd25f013 delete 2006-10-06 06:42:18 +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
Glenn Maynard 2f3f9f6fee fix name not copied 2006-10-04 23:41:46 +00:00
Glenn Maynard db335a813f fix double-free 2006-10-04 23:06:46 +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 30d8823a44 allow removing without deleting (detaching) 2006-10-02 06:36:07 +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 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 ca0f34d5a8 End with a new line. 2006-10-01 14:58:19 +00:00
Steve Checkoway b22b7972aa Simplify. 2006-10-01 14:24:19 +00:00
Steve Checkoway b885a19f89 Simplify. 2006-10-01 14:22:15 +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
Glenn Maynard e206261b80 ARRAYSIZE -> ARRAYLEN 2006-09-13 03:11:38 +00:00
Steve Checkoway a07e194cf1 Revert. Fixes Linux build. 2006-07-18 05:51:37 +00:00
Jason Felds 366c3440d4 Fix VC8 macro redef warning. (more to come) 2006-07-18 03:56:37 +00:00
Steve Checkoway 7a50252a94 Work around stupid debug CRT. From MSDN:
When used with a debug CRT library, isspace will display a CRT assert if passed a parameter that isn't EOF or in the range of 0 through 0xFF.

We don't care about EOF, so just check for positive values. (I'm not sure why casting didn't work and I don't have a windows machine to test with anyway.)
2006-06-13 04:36:56 +00:00
Steve Checkoway e0b569d495 Trying to track down a debug assert. 2006-06-13 04:08:46 +00:00
Steve Checkoway d2f3a14495 strtof -> StringToFloat. 2006-06-12 06:42:25 +00:00
Glenn Maynard 3b0f4fa656 cleanup 2006-02-15 00:39:02 +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 a2727f6644 warning: `static' is not at beginning of declaration 2005-10-27 16:57:18 +00:00
Chris Danford b2e9c616c8 fix Attr stuff 2005-10-18 07:00:33 +00:00
Glenn Maynard 8b7e6d6b92 add error check to prevent infinite recursion 2005-10-15 06:12:58 +00:00
Chris Danford de8a86213f fix VC6 compile 2005-10-12 21:27:15 +00:00
Glenn Maynard fc070a1d32 fix AppendAttr doesn't overwrite 2005-10-11 11:12:24 +00:00
Glenn Maynard 6b5f23ef02 simplify/optimize 2005-10-11 10:34:27 +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 35dfba854e g++ fix 2005-09-07 02:05:19 +00:00
Glenn Maynard f30533431d parse fix 2005-09-06 23:39:45 +00:00