LibreOffice Module onlineupdate (master) 1
Classes | Macros | Functions | Variables
readstrings.cxx File Reference
#include <limits.h>
#include <string.h>
#include <stdio.h>
#include "readstrings.h"
#include "errors.h"
Include dependency graph for readstrings.cxx:

Go to the source code of this file.

Classes

class  AutoFILE
 
class  AutoCharArray
 

Macros

#define NS_tfopen   fopen
 
#define OPEN_MODE   "r"
 

Functions

static const char * NS_strspnp (const char *delims, const char *str)
 
static char * NS_strtok (const char *delims, char **str)
 
static int find_key (const char *keyList, char *key)
 Find a key in a keyList containing zero-delimited keys ending with "\0\0". More...
 
int ReadStrings (const NS_tchar *path, const char *keyList, unsigned int numStrings, char results[][MAX_TEXT_LEN], const char *section)
 A very basic parser for updater.ini taken mostly from nsINIParser.cpp that can be used by standalone apps. More...
 
int ReadStrings (const NS_tchar *path, StringTable *results)
 This function reads in localized strings from updater.ini. More...
 

Variables

static const char kNL [] = "\r\n"
 
static const char kEquals [] = "="
 
static const char kWhitespace [] = " \t"
 
static const char kRBracket [] = "]"
 

Macro Definition Documentation

◆ NS_tfopen

#define NS_tfopen   fopen

Definition at line 17 of file readstrings.cxx.

◆ OPEN_MODE

#define OPEN_MODE   "r"

Definition at line 18 of file readstrings.cxx.

Function Documentation

◆ find_key()

static int find_key ( const char *  keyList,
char *  key 
)
static

Find a key in a keyList containing zero-delimited keys ending with "\0\0".

Returns a zero-based index of the key in the list, or -1 if the key is not found.

Definition at line 121 of file readstrings.cxx.

References index, and p.

Referenced by ReadStrings().

◆ NS_strspnp()

static const char * NS_strspnp ( const char *  delims,
const char *  str 
)
static

Definition at line 63 of file readstrings.cxx.

References d.

Referenced by NS_strtok(), and ReadStrings().

◆ NS_strtok()

static char * NS_strtok ( const char *  delims,
char **  str 
)
static

Definition at line 83 of file readstrings.cxx.

References d, i, and NS_strspnp().

Referenced by ReadStrings().

◆ ReadStrings() [1/2]

int ReadStrings ( const NS_tchar path,
const char *  keyList,
unsigned int  numStrings,
char  results[][MAX_TEXT_LEN],
const char *  section 
)

A very basic parser for updater.ini taken mostly from nsINIParser.cpp that can be used by standalone apps.

This function reads in localized strings corresponding to the keys from a given .ini.

Parameters
pathPath to the .ini file to read
keyListList of zero-delimited keys ending with two zero characters
numStringsNumber of strings to read into results buffer - must be equal to the number of keys
resultsTwo-dimensional array of strings to be filled in the same order as the keys provided
sectionOptional name of the section to read; defaults to "Strings"

Definition at line 152 of file readstrings.cxx.

References find_key(), kEquals, kNL, kRBracket, kWhitespace, MAX_TEXT_LEN, NS_strspnp(), NS_strtok(), NS_tfopen, OK, OPEN_MODE, PARSE_ERROR, READ_ERROR, READ_STRINGS_MEM_ERROR, and section.

Referenced by LaunchMacPostProcess(), ReadMaintenanceServiceStrings(), ReadStrings(), and ShowProgressUI().

◆ ReadStrings() [2/2]

int ReadStrings ( const NS_tchar path,
StringTable results 
)

This function reads in localized strings from updater.ini.

Definition at line 253 of file readstrings.cxx.

References StringTable::info, MAX_TEXT_LEN, ReadStrings(), result, and StringTable::title.

Variable Documentation

◆ kEquals

const char kEquals[] = "="
static

Definition at line 58 of file readstrings.cxx.

Referenced by ReadStrings().

◆ kNL

const char kNL[] = "\r\n"
static

Definition at line 57 of file readstrings.cxx.

Referenced by ReadStrings().

◆ kRBracket

const char kRBracket[] = "]"
static

Definition at line 60 of file readstrings.cxx.

Referenced by ReadStrings().

◆ kWhitespace

const char kWhitespace[] = " \t"
static

Definition at line 59 of file readstrings.cxx.

Referenced by ReadStrings().