|
CLASS moVariable
NAME
Constructor - create an moVariable object
VERSION
Version: 1.2.0
SYNOPSIS
moVariable(const moWCString& name);
PARAMETERS
name - name of the new variable
DESCRIPTION
A new variable needs a name before to be created. Thus
only one constructor is available.
Because there shouldn't be two variables with the same
name, there is no copy operator.
The value of the variable is itself. That is, an
moVariable object is a string and that string represents
the contents of the variable. Therefore, all the string
operators and function members applied to an moVariable
will be applied to the contents of the variable.
Note that their is one exception: the moVariable redefines
the Compare() function member to be able to order variables
in a list. This means, all the comparison operators won't
work either (doing something like: var1 < var2, will compare
the variable names, not their contents).
SEE ALSO
moWCString constructor, Compare, Name
BUGS
Using the Compare() or either the ordering or equal/not equal
operators directly on a variable when the intend is to compare
the contents is a mistake. Casting will usually not solve the
problem since the Compare() function is a virtual function.
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariable
NAME
Compare - compare two variables and give their order
VERSION
Version: 1.2.0
SYNOPSIS
virtual compare_t Compare(const moBase& object) const;
DESCRIPTION
This function compares the name of two variables and
returns the corresponding order.
One can use the Name() function to retrieve the name
of a variable.
RETURN VALUE
One of the compare value:
MO_BASE_COMPARE_SMALLER
MO_BASE_COMPARE_EQUAL
MO_BASE_COMPARE_LARGER
SEE ALSO
Name
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariable
NAME
Name - return the name of the variable
VERSION
Version: 1.2.0
SYNOPSIS
const moWCString& Name(void) const;
DESCRIPTION
This function returns the name of this variable.
The name is read-only and can't be modified. This
is the name used to sort a list of variables.
RETURN VALUE
A reference on the name of the variable
SEE ALSO
Compare
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariableList
NAME
Compare - compare two variable lists
VERSION
Version: 1.2.0
SYNOPSIS
virtual compare_t Compare(const moBase& object) const;
DESCRIPTION
This function compares the name of two variable lists.
This is useful if you need to have a sorted list of variable
lists.
RETURN VALUE
One of the compare value:
MO_BASE_COMPARE_SMALLER
MO_BASE_COMPARE_EQUAL
MO_BASE_COMPARE_LARGER
SEE ALSO
Name
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariableList
NAME
Name - return the name of the list of variables
VERSION
Version: 1.2.0
SYNOPSIS
const moWCString& Name(void) const;
DESCRIPTION
This function returns the name of this list of variables.
The name is read-only and can't be modified. This
is the name used to sort lists of lists of variables.
RETURN VALUE
A reference on the name of the list of variables
SEE ALSO
Compare
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariableList
NAME
Count - return the number of variables
VERSION
Version: 1.2.0
SYNOPSIS
unsigned long Count(void) const;
DESCRIPTION
This function returns the number of variables currently
defined in the variable list.
RETURN VALUE
a positive value or zero
SEE ALSO
Get
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariable
NAME
operator = - set a variable value
VERSION
Version: 1.2.0
SYNOPSIS
moVariable& operator = (const moWCString& value);
PARAMETERS
value - the new value of the variable
DESCRIPTION
This operator will be used to set a new value in a variable.
ERRORS
When invalid parameters are given to the functions, then
an error will be thrown. Note that these function expect
a valid variable name that is a name which doesn't include
an equal sign and which isn't empty.
These function throw moError() objects.
BUGS
An Unset() variable is deleted from memory. Keeping pointers
or references on it will result in bugs.
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariableList
NAME
Constructor - create an moVariableList object
VERSION
Version: 1.2.0
SYNOPSIS
moVariableList(const moWCString& name);
moVariableList(const moVariableList& variable);
PARAMETERS
name - name of the new list of variables
variable - another list of variables
DESCRIPTION
A new list of variables is created.
One can set, get and unset variables using the function
members of this object.
Though this object is based on an moSortedListUnique,
the functions of that object are private. It is done
this way so the coherency of the list is ensured.
Note that the Compare() of this object doesn't behave
like the Compare() of the moListBase object.
SEE ALSO
moVariable constructor, Compare, Name
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariableList
NAME
Set - set (or create) a variable in a list of variables
Get - get a variable (its name and content)
Unset - delete a variable
VERSION
Version: 1.2.0
SYNOPSIS
virtual void Append(const moVariable& variable);
virtual void SafeAppend(const moVariable& variable);
moVariableSPtr Set(const moVariable& variable);
moVariableSPtr Set(const moWCString& set);
moVariableSPtr Set(const moWCString& name, const moWCString& value);
moVariableSPtr Get(const moWCString& name) const;
moVariableSPtr Get(position_t position) const;
void Unset(const moWCString& name);
moVariableList& operator += (const moVariableList& list);
moVariableList& operator += (const moVariable& variable);
moVariableList& operator += (const moWCString& set);
PARAMETERS
variable - copy this variable in this list
set - a "<variable>=<value>" or just a "<variable name>"
name - the name of the variable
value - the initial value of the variable
position - a specific position at which a variable was defined
list - another list of variables
DESCRIPTION
These functions will be used to create, modify, get and
delete variables in a list.
The Append() function reads all the variables from a list
of variables and add them all to the destination list of
variables. This function overwrites existing variables.
The SafeAppend() function does the same thing except it
won't overwrite existing variables.
The Set() functions can be used to set a variable. If the
variable doesn't exists, it is created. The first syntax
is equivalent to the putenv() function, though only a name
can be given in which case the initial value is the empty
string. To know if the variable is already defined, use
the Get() function instead.
The Get() function can be used to retrieve a variable and
its contents. The result is a variable which can also be
seen as a string which is the contents of that variable.
If the named variable doesn't exist, this function returns
zero (0).
The Unset() function will delete the named variable if it
exists. No error is generated when the variable wasn't
created first.
The += operators will append a list of variables or add one
variable like the Set() function does.
NOTES
Append, SafeAppend and += of a list on itself is safe. It
actual does nothing.
RETURN VALUE
The Set() and Get() functions return a pointer to a variable
or null (0) when an error occurs (or a variable can't be found)
The Unset() function doesn't return anything
The += operators return a reference to this
ERRORS
When invalid parameters are given to the functions, then
an error will be thrown. Note that these function expect
a valid variable name that is a name which doesn't include
an equal sign and which isn't empty.
These function throw moError() objects.
BUGS
An Unset() variable is deleted from memory. Keeping pointers
or references on it will result in bugs.
The Set() functions with a variable should not be used
with a variable from the same list.
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariableList
NAME
Load - load variables from a file
VERSION
Version: 1.2.0
SYNOPSIS
bool Load(const moWCString& filename);
PARAMETERS
filename - the name of the file to be loaded
DESCRIPTION
This function can be used to load a file of variables.
The syntax is like in any makefile script:
<variable name> = <value>
The name of the variable can't include any spaces or hash
characters (#). There can be spaces before and after the
equal sign. The value can be anything (including a comment
after a hash character).
A long value can be continued on the following line(s) by
ending a line with a backslash and a newline ('\\' + '\n')
sequence.
Any other line will silently be skipped.
NOTES
The list of variables is NOT emptied by this function. If
you want to reload a new list and lose what was defined
in the original first, then you need to call the Empty()
function first.
If an error occurs, nothing happens. Thus, if the named
file doesn't exists, one can't know about it.
RETURN VALUE
This function returns true if the file could be opened
for reading. Note that doesn't mean anything could be
read from the file.
SEE ALSO
LoadFromString, Empty, Save
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariableList
NAME
LoadFromString - load variables from a string
VERSION
Version: 1.2.0
SYNOPSIS
void LoadFromString(const moWCString& variables, moWCString::wc_t separator = '\n', mowc::wc_t append = '\0');
PARAMETERS
variables - a list of variables
seperator - the character checked as a separator
DESCRIPTION
This function is similar to the Load() function in that it
parses a string with a variable name followed by an equal
sign and a value. Each new variable is on a new line unless
you change the separator to another character.
For instance, to parse a query string from an HTTP request,
one can use '&' as the separator.
Note that the special character '#' is viewed as a comment
introducer. However, it is ignored (taken as part of the
variable name or content) when the separator is not '\n'.
NOTES
The list of variables is NOT emptied by this function. If
you want to reload a new list and lose what was defined
in the original first, then you need to call the Empty()
function first.
SEE ALSO
Load, SaveToString, Empty
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariableList
NAME
Save - save variables to a file
VERSION
Version: 1.2.0
SYNOPSIS
bool Save(const moWCString& filename);
PARAMETERS
filename - the name of the file to be loaded
DESCRIPTION
This function can be used to save a list of variables in
a file. It will create a file which can later be loaded
with the Load() function.
RETURN VALUE
The Save() function returns true if it could open the
output file. It returns false if the output file could
not be opened (invalid file name, permission denied...)
SEE ALSO
SaveToString, Load, LoadFromString
BUGS
The function doesn't currently test to know whether
writing to the file works.
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariableList
NAME
SaveToString - save variables to a file
VERSION
Version: 1.2.0
SYNOPSIS
void SaveToString(moWCString& variables, moWCString::wc_t separator = '\n');
PARAMETERS
variables - the destination string where the variables are saved
separator - the character used to seperate each variable
DESCRIPTION
This function can be used to save a list of variables in
a string. It will create a string which can later be loaded
with the LoadFromString() function.
Note that the input string (variables) is not emptied by
this function. If you need to have it emptied, then call the
Empty() function on it before to call this function. The
enables you to put a header or to call this function
multiple times with different lists of variables.
BUGS
At this time this function doesn't check whether a variable contains
the separator. If it does, then it will be saved as is and therefore
will cause problems when being reloaded.
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moVariableList
NAME
IsEmpty - check whether the list is empty
Empty - empty the entire list of variables
VERSION
Version: 1.2.0
SYNOPSIS
bool IsEmpty(void) const;
virtual void Empty(void);
DESCRIPTION
The IsEmpty() function checks whether the list of variable
is currently empty.
The Empty() function will delete all the variables currently
defined in the list of variables.
You can call this function before calling the Load()
function in order to remove the already existing
variables.
SEE ALSO
Count, Load
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
Links:
molib
the sandbox
|