Makeprojects
Loading...
Searching...
No Matches
makeprojects.validators Namespace Reference

Validation objects for project data generators. More...

Classes

class  VSBooleanProperty
 Value can only be true or false. More...
class  VSEnumProperty
 Enumeration integer value. More...
class  VSIntegerProperty
 Value can only be integer or None. More...
class  VSStringListProperty
 List of strings or directories. More...
class  VSStringProperty
 Value can be any string. More...

Functions

 lookup_enum_value (enum_lookup, key, fallback)
 Find a value in a list of enums.
 lookup_enum_append_key (cmd, enum_lookup, value)
 Look up a command line option from an enumeration.
 lookup_enum_append_keys (cmd, enum_dicts, command_dict)
 Look up a set of enum command line options.
 lookup_strings (cmd, string_entries, command_dict)
 Lookup string items and add them to the command line.
 lookup_string_list (cmd, switches, entry_list, quotes=True)
 Create a command line with an entry list.
 lookup_string_lists (cmd, string_list, command_dict)
 Lookup string items and add them to the command line.
 lookup_booleans (cmd, boolean_list, command_dict)
 Look up a command line option from a list of booleans.

Detailed Description

Validation objects for project data generators.

Function Documentation

◆ lookup_booleans()

makeprojects.validators.lookup_booleans ( cmd,
boolean_list,
command_dict )

Look up a command line option from a list of booleans.

The command dict is a dict of Visual Studio XML entries where the value is None, or a value that will be converted into a boolean.

The boolean list is an iterable of tuples where the first entry is the Visual Studio XML entry and the second is a variable length tuple where the first entry is the default value followed by pairs of values of a string for the command line switch and then the boolean to match.

Parameters
cmdlist of command line options to append the new entry.
boolean_listlist of boolean entries.
command_dictdict of command entries.
Returns
None

◆ lookup_enum_append_key()

makeprojects.validators.lookup_enum_append_key ( cmd,
enum_lookup,
value )

Look up a command line option from an enumeration.

Iterate over a list of tuples, with the first entry is a command line entry and the second entry is the integer enumeration value. If the value is a match to the enumeration value, append the command line entry to cmd.

Parameters
cmdlist of command line options to append the new entry
enum_lookupiterable of enumeration entries (key, integer)
valueinteger enumeration value to match in enum_lookup
Returns
cmd, which may have been modified.
Exceptions
ValueError

◆ lookup_enum_append_keys()

makeprojects.validators.lookup_enum_append_keys ( cmd,
enum_dicts,
command_dict )

Look up a set of enum command line options.

A command_dict has keys in the form of Visual Studio XML entries with the data being the expected setting, or None for default. If the value starts with _NOT_USED, it's considered None and will use the default.

Note
Enumeration entries are a list of tuples where the first entry is the command line switch and the second entry is an integer as the enumeration value. If multiple entries have the same integer, the first entry is the default.
Parameters
cmdlist of command line options to append the new entry
enum_dictsIterable of enumeration entries
command_dictdict of command entries
Returns
Argument cmd is returned.
Exceptions
ValueError

◆ lookup_enum_value()

makeprojects.validators.lookup_enum_value ( enum_lookup,
key,
fallback )

Find a value in a list of enums.

Iterate over a list of two entry tuples, the first entry is the key and the second is the value. Essentually, it's a dict implemented as a list/tuple.

Parameters
enum_lookupiterable of enumeration entries (key, integer)
keyKey value to match in enumeration keys
fallbackValue to return if there is no match
Returns
Second value in the enumeration entry where the key matches, or fallback

◆ lookup_string_list()

makeprojects.validators.lookup_string_list ( cmd,
switches,
entry_list,
quotes = True )

Create a command line with an entry list.

Given a list of strings in entry_list, add to a command line a compiler switch followed by each string with or without quotes. If the switch has an ending space, the space is removed and entries are stored in separate lines.

Parameters
cmdlist of command line options to append the new entry.
switchesString, Command line switch string.
entry_listList of parameter strings.
quotesBoolean, True caused the entries to be quoted.
Returns
None

◆ lookup_string_lists()

makeprojects.validators.lookup_string_lists ( cmd,
string_list,
command_dict )

Lookup string items and add them to the command line.

The command_dict has the overrides where the value is either a single string or an array of strings or None.

The string_list is an iterable of tuples where the first entry is a string of the Visual Studio XML name and the second entry is a 2 entry tuple, where the first entry is the command line switch and the second entry is a boolean where if True will have the string in quotes.

Note
If a command line switch ends with a space, it will be used as a flag to append the parameter string as a separate line in the cmd list.
Parameters
cmdlist of command line options to append the new entry.
string_listdict of string list entries.
command_dictdict of command entries.
Returns
None

◆ lookup_strings()

makeprojects.validators.lookup_strings ( cmd,
string_entries,
command_dict )

Lookup string items and add them to the command line.

The command dictionary has a key of the Visual Studio XML name and the data is a valid string, usually a filename. If the data is None, the default string is used.

String entries are a list of tuples where the first entry is the key and the second entry is a four entry tuple with the actions.

The function will return a list of strings of output files so the caller can properly create the make entries for output files for the dependency tree.

The four entry tuple is as follows:

  1. String/None, Output filename if any, or None for no output.
  2. String, command line switch, may have a space at the end.
  3. Boolean, if True, encapsulate the output filename with quotes.
  4. Boolean, if True, add the string to the return list.
Parameters
cmdlist of command line options to append the new entry
string_entriesdict of string entries
command_dictdict of command entries
Returns
String list of string items the generate output