LibreOffice Module o3tl (master) 1
enumrange.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_O3TL_ENUMRANGE_HXX
21#define INCLUDED_O3TL_ENUMRANGE_HXX
22
23namespace o3tl {
24
39template< typename T>
41{
42public:
44 {
45 public:
46 Iterator( int value ) :
47 m_value( value )
48 {
49 }
50
51 T operator*( void ) const
52 {
53 return static_cast<T>(m_value);
54 }
55
56 void operator++( void )
57 {
58 ++m_value;
59 }
60
61 bool operator!=( Iterator rhs ) const
62 {
63 return m_value != rhs.m_value;
64 }
65
66 private:
68 };
69};
70
71template< typename T >
73{
74 return typename enumrange<T>::Iterator( int(0) );
75}
76
77template< typename T >
79{
80 return typename enumrange<T>::Iterator( static_cast<int>(T::LAST) + 1 );
81}
82
83}; // namespace o3tl
84
85#endif /* INCLUDED_O3TL_ENUMRANGE_HXX */
86
87/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
T operator*(void) const
Definition: enumrange.hxx:51
bool operator!=(Iterator rhs) const
Definition: enumrange.hxx:61
This is a container convenience class iterating over scoped enumerations.
Definition: enumrange.hxx:41
Any value
enumrange< T >::Iterator begin(enumrange< T >)
Definition: enumrange.hxx:72
enumrange< T >::Iterator end(enumrange< T >)
Definition: enumrange.hxx:78