home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / libstyle / stystruc.h < prev   
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.0 KB  |  70 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef SS_HEADER
  20. #define SS_HEADER
  21.  
  22. /* maxint */
  23. #define MAX_STYLESTRUCT_PRIORITY (((unsigned) (~0) << 1) >> 1)
  24.  
  25. #define STYLESTRUCT_NewSSNumber(self, num, uts) (*self->vtable->styleNewSSNumber)(self, num, uts)
  26. #define STYLESTRUCT_FreeSSNumber(self, num)        (*self->vtable->styleFreeSSNumber)(self, num)
  27. #define STYLESTRUCT_CopySSNumber(self, num)        (*self->vtable->styleCopySSNumber)(self, num)
  28. #define STYLESTRUCT_StringToSSNumber(self, strng) (*self->vtable->styleStringToSSNumber)(self, strng)
  29. #define STYLESTRUCT_SetString(self, name, value, priority)    \
  30.                                             (*self->vtable->styleSetString)(self, name, value, priority)
  31. #define STYLESTRUCT_SetNumber(self, name, num, priority)    (*self->vtable->styleSetNumber)(self, name, num, priority)
  32. #define STYLESTRUCT_GetString(self, name)        (*self->vtable->styleGetString)(self, name)
  33. #define STYLESTRUCT_GetNumber(self, name)        (*self->vtable->styleGetNumber)(self, name)
  34. #define STYLESTRUCT_Count(self)                    (*self->vtable->styleCount)(self)
  35. #define STYLESTRUCT_Duplicate(self)                (*self->vtable->styleDuplicate)(self)
  36. #define STYLESTRUCT_Delete(self)                (*self->vtable->styleDelete)(self)
  37.  
  38.  
  39. typedef struct _SS_Number {
  40.     double value;
  41.     char  *units;
  42. } SS_Number;
  43.  
  44. typedef struct _StyleStructInterface StyleStructInterface;
  45.  
  46. typedef struct _StyleStruct {
  47.     StyleStructInterface* vtable;
  48.     int32    refcount;
  49. } StyleStruct;
  50.  
  51. struct _StyleStructInterface {
  52.     SS_Number* (*styleNewSSNumber)(StyleStruct *self, double value, char *units);
  53.     void (*styleFreeSSNumber)(StyleStruct * self, SS_Number *obj);
  54.     SS_Number* (*styleCopySSNumber)(StyleStruct *self, SS_Number *old_num);
  55.     SS_Number* (*styleStringToSSNumber)(StyleStruct *self, char *strng);
  56.     void (*styleSetString)(StyleStruct * self, char *name, char *value, int32 priority);
  57.     void (*styleSetNumber)(StyleStruct * self, char *name, SS_Number *value, int32 priority);
  58.     char* (*styleGetString)(StyleStruct * self, char *name);
  59.     SS_Number* (*styleGetNumber)(StyleStruct * self, char *name);
  60.     uint32 (*styleCount)(StyleStruct * self);
  61.     StyleStruct* (*styleDuplicate)(StyleStruct * self);
  62.     void (*styleDelete)(StyleStruct * self);
  63. };
  64.  
  65.  
  66. /* initializer */
  67. extern StyleStruct * STYLESTRUCT_Factory_Create(void);
  68.  
  69. #endif /* SS_HEADER */
  70.