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