Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
StrSet Struct Reference

#include <strset.h>

Collaboration diagram for StrSet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 StrSet ()
void add (const char *string)
int contains (const char *string)
bool IsEmpty () const

Public Attributes

char ** strings
int numstrings

Detailed Description

Definition at line 41 of file strset.h.


Constructor & Destructor Documentation

Definition at line 41 of file strset.cpp.

{
    strings = 0;
    numstrings = 0;
}

Member Function Documentation

void StrSet::add ( const char *  string)

Definition at line 47 of file strset.cpp.

{
    if (strings) {
       strings = (char**) realloc(strings, (numstrings + 1) * sizeof(char*));
    } else {
       strings = (char**) malloc(sizeof(char*));
    }
    strings[numstrings] = strdup(s);
    numstrings++;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int StrSet::contains ( const char *  string)

Definition at line 58 of file strset.cpp.

{
    char** sp = strings;
    int i = numstrings;

    while (--i >= 0) {
       char *ss = *sp++;
       if (ss[0] == s[0]) {
           if (strcmp(ss, s) == 0) {
              return 1;
           }
       }
    }
    return 0;
}

Here is the caller graph for this function:

bool StrSet::IsEmpty ( void  ) const [inline]

Definition at line 46 of file strset.h.

{ return 0 == numstrings; }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 49 of file strset.h.

Definition at line 48 of file strset.h.


The documentation for this struct was generated from the following files: