Files
Web_FreeCAD_Bitbybit/native/freecad-naming-probe/probe.cpp
wangdequan 58c0807219
Some checks failed
real-verification / chrome (push) Has been cancelled
real-verification / freecad-oracle (push) Has been cancelled
real-verification / wasm (push) Has been cancelled
feat: add offline Qt6 naming prerequisites and boundary gates
2026-08-12 08:17:44 -04:00

35 lines
958 B
C++

#include <emscripten/bind.h>
#include <App/IndexedName.h>
#include <App/MappedName.h>
#include <stdexcept>
#include <string>
namespace
{
std::string freecadPrivateNamingSourceProbe()
{
const Data::IndexedName indexed("Edge12");
if (!indexed || indexed.getIndex() != 12 || std::string(indexed.getType()) != "Edge") {
throw std::runtime_error("FreeCAD IndexedName source probe failed");
}
Data::MappedName name(indexed);
name += ";:M;CUT;:H2a:7,E";
long tag = 0;
int length = 0;
char type = 0;
const int position = name.findTagInElementName(&tag, &length, nullptr, &type);
if (position < 0 || tag != 0x2a || type != 'E') {
throw std::runtime_error("FreeCAD MappedName source probe failed");
}
return name.toString();
}
} // namespace
EMSCRIPTEN_BINDINGS(freecad_private_naming_source_probe)
{
emscripten::function("freecadPrivateNamingSourceProbe", &freecadPrivateNamingSourceProbe);
}