Back to index

lightning-sunbird  0.9+nobinonly
Functions
TestINIParser.cpp File Reference
#include <string.h>
#include "nsINIParser.h"
#include "nsILocalFile.h"

Go to the source code of this file.

Functions

static PRBool StringCB (const char *aKey, const char *aValue, void *aClosure)
static PRBool SectionCB (const char *aSection, void *aClosure)
int main (int argc, char **argv)
 The Xalan testcases app.

Function Documentation

int main ( int  argc,
char **  argv 
)

The Xalan testcases app.

Definition at line 65 of file TestINIParser.cpp.

{
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <ini-file>\n", argv[0]);
    return 255;
  }

  nsCOMPtr<nsILocalFile> lf;

  nsresult rv = NS_NewNativeLocalFile(nsDependentCString(argv[1]),
                                      PR_TRUE,
                                      getter_AddRefs(lf));
  if (NS_FAILED(rv)) {
    fprintf(stderr, "Error: NS_NewNativeLocalFile failed\n");
    return 1;
  }

  nsINIParser ini;
  rv = ini.Init(lf);
  if (NS_FAILED(rv)) {
    fprintf(stderr, "Error: Init failed.");
    return 2;
  }

  ini.GetSections(SectionCB, &ini);

  return 0;
}

Here is the call graph for this function:

static PRBool SectionCB ( const char *  aSection,
void aClosure 
) [static]

Definition at line 52 of file TestINIParser.cpp.

{
  nsINIParser *ini = NS_REINTERPRET_CAST(nsINIParser*, aClosure);

  printf("[%s]\n", aSection);

  ini->GetStrings(aSection, StringCB, nsnull);

  printf("\n");

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool StringCB ( const char *  aKey,
const char *  aValue,
void aClosure 
) [static]

Definition at line 44 of file TestINIParser.cpp.

{
  printf("%s=%s\n", aKey, aValue);

  return PR_TRUE;
}

Here is the caller graph for this function: