Home | History | Annotate | Download | only in table
      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/table_based_table_builder.h"
     18 
     19 namespace sfntly {
     20 
     21 /******************************************************************************
     22  * TableBasedTableBuilder class
     23  ******************************************************************************/
     24 TableBasedTableBuilder::~TableBasedTableBuilder() {}
     25 
     26 int32_t TableBasedTableBuilder::SubSerialize(WritableFontData* data) {
     27   UNREFERENCED_PARAMETER(data);
     28   return 0;
     29 }
     30 
     31 bool TableBasedTableBuilder::SubReadyToSerialize() {
     32   return false;
     33 }
     34 
     35 int32_t TableBasedTableBuilder::SubDataSizeToSerialize() {
     36   return 0;
     37 }
     38 
     39 void TableBasedTableBuilder::SubDataSet() {
     40   table_ = NULL;
     41 }
     42 
     43 CALLER_ATTACH FontDataTable* TableBasedTableBuilder::Build() {
     44   FontDataTablePtr table = static_cast<FontDataTable*>(GetTable());
     45   return table.Detach();
     46 }
     47 
     48 TableBasedTableBuilder::TableBasedTableBuilder(Header* header,
     49                                                WritableFontData* data)
     50     : Table::Builder(header, data) {
     51 }
     52 
     53 TableBasedTableBuilder::TableBasedTableBuilder(Header* header,
     54                                                ReadableFontData* data)
     55     : Table::Builder(header, data) {
     56 }
     57 
     58 TableBasedTableBuilder::TableBasedTableBuilder(Header* header)
     59     : Table::Builder(header) {
     60 }
     61 
     62 Table* TableBasedTableBuilder::GetTable() {
     63   if (table_ == NULL) {
     64     table_.Attach(down_cast<Table*>(SubBuildTable(InternalReadData())));
     65   }
     66   return table_;
     67 }
     68 
     69 }  // namespace sfntly
     70