• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2011 Google Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SFNTLY_CPP_SRC_SFNTLY_TABLE_BYTE_ARRAY_TABLE_BUILDER_H_
18 #define SFNTLY_CPP_SRC_SFNTLY_TABLE_BYTE_ARRAY_TABLE_BUILDER_H_
19 
20 #include "sfntly/table/table_based_table_builder.h"
21 
22 namespace sfntly {
23 
24 // An abstract builder base for byte array based tables.
25 class ByteArrayTableBuilder : public TableBasedTableBuilder {
26  public:
27   virtual ~ByteArrayTableBuilder();
28 
29   // Get the byte value at the specified index. The index is relative to the
30   // start of the table.
31   // @param index index relative to the start of the table
32   // @return byte value at the given index
33   virtual int32_t ByteValue(int32_t index);
34 
35   // Set the byte value at the specified index. The index is relative to the
36   // start of the table.
37   // @param index index relative to the start of the table
38   // @param b byte value to set
39   virtual void SetByteValue(int32_t index, byte_t b);
40 
41   // Get the number of bytes set for this table. It may include padding bytes at
42   // the end.
43   virtual int32_t ByteCount();
44 
45  protected:
46   ByteArrayTableBuilder(Header* header, WritableFontData* data);
47   ByteArrayTableBuilder(Header* header, ReadableFontData* data);
48   explicit ByteArrayTableBuilder(Header* header);
49 };
50 
51 }  // namespace sfntly
52 
53 #endif  // SFNTLY_CPP_SRC_SFNTLY_TABLE_BYTE_ARRAY_TABLE_BUILDER_H_
54