list assignment types in assignment-client help

This commit is contained in:
Thijs Wenker 2017-12-18 15:32:32 -08:00
parent affd67d7d4
commit 1bfb62bd7f
4 changed files with 16 additions and 4 deletions

View file

@ -46,8 +46,14 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
const QCommandLineOption helpOption = parser.addHelpOption();
const QCommandLineOption clientTypeOption(ASSIGNMENT_TYPE_OVERRIDE_OPTION,
"run single assignment client of given type", "type");
QString typeDescription = "run single assignment client of given type\n# | Type\n============================";
for (Assignment::Type type = Assignment::FirstType;
type != Assignment::AllTypes;
type = static_cast<Assignment::Type>(static_cast<int>(type) + 1)) {
typeDescription.append(QStringLiteral("\n%1 | %2").arg(QString::number(type), Assignment::typeToString(type)));
}
const QCommandLineOption clientTypeOption(ASSIGNMENT_TYPE_OVERRIDE_OPTION, typeDescription, "type");
parser.addOption(clientTypeOption);
const QCommandLineOption poolOption(ASSIGNMENT_POOL_OPTION, "set assignment pool", "pool-name");

View file

@ -945,7 +945,7 @@ void DomainServer::createStaticAssignmentsForType(Assignment::Type type, const Q
void DomainServer::populateDefaultStaticAssignmentsExcludingTypes(const QSet<Assignment::Type>& excludedTypes) {
// enumerate over all assignment types and see if we've already excluded it
for (Assignment::Type defaultedType = Assignment::AudioMixerType;
for (Assignment::Type defaultedType = Assignment::FirstType;
defaultedType != Assignment::AllTypes;
defaultedType = static_cast<Assignment::Type>(static_cast<int>(defaultedType) + 1)) {
if (!excludedTypes.contains(defaultedType) && defaultedType != Assignment::AgentType) {

View file

@ -127,7 +127,11 @@ void Assignment::swap(Assignment& otherAssignment) {
}
const char* Assignment::getTypeName() const {
switch (_type) {
return typeToString(_type);
}
const char* Assignment::typeToString(Assignment::Type type) {
switch (type) {
case Assignment::AudioMixerType:
return "audio-mixer";
case Assignment::AvatarMixerType:

View file

@ -28,6 +28,7 @@ class Assignment : public QObject {
public:
enum Type : uint8_t {
FirstType = 0,
AudioMixerType = 0,
AvatarMixerType = 1,
AgentType = 2,
@ -89,6 +90,7 @@ public:
const QString& getNodeVersion() const { return _nodeVersion; }
const char* getTypeName() const;
static const char* typeToString(Assignment::Type type);
friend QDebug operator<<(QDebug debug, const Assignment& assignment);
friend QDataStream& operator<<(QDataStream &out, const Assignment& assignment);