| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- // Filename: configVariableString.I
- // Created by: drose (20Oct04)
- //
- ////////////////////////////////////////////////////////////////////
- //
- // PANDA 3D SOFTWARE
- // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
- //
- // All use of this software is subject to the terms of the Panda 3d
- // Software license. You should have received a copy of this license
- // along with this source code; you will also find a current copy of
- // the license at http://etc.cmu.edu/panda3d/docs/license/ .
- //
- // To contact the maintainers of this program write to
- // [email protected] .
- //
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::Constructor
- // Access: Published
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE ConfigVariableString::
- ConfigVariableString(const string &name) :
- ConfigVariable(name, VT_string)
- {
- _core->set_used();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::Constructor
- // Access: Published
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE ConfigVariableString::
- ConfigVariableString(const string &name, const string &default_value,
- const string &description, int flags) :
- ConfigVariable(name, VT_string, description, flags)
- {
- _core->set_default_value(default_value);
- _core->set_used();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::operator =
- // Access: Published
- // Description: Reassigns the variable's local value.
- ////////////////////////////////////////////////////////////////////
- INLINE void ConfigVariableString::
- operator = (const string &value) {
- set_value(value);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::string typecast operator
- // Access: Published
- // Description: Returns the variable's value.
- ////////////////////////////////////////////////////////////////////
- INLINE ConfigVariableString::
- operator string () const {
- return get_value();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::empty
- // Access: Published
- // Description: Returns true if the string is empty, false otherwise.
- ////////////////////////////////////////////////////////////////////
- INLINE bool ConfigVariableString::
- empty() const {
- return get_value().empty();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::Equality operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE bool ConfigVariableString::
- operator == (const string &other) const {
- return get_value() == other;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::Inequality operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE bool ConfigVariableString::
- operator != (const string &other) const {
- return get_value() != other;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::Ordering operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE bool ConfigVariableString::
- operator < (const string &other) const {
- return get_value() < other;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::set_value
- // Access: Published
- // Description: Reassigns the variable's local value.
- ////////////////////////////////////////////////////////////////////
- INLINE void ConfigVariableString::
- set_value(const string &value) {
- set_string_value(value);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::get_value
- // Access: Published
- // Description: Returns the variable's value.
- ////////////////////////////////////////////////////////////////////
- INLINE string ConfigVariableString::
- get_value() const {
- return get_string_value();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::get_default_value
- // Access: Published
- // Description: Returns the variable's default value.
- ////////////////////////////////////////////////////////////////////
- INLINE string ConfigVariableString::
- get_default_value() const {
- const ConfigDeclaration *decl = ConfigVariable::get_default_value();
- if (decl != (ConfigDeclaration *)NULL) {
- return decl->get_string_word(0);
- }
- return string();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::get_word
- // Access: Published
- // Description: Returns the variable's nth value.
- ////////////////////////////////////////////////////////////////////
- INLINE string ConfigVariableString::
- get_word(int n) const {
- return get_string_word(n);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: ConfigVariableString::set_word
- // Access: Published
- // Description: Reassigns the variable's nth value. This makes a
- // local copy of the variable's overall value.
- ////////////////////////////////////////////////////////////////////
- INLINE void ConfigVariableString::
- set_word(int n, const string &value) {
- set_string_word(n, value);
- }
|