New functions GetFlag and SetFlag
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7561 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
01317f0bbf
commit
33486da5a5
2 changed files with 31 additions and 2 deletions
|
|
@ -372,6 +372,21 @@ DohGetChar(DOH *obj, const DOH *name) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DohGetFlag()
|
||||
* A flag is unset if the attribute (name) does not exist on the node (obj),
|
||||
* or it is set to "0". If the attribute is set to any other value, the flag is set.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
DohGetFlag(DOH *obj, const DOH *name) {
|
||||
DOH *val;
|
||||
val = Getattr(obj,(DOH *) name);
|
||||
if (!val) return 0;
|
||||
return (Strcmp(val, "0") != 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DohGetVoid()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
@ -417,6 +432,15 @@ DohSetChar(DOH *obj, const DOH *name, char *value) {
|
|||
Setattr(obj,(DOH *) name,NewString(value));
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DohSetFlag()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
DohSetFlag(DOH *obj, const DOH *name) {
|
||||
Setattr(obj,(DOH *) name,NewString("1"));
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DohSetVoid()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue