Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

thrift constant structure using enum

I've got following enum and want to create a constant map using elements of this enum:

enum UploadFileType {
    POPULATION,
    PROBABILITY,
    REACH,
    CMOBILE,
    CMOBAPP
}

/**
 * Defines which files are uploadable in which country
 */
const map<string,list<UploadFileType>> uploadable_files = {
    'hu': [POPULATION, PROBABILITY, REACH, CMOBILE, CMOBAPP],
    'sk': [POPULATION, PROBABILITY, REACH]
}

I'm getting following error here:

[FAILURE:/home/abc/internal.thrift:29] error: identifier POPULATION is unqualified!
[FAILURE:/home/abc/internal.thrift:29] error: identifier POPULATION is unqualified!

and I don't know how this should look properly.

like image 521
ducin Avatar asked May 01 '26 07:05

ducin


1 Answers

Enums use dot notation:

const map<string,list<UploadFileType>> uploadable_files = {
    'hu': [UploadFileType.POPULATION, UploadFileType.PROBABILITY, UploadFileType.REACH, UploadFileType.CMOBILE, UploadFileType.CMOBAPP],
    'sk': [UploadFileType.POPULATION, UploadFileType.PROBABILITY, UploadFileType.REACH]
}
like image 81
ducin Avatar answered May 04 '26 15:05

ducin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!