LibreOffice Module sc (master)  1
userlist.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_SC_INC_USERLIST_HXX
21 #define INCLUDED_SC_INC_USERLIST_HXX
22 
23 #include "scdllapi.h"
24 
25 #include <rtl/ustring.hxx>
26 
27 #include <memory>
28 #include <vector>
29 
34 {
35 public:
36  struct SAL_DLLPRIVATE SubStr
37  {
38  OUString maReal;
39  OUString maUpper;
40  SubStr(const OUString& rReal, const OUString& rUpper);
41  };
42 
43 private:
44  typedef std::vector<SubStr> SubStringsType;
45  SubStringsType maSubStrings;
46  OUString aStr;
47 
48  SAL_DLLPRIVATE void InitTokens();
49 
50 public:
51  ScUserListData(const OUString& rStr);
52  ScUserListData(const ScUserListData& rData);
53  ~ScUserListData();
54 
55  const OUString& GetString() const { return aStr; }
56  void SetString(const OUString& rStr);
57  size_t GetSubCount() const;
58  bool GetSubIndex(const OUString& rSubStr, sal_uInt16& rIndex, bool& bMatchCase) const;
59  OUString GetSubStr(sal_uInt16 nIndex) const;
60  sal_Int32 Compare(const OUString& rSubStr1, const OUString& rSubStr2) const;
61  sal_Int32 ICompare(const OUString& rSubStr1, const OUString& rSubStr2) const;
62 };
63 
68 {
69  typedef std::vector<std::unique_ptr<ScUserListData>> DataType;
70  DataType maData;
71 
72 public:
73  typedef DataType::iterator iterator;
74  typedef DataType::const_iterator const_iterator;
75 
76  ScUserList();
77  ScUserList(const ScUserList& r);
78 
79  const ScUserListData* GetData(const OUString& rSubStr) const;
81  bool HasEntry(std::u16string_view rStr) const;
82 
83  const ScUserListData& operator[](size_t nIndex) const;
84  ScUserListData& operator[](size_t nIndex);
85  ScUserList& operator=(const ScUserList& r);
86  bool operator==(const ScUserList& r) const;
87  bool operator!=(const ScUserList& r) const;
88 
89  iterator begin();
90  const_iterator begin() const;
91  void clear();
92  size_t size() const;
93  void push_back(ScUserListData* p);
94  void erase(const iterator& itr);
95 };
96 
97 #endif
98 
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)
Definition: xlstyle.cxx:517
DataType::const_iterator const_iterator
Definition: userlist.hxx:74
Collection of user-defined sort lists.
Definition: userlist.hxx:67
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
Definition: xestring.hxx:251
DataType maData
Definition: userlist.hxx:70
std::vector< std::unique_ptr< ScUserListData > > DataType
Definition: userlist.hxx:69
OUString aStr
Definition: userlist.hxx:46
void SetString(SwCursor &rCursor, const OUString &rString)
Stores individual user-defined sort list.
Definition: userlist.hxx:33
enumrange< T >::Iterator begin(enumrange< T >)
const OUString & GetString() const
Definition: userlist.hxx:55
size
static short Compare(const OUString &sInput1, const OUString &sInput2, const bool bCaseSens, const ScUserListData *pData, const CollatorWrapper *pCW)
Naturally compares two given strings.
Definition: table3.cxx:163
DataType::iterator iterator
Definition: userlist.hxx:73
SubStringsType maSubStrings
Definition: userlist.hxx:45
std::vector< SubStr > SubStringsType
Definition: userlist.hxx:44
#define SC_DLLPUBLIC
Definition: scdllapi.h:28