inline TargetType operator()(const SourceType& source) const { const auto center = source.getCenter(); const auto radius = source.getRadius(); static const auto extend = typename VectorSpaceType::VectorType(GeneratorType(ScalarFieldType::multiplicativeNeutral()), std::make_index_sequence<VectorSpaceType::VectorType::dimensionality()>{}) * radius; return TargetType(center - extend, center + extend); }
inline TargetType raise_rounding_error( const char* function, const char* message, const T& val, const TargetType&, const ::boost::math::policies::rounding_error< ::boost::math::policies::throw_on_error>&) { raise_error<boost::math::rounding_error, T>(function, message, val); // we never get here: return TargetType(0); }
Object::Object(DataBase *b, int i, select_type t, double v, const string& e, int si, const FloatVector *vv, map<string,aspect_data> *ar) : Valued(v) { genuine_relevance = true; below_value = 0; above_value = 0; sibling_value = 0; not_really_seen = false; rank = round = -1; if (!b) { ShowError("Object::Object() : b==NULL"); return; } if (i<0) { // Query::SelectAroundMapPoint() may do it... oi = b->DummyObject(); if (t!=select_map) ShowError("Object::Object() : i<0 && t!=select_map"); } else { oi = b->FindObject(i); if (!oi) { ShowError("Object::Object() : object #", ToStr(i), " not found"); oi = b->DummyObject(); } } sel_type = t; extra_str = e; HandleStageInfo(si, vv); if (ar) aspect_relevance.Aspects(*ar); else { const DataBase *d = GetDataBase(); if (d) { bool segm_is_mod = d->SegmentIsModifier(); target_type tt = PicSOM::TargetTypeMasked(TargetType(), segm_is_mod); d->DefaultAspects(tt).copyTo(aspect_relevance); } } // cout << DumpStr() << endl; }
void ProjectOptionsDlg::DoBeforeTargetChange(bool force) { wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox); // if no previously selected target, exit if (m_Current_Sel == -1) return; if (force || lstTargets->GetSelection() != m_Current_Sel) { // selected another build target // save changes to the previously selected target wxArrayString array; ProjectBuildTarget* target = m_Project->GetBuildTarget(m_Current_Sel); if (!target) return; target->SetTargetType(TargetType(XRCCTRL(*this, "cmbProjectType", wxComboBox)->GetSelection())); wxFileName fname(XRCCTRL(*this, "txtOutputFilename", wxTextCtrl)->GetValue()); // fname.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, m_Project->GetBasePath()); // fname.MakeRelativeTo(m_Project->GetBasePath()); target->SetOutputFilename(fname.GetFullPath()); fname.Assign(XRCCTRL(*this, "txtObjectDir", wxTextCtrl)->GetValue()); // fname.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, m_Project->GetBasePath()); // fname.MakeRelativeTo(m_Project->GetBasePath()); target->SetObjectOutput(fname.GetFullPath()); target->SetCreateHex(XRCCTRL(*this, "chkCreateHex", wxCheckBox)->GetValue()); // files options wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox); int count = list->GetCount(); for (int i = 0; i < count; ++i) { ProjectFile* pf = m_Project->GetFile(i); if (!pf) break; if (list->IsChecked(i)) pf->AddBuildTarget(target->GetTitle()); else pf->RemoveBuildTarget(target->GetTitle()); } } }
void ReflectiveReader::Read(ContentReader*) { printf("\n"); printf("This C++ XNB loader implementation does not support ReflectiveReader.\n"); printf("(think about it: it's not really possible to implement this without .NET style reflection)\n"); printf("\n"); printf("To load this file, you must manually implement a TypeReader subclass, fill in its Read method\n"); printf("to load the contents of your custom object, and call TypeReaderManager::RegisterTypeReader\n"); printf("to register this new custom loader.\n"); printf("\n"); printf("Your custom TypeReader should specify:\n"); printf(" TargetType = '%S'\n", TargetType().c_str()); printf(" ReaderName = '%S'\n", ReaderName().c_str()); printf("\n"); throw exception("Cannot parse XNB files that use automatic serialization."); }
void ProjectOptionsDlg::EndModal(int retCode) { if (retCode == wxID_OK) { m_Project->SetTitle(XRCCTRL(*this, "txtProjectName", wxTextCtrl)->GetValue()); m_Project->RenameInTree(m_Project->GetTitle()); m_Project->SetMakefile(XRCCTRL(*this, "txtProjectMakefile", wxTextCtrl)->GetValue()); m_Project->SetMakefileCustom(XRCCTRL(*this, "chkCustomMakefile", wxCheckBox)->GetValue()); m_Project->SetMakeTool(XRCCTRL(*this, "txtMakeTool", wxTextCtrl)->GetValue()); m_Project->SetMakefileExecutionDir(XRCCTRL(*this, "txtExecutionDir", wxTextCtrl)->GetValue()); m_Project->SetTargetType(TargetType(XRCCTRL(*this, "cmbProjectType", wxComboBox)->GetSelection())); m_Project->SetModeForPCH((PCHMode)XRCCTRL(*this, "rbPCHStrategy", wxRadioBox)->GetSelection()); m_Project->SetExtendedObjectNamesGeneration(XRCCTRL(*this, "chkExtendedObjNames", wxCheckBox)->GetValue()); m_Project->SetForceLowerCaseObject(XRCCTRL(*this, "chkNoForceObjectLowCase", wxCheckBox)->GetValue()); m_Project->SetShowNotesOnLoad(XRCCTRL(*this, "chkShowNotes", wxCheckBox)->GetValue()); m_Project->SetNotes(XRCCTRL(*this, "txtNotes", wxTextCtrl)->GetValue()); if (m_Current_Sel == -1) m_Current_Sel = 0; // force update of global options DoBeforeTargetChange(true); // finally, apply settings in all plugins' panels for (size_t i = 0; i < m_PluginPanels.GetCount(); ++i) { cbConfigurationPanel* panel = m_PluginPanels[i]; panel->OnApply(); } } else { // finally, cancel settings in all plugins' panels for (size_t i = 0; i < m_PluginPanels.GetCount(); ++i) { cbConfigurationPanel* panel = m_PluginPanels[i]; panel->OnCancel(); } } wxScrollingDialog::EndModal(retCode); }
string Object::DumpString(int i, int ll, int li, int lx, int lr, int lo, const string& fmt, const string& e) const { char tmp[1000] = ""; if (i>=0) sprintf(tmp, "%*d ", li, i); sprintf(tmp+strlen(tmp), "%s %-*s %*d @%*d/%*d %c %10.6f %d %s", GetDataBase()->Name().c_str(), ll, LabelP(), lx, Index(), lr, Rank(), lo, Round(), SelectTypeChar(sel_type)[0], value, //genuine_relevance, retained, extra_str.c_str()); stringstream ss; ss << tmp; for (int s=0; s<stagevalues.Nitems(); s++) ss << " ST#" << s+1 << ": " << StageInfoText(s, fmt, e); ss << " " << TargetTypeString(TargetType()); ss << " aspects=[" << AspectNamesValues() << "]"; return ss.str(); }
void Project::Link(void) { BString linkString; if (TargetType() == TARGET_STATIC_LIB) { linkString = "ar rcs '"; linkString << GetPath().GetFolder() << "/" << GetTargetName() << "' "; for (int32 i = 0; i < CountGroups(); i++) { SourceGroup *group = GroupAt(i); for (int32 j = 0; j < group->filelist.CountItems(); j++) { SourceFile *file = group->filelist.ItemAt(j); if (file->GetObjectPath(fBuildInfo).GetFullPath()) linkString << "'" << file->GetObjectPath(fBuildInfo).GetFullPath() << "' "; } } } else { linkString = "gcc -o '"; linkString << GetPath().GetFolder() << "/" << GetTargetName() << "' "; for (int32 i = 0; i < CountGroups(); i++) { SourceGroup *group = GroupAt(i); for (int32 j = 0; j < group->filelist.CountItems(); j++) { SourceFile *file = group->filelist.ItemAt(j); if (file->GetObjectPath(fBuildInfo).GetFullPath()) linkString << "'" << file->GetObjectPath(fBuildInfo).GetFullPath() << "' "; } } for (int32 i = 0; i < CountGroups(); i++) { SourceGroup *group = GroupAt(i); for (int32 j = 0; j < group->filelist.CountItems(); j++) { SourceFile *file = group->filelist.ItemAt(j); if (file->GetLibraryPath(fBuildInfo).GetFullPath()) linkString << "'" << file->GetLibraryPath(fBuildInfo).GetFullPath() << "' "; } } for (int32 i = 0; i < CountLibraries(); i++) { SourceFile *file = LibraryAt(i); if (!file) continue; BString filenamebase; filenamebase = file->GetPath().GetBaseName(); if (filenamebase.FindFirst("lib") == 0) filenamebase.RemoveFirst("lib"); linkString << "-l" << filenamebase << " "; } if (TargetType() == TARGET_DRIVER) linkString << "/boot/develop/lib/x86/_KERNEL_ "; linkString << "-L/boot/home/config/lib "; switch (TargetType()) { case TARGET_DRIVER: { linkString << "-Xlinker -nostdlib "; break; } case TARGET_SHARED_LIB: { linkString << "-nostart -Xlinker -soname=" << GetTargetName() << " "; break; } default: { // Application linkString << "-Xlinker -soname=_APP_ "; break; } } } linkString << " 2>&1"; BString errmsg; PipeCommand(linkString.String(),errmsg); STRACE(1,("Linking %s:\n%s\nErrors:\n%s\n",GetName(),linkString.String(),errmsg.String())); if (errmsg.CountChars() > 0) ParseLDErrors(errmsg.String(),fBuildInfo.errorList); }
static void SerializeType(const void *in, void *out, Reflector &reflector) { reflector.Check(reflector.Serializing() ? reflector.GetSerializer().Serialize(TargetType(*translucent_cast<const T *>(in))) : reflector.GetDeserializer().Deserialize(Target(*translucent_cast<T *>(out)))); }
inline void doXercesTranscode( const SourceType* theSourceString, XalanDOMString::size_type theSourceStringLength, bool theSourceStringIsNullTerminated, XalanVector<TargetType>& theTargetVector, bool terminate, char theSubstitutionChar) { assert( theSourceStringIsNullTerminated == false || theSourceStringLength == XalanDOMString::length(theSourceString)); const SourceType* theRealSourceString = theSourceString; XalanVector<SourceType> theCopiedSource(theTargetVector.getMemoryManager()); if (theSourceStringIsNullTerminated == false) { theCopiedSource.reserve(theSourceStringLength + 1); theCopiedSource.assign( theSourceString, theSourceString + theSourceStringLength); theCopiedSource.push_back(static_cast<SourceType>(0)); theRealSourceString = &*theCopiedSource.begin(); } // Initially, let's guess the the transcoded string will be the same // length as the source string. theTargetVector.resize(theSourceStringLength + 1); assert(theRealSourceString != 0); bool fSuccess = false; XALAN_USING_XERCES(XMLString) fSuccess = XMLString::transcode( theRealSourceString, &*theTargetVector.begin(), theTargetVector.size() - 1, &theTargetVector.getMemoryManager()); if (fSuccess == false) { // Do the "manual" transcoding. But first, clean up from the // previous phase theTargetVector.clear(); // See if there are any unrepresentable characters for the // local code page. SourceType oneCharArray[2]; oneCharArray[1] = SourceType(0); TargetType theOneTranslatedWbChar[theOneTranslatedWbCharLen]; for (XalanDOMString::size_type i = 0; i < theSourceStringLength; ++i) { oneCharArray[0] = theRealSourceString[i]; theOneTranslatedWbChar[0] = TargetType(0); fSuccess = XMLString::transcode( oneCharArray, theOneTranslatedWbChar, theOneTranslatedWbCharLen - 1, &theTargetVector.getMemoryManager()); if (fSuccess == false) { theTargetVector.push_back(theSubstitutionChar); } else { XalanDOMString::size_type theRealCharLength = XalanDOMString::length(theOneTranslatedWbChar); // When we transcode the character '\0', that looks like "\0\0", // XalanDOMString::length returns a size of 0. In this case, the // real size should be 1 if (theRealCharLength == 0) { theRealCharLength = 1; } // append the translated set of characters theTargetVector.insert( theTargetVector.end(), theOneTranslatedWbChar, theOneTranslatedWbChar + theRealCharLength); } } } while(theTargetVector.back() == static_cast<TargetType>(0)) { theTargetVector.pop_back(); } if (terminate == true) { theTargetVector.push_back(static_cast<TargetType>(0)); } }