ipr_samples: iprenumsample


Introduction

This sample demonstrates how to iterate all categories, enums and locales and how to print them to std::out.

Syntax:

iprenumsample <dca-redist-folder> <ticket> <product> [ <locale> ]
locale
This is the locale (dca_ipr::IprLocale) to use for printing out category and enum names. It defaults to en_US
See also:

Files

file  ipr_samples/iprenumsample/main.cpp
 

IP classification enumeration using provided IprCategoriesInfo.


Defines

#define DCA_BINDIR   "bin/linux"
 DCA subdirectory of the DCA binaries.
#define DCA_INITDIR   "init"
 DCA subdirectory of the DCA initialization data.
#define DCA_LOGDIR   "./logs"
 Relative directory for logfile(s).

Functions

static void SetupInitData (const std::string &strRedistFolder, InitData &aInitData)
 Sets up the given initData by substituting the given redist_folder with DCA subdirectories.
static void SetupLicense (const std::string &strTicket, const std::string &strProduct, LicenseData &aLicenseData)
 Sets up the given licenseData by copying the given ticket and product strings.
static void PrintLicenseInfo (const License &aLicense)
 Prints out information about the provided License.
static void PrintToolHeader ()
 Prints out the name and the version of this sample.
static void PrintUsage (const char *pSampleName)
 Prints out the syntax of the sample.
void PrintLocale (const IprLocale &aIprLocale, const std::string &strIndent="")
 Prints out a line of the given IprEnum.
void EnumLocales (const IprLocales &aIprLocales)
 Performs the enumeration of the contents of the given IprLocales class.
void PrintEnum (const IprEnum &aIprEnum, const std::string &strLocale, const std::string &strIndent="")
 Prints out a line of the given IprEnum.
void EnumCategoryEnums (const IprCategoriesInfo &aIprCategoriesInfo, const IprCategory &aIprCategory, const std::string &strLocale)
 Performs the enumeration of all enums of the given Category if there exists any.
void PrintCategory (const IprCategory &aIprCategory, const std::string &strLocale, const std::string &strIndent="")
 Prints out a line of the given IprCategory.
void EnumCategories (const IprCategoriesInfo &aIprCategoriesInfo, const IprCategories &aIprCategories, const std::string &strLocale)
 Performs the enumeration of the contents of the given IprCategories class.
void EnumEnums (const IprEnums &aIprEnums, const std::string &strLocale)
 Performs the enumeration of the contents of the given IprEnums class.
void EnumIprCategoriesInfo (const IprCategoriesInfo &aIprCategoriesInfo, const std::string &strLocale)
 Performs the enumeration of the contents of the given IprCategoriesInfo class.
int main (int argc, char *argv[])
 The main routine.

Variables

const std::string S_UsageString
 Usage string, displayed if a parameter is missing.

Function Documentation

static void SetupInitData ( const std::string &  strRedistFolder,
InitData aInitData 
) [static]

Sets up the given initData by substituting the given redist_folder with DCA subdirectories.

Parameters:
[in] strRedistFolder This is the folder where the DCA has been installed to (assuming trailing fileslash)
[out] aInitData The InitData structure to set up
Note:
Only DCA_BINDIR differs between Windows and Linux
The directory ./logs is used for the logfile(s)

Definition at line 94 of file ipr_samples/iprenumsample/main.cpp.

static void SetupLicense ( const std::string &  strTicket,
const std::string &  strProduct,
LicenseData aLicenseData 
) [static]

Sets up the given licenseData by copying the given ticket and product strings.

Parameters:
[in] strTicket This is the ticket data as provided with your DCA license
[in] strProduct This is the product shortcut e.g. DC or MS etc
[out] aLicenseData The LicenseData structure to set up

Definition at line 110 of file ipr_samples/iprenumsample/main.cpp.

static void PrintLicenseInfo ( const License aLicense  )  [static]

Prints out information about the provided License.

Parameters:
[in] aLicense The license for which information should be displayed.

Definition at line 124 of file ipr_samples/iprenumsample/main.cpp.

static void PrintUsage ( const char *  pSampleName  )  [static]

Prints out the syntax of the sample.

Parameters:
[in] pSampleName The name of the executable

Definition at line 161 of file ipr_samples/iprenumsample/main.cpp.

void PrintLocale ( const IprLocale aIprLocale,
const std::string &  strIndent = "" 
)

Prints out a line of the given IprEnum.

Parameters:
[in] aIprLocale A valid and initialized IprLocale object
[in] strIndent Defines an indent for the current line print out

Definition at line 174 of file ipr_samples/iprenumsample/main.cpp.

void EnumLocales ( const IprLocales aIprLocales  ) 

Performs the enumeration of the contents of the given IprLocales class.

Parameters:
[in] aIprLocales A valid and initialized IprLocales object

Definition at line 187 of file ipr_samples/iprenumsample/main.cpp.

void PrintEnum ( const IprEnum aIprEnum,
const std::string &  strLocale,
const std::string &  strIndent = "" 
)

Prints out a line of the given IprEnum.

Parameters:
[in] aIprEnum A valid and initialized IprEnum object
[in] strLocale Locale for the output
[in] strIndent Defines an indent for the current line print out

Definition at line 208 of file ipr_samples/iprenumsample/main.cpp.

void EnumCategoryEnums ( const IprCategoriesInfo aIprCategoriesInfo,
const IprCategory aIprCategory,
const std::string &  strLocale 
)

Performs the enumeration of all enums of the given Category if there exists any.

Parameters:
[in] aIprCategoriesInfo A valid and initialized IprCategoriesInfo object
[in] aIprCategory A valid and initialized IprCategory object
[in] strLocale Locale for the output

Definition at line 224 of file ipr_samples/iprenumsample/main.cpp.

void PrintCategory ( const IprCategory aIprCategory,
const std::string &  strLocale,
const std::string &  strIndent = "" 
)

Prints out a line of the given IprCategory.

Parameters:
[in] aIprCategory A valid and initialized IprCategory object
[in] strLocale Locale for the output
[in] strIndent Defines an indent for the current line print out

Definition at line 263 of file ipr_samples/iprenumsample/main.cpp.

void EnumCategories ( const IprCategoriesInfo aIprCategoriesInfo,
const IprCategories aIprCategories,
const std::string &  strLocale 
)

Performs the enumeration of the contents of the given IprCategories class.

Parameters:
[in] aIprCategoriesInfo A valid and initialized IprCategoriesInfo object
[in] aIprCategories A valid and initialized IprCategories object
[in] strLocale Locale for the output

Definition at line 279 of file ipr_samples/iprenumsample/main.cpp.

void EnumEnums ( const IprEnums aIprEnums,
const std::string &  strLocale 
)

Performs the enumeration of the contents of the given IprEnums class.

Parameters:
[in] aIprEnums A valid and initialized IprEnums object
[in] strLocale Locale for the output

Definition at line 305 of file ipr_samples/iprenumsample/main.cpp.

void EnumIprCategoriesInfo ( const IprCategoriesInfo aIprCategoriesInfo,
const std::string &  strLocale 
)

Performs the enumeration of the contents of the given IprCategoriesInfo class.

Parameters:
[in] aIprCategoriesInfo A valid and initialized IprCategoriesInfo object
[in] strLocale Locale for the output

Definition at line 341 of file ipr_samples/iprenumsample/main.cpp.

int main ( int  argc,
char *  argv[] 
)

The main routine.

Parameters:
[in] argc The count of arguments provided
[in] argv An array of provided arguments
Returns:
5 on usage error, 10 on exception and internal error and 0 on success

Definition at line 364 of file ipr_samples/iprenumsample/main.cpp.


Variable Documentation

const std::string S_UsageString
Initial value:
        "<redist-folder> <ticket> <product> [<locale>]\n"
        "  redist-folder - the folder where the DCA is installed\n"
        "  ticket - a valid ticket\n"
        "  product - the product associated with your ticket\n"
        "  locale - optional locale for the IPR category info names and descriptions, default = en_US\n\n"

Usage string, displayed if a parameter is missing.

Definition at line 54 of file ipr_samples/iprenumsample/main.cpp.


Generated on 26 Sep 2016 for dca_interface by  doxygen 1.6.1