Class DInt

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

Class Hierarchy

    Object
      |
      +---DInt

Class Description

The Int class implements a number of methods for storing and manipulating int numbers.

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

int main(int argc, char *agv[])
{
  DInt  *i1 = [DInt alloc];
  DInt  *i2 = [DInt new  ];
  DText *str;

  [i1 init :-70];                      // Init with a number

  printf("Int1 has value:%d.\n", [i1 get]); // Get value from object

  [i2 set :140];                       // Set with a number

  str = [i2 toText];
  printf("Int2 has value:%s as string.\n", [str cstring]); // Convert value to string
  [str free];

  if ([i1 compare :i2] == 0)           // Compare integers
    printf("Int1 and int2 are equal.\n");
  else if ([i1 compare :i2] < 0)
    printf("Int1 is smaller than int2.\n");
  else
    printf("Int1 is greater than int2.\n");

                                       // Conversion big- and little-endian
  printf("Int1 as little-endian (%d) and as big-endian (%d).\n", [i1 toLittleEndian], [i2 toBigEndian]);

  [i1 free];                           // Cleanup
  [i2 free];

  return 0;
}
Last modified:
02-Aug-2008 (DInt.h)

Instance Variables

private int _int

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0