Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <precomp.h>
21 : #include <tokens/stmstar2.hxx>
22 :
23 :
24 : // NOT FULLY DECLARED SERVICES
25 : #include <x_parse2.hxx>
26 :
27 :
28 :
29 1494 : StmArrayStatu2::StmArrayStatu2( intt i_nStatusSize,
30 : const INT16 * in_aArrayModel,
31 : uintt i_nTokenId,
32 : bool in_bIsDefault )
33 1494 : : dpBranches(new StmStatu2::Branch[i_nStatusSize]),
34 : nNrOfBranches(i_nStatusSize),
35 : nTokenId(UINT16(i_nTokenId)),
36 2988 : bIsADefault(in_bIsDefault)
37 : {
38 : // KORR_FUTURE: Interface of StmArrayStatu2() has to be changed.
39 : csv_assert(i_nTokenId < 64536);
40 :
41 1494 : if (in_aArrayModel != 0)
42 : {
43 1494 : intt count = 0;
44 192726 : for (const INT16 * get = in_aArrayModel; count < nNrOfBranches; count++, get++)
45 191232 : dpBranches[count] = *get;
46 : }
47 : else
48 : {
49 0 : memset(dpBranches, 0, nNrOfBranches);
50 : }
51 1494 : }
52 :
53 4482 : StmArrayStatu2::~StmArrayStatu2()
54 : {
55 1494 : delete [] dpBranches;
56 2988 : }
57 :
58 : bool
59 35085 : StmArrayStatu2::SetBranch( intt in_nBranchIx,
60 : StmStatu2::Branch in_nBranch )
61 : {
62 35085 : if ( csv::in_range(intt(0), in_nBranchIx, intt(nNrOfBranches) ) )
63 : {
64 35085 : dpBranches[in_nBranchIx] = in_nBranch;
65 35085 : return true;
66 : }
67 0 : return false;
68 : }
69 :
70 :
71 : StmStatu2::Branch
72 8206852 : StmArrayStatu2::NextBy(intt in_nIndex) const
73 : {
74 8206852 : if (in_nIndex < 0)
75 1 : throw X_AutodocParser(X_AutodocParser::x_InvalidChar);
76 :
77 : return in_nIndex < nNrOfBranches
78 8206851 : ? dpBranches[in_nIndex]
79 16413702 : : dpBranches[nNrOfBranches - 1];
80 : }
81 :
82 :
83 : bool
84 1476 : StmArrayStatu2::IsADefault() const
85 : {
86 1476 : return bIsADefault;
87 : }
88 :
89 : StmArrayStatu2 *
90 10090633 : StmArrayStatu2::AsArray()
91 : {
92 10090633 : return this;
93 3 : }
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|