Line data Source code
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 : #include "sfntly/table/byte_array_table_builder.h"
18 :
19 : namespace sfntly {
20 :
21 0 : ByteArrayTableBuilder::~ByteArrayTableBuilder() {}
22 :
23 0 : int32_t ByteArrayTableBuilder::ByteValue(int32_t index) {
24 0 : ReadableFontDataPtr data = InternalReadData();
25 0 : if (data == NULL) {
26 : #if !defined (SFNTLY_NO_EXCEPTION)
27 : throw IOException("No font data for the table");
28 : #endif
29 0 : return -1;
30 : }
31 0 : return data->ReadByte(index);
32 : }
33 :
34 0 : void ByteArrayTableBuilder::SetByteValue(int32_t index, byte_t b) {
35 0 : WritableFontDataPtr data = InternalWriteData();
36 0 : if (data == NULL) {
37 : #if !defined (SFNTLY_NO_EXCEPTION)
38 : throw IOException("No font data for the table");
39 : #endif
40 0 : return;
41 : }
42 0 : data->WriteByte(index, b);
43 : }
44 :
45 0 : int32_t ByteArrayTableBuilder::ByteCount() {
46 0 : ReadableFontDataPtr data = InternalReadData();
47 0 : if (data == NULL) {
48 : #if !defined (SFNTLY_NO_EXCEPTION)
49 : throw IOException("No font data for the table");
50 : #endif
51 0 : return 0;
52 : }
53 0 : return data->Length();
54 : }
55 :
56 0 : ByteArrayTableBuilder::ByteArrayTableBuilder(Header* header,
57 0 : WritableFontData* data)
58 0 : : TableBasedTableBuilder(header, data) {
59 0 : }
60 :
61 0 : ByteArrayTableBuilder::ByteArrayTableBuilder(Header* header,
62 0 : ReadableFontData* data)
63 0 : : TableBasedTableBuilder(header, data) {
64 0 : }
65 :
66 0 : ByteArrayTableBuilder::ByteArrayTableBuilder(Header* header)
67 0 : : TableBasedTableBuilder(header) {
68 0 : }
69 :
70 : } // namespace sfntly
|