Simplify a bit
[LibreOffice.git] / idl / inc / types.hxx
blobb78b8c644729a14692abede4aace50a888ee7973
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 <rtl/strbuf.hxx>
23 #include <tools/ref.hxx>
24 #include "basobj.hxx"
26 class SvMetaType;
27 class SvMetaSlot;
28 typedef SvRefMemberList< SvMetaSlot* > SvSlotElementList;
30 class SvMetaAttribute : public SvMetaReference
32 public:
33 tools::SvRef<SvMetaType> aType;
34 SvIdentifier aSlotId;
35 SvMetaAttribute();
36 SvMetaAttribute( SvMetaType * );
38 void SetSlotId( const SvIdentifier & rId )
39 { aSlotId = rId; }
40 const SvIdentifier& GetSlotId() const;
41 SvMetaType * GetType() const;
43 virtual bool Test( SvTokenStream & rInStm );
44 virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) override;
45 size_t MakeSfx( OStringBuffer& rAtrrArray ) const;
46 virtual void Insert( SvSlotElementList& );
49 enum MetaTypeType { Method, Struct, Base, Enum, Interface, Shell };
51 class SvMetaType : public SvMetaReference
53 SvRefMemberList<SvMetaAttribute *> aAttrList;
54 MetaTypeType nType;
55 bool bIsItem;
57 void WriteSfxItem( std::string_view rItemName, SvIdlDataBase const & rBase,
58 SvStream & rOutStm );
59 protected:
60 bool ReadHeaderSvIdl( SvTokenStream & rInStm );
61 public:
62 SvMetaType();
63 SvMetaType( const OString& rTypeName );
65 virtual ~SvMetaType() override;
67 virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) override;
69 SvRefMemberList<SvMetaAttribute *>&
70 GetAttrList() { return aAttrList; }
71 size_t GetAttrCount() const { return aAttrList.size(); }
73 void SetType( MetaTypeType nT );
74 MetaTypeType GetMetaTypeType() const { return nType; }
75 SvMetaType * GetBaseType() const;
76 SvMetaType * GetReturnType() const;
77 void SetItem(bool b) { bIsItem = b; }
78 bool IsItem() const { return bIsItem; }
80 virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) override;
82 size_t MakeSfx( OStringBuffer& rAtrrArray );
83 virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm );
84 bool ReadMethodArgs( SvIdlDataBase & rBase,
85 SvTokenStream & rInStm );
88 class SvMetaTypeString final : public SvMetaType
90 public:
91 SvMetaTypeString();
94 class SvMetaEnumValue final : public SvMetaObject
96 public:
97 SvMetaEnumValue();
100 class SvMetaTypeEnum final : public SvMetaType
102 public:
103 SvRefMemberList<SvMetaEnumValue *> aEnumValueList;
104 OString aPrefix;
105 SvMetaTypeEnum();
108 class SvMetaTypevoid final : public SvMetaType
110 public:
111 SvMetaTypevoid();
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */