Shaka Packager SDK
Main Page
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
packager
app
gflags_hex_bytes.h
1
// Copyright 2017 Google Inc. All rights reserved.
2
//
3
// Use of this source code is governed by a BSD-style
4
// license that can be found in the LICENSE file or at
5
// https://developers.google.com/open-source/licenses/bsd
6
//
7
// Extends gflags to support hex formatted bytes.
8
9
#ifndef PACKAGER_APP_GFLAGS_HEX_BYTES_H_
10
#define PACKAGER_APP_GFLAGS_HEX_BYTES_H_
11
12
#include <gflags/gflags.h>
13
14
#include <string>
15
#include <vector>
16
17
namespace
shaka {
18
bool
ValidateHexString(
const
char
* flagname,
19
const
std::string& value,
20
std::vector<uint8_t>* value_bytes);
21
}
// namespace shaka
22
23
// The raw bytes will be available in FLAGS_##name##_bytes.
24
// The original gflag variable FLAGS_##name is defined in shaka_gflags_extension
25
// and not exposed directly.
26
#define DECLARE_hex_bytes(name) \
27
namespace shaka_gflags_extension { \
28
DECLARE_string(name); \
29
} \
30
namespace shaka_gflags_extension { \
31
extern std::vector<uint8_t> FLAGS_##name##_bytes; \
32
} \
33
using shaka_gflags_extension::FLAGS_##name##_bytes
34
35
#define DEFINE_hex_bytes(name, val, txt) \
36
namespace shaka_gflags_extension { \
37
DEFINE_string(name, val, txt); \
38
} \
39
namespace shaka_gflags_extension { \
40
std::vector<uint8_t> FLAGS_##name##_bytes; \
41
static bool hex_validator_##name = gflags::RegisterFlagValidator( \
42
&FLAGS_##name, \
43
[](const char* flagname, const std::string& value) { \
44
return shaka::ValidateHexString(flagname, value, \
45
&FLAGS_##name##_bytes); \
46
}); \
47
} \
48
using shaka_gflags_extension::FLAGS_##name##_bytes
49
50
#endif // PACKAGER_APP_GFLAGS_HEX_BYTES_H_
Generated on Tue Sep 19 2017 20:22:03 for Shaka Packager SDK by
1.8.6