本文整理汇总了C++中Manifest::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Manifest::end方法的具体用法?C++ Manifest::end怎么用?C++ Manifest::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manifest
的用法示例。
在下文中一共展示了Manifest::end方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testManifest
void ManifestTest::testManifest()
{
Manifest<MfTestBase> manifest;
assert (manifest.empty());
assert (manifest.size() == 0);
assert (manifest.insert(new MetaObject<MfTestObject, MfTestBase>("MfTestObject1")));
assert (!manifest.empty());
assert (manifest.size() == 1);
assert (manifest.insert(new MetaObject<MfTestObject, MfTestBase>("MfTestObject2")));
MetaObject<MfTestObject, MfTestBase>* pMeta = new MetaObject<MfTestObject, MfTestBase>("MfTestObject2");
assert (!manifest.insert(pMeta));
delete pMeta;
assert (!manifest.empty());
assert (manifest.size() == 2);
assert (manifest.insert(new MetaObject<MfTestObject, MfTestBase>("MfTestObject3")));
assert (manifest.size() == 3);
assert (manifest.find("MfTestObject1") != manifest.end());
assert (manifest.find("MfTestObject2") != manifest.end());
assert (manifest.find("MfTestObject3") != manifest.end());
assert (manifest.find("MfTestObject4") == manifest.end());
std::set<std::string> classes;
Manifest<MfTestBase>::Iterator it = manifest.begin();
assert (it != manifest.end());
classes.insert(it->name());
++it;
assert (it != manifest.end());
classes.insert(it->name());
++it;
assert (it != manifest.end());
classes.insert(it->name());
it++;
assert (it == manifest.end());
assert (classes.find("MfTestObject1") != classes.end());
assert (classes.find("MfTestObject2") != classes.end());
assert (classes.find("MfTestObject3") != classes.end());
manifest.clear();
assert (manifest.empty());
assert (manifest.size() == 0);
assert (manifest.insert(new MetaObject<MfTestObject, MfTestBase>("MfTestObject4")));
assert (!manifest.empty());
assert (manifest.size() == 1);
it = manifest.begin();
assert (it != manifest.end());
assert (std::string(it->name()) == "MfTestObject4");
++it;
assert (it == manifest.end());
}
示例2:
void
write_manifest(ostream& os)
{
os << "@prefix lv2: <http://lv2plug.in/ns/lv2core#> ." << endl;
os << "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> ." << endl;
os << "@prefix uiext: <http://lv2plug.in/ns/extensions/ui#> ." << endl << endl;
for (Manifest::iterator i = manifest.begin(); i != manifest.end(); ++i) {
Record& r = i->second;
os << "<" << i->first << ">\n\ta lv2:Plugin ;" << endl;
os << "\trdfs:seeAlso <" << r.base_name << ".ttl> ;" << endl;
os << "\tlv2:binary <" << r.base_name << ".so> ";
for (Record::UIs::iterator j = r.uis.begin(); j != r.uis.end(); ++j)
os << ";" << endl << "\tuiext:ui <" << *j << "> ";
os << "." << endl << endl;
}
}
示例3: os
void
write_plugin(AudioEffectX* effect, const string& lib_file_name)
{
const string base_name = lib_file_name.substr(0, lib_file_name.find_last_of("."));
const string data_file_name = base_name + ".ttl";
fstream os(data_file_name.c_str(), ios::out);
effect->getProductString(name_buf);
os << "@prefix lv2: <http://lv2plug.in/ns/lv2core#> ." << endl;
os << "@prefix doap: <http://usefulinc.com/ns/doap#> ." << endl << endl;
os << "<" << effect->getURI() << ">" << endl;
os << "\tlv2:symbol \"" << effect->getUniqueID() << "\" ;" << endl;
os << "\tdoap:name \"" << name_buf << "\" ;" << endl;
os << "\tdoap:license <http://usefulinc.com/doap/licenses/gpl> ;" << endl;
os << "\tlv2:pluginProperty lv2:hardRTCapable";
uint32_t num_params = effect->getNumParameters();
uint32_t num_audio_ins = effect->getNumInputs();
uint32_t num_audio_outs = effect->getNumOutputs();
uint32_t num_ports = num_params + num_audio_ins + num_audio_outs;
if (num_ports > 0)
os << " ;" << endl << "\tlv2:port [" << endl;
else
os << " ." << endl;
uint32_t idx = 0;
for (uint32_t i = idx; i < num_params; ++i, ++idx) {
effect->getParameterName(i, name_buf);
os << "\t\ta lv2:InputPort, lv2:ControlPort ;" << endl;
os << "\t\tlv2:index" << " " << idx << " ;" << endl;
os << "\t\tlv2:name \"" << name_buf << "\" ;" << endl;
os << "\t\tlv2:symbol \"" << symbolify(name_buf) << "\" ;" << endl;
os << "\t\tlv2:default " << lvz_translate_parameter(effect, i, effect->getParameter(i)) << " ;" << endl;
os << "\t\tlv2:minimum " << lvz_translate_parameter(effect, i, 0.0f) << " ;" << endl;
os << "\t\tlv2:maximum " << lvz_translate_parameter(effect, i, 1.0f) << " ;" << endl;
os << ((idx == num_ports - 1) ? "\t] ." : "\t] , [") << endl;
}
for (uint32_t i = 0; i < num_audio_ins; ++i, ++idx) {
os << "\t\ta lv2:InputPort, lv2:AudioPort ;" << endl;
os << "\t\tlv2:index" << " " << idx << " ;" << endl;
os << "\t\tlv2:symbol \"in" << i+1 << "\" ;" << endl;
os << "\t\tlv2:name \"Input " << i+1 << "\" ;" << endl;
os << ((idx == num_ports - 1) ? "\t] ." : "\t] , [") << endl;
}
for (uint32_t i = 0; i < num_audio_outs; ++i, ++idx) {
os << "\t\ta lv2:OutputPort, lv2:AudioPort ;" << endl;
os << "\t\tlv2:index " << idx << " ;" << endl;
os << "\t\tlv2:symbol \"out" << i+1 << "\" ;" << endl;
os << "\t\tlv2:name \"Output " << i+1 << "\" ;" << endl;
os << ((idx == num_ports - 1) ? "\t] ." : "\t] , [") << endl;
}
os.close();
Manifest::iterator i = manifest.find(effect->getURI());
if (i != manifest.end()) {
i->second.base_name = base_name;
} else {
manifest.insert(std::make_pair(effect->getURI(), Record(base_name)));
}
if (effect->getNumPrograms() > 1) {
std::string preset_file = base_name + "-presets.ttl";
fstream pos(preset_file.c_str(), ios::out);
pos << "@prefix lv2: <http://lv2plug.in/ns/lv2core#> ." << endl;
pos << "@prefix pset: <http://lv2plug.in/ns/ext/presets#> ." << endl;
pos << "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> ." << endl << endl;
for (int32_t i = 0; i < effect->getNumPrograms(); ++i) {
effect->setProgram(i);
effect->getProgramName(name_buf);
if (!strcmp(name_buf, "Empty Patch"))
continue;
std::string preset_uri = string("http://moddevices.com/plugins/mda/presets#") + base_name + "-" + symbolify(name_buf, '-');
// Write manifest entry
std::cout << "<" << preset_uri << ">"
<< "\n\ta pset:Preset ;\n\tlv2:appliesTo <"
<< effect->getURI() << "> ;\n\t"
<< "rdfs:seeAlso <" << preset_file << "> .\n" << std::endl;
// Write preset file
pos << "<" << preset_uri << ">"
<< "\n\ta pset:Preset ;\n\tlv2:appliesTo <"
<< effect->getURI() << "> ;\n\t"
<< "rdfs:label \"" << name_buf << "\"";
for (uint32_t i = 0; i < num_params; ++i) {
effect->getParameterName(i, name_buf);
pos << " ;\n\tlv2:port [" << endl;
pos << "\t\tlv2:symbol \"" << symbolify(name_buf) << "\" ;" << endl;
pos << "\t\tpset:value " << lvz_translate_parameter(effect, i, effect->getParameter(i)) << " ;" << endl;
pos << "\t]";
}
//.........这里部分代码省略.........