Branch data 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 <WW8CpAndFc.hxx>
21 : :
22 : : #include <iterator>
23 : : #include <algorithm>
24 : : #include <string>
25 : : #include <map>
26 : :
27 : : namespace writerfilter {
28 : : namespace doctok
29 : : {
30 : : using namespace ::std;
31 : :
32 : 0 : bool operator < (const Cp & rA, const Cp & rB)
33 : : {
34 : 0 : return rA.nCp < rB.nCp;
35 : : }
36 : :
37 : 0 : bool operator == (const Cp & rA, const Cp & rB)
38 : : {
39 : 0 : return rA.nCp == rB.nCp;
40 : : }
41 : :
42 : 0 : string Cp::toString() const
43 : : {
44 : : char sBuffer[256];
45 : :
46 : 0 : snprintf(sBuffer, 255, "%" SAL_PRIxUINT32 "", get());
47 : :
48 [ # # ]: 0 : return string(sBuffer);
49 : : }
50 : :
51 : 0 : ostream & operator << (ostream & o, const Cp & rCp)
52 : : {
53 [ # # ]: 0 : return o << rCp.toString();
54 : : }
55 : :
56 : 0 : bool operator < (const Fc & rA, const Fc & rB)
57 : : {
58 : 0 : return rA.mnFc < rB.mnFc;
59 : : }
60 : :
61 : 0 : bool operator == (const Fc & rA, const Fc & rB)
62 : : {
63 : 0 : return rA.mnFc == rB.mnFc;
64 : : }
65 : :
66 : 0 : string Fc::toString() const
67 : : {
68 : : char sBuffer[256];
69 : :
70 : : snprintf(sBuffer, 255, "(%" SAL_PRIxUINT32 ", %s)", static_cast<sal_uInt32>(get()),
71 [ # # ]: 0 : isComplex() ? "true" : "false");
72 : :
73 [ # # ]: 0 : return string(sBuffer);
74 : : }
75 : :
76 : 0 : ostream & operator << (ostream & o, const Fc & rFc)
77 : : {
78 : :
79 [ # # ]: 0 : return o << rFc.toString();
80 : : }
81 : :
82 : 0 : bool operator < (const CpAndFc & rA, const CpAndFc & rB)
83 : : {
84 : 0 : bool bResult = false;
85 : :
86 [ # # ]: 0 : if (rA.mCp < rB.mCp)
87 : 0 : bResult = true;
88 [ # # ][ # # ]: 0 : else if (rA.mCp == rB.mCp && rA.mType < rB.mType)
[ # # ]
89 : 0 : bResult = true;
90 : :
91 : 0 : return bResult;
92 : : }
93 : :
94 : 0 : bool operator == (const CpAndFc & rA, const CpAndFc & rB)
95 : : {
96 : 0 : return rA.mCp == rB.mCp;
97 : : }
98 : :
99 : 0 : ostream & operator << (ostream & o, const CpAndFc & rCpAndFc)
100 : : {
101 [ # # ]: 0 : return o << rCpAndFc.toString();
102 : : }
103 : :
104 : 0 : ostream & operator << (ostream & o, const CpAndFcs & rCpAndFcs)
105 : : {
106 : : copy(rCpAndFcs.begin(), rCpAndFcs.end(),
107 [ # # ]: 0 : ostream_iterator<CpAndFc>(o, ", "));
108 : :
109 : : char sBuffer[256];
110 : :
111 : 0 : snprintf(sBuffer, 255, "%" SAL_PRI_SIZET "u", rCpAndFcs.size());
112 [ # # ]: 0 : o << sBuffer;
113 : :
114 : 0 : return o;
115 : : }
116 : :
117 : 0 : CpAndFc::CpAndFc(const Cp & rCp, const Fc & rFc, PropertyType eType_)
118 : 0 : : mCp(rCp), mFc(rFc), mType(eType_)
119 : : {
120 : 0 : }
121 : :
122 [ + - ][ + - ]: 60 : }}
123 : :
124 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|