1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #include <precomp.h> 23 #include <tokens/stmstar2.hxx> 24 25 26 // NOT FULLY DECLARED SERVICES 27 #include <x_parse2.hxx> 28 29 30 31 StmArrayStatu2::StmArrayStatu2( intt i_nStatusSize, 32 const INT16 * in_aArrayModel, 33 uintt i_nTokenId, 34 bool in_bIsDefault ) 35 : dpBranches(new StmStatu2::Branch[i_nStatusSize]), 36 nNrOfBranches(i_nStatusSize), 37 nTokenId(UINT16(i_nTokenId)), 38 bIsADefault(in_bIsDefault) 39 { 40 // KORR_FUTURE: Interface of StmArrayStatu2() has to be changed. 41 csv_assert(i_nTokenId < 64536); 42 43 if (in_aArrayModel != 0) 44 { 45 intt count = 0; 46 for (const INT16 * get = in_aArrayModel; count < nNrOfBranches; count++, get++) 47 dpBranches[count] = *get; 48 } 49 else // 50 { 51 memset(dpBranches, 0, nNrOfBranches); 52 } // endif 53 } 54 55 StmArrayStatu2::~StmArrayStatu2() 56 { 57 delete [] dpBranches; 58 } 59 60 bool 61 StmArrayStatu2::SetBranch( intt in_nBranchIx, 62 StmStatu2::Branch in_nBranch ) 63 { 64 if ( csv::in_range(intt(0), in_nBranchIx, intt(nNrOfBranches) ) ) 65 { 66 dpBranches[in_nBranchIx] = in_nBranch; 67 return true; 68 } 69 return false; 70 } 71 72 73 StmStatu2::Branch 74 StmArrayStatu2::NextBy(intt in_nIndex) const 75 { 76 if (in_nIndex < 0) 77 throw X_AutodocParser(X_AutodocParser::x_InvalidChar); 78 79 return in_nIndex < nNrOfBranches 80 ? dpBranches[in_nIndex] 81 : dpBranches[nNrOfBranches - 1]; 82 } 83 84 85 bool 86 StmArrayStatu2::IsADefault() const 87 { 88 return bIsADefault; 89 } 90 91 StmArrayStatu2 * 92 StmArrayStatu2::AsArray() 93 { 94 return this; 95 } 96 97