1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <connectivity/dbcharset.hxx>
23 #include <rtl/ustring.hxx>
29 typedef ::dbtools::OCharsetMap OCharsetDisplay_Base
;
30 class OCharsetDisplay final
: protected OCharsetDisplay_Base
33 OUString m_aSystemDisplayName
;
36 class ExtendedCharsetIterator
;
37 friend class OCharsetDisplay::ExtendedCharsetIterator
;
39 typedef ExtendedCharsetIterator iterator
;
40 typedef ExtendedCharsetIterator const_iterator
;
44 // various find operations
45 const_iterator
findEncoding(const rtl_TextEncoding _eEncoding
) const;
46 const_iterator
findIanaName(std::u16string_view _rIanaName
) const;
47 const_iterator
findDisplayName(const OUString
& _rDisplayName
) const;
49 /// get access to the first element of the charset collection
50 const_iterator
begin() const;
51 /// get access to the (last + 1st) element of the charset collection
52 const_iterator
end() const;
55 virtual bool approveEncoding( const rtl_TextEncoding _eEncoding
, const rtl_TextEncodingInfo
& _rInfo
) const override
;
57 using OCharsetDisplay_Base::find
;
60 //- CharsetDisplayDerefHelper
61 typedef ::dbtools::CharsetIteratorDerefHelper CharsetDisplayDerefHelper_Base
;
62 class CharsetDisplayDerefHelper final
: protected CharsetDisplayDerefHelper_Base
64 friend class OCharsetDisplay::ExtendedCharsetIterator
;
66 OUString m_sDisplayName
;
69 CharsetDisplayDerefHelper(const CharsetDisplayDerefHelper
& _rSource
);
71 OUString
const & getIanaName() const { return CharsetDisplayDerefHelper_Base::getIanaName(); }
72 const OUString
& getDisplayName() const { return m_sDisplayName
; }
75 CharsetDisplayDerefHelper(const ::dbtools::CharsetIteratorDerefHelper
& _rBase
, OUString _sDisplayName
);
78 //- OCharsetDisplay::ExtendedCharsetIterator
79 class OCharsetDisplay::ExtendedCharsetIterator
81 friend class OCharsetDisplay
;
83 friend bool operator==(const ExtendedCharsetIterator
& lhs
, const ExtendedCharsetIterator
& rhs
);
84 friend bool operator!=(const ExtendedCharsetIterator
& lhs
, const ExtendedCharsetIterator
& rhs
) { return !(lhs
== rhs
); }
86 typedef ::dbtools::OCharsetMap container
;
87 typedef container::CharsetIterator base_iterator
;
90 const OCharsetDisplay
* m_pContainer
;
91 base_iterator m_aPosition
;
94 CharsetDisplayDerefHelper
operator*() const;
97 const ExtendedCharsetIterator
& operator++();
100 ExtendedCharsetIterator( const OCharsetDisplay
* _pContainer
, base_iterator _aPosition
);
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */