Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F4824314
typehints.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Aug 25, 3:28 AM
Size
1 KB
Mime Type
text/x-c++
Expires
Thu, Aug 27, 3:28 AM (1 d, 5 h)
Engine
blob
Format
Raw Data
Handle
286955
Attached To
rXR Xreate
typehints.cpp
View Options
//
// Created by pgess on 24/03/2020.
//
#include "analysis/typehints.h"
#include "analysis/predefinedanns.h"
#include "analysis/utils.h"
namespace xreate{namespace typehints{
namespace impl {
template<class Hint>
inline Hint getHint(const Expression& e, const Hint& def, unsigned annId, const ExpandedType& hintT){
std::list<Expression> hintsL;
auto predefined = analysis::PredefinedAnns::instance();
for(const auto& tag: e.tags){hintsL.push_back(tag.second);}
const Expression& hintActual = analysis::findAnnById(annId, hintT, hintsL);
if (!hintActual.isValid()){
return def;
}
return parse<Hint>(hintActual);
}
}
template<> IntBits parse(const Expression& e){
return {(unsigned) e.operands.at(0).getValueDouble()};
}
template<> Array parse(const Expression& e){
return {(unsigned) e.operands.at(0).getValueDouble()};
}
template<>
IntBits getHint(const Expression& e, const IntBits& def){
auto predefined = analysis::PredefinedAnns::instance();
return impl::getHint<IntBits>(e, def,
(unsigned) analysis::PredefinedAnns::IntHints::SIZE,
ExpandedType(predefined.hintsIntT)
);
}
template<>
Array getHint(const Expression& e, const Array& def){
auto predefined = analysis::PredefinedAnns::instance();
return impl::getHint<Array>(e, def,
(unsigned) analysis::PredefinedAnns::ContHints::ARRAY,
ExpandedType(predefined.hintsContT)
);
}
}}
Event Timeline
Log In to Comment