mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-03-15 08:37:14 +01:00
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
95 lines
1.7 KiB
C++
95 lines
1.7 KiB
C++
//
|
|
// Enum.h
|
|
//
|
|
// Library: CppParser
|
|
// Package: SymbolTable
|
|
// Module: Enum
|
|
//
|
|
// Definition of the Enum class.
|
|
//
|
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
|
// and Contributors.
|
|
//
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
//
|
|
|
|
|
|
#ifndef CppParser_Enum_INCLUDED
|
|
#define CppParser_Enum_INCLUDED
|
|
|
|
|
|
#include "Poco/CppParser/CppParser.h"
|
|
#include "Poco/CppParser/Symbol.h"
|
|
#include <vector>
|
|
|
|
|
|
namespace Poco {
|
|
namespace CppParser {
|
|
|
|
|
|
class EnumValue;
|
|
|
|
|
|
class CppParser_API Enum: public Symbol
|
|
/// This class represents an enum declaration.
|
|
///
|
|
/// An enumeration has an optional name and
|
|
/// a collection of EnumValues.
|
|
{
|
|
public:
|
|
typedef std::vector<EnumValue*> Values;
|
|
typedef Values::const_iterator Iterator;
|
|
|
|
enum Flags
|
|
{
|
|
ENUM_IS_CLASS = 0x01 // C++11 enum class
|
|
};
|
|
|
|
Enum(const std::string& name, NameSpace* pNameSpace, int flags = 0);
|
|
/// Creates the Enum.
|
|
///
|
|
/// If name is the empty string, an internal name
|
|
/// in the form #AnonEnum<n> (where <n> is a unique integer)
|
|
/// will be assigned.
|
|
|
|
~Enum();
|
|
/// Destroys the Enum.
|
|
|
|
void addValue(EnumValue* pValue);
|
|
/// Adds an enum value. The Enum takes ownership of the value.
|
|
|
|
Iterator begin() const;
|
|
/// Returns an iterator for iterating over the Enum's EnumValue's.
|
|
|
|
Iterator end() const;
|
|
/// Returns an iterator for iterating over the Enum's EnumValue's.
|
|
|
|
int flags() const;
|
|
|
|
Symbol::Kind kind() const;
|
|
std::string toString() const;
|
|
|
|
protected:
|
|
static std::string processName(const std::string& name);
|
|
|
|
private:
|
|
Values _values;
|
|
int _flags;
|
|
static int _count;
|
|
};
|
|
|
|
|
|
//
|
|
// inlines
|
|
//
|
|
inline int Enum::flags() const
|
|
{
|
|
return _flags;
|
|
}
|
|
|
|
|
|
} } // namespace Poco::CppParser
|
|
|
|
|
|
#endif // CppParser_Enum_INCLUDED
|