Skip to main content

cpp enum class string idl.

Project description

cpp-enum-class-string-idl

python3 -m cpp_enum_class_string_idl MyEnums.yaml

MyEnums.yaml

interfaces:
  - MyEnum.yaml
  - MyOtherEnum.yaml

MyEnum.yaml

name: MyEnum
type: int
values:
  - Value0
  - Value1

MyEnum.h

#pragma once

/*
 * generated code from cpp-enum-class-string-idl
 */

enum class MyEnum : int {
    Value0,
    Value1,
    Count
};

const char* enum_to_string(const MyEnum value);

MyEnum.cpp

#include "MyEnum.h"

/*
 * generated code from cpp-enum-class-string-idl
 */

const char* _MyEnum[] = {
    "Value0",
    "Value1"
};

const char* enum_to_string(const MyEnum value) {
    if (MyEnum::Count == value) {
        return "";
    }

    return _MyEnum[static_cast<int>(value)];
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cpp-enum-class-string-idl-0.0.4.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file cpp-enum-class-string-idl-0.0.4.tar.gz.

File metadata

  • Download URL: cpp-enum-class-string-idl-0.0.4.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.2

File hashes

Hashes for cpp-enum-class-string-idl-0.0.4.tar.gz
Algorithm Hash digest
SHA256 90c621f5ddf63f4dd4f4209e41495626ae6874bbe2a957948055d35e10c519cb
MD5 7e1ae858db75b107b90754b84b5fd929
BLAKE2b-256 950808993d3fac2995644721c062e0e9166c16b5e751735410a2e1ef47c391dd

See more details on using hashes here.

File details

Details for the file cpp_enum_class_string_idl-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: cpp_enum_class_string_idl-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.2

File hashes

Hashes for cpp_enum_class_string_idl-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e9c7816796b9e807ae82fd1985c32ce5f020742bcbc9fa33bd561fda4008a97e
MD5 5f93853c54db71d5d39fac89f18a18a4
BLAKE2b-256 32ac687903169667db70d4b241675d551f02e6d35e6f96ce74d475ec3fa7f8c0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page