本文整理汇总了C++中creator函数的典型用法代码示例。如果您正苦于以下问题:C++ creator函数的具体用法?C++ creator怎么用?C++ creator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了creator函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: creator
void FileManager::saveFileAs(string fileName, FileContent content){
//Muda o arquivo que esta sendo trabalhado
this->fileName = fileName;
//Cria o arquivo no sistema
ofstream creator(fileName.c_str());
creator.close();
this->saveFile(content);
}
开发者ID:ivan94,项目名称:faculdade,代码行数:11,代码来源:filemanager.cpp
示例2: SignSignature
bool SignSignature(const SigningProvider &provider, const CScript& fromPubKey, CMutableTransaction& txTo, unsigned int nIn, const CAmount& amount, int nHashType)
{
assert(nIn < txTo.vin.size());
MutableTransactionSignatureCreator creator(&txTo, nIn, amount, nHashType);
SignatureData sigdata;
bool ret = ProduceSignature(provider, creator, fromPubKey, sigdata);
UpdateInput(txTo.vin.at(nIn), sigdata);
return ret;
}
开发者ID:alecalve,项目名称:bitcoin,代码行数:11,代码来源:sign.cpp
示例3: creator
void permission_object_t::test<8>()
{
LLPermissions perm,perm1;
LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");
LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806");
LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d");
LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");
perm.init(creator,owner,lastOwner,group);
perm1.init(creator,owner,lastOwner,group);
ensure_equals("getCRC32:failed ", perm.getCRC32(),perm1.getCRC32());
}
开发者ID:9skunks,项目名称:imprudence,代码行数:11,代码来源:llpermissions_tut.cpp
示例4: GetValue
T& GetValue(InstanceCreator* creator, void* data)
{
T* local_thread_value = static_cast<T*>(pthread_getspecific(
m_key));
if (NULL == local_thread_value)
{
T* newObj = creator(data);
pthread_setspecific(m_key, newObj);
local_thread_value = newObj;
}
return *local_thread_value;
}
开发者ID:Abioy,项目名称:ardb,代码行数:12,代码来源:thread_local.hpp
示例5: creator
ItemBase* ItemFactory::create(QString itemType, QPointF pos, ItemBase* linker)
{
creator = itemCreators.find(itemType).value();
if(creator == NULL)
{
return NULL;
}
else
{
return creator(itemType, pos, linker);
}
}
开发者ID:hadesjaky,项目名称:RiskKiller,代码行数:12,代码来源:ItemFactory.cpp
示例6: EmberEntity
// create whatever entity the client desires
Eris::Entity* EmberEntityFactory::instantiate(const Atlas::Objects::Entity::RootEntity &ge, Eris::TypeInfo* type, Eris::View* w)
{
EmberEntity* entity = new EmberEntity(ge->getId(), type, w);
//the creator binds the model mapping and this instance together by creating instance of EmberEntityModelAction and EmberEntityPartAction which in turn calls the setModel(..) and show/hideModelPart(...) methods.
EmberEntityActionCreator creator(*entity, mScene);
EntityMapping::EntityMapping* mapping = Mapping::EmberEntityMappingManager::getSingleton().getManager().createMapping(*entity, creator, &mView);
entity->BeingDeleted.connect(sigc::bind(sigc::mem_fun(*this, &EmberEntityFactory::deleteMapping), mapping));
mapping->initialize();
S_LOG_VERBOSE("Entity added to game view.");
return entity;
}
开发者ID:Arsakes,项目名称:ember,代码行数:13,代码来源:EmberEntityFactory.cpp
示例7: SignSignature
bool SignSignature(const CKeyStore &keystore, const CScript& fromPubKey, CMutableTransaction& txTo, unsigned int nIn, const CAmount& amount, int nHashType)
{
assert(nIn < txTo.vin.size());
CTransaction txToConst(txTo);
TransactionSignatureCreator creator(&keystore, &txToConst, nIn, amount, nHashType);
SignatureData sigdata;
bool ret = ProduceSignature(creator, fromPubKey, sigdata);
UpdateTransaction(txTo, nIn, sigdata);
return ret;
}
开发者ID:21E14,项目名称:bitcoin,代码行数:12,代码来源:sign.cpp
示例8: create_class
DexClass* create_class(const DexType* type,
const DexType* super_type,
const std::string& pkg_name,
std::vector<DexField*> fields,
const TypeSet& interfaces,
bool with_default_ctor,
DexAccessFlags access) {
DexType* t = const_cast<DexType*>(type);
always_assert(!pkg_name.empty());
auto name = std::string(type->get_name()->c_str());
name = pkg_name + "/" + name.substr(1);
t->set_name(DexString::make_string(name));
// Create class.
ClassCreator creator(t);
creator.set_access(access);
always_assert(super_type != nullptr);
creator.set_super(const_cast<DexType*>(super_type));
for (const auto& itf : interfaces) {
creator.add_interface(const_cast<DexType*>(itf));
}
for (const auto& field : fields) {
creator.add_field(field);
}
auto cls = creator.create();
// Keeping type-erasure generated classes from being renamed.
cls->rstate.set_keep_name();
if (!with_default_ctor) {
return cls;
}
// Create ctor.
auto super_ctors = type_class(super_type)->get_ctors();
for (auto super_ctor : super_ctors) {
auto mc = new MethodCreator(t,
DexString::make_string("<init>"),
super_ctor->get_proto(),
ACC_PUBLIC | ACC_CONSTRUCTOR);
// Call to super.<init>
std::vector<Location> args;
size_t args_size = super_ctor->get_proto()->get_args()->size();
for (size_t arg_loc = 0; arg_loc < args_size + 1; ++arg_loc) {
args.push_back(mc->get_local(arg_loc));
}
auto mb = mc->get_main_block();
mb->invoke(OPCODE_INVOKE_DIRECT, super_ctor, args);
mb->ret_void();
auto ctor = mc->create();
TRACE(TERA, 4, " default ctor created %s\n", SHOW(ctor));
cls->add_method(ctor);
}
return cls;
}
开发者ID:facebook,项目名称:redex,代码行数:52,代码来源:ClassAssemblingUtils.cpp
示例9: SignPSBTInput
bool SignPSBTInput(const SigningProvider& provider, const CMutableTransaction& tx, PSBTInput& input, int index, int sighash)
{
// if this input has a final scriptsig or scriptwitness, don't do anything with it
if (!input.final_script_sig.empty() || !input.final_script_witness.IsNull()) {
return true;
}
// Fill SignatureData with input info
SignatureData sigdata;
input.FillSignatureData(sigdata);
// Get UTXO
bool require_witness_sig = false;
CTxOut utxo;
if (input.non_witness_utxo) {
// If we're taking our information from a non-witness UTXO, verify that it matches the prevout.
if (input.non_witness_utxo->GetHash() != tx.vin[index].prevout.hash) return false;
// If both witness and non-witness UTXO are provided, verify that they match. This check shouldn't
// matter, as the PSBT deserializer enforces only one of both is provided, and the only way both
// can be present is when they're added simultaneously by FillPSBT (in which case they always match).
// Still, check in order to not rely on callers to enforce this.
if (!input.witness_utxo.IsNull() && input.non_witness_utxo->vout[tx.vin[index].prevout.n] != input.witness_utxo) return false;
utxo = input.non_witness_utxo->vout[tx.vin[index].prevout.n];
} else if (!input.witness_utxo.IsNull()) {
utxo = input.witness_utxo;
// When we're taking our information from a witness UTXO, we can't verify it is actually data from
// the output being spent. This is safe in case a witness signature is produced (which includes this
// information directly in the hash), but not for non-witness signatures. Remember that we require
// a witness signature in this situation.
require_witness_sig = true;
} else {
return false;
}
MutableTransactionSignatureCreator creator(&tx, index, utxo.nValue, sighash);
sigdata.witness = false;
bool sig_complete = ProduceSignature(provider, creator, utxo.scriptPubKey, sigdata);
// Verify that a witness signature was produced in case one was required.
if (require_witness_sig && !sigdata.witness) return false;
input.FromSignatureData(sigdata);
// If both UTXO types are present, drop the unnecessary one.
if (input.non_witness_utxo && !input.witness_utxo.IsNull()) {
if (sigdata.witness) {
input.non_witness_utxo = nullptr;
} else {
input.witness_utxo.SetNull();
}
}
return sig_complete;
}
开发者ID:alecalve,项目名称:bitcoin,代码行数:52,代码来源:sign.cpp
示例10: creator
void Programming::creator(){
for (int f=0;f<ThisClassLessons.size();f++){
if (ThisClassLessons[f].hours!=0){
FinalList.append(ThisClassLessons[f]);
FinalListPrinter.append(ThisClassLessons[f].name);
ThisClassLessons[f].hours-=2;}
}
for (int t=0;t<ThisClassLessons.size();t++){
if (ThisClassLessons[t].hours!=0)
creator();
}
}
开发者ID:mhahmadilivany,项目名称:school-schedule,代码行数:13,代码来源:programming.cpp
示例11: TEST
//component id를 가지고 해당 컴포넌트를 소유하는 object 얻기
TEST(Object, componentObjectConnect)
{
World world;
Object *obj = world.create();
const int family = kFamilySimpleHP;
SimpleHPCompCreator creator(obj);
int compId = creator.create(10);
EXPECT_EQ(obj, world.getCompList(family)->getGameObject(compId));
obj->removeComponent(kFamilySimpleHP);
EXPECT_EQ(nullptr, world.getCompList(family)->getGameObject(compId));
}
开发者ID:Perlmint,项目名称:dokuro,代码行数:14,代码来源:object_test.cpp
示例12: creator
void loadgame::show_difficulty_dialog()
{
create_save_info creator;
save_info info = creator(filename_);
const config& cfg_summary = info.summary();
if ( cfg_summary["corrupt"].to_bool() || (cfg_summary["replay"].to_bool() && !cfg_summary["snapshot"].to_bool(true))
|| (!cfg_summary["turn"].empty()) )
return;
std::string campaign_id = cfg_summary["campaign"];
const config::const_child_itors &campaigns = game_config_.child_range("campaign");
std::vector<std::string> difficulties;
std::vector<std::pair<std::string, bool> > difficulty_options;
BOOST_FOREACH(const config &campaign, campaigns)
{
if (campaign["id"] == campaign_id) {
difficulties = utils::split(campaign["difficulties"], ',');
std::vector<std::string> difficulty_opts = utils::split(campaign["difficulty_descriptions"], ';');
if (difficulty_opts.size() != difficulties.size()) {
difficulty_opts = difficulties;
}
for (size_t i = 0; i < difficulties.size(); i++) {
difficulty_options.push_back(make_pair(difficulty_opts[i], preferences::is_campaign_completed(campaign_id, difficulties[i])));
}
break;
}
}
if (difficulty_options.empty())
return;
#if 0
int default_difficulty = -1;
for (size_t i = 0; i < difficulties.size(); i++) {
if (difficulties[i] == cfg_summary["difficulty"]) {
default_difficulty = i;
break;
}
}
#endif
gui2::tcampaign_difficulty difficulty_dlg(difficulty_options);
difficulty_dlg.show(gui_.video());
if (difficulty_dlg.get_retval() != gui2::twindow::OK) {
return;
}
difficulty_ = difficulties[difficulty_dlg.selected_index()];
}
开发者ID:pax2you4now,项目名称:wesnoth,代码行数:51,代码来源:savegame.cpp
示例13: internal_GetIDOfName
inline
/* static */
DISPID
object_helper::
internal_GetIDOfName(
object const& o,
LPCOLESTR methodName
) /* const */
{
DISPID dispids[1] = { 0 };
HRESULT hr = internal_has_member(o, methodName, &dispids[0]);
if(FAILED(hr))
{
if(DISP_E_UNKNOWNNAME == hr)
{
#if 0
stlsoft::exception_string_creator creator(256u);
creator
.append("Unknown name: '")
.append(methodName)
.append('\'')
;
throw invocation_exception(creator.c_str(), hr);
#else /* ? 0 */
typedef winstl::system_traits<char> traits_t;
static const char msg[] = "Unknown name: '";
winstl::w2a a(methodName);
stlsoft::auto_buffer<char> buff(STLSOFT_NUM_ELEMENTS(msg) + a.size() + 1);
traits_t::char_copy(&buff[0], msg, STLSOFT_NUM_ELEMENTS(msg) - 1);
traits_t::char_copy(&buff[0] + (STLSOFT_NUM_ELEMENTS(msg) - 1), a, a.size());
buff[(STLSOFT_NUM_ELEMENTS(msg) - 1) + a.size()] = '\'';
buff[(STLSOFT_NUM_ELEMENTS(msg) - 1) + a.size() + 1] = '\0';
STLSOFT_ASSERT(1 + ::strlen(buff.data()) == buff.size()); // Guard against changing "size()" for winstl::wide2multibyte
throw invocation_exception(buff.data(), hr);
#endif /* 0 */
}
else
{
throw invocation_exception("GetIDsOfNames failed", hr);
}
}
return dispids[0];
}
开发者ID:synesissoftware,项目名称:VOLE,代码行数:51,代码来源:object.hpp
示例14: main
int main (int argc, char *argv[])
{
int c;
strcpy(&appName[0],argv[0]);
static struct option long_options[] = {
{"username", required_argument, 0, 'u'},
{"password", required_argument, 0, 'p'},
{"hostname", required_argument, 0, 'h'},
{"conffilename", required_argument, 0, 'c'},
{0, 0, 0, 0}
};
strcpy (UserName, getenv ("LOGNAME"));
while (1)
{
int option_index = 0;
c = getopt_long_only (argc, argv, "u:p:c:h:", long_options, &option_index);
if (c == -1)
break;
switch (c)
{
case 'u':
printf ("option -u with value `%s'\n", optarg);
strcpy (UserName, optarg);
break;
case 'p':
printf ("option -p with value `%s'\n", optarg);
strcpy (Password, optarg);
break;
case 'h':
printf ("option -h with value `%s'\n", optarg);
strcpy (HostName, optarg);
break;
case 'c':
printf ("option -c with value `%s'\n", optarg);
strcpy (ConfFName, optarg);
break;
}
}
openlog ("net_service:mininet", LOG_NDELAY, LOG_USER);
syslog (LOG_NOTICE, "NET_SERVICE started");
closelog ();
creator ();
return 0;
}
开发者ID:obrpasha,项目名称:votlis_krizh_gaz_nas,代码行数:51,代码来源:main.cpp
示例15: InitializeWindowCreator
/* InitializeWindowCreator creates and hands off an object with a callback
to a window creation function. This is how all new windows are opened,
except any created directly by the embedding app. */
nsresult
InitializeWindowCreator()
{
// create an nsWindowCreator and give it to the WindowWatcher service
nsCOMPtr<nsIWindowCreator> creator(new WindowCreator());
if (!creator)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (!wwatch)
return NS_ERROR_UNEXPECTED;
return wwatch->SetWindowCreator(creator);
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:17,代码来源:winEmbed.cpp
示例16: LOGD
void PluginManager::openPlugin(const std::string &path) {
LOGD("Loading plugin: <%s>", path.c_str());
void *handle = dlopen(path.c_str(), RTLD_LAZY);
if (!handle) {
LOGW("File could not be dlopened <%s> : <%s>", path.c_str(), dlerror());
return;
}
PluginLibPtr handlePtr(handle, std::ptr_fun(dlclose));
//Flush any previous errors
dlerror();
create_t creator = reinterpret_cast<create_t>(dlsym(handle, "create"));
char *error;
if ((error = dlerror()) != NULL) {
LOGE("Couldn't resolve symbol <create> from lib <%s> : <%s>", path.c_str(), error);
return;
}
destroy_t destroyer = reinterpret_cast<destroy_t>(dlsym(handle, "destroy"));
if ((error = dlerror()) != NULL) {
LOGE("Couldn't resolve symbol <destroy> from lib <%s> : <%s>", path.c_str(), error);
return;
}
ExternalPluginPtr pluginPtr(creator(), destroyer);
if (!pluginPtr) {
LOGE("Couldn't create plugin for <%s>", path.c_str());
return;
}
auto policies = pluginPtr->getSupportedPolicyDescr();
if (policies.empty()) {
LOGE("Plugin <%s> does not support any type!", path.c_str());
return;
}
for (auto &desc : policies) {
if (!m_plugins.insert(std::make_pair(desc, pluginPtr)).second) {
LOGW("Policy: type [%" PRIu16 "] name <%s> was already supported.",
desc.type, desc.name.c_str());
} else {
LOGD("Supported policy: type [%" PRIu16 "] name <%s>", desc.type, desc.name.c_str());
}
}
m_pluginLibs.push_back(std::move(handlePtr));
}
开发者ID:Samsung,项目名称:cynara,代码行数:50,代码来源:PluginManager.cpp
示例17: main
int main(int argc, char* argv[])
{
try
{
log_init();
zim::writer::ZimCreator creator(argc, argv);
ArticleSource source;
creator.create("foo.zim", source);
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
}
}
开发者ID:cscott,项目名称:openzim,代码行数:14,代码来源:createzim.cpp
示例18: create_class
DexClass* create_class(DexType* type, DexType* super,
std::vector<DexField*> fields,
DexAccessFlags access = ACC_PUBLIC, bool external = false) {
ClassCreator creator(type);
creator.set_access(access);
if (external) creator.set_external();
if (super != nullptr) {
creator.set_super(super);
}
for (const auto& field : fields) {
creator.add_field(field);
}
return creator.create();
}
开发者ID:476139183,项目名称:redex,代码行数:14,代码来源:ResolverTest.cpp
示例19: throw
template <typename _ReturnType> void PortRefCreator<_ReturnType>::visit(PortBundle& port)
throw (Error) {
try {
PortBundleReferenceSharedPtr portBundleRef;
mFactory->create(portBundleRef);
PortRefCreator<PortReferenceSharedPtr> creator(mFactory, mInstance, portBundleRef);
VisitorApplier<PortRefCreator<PortReferenceSharedPtr> > applier(creator);
port.applyOnAllChildren(applier);
setupCreatedPort(port.getSharedThis(), portBundleRef);
mReturnValue = portBundleRef;
} catch(Error& e) {
e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
throw;
}
}
开发者ID:torc-isi,项目名称:torc,代码行数:15,代码来源:PortRefCreator.hpp
示例20: creator
std::unique_ptr<BasePropertyWidget> PropertyWidgetFactory::create(std::shared_ptr<Property> property, QWidget* parent) const
{
if(!property)
return nullptr;
const std::type_index type = property->type();
std::string widget;
auto meta = property->getMeta<meta::Widget>();
if (meta)
widget = meta->type();
const auto* ctr = creator(type, widget);
if(ctr)
return ctr->create(property, parent);
return nullptr;
}
开发者ID:cguebert,项目名称:SofaViewer,代码行数:15,代码来源:PropertyWidgetFactory.cpp
注:本文中的creator函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论