Sketcher: App - Clang-format

This commit is contained in:
Abdullah Tahiri
2023-05-18 19:01:34 +02:00
committed by abdullahtahiriyo
parent c33cdcd68a
commit 987b4bda2a
40 changed files with 9714 additions and 7322 deletions

View File

@@ -37,75 +37,103 @@ class ISketchExternalGeometryExtension
{
public:
// Identification information
// START_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) <realthunder.dev@gmail.com>
// START_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder)
// <realthunder.dev@gmail.com>
virtual bool testFlag(int flag) const = 0;
virtual void setFlag(int flag, bool v=true) = 0;
// END_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) <realthunder.dev@gmail.com>
virtual void setFlag(int flag, bool v = true) = 0;
// END_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder)
// <realthunder.dev@gmail.com>
virtual bool isClear() const = 0;
virtual size_t flagSize() const = 0;
virtual const std::string& getRef() const = 0;
virtual void setRef(const std::string & ref) = 0;
virtual void setRef(const std::string& ref) = 0;
};
class SketcherExport ExternalGeometryExtension : public Part::GeometryPersistenceExtension, private ISketchExternalGeometryExtension
class SketcherExport ExternalGeometryExtension: public Part::GeometryPersistenceExtension,
private ISketchExternalGeometryExtension
{
TYPESYSTEM_HEADER_WITH_OVERRIDE();
public:
// START_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) <realthunder.dev@gmail.com>
enum Flag {
Defining = 0, // allow an external geometry to build shape
Frozen = 1, // freeze an external geometry
Detached = 2, // signal the intentions of detaching the geometry from external reference
Missing = 3, // geometry with missing external reference
Sync = 4, // signal the intention to synchronize a frozen geometry
NumFlags // Must be the last type
// START_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder)
// <realthunder.dev@gmail.com>
enum Flag
{
Defining = 0,// allow an external geometry to build shape
Frozen = 1, // freeze an external geometry
Detached = 2,// signal the intentions of detaching the geometry from external reference
Missing = 3, // geometry with missing external reference
Sync = 4, // signal the intention to synchronize a frozen geometry
NumFlags // Must be the last type
};
// END_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) <realthunder.dev@gmail.com>
// END_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder)
// <realthunder.dev@gmail.com>
constexpr static std::array<const char*, NumFlags> flag2str {
{"Defining", "Frozen", "Detached", "Missing", "Sync"}};
constexpr static std::array<const char *,NumFlags> flag2str {{ "Defining", "Frozen", "Detached","Missing", "Sync" }};
public:
ExternalGeometryExtension() = default;
~ExternalGeometryExtension() override = default;
std::unique_ptr<Part::GeometryExtension> copy() const override;
PyObject *getPyObject() override;
PyObject* getPyObject() override;
// START_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) <realthunder.dev@gmail.com>
bool testFlag(int flag) const override { return Flags.test((size_t)(flag)); }
void setFlag(int flag, bool v=true) override { Flags.set((size_t)(flag),v); }
// END_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) <realthunder.dev@gmail.com>
// START_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder)
// <realthunder.dev@gmail.com>
bool testFlag(int flag) const override
{
return Flags.test((size_t)(flag));
}
void setFlag(int flag, bool v = true) override
{
Flags.set((size_t)(flag), v);
}
// END_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder)
// <realthunder.dev@gmail.com>
bool isClear() const override {return Flags.none();}
size_t flagSize() const override {return Flags.size();}
bool isClear() const override
{
return Flags.none();
}
size_t flagSize() const override
{
return Flags.size();
}
const std::string& getRef() const override {return Ref;}
void setRef(const std::string & ref) override {Ref = ref;}
const std::string& getRef() const override
{
return Ref;
}
void setRef(const std::string& ref) override
{
Ref = ref;
}
static bool getFlagsFromName(std::string str, ExternalGeometryExtension::Flag &flag);
static bool getFlagsFromName(std::string str, ExternalGeometryExtension::Flag& flag);
protected:
void copyAttributes(Part::GeometryExtension * cpy) const override;
void restoreAttributes(Base::XMLReader &reader) override;
void saveAttributes(Base::Writer &writer) const override;
void copyAttributes(Part::GeometryExtension* cpy) const override;
void restoreAttributes(Base::XMLReader& reader) override;
void saveAttributes(Base::Writer& writer) const override;
private:
ExternalGeometryExtension(const ExternalGeometryExtension&) = default;
private:
using FlagType = std::bitset<32>;
// START_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) <realthunder.dev@gmail.com>
// START_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder)
// <realthunder.dev@gmail.com>
std::string Ref;
FlagType Flags;
// END_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder) <realthunder.dev@gmail.com>
// END_CREDIT_BLOCK: Credit under LGPL for this block to Zheng, Lei (realthunder)
// <realthunder.dev@gmail.com>
};
} //namespace Sketcher
}// namespace Sketcher
#endif // SKETCHER_EXTERNALGEOMETRYEXTENSION_H
#endif// SKETCHER_EXTERNALGEOMETRYEXTENSION_H