feat: add candidate FreeCAD naming SDK and attachment oracles
Build and verify the candidate-only FreeCAD naming bridge and OCCT worker path, including three-stage StringHasher restoration. Add Datum, ShapeBinder, attachment-mode, and PartDesign structure oracles plus offline SDK build plans and CI boundary checks.
This commit is contained in:
41
native/freecad-naming-probe/shims/App/Application.h
Normal file
41
native/freecad-naming-probe/shims/App/Application.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef SRC_APP_APPLICATION_H_
|
||||
#define SRC_APP_APPLICATION_H_
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
namespace App {
|
||||
|
||||
class Document;
|
||||
|
||||
class ProbeSignal
|
||||
{
|
||||
public:
|
||||
template<typename Callback>
|
||||
void connect(Callback&&)
|
||||
{}
|
||||
};
|
||||
|
||||
class Application
|
||||
{
|
||||
public:
|
||||
Document* getActiveDocument() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ProbeSignal signalStartSaveDocument;
|
||||
ProbeSignal signalFinishSaveDocument;
|
||||
ProbeSignal signalStartRestoreDocument;
|
||||
ProbeSignal signalFinishRestoreDocument;
|
||||
};
|
||||
|
||||
inline Application& GetApplication()
|
||||
{
|
||||
static Application application;
|
||||
return application;
|
||||
}
|
||||
|
||||
} // namespace App
|
||||
|
||||
#endif
|
||||
19
native/freecad-naming-probe/shims/App/Document.h
Normal file
19
native/freecad-naming-probe/shims/App/Document.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef SRC_APP_DOCUMENT_H_
|
||||
#define SRC_APP_DOCUMENT_H_
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
|
||||
namespace App {
|
||||
|
||||
class Document
|
||||
{
|
||||
public:
|
||||
DocumentObject* getObjectByID(long) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace App
|
||||
|
||||
#endif
|
||||
31
native/freecad-naming-probe/shims/App/DocumentObject.h
Normal file
31
native/freecad-naming-probe/shims/App/DocumentObject.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef SRC_APP_DOCUMENTOBJECT_H_
|
||||
#define SRC_APP_DOCUMENTOBJECT_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace App {
|
||||
|
||||
class DocumentObject
|
||||
{
|
||||
public:
|
||||
explicit DocumentObject(long id = 0)
|
||||
: objectId(id)
|
||||
{}
|
||||
|
||||
long getID() const
|
||||
{
|
||||
return objectId;
|
||||
}
|
||||
|
||||
std::string getFullName() const
|
||||
{
|
||||
return "ProbeObject";
|
||||
}
|
||||
|
||||
private:
|
||||
long objectId;
|
||||
};
|
||||
|
||||
} // namespace App
|
||||
|
||||
#endif
|
||||
@@ -1,27 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define APP_STRING_ID_H
|
||||
|
||||
#include <QByteArray>
|
||||
|
||||
namespace App
|
||||
{
|
||||
class StringIDRef
|
||||
{
|
||||
public:
|
||||
void toBytes(QByteArray& bytes) const
|
||||
{
|
||||
bytes.clear();
|
||||
}
|
||||
|
||||
bool operator<(const StringIDRef&) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator==(const StringIDRef&) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
} // namespace App
|
||||
@@ -1,3 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <Base/Exception.h>
|
||||
|
||||
struct FreeCadNamingProbeLogInstance
|
||||
{
|
||||
bool isEnabled(int) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
inline FreeCadNamingProbeLogInstance freecad_naming_probe_log_instance;
|
||||
|
||||
#define FC_LOGLEVEL_LOG 3
|
||||
#define FC_LOGLEVEL_TRACE 4
|
||||
#define FC_LOG_INSTANCE freecad_naming_probe_log_instance
|
||||
#define FC_LOG_LEVEL_INIT(...)
|
||||
#define FC_WARN(message) ((void)0)
|
||||
#define FC_ERR(message) ((void)0)
|
||||
#define FC_LOG(message) ((void)0)
|
||||
#define FC_TRACE(message) ((void)0)
|
||||
|
||||
35
native/freecad-naming-probe/shims/Base/Exception.h
Normal file
35
native/freecad-naming-probe/shims/Base/Exception.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Base {
|
||||
|
||||
class Exception : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
using std::runtime_error::runtime_error;
|
||||
|
||||
void reportException() const {}
|
||||
};
|
||||
|
||||
class RuntimeError : public Exception
|
||||
{
|
||||
public:
|
||||
using Exception::Exception;
|
||||
};
|
||||
|
||||
class ValueError : public Exception
|
||||
{
|
||||
public:
|
||||
using Exception::Exception;
|
||||
};
|
||||
|
||||
} // namespace Base
|
||||
|
||||
#define FC_THROWM(type, message) \
|
||||
do { \
|
||||
std::ostringstream freecad_naming_probe_exception_stream; \
|
||||
freecad_naming_probe_exception_stream << message; \
|
||||
throw type(freecad_naming_probe_exception_stream.str()); \
|
||||
} while (false)
|
||||
38
native/freecad-naming-probe/shims/Base/Persistence.h
Normal file
38
native/freecad-naming-probe/shims/Base/Persistence.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
namespace Base {
|
||||
|
||||
class Reader;
|
||||
class Writer;
|
||||
class XMLReader;
|
||||
|
||||
class BaseClass
|
||||
{
|
||||
public:
|
||||
virtual ~BaseClass() = default;
|
||||
virtual PyObject* getPyObject()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
class Persistence : public BaseClass
|
||||
{
|
||||
public:
|
||||
~Persistence() override = default;
|
||||
|
||||
virtual unsigned int getMemSize() const = 0;
|
||||
virtual void Save(Writer&) const = 0;
|
||||
virtual void Restore(XMLReader&) = 0;
|
||||
virtual void SaveDocFile(Writer&) const = 0;
|
||||
virtual void RestoreDocFile(Reader&) = 0;
|
||||
};
|
||||
|
||||
} // namespace Base
|
||||
|
||||
#define TYPESYSTEM_HEADER()
|
||||
#define TYPESYSTEM_HEADER_WITH_OVERRIDE()
|
||||
#define TYPESYSTEM_SOURCE(...)
|
||||
#define TYPESYSTEM_SOURCE_ABSTRACT(...)
|
||||
3
native/freecad-naming-probe/shims/Base/PyObjectBase.h
Normal file
3
native/freecad-naming-probe/shims/Base/PyObjectBase.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include <CXX/Objects.hxx>
|
||||
45
native/freecad-naming-probe/shims/Base/Reader.h
Normal file
45
native/freecad-naming-probe/shims/Base/Reader.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <istream>
|
||||
#include <sstream>
|
||||
|
||||
namespace Base {
|
||||
|
||||
class Reader : public std::istream
|
||||
{
|
||||
public:
|
||||
Reader()
|
||||
: std::istream(nullptr)
|
||||
{}
|
||||
};
|
||||
|
||||
class XMLReader
|
||||
{
|
||||
public:
|
||||
template<typename T>
|
||||
T getAttribute(const char*) const
|
||||
{
|
||||
return T {};
|
||||
}
|
||||
|
||||
bool hasAttribute(const char*) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void readElement(const char*) {}
|
||||
void readEndElement(const char*) {}
|
||||
void addFile(const char*, void*) {}
|
||||
|
||||
std::istream& beginCharStream()
|
||||
{
|
||||
return stream;
|
||||
}
|
||||
|
||||
int FileVersion = 1;
|
||||
|
||||
private:
|
||||
std::istringstream stream;
|
||||
};
|
||||
|
||||
} // namespace Base
|
||||
43
native/freecad-naming-probe/shims/Base/Stream.h
Normal file
43
native/freecad-naming-probe/shims/Base/Stream.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
namespace Base {
|
||||
|
||||
class TextOutputStream
|
||||
{
|
||||
public:
|
||||
explicit TextOutputStream(std::ostream& stream)
|
||||
: output(stream)
|
||||
{}
|
||||
|
||||
TextOutputStream& operator<<(const char* value)
|
||||
{
|
||||
output << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
std::ostream& output;
|
||||
};
|
||||
|
||||
class TextInputStream
|
||||
{
|
||||
public:
|
||||
explicit TextInputStream(std::istream& stream)
|
||||
: input(stream)
|
||||
{}
|
||||
|
||||
TextInputStream& operator>>(std::string& value)
|
||||
{
|
||||
input >> value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
std::istream& input;
|
||||
};
|
||||
|
||||
} // namespace Base
|
||||
40
native/freecad-naming-probe/shims/Base/Writer.h
Normal file
40
native/freecad-naming-probe/shims/Base/Writer.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
|
||||
namespace Base {
|
||||
|
||||
class Writer
|
||||
{
|
||||
public:
|
||||
std::ostream& Stream()
|
||||
{
|
||||
return stream;
|
||||
}
|
||||
|
||||
const char* ind() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* addFile(const char* name, const void*)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
std::ostream& beginCharStream()
|
||||
{
|
||||
return stream;
|
||||
}
|
||||
|
||||
std::ostream& endCharStream()
|
||||
{
|
||||
return stream;
|
||||
}
|
||||
|
||||
private:
|
||||
std::ostringstream stream;
|
||||
};
|
||||
|
||||
} // namespace Base
|
||||
9
native/freecad-naming-probe/shims/CXX/Objects.hxx
Normal file
9
native/freecad-naming-probe/shims/CXX/Objects.hxx
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
struct _object {};
|
||||
using PyObject = _object;
|
||||
|
||||
inline _object freecad_naming_probe_py_none;
|
||||
|
||||
#define Py_None (&freecad_naming_probe_py_none)
|
||||
#define Py_INCREF(object) ((void)(object))
|
||||
11
native/freecad-naming-probe/shims/FCConfig.h
Normal file
11
native/freecad-naming-probe/shims/FCConfig.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
#ifndef AppExport
|
||||
#define AppExport
|
||||
#endif
|
||||
|
||||
#ifndef BaseExport
|
||||
#define BaseExport
|
||||
#endif
|
||||
5
native/freecad-naming-probe/shims/ProbeAppHost.h
Normal file
5
native/freecad-naming-probe/shims/ProbeAppHost.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Application.h>
|
||||
15
native/freecad-naming-probe/shims/StringHasherPy.h
Normal file
15
native/freecad-naming-probe/shims/StringHasherPy.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
namespace App {
|
||||
|
||||
class StringHasher;
|
||||
|
||||
class StringHasherPy : public _object
|
||||
{
|
||||
public:
|
||||
explicit StringHasherPy(StringHasher*) {}
|
||||
};
|
||||
|
||||
} // namespace App
|
||||
17
native/freecad-naming-probe/shims/StringIDPy.h
Normal file
17
native/freecad-naming-probe/shims/StringIDPy.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
namespace App {
|
||||
|
||||
class StringID;
|
||||
|
||||
class StringIDPy : public _object
|
||||
{
|
||||
public:
|
||||
explicit StringIDPy(StringID*) {}
|
||||
|
||||
int _index = 0;
|
||||
};
|
||||
|
||||
} // namespace App
|
||||
Reference in New Issue
Block a user