Shaka Player Embedded
byte_string.h
Go to the documentation of this file.
1 // Copyright 2016 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SHAKA_EMBEDDED_MAPPING_BYTE_STRING_H_
16 #define SHAKA_EMBEDDED_MAPPING_BYTE_STRING_H_
17 
18 #include <string>
19 #include <vector>
20 
22 
23 namespace shaka {
24 
32 class ByteString : public std::vector<uint8_t>,
33  public GenericConverter,
34  public memory::Traceable {
35  public:
36  static std::string name() {
37  return "string";
38  }
39 
40  explicit ByteString(const char* source);
41  explicit ByteString(const std::string& source);
42 
43  // Inherit other constructors from std::vector.
44  using std::vector<uint8_t>::vector;
45 
46 
47  bool TryConvert(Handle<JsValue> value) override;
48  ReturnVal<JsValue> ToJsValue() const override;
49  void Trace(memory::HeapTracer* tracer) const override {}
50 };
51 
52 } // namespace shaka
53 
54 #endif // SHAKA_EMBEDDED_MAPPING_BYTE_STRING_H_
ReturnVal< JsValue > ToJsValue() const override
Definition: byte_string.cc:69
bool TryConvert(Handle< JsValue > value) override
Definition: byte_string.cc:32
const char * source
Definition: media_utils.cc:30
static std::string name()
Definition: byte_string.h:36
ByteString(const char *source)
Definition: byte_string.cc:25
void Trace(memory::HeapTracer *tracer) const override
Definition: byte_string.h:49