wac_samples: wacenumsample


Introduction

This sample shows how to enumerate all WAC applications, actions and tags and prints them to stdout. It also shows how they are related to the URL categories and locales.

Syntax:

wacdbdownloadsample <dca-redist-folder> <ticket> <product> [ <locale> ]
locale
locale is one of the support locale-strings that comes with the WAC. See also: dca_wac::WacLocales, dca_wac::WacLocale
See also:

Files

file  wac_samples/wacenumsample/main.cpp
 

WAC classification enumeration using provided WacCategoriesInfo and dca::CategoriesInfo.


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 &redist_folder, dca::InitData &initData)
 Sets up the given initData by substituting the given redist_folder with DCA subdirectories.
static void SetupLicense (const std::string &ticket, const std::string &product, dca::LicenseData &licenseData)
 Sets up the given licenseData by copying the given ticket and product strings.
static void PrintLicenseInfo (const dca::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 *name)
 Prints out the syntax of the sample.
void EnumApplications (const dca::CategoriesInfo &aDcaCategoriesInfo, const dca_wac::WacApplications &aApplications, const std::string &localeString)
 Performs the enumeration of the contents of the given WacApplications class.
void EnumActions (const dca_wac::WacActions &aWacActions, const std::string &localeString)
 Performs the enumeration of the contents of the given WacActions class.
void EnumTags (const dca_wac::WacTags &aWacTags, const std::string &localeString)
 Performs the enumeration of the contents of the given WacTags class.
void EnumWacCategoriesInfo (const dca::CategoriesInfo &aDcaCategoriesInfo, const dca_wac::WacCategoriesInfo &aWacCategoriesInfo, const std::string &localeString)
 Performs the enumeration of the contents of the given WacCategoriesInfo class.
void EnumLocales (const dca::Locales &aLocales)
 Performs the enumeration of the contents of the given Locales class.
void EnumCategories (const dca::Categories &aCategories, const std::string &localeString)
 Performs the enumeration of the contents of the given Categories class.
void EnumDcaCategoriesInfo (const dca::CategoriesInfo &aCategoriesInfo, const std::string &localeString)
 Performs the enumeration of the contents of the given CategoriesInfo 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 &  redist_folder,
dca::InitData initData 
) [static]

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

Parameters:
[in] redist_folder This is the folder where the DCA has been installed to (assuming trailing fileslash)
[out] initData 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 92 of file wac_samples/wacenumsample/main.cpp.

static void SetupLicense ( const std::string &  ticket,
const std::string &  product,
dca::LicenseData licenseData 
) [static]

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

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

Definition at line 106 of file wac_samples/wacenumsample/main.cpp.

static void PrintLicenseInfo ( const dca::License aLicense  )  [static]

Prints out information about the provided License.

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

Definition at line 118 of file wac_samples/wacenumsample/main.cpp.

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

Prints out the syntax of the sample.

Parameters:
[in] name The name of the executable

Definition at line 154 of file wac_samples/wacenumsample/main.cpp.

void EnumApplications ( const dca::CategoriesInfo aDcaCategoriesInfo,
const dca_wac::WacApplications aApplications,
const std::string &  localeString 
)

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

Parameters:
[in] aDcaCategoriesInfo A CategoriesInfo used for printing out (URL) categories related to a given WacApplication
[in] aApplications A valid and initialized WacApplications object
[in] localeString Locale for the output

Definition at line 169 of file wac_samples/wacenumsample/main.cpp.

void EnumActions ( const dca_wac::WacActions aWacActions,
const std::string &  localeString 
)

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

Parameters:
[in] aWacActions A valid and initialized WacActions object
[in] localeString Locale for the output

Definition at line 233 of file wac_samples/wacenumsample/main.cpp.

void EnumTags ( const dca_wac::WacTags aWacTags,
const std::string &  localeString 
)

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

Parameters:
[in] aWacTags A valid and initialized WacTags object
[in] localeString Locale for the output

Definition at line 259 of file wac_samples/wacenumsample/main.cpp.

void EnumWacCategoriesInfo ( const dca::CategoriesInfo aDcaCategoriesInfo,
const dca_wac::WacCategoriesInfo aWacCategoriesInfo,
const std::string &  localeString 
)

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

Parameters:
[in] aDcaCategoriesInfo Used as input param for the EnumApplications() function.
[in] aWacCategoriesInfo A valid and initialized WacCategoriesInfo object
[in] localeString Locale for the output

Definition at line 285 of file wac_samples/wacenumsample/main.cpp.

void EnumLocales ( const dca::Locales aLocales  ) 

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

Parameters:
[in] aLocales A valid and initialized Locales object

Definition at line 310 of file wac_samples/wacenumsample/main.cpp.

void EnumCategories ( const dca::Categories aCategories,
const std::string &  localeString 
)

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

Parameters:
[in] aCategories A valid and initialized Categories object
[in] localeString Locale for the output

Definition at line 334 of file wac_samples/wacenumsample/main.cpp.

void EnumDcaCategoriesInfo ( const dca::CategoriesInfo aCategoriesInfo,
const std::string &  localeString 
)

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

Parameters:
[in] aCategoriesInfo A valid and initialized CategoriesInfo object
[in] localeString Locale for the output

Definition at line 358 of file wac_samples/wacenumsample/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 380 of file wac_samples/wacenumsample/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 to\n"
        "  ticket - a valid ticket\n"
        "  product - the product associated with your ticket\n"
        "  locale - optional locale for the WAC category info names and descriptions, default = en_US\n\n"

Usage string, displayed if a parameter is missing.

Definition at line 55 of file wac_samples/wacenumsample/main.cpp.


Generated on 26 Sep 2016 for dca_interface by  doxygen 1.6.1