Class DLong

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

Class Hierarchy

    Object
      |
      +---DLong

Class Description

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

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

int main(int argc, char *agv[])
{
  DLong *l1 = [DLong alloc];
  DLong *l2 = [DLong new  ];
  DText *str;

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

  printf("Long1 has value:%ld.\n", [l1 get]); // Get value from object

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

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

  if ([l1 compare :l2] == 0)           // Compare longs
    printf("Long1 and long2 are equal.\n");
  else if ([l1 compare :l2] < 0)
    printf("Long1 is smaller than long2.\n");
  else
    printf("Long1 is greater than long2.\n");

                                       // Conversion big- and little-endian
  printf("Long1 as little-endian (%ld) and as big-endian (%ld).\n", [l1 toLittleEndian], [l2 toBigEndian]);

  [l1 free];                           // Cleanup
  [l2 free];

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

Instance Variables

private long _nr

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0