bump product version to 4.1.6.2
[LibreOffice.git] / writerfilter / source / doctok / WW8CpAndFc.cxx
blobf90e81adba236618347bf933d8e29c62c2739432
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <WW8CpAndFc.hxx>
22 #include <iterator>
23 #include <algorithm>
24 #include <string>
25 #include <map>
27 namespace writerfilter {
28 namespace doctok
30 using namespace ::std;
32 bool operator < (const Cp & rA, const Cp & rB)
34 return rA.nCp < rB.nCp;
37 bool operator == (const Cp & rA, const Cp & rB)
39 return rA.nCp == rB.nCp;
42 string Cp::toString() const
44 char sBuffer[256];
46 snprintf(sBuffer, 255, "%" SAL_PRIxUINT32 "", get());
48 return string(sBuffer);
51 ostream & operator << (ostream & o, const Cp & rCp)
53 return o << rCp.toString();
56 bool operator < (const Fc & rA, const Fc & rB)
58 return rA.mnFc < rB.mnFc;
61 bool operator == (const Fc & rA, const Fc & rB)
63 return rA.mnFc == rB.mnFc;
66 string Fc::toString() const
68 char sBuffer[256];
70 snprintf(sBuffer, 255, "(%" SAL_PRIxUINT32 ", %s)", static_cast<sal_uInt32>(get()),
71 isComplex() ? "true" : "false");
73 return string(sBuffer);
76 ostream & operator << (ostream & o, const Fc & rFc)
79 return o << rFc.toString();
82 bool operator < (const CpAndFc & rA, const CpAndFc & rB)
84 bool bResult = false;
86 if (rA.mCp < rB.mCp)
87 bResult = true;
88 else if (rA.mCp == rB.mCp && rA.mType < rB.mType)
89 bResult = true;
91 return bResult;
94 bool operator == (const CpAndFc & rA, const CpAndFc & rB)
96 return rA.mCp == rB.mCp;
99 ostream & operator << (ostream & o, const CpAndFc & rCpAndFc)
101 return o << rCpAndFc.toString();
104 ostream & operator << (ostream & o, const CpAndFcs & rCpAndFcs)
106 copy(rCpAndFcs.begin(), rCpAndFcs.end(),
107 ostream_iterator<CpAndFc>(o, ", "));
109 char sBuffer[256];
111 snprintf(sBuffer, 255, "%" SAL_PRI_SIZET "u", rCpAndFcs.size());
112 o << sBuffer;
114 return o;
117 CpAndFc::CpAndFc(const Cp & rCp, const Fc & rFc, PropertyType eType_)
118 : mCp(rCp), mFc(rFc), mType(eType_)
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */