LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / sc / inc / userlist.hxx
blobdbefe744498dacec363184689670cae1414287e2
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 #pragma once
22 #include "scdllapi.h"
24 #include <rtl/ustring.hxx>
26 #include <memory>
27 #include <vector>
29 /**
30 * Stores individual user-defined sort list.
32 class SC_DLLPUBLIC ScUserListData
34 public:
35 struct SAL_DLLPRIVATE SubStr
37 OUString maReal;
38 OUString maUpper;
39 SubStr(const OUString& rReal, const OUString& rUpper);
42 private:
43 typedef std::vector<SubStr> SubStringsType;
44 SubStringsType maSubStrings;
45 OUString aStr;
47 SAL_DLLPRIVATE void InitTokens();
49 public:
50 ScUserListData(const OUString& rStr);
51 ScUserListData(const ScUserListData& rData);
52 ~ScUserListData();
54 const OUString& GetString() const { return aStr; }
55 void SetString(const OUString& rStr);
56 size_t GetSubCount() const;
57 bool GetSubIndex(const OUString& rSubStr, sal_uInt16& rIndex, bool& bMatchCase) const;
58 OUString GetSubStr(sal_uInt16 nIndex) const;
59 sal_Int32 Compare(const OUString& rSubStr1, const OUString& rSubStr2) const;
60 sal_Int32 ICompare(const OUString& rSubStr1, const OUString& rSubStr2) const;
63 /**
64 * Collection of user-defined sort lists.
66 class SC_DLLPUBLIC ScUserList
68 typedef std::vector<std::unique_ptr<ScUserListData>> DataType;
69 DataType maData;
71 public:
72 typedef DataType::iterator iterator;
73 typedef DataType::const_iterator const_iterator;
75 ScUserList();
76 ScUserList(const ScUserList& r);
78 const ScUserListData* GetData(const OUString& rSubStr) const;
79 /// If the list in rStr is already inserted
80 bool HasEntry(std::u16string_view rStr) const;
82 const ScUserListData& operator[](size_t nIndex) const;
83 ScUserListData& operator[](size_t nIndex);
84 ScUserList& operator=(const ScUserList& r);
85 bool operator==(const ScUserList& r) const;
86 bool operator!=(const ScUserList& r) const;
88 iterator begin();
89 const_iterator begin() const;
90 void clear();
91 size_t size() const;
92 void push_back(ScUserListData* p);
93 void erase(const iterator& itr);
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */