Class DBool

Inherits from:
Object
Conforms to:
DComparable, DDatable, DParsable, DTextable
Declared in:
DBool.h

Class Hierarchy

    Object
      |
      +---DBool

Class Description

The Bool class implements a number of methods for storing and manipulating booleans.

Example:
#include <stdio.h>
#include "ofc/DBool.h"

int main(int argc, char *argv[])
{
  DBool *flg1  = [DBool alloc];
  DBool *flg2  = [DBool new  ];
  DBool *flg3  = [DBool new  ];
  DText *str;
  char   txt[] = "false";
  char  *txtp  = txt;

  [flg1 init :YES];                 // Init the flag to true/yes

  [flg2 set  :YES];                 // Set the flag to true/yes

  if ([flg3 fromString :&txtp] == 0)  // Read the flag from a string
    printf("Boolean correctly converted from a string\n");
  else
    printf("No boolean value in the string\n");

  str = [flg2 toText];              // Convert the flag to a string
  printf("Flag2 is %s\n", [str cstring]);

  if ([flg2 compare :flg3] == 0)    // Compare flags
    printf("Flag2 and flag3 are equal\n");
  else
    printf("Flag2 and flag3 are different\n");

  [str  free];
  [flg1 free];                      // Cleanup
  [flg2 free];
  [flg3 free];

  return 0;
}
Last modified:
19-Jul-2008 (DBool.h)

Instance Variables

private BOOL _bool
the boolean state

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0