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#pragma once
21
22#include "scdllapi.h"
23
24#include <rtl/ustring.hxx>
25
26#include <vector>
27
32{
33private:
34 struct SAL_DLLPRIVATE SubStr
35 {
36 OUString maReal;
37 OUString maUpper;
38 SubStr(OUString&& aReal);
39 };
40
41 std::vector<SubStr> maSubStrings;
42 OUString aStr;
43
44 SAL_DLLPRIVATE void InitTokens();
45
46public:
47 ScUserListData(OUString aStr);
48
49 const OUString& GetString() const { return aStr; }
50 void SetString(const OUString& rStr);
51 size_t GetSubCount() const { return maSubStrings.size(); }
52 bool GetSubIndex(const OUString& rSubStr, sal_uInt16& rIndex, bool& bMatchCase) const;
53 OUString GetSubStr(sal_uInt16 nIndex) const;
54 sal_Int32 Compare(const OUString& rSubStr1, const OUString& rSubStr2) const;
55 sal_Int32 ICompare(const OUString& rSubStr1, const OUString& rSubStr2) const;
56};
57
62{
63 typedef std::vector<ScUserListData> DataType;
65
66public:
67 explicit ScUserList(bool initDefault = true);
68 ScUserList(const ScUserList& r) = default;
69
70 void AddDefaults();
71 void EraseData(size_t nIndex) { maData.erase(maData.cbegin() + nIndex); }
72
73 const ScUserListData* GetData(const OUString& rSubStr) const;
75 bool HasEntry(std::u16string_view rStr) const;
76
77 const ScUserListData& operator[](size_t nIndex) const { return maData[nIndex]; }
78 ScUserListData& operator[](size_t nIndex) { return maData[nIndex]; }
79 ScUserList& operator=(const ScUserList& r) = default;
80 bool operator==(const ScUserList& r) const;
81 bool operator!=(const ScUserList& r) const { return !operator==(r); }
82
83 void clear() { maData.clear(); }
84 size_t size() const { return maData.size(); }
85 template <class... Args> void emplace_back(Args&&... args)
86 {
87 maData.emplace_back(std::forward<Args>(args)...);
88 }
89};
90
91/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Stores individual user-defined sort list.
Definition: userlist.hxx:32
const OUString & GetString() const
Definition: userlist.hxx:49
OUString aStr
Definition: userlist.hxx:42
size_t GetSubCount() const
Definition: userlist.hxx:51
std::vector< SubStr > maSubStrings
Definition: userlist.hxx:41
Collection of user-defined sort lists.
Definition: userlist.hxx:62
void clear()
Definition: userlist.hxx:83
void EraseData(size_t nIndex)
Definition: userlist.hxx:71
void emplace_back(Args &&... args)
Definition: userlist.hxx:85
ScUserList & operator=(const ScUserList &r)=default
std::vector< ScUserListData > DataType
Definition: userlist.hxx:63
ScUserListData & operator[](size_t nIndex)
Definition: userlist.hxx:78
DataType maData
Definition: userlist.hxx:64
bool operator!=(const ScUserList &r) const
Definition: userlist.hxx:81
size_t size() const
Definition: userlist.hxx:84
const ScUserListData & operator[](size_t nIndex) const
Definition: userlist.hxx:77
ScUserList(const ScUserList &r)=default
sal_Int32 nIndex
std::vector< sal_Int8, boost::noinit_adaptor< std::allocator< sal_Int8 > > > maData
aStr
void SetString(SwCursor &rCursor, std::u16string_view aString)
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:162
args
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)
Definition: xlstyle.cxx:518