コード例 #1
0
ファイル: filemanager.cpp プロジェクト: ivan94/faculdade
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);
}
コード例 #2
0
ファイル: sign.cpp プロジェクト: alecalve/bitcoin
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;
}
コード例 #3
0
	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());
	}
コード例 #4
0
ファイル: thread_local.hpp プロジェクト: Abioy/ardb
			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;
			}
コード例 #5
0
ファイル: ItemFactory.cpp プロジェクト: hadesjaky/RiskKiller
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);
	}
}
コード例 #6
0
ファイル: EmberEntityFactory.cpp プロジェクト: Arsakes/ember
// 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;
}
コード例 #7
0
	void permission_object_t::test<4>()
	{
		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");		
		perm1.init(creator,owner,lastOwner,group);
		perm.set(perm1);
		ensure("set():failed to set ", (creator == perm.getCreator()) && (owner == perm.getOwner())&&
									(lastOwner == perm.getLastOwner())&& (group == perm.getGroup()));	
		}
コード例 #8
0
ファイル: sign.cpp プロジェクト: 21E14/bitcoin
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;
}
コード例 #9
0
	void permission_object_t::test<22>()
	{
		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);
		LLXMLNode* xml_node = perm.exportFileXML();
		perm1.importXML(xml_node);
		ensure("exportFileXML()/importXML():failed to export and import the data ", perm1 == perm);	
	}
コード例 #10
0
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;
}
コード例 #11
0
ファイル: sign.cpp プロジェクト: alecalve/bitcoin
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;
}
コード例 #12
0
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();
     }
}
コード例 #13
0
void permission_object_t::test<17>()
{
    LLPermissions perm;
    LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");
    LLUUID owner;
    LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d");
    LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");
    LLUUID agent;
    ensure("1:allowMoveBy():failed ", perm.allowTransferTo(agent));

    perm.init(creator,owner,lastOwner,group);
    ensure("2:allowMoveBy():failed ", perm.allowTransferTo(agent));
}
コード例 #14
0
ファイル: object_test.cpp プロジェクト: Perlmint/dokuro
//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));
}
コード例 #15
0
ファイル: savegame.cpp プロジェクト: pax2you4now/wesnoth
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()];
}
コード例 #16
0
ファイル: object.hpp プロジェクト: synesissoftware/VOLE
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];
    }
コード例 #17
0
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;
}
コード例 #18
0
	void permission_object_t::test<2>()
	{
		LLPermissions permissions;
		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");		
		permissions.init(creator, owner, lastOwner, group);

		ensure_equals("init/getCreator():failed to return the creator ", creator, permissions.getCreator());	
		ensure_equals("init/getOwner():failed to return the owner ", owner, permissions.getOwner());
		ensure_equals("init/getLastOwner():failed to return the group ", lastOwner, permissions.getLastOwner());	
		ensure_equals("init/getGroup():failed to return the group ", group, permissions.getGroup());	
	}
コード例 #19
0
	void permission_object_t::test<23>()
	{
		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);
		std::ostringstream stream1, stream2;
		stream1 << perm;
		perm1.init(creator,owner,lastOwner,group);
		stream2 << perm1;
		ensure("1:operator << failed",(stream1.str() == stream2.str()));	
	}
コード例 #20
0
ファイル: winEmbed.cpp プロジェクト: BitVapor/Pale-Moon
/* 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);
}
コード例 #21
0
ファイル: PluginManager.cpp プロジェクト: Samsung/cynara
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));
}
コード例 #22
0
ファイル: createzim.cpp プロジェクト: cscott/openzim
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;
  }
}
コード例 #23
0
ファイル: ResolverTest.cpp プロジェクト: 476139183/redex
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();
}
コード例 #24
0
ファイル: PortRefCreator.hpp プロジェクト: torc-isi/torc
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;
	}
}
コード例 #25
0
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;
}
コード例 #26
0
ファイル: uniform_view.hpp プロジェクト: belleau/librjmcmc
 inline double inverse_pdf(Configuration const& c, Modification& m, InputIterator it) const
 {
     m.birth().clear();
     unsigned int beg   = c.size()-m.death().size()+1;
     unsigned int end   = beg+N;
     unsigned int denom = 1;
     object_from_coordinates<T> creator;
     for(unsigned int n=beg ; n<end ; ++n)
     {
         m.birth().push_back(creator(it));
         it    += dimension;
         denom *= n;
     }
     return 1./denom;
 }
コード例 #27
0
	void permission_object_t::test<13>()
	{
		LLPermissions perm;
		LLUUID agent;
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		U32 bits = 10;
		ensure("allowOperationBy():failed ", (TRUE == perm.allowOperationBy(bits,agent,group)));

		LLUUID agent1("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		perm.init(creator,owner,lastOwner,group);
		ensure("allowOperationBy():failed ", (TRUE == perm.allowOperationBy(bits,agent1,group)));
	}
コード例 #28
0
ファイル: tutorial2.cpp プロジェクト: mathstuf/Boost.DLL
int main(int argc, char* argv[]) { 
    // argv[1] contains path to our plugin library 
    BOOST_ASSERT(argc >= 2);
    boost::filesystem::path shared_library_path = shared_lib_path(argv[1], L"my_plugin_aggregator");

    typedef boost::shared_ptr<my_plugin_api> (pluginapi_create_t)();
    boost::function<pluginapi_create_t> creator
        = boost::dll::import_function_alias<pluginapi_create_t>(shared_library_path, "create_plugin");

    boost::shared_ptr<my_plugin_api> plugin = creator();

    std::cout << "Plugin Version: " << plugin->version() << std::endl;
    std::cout << "Plugin Method:  " << plugin->calculate(1.5, 1.5) << std::endl;
    std::cout << "Plugin Method second call:  " << plugin->calculate(1.5, 1.5) << std::endl;
    std::cout << "Plugin Name:  " << plugin->name() << std::endl;
}
コード例 #29
0
ファイル: mgcmddraw.cpp プロジェクト: arthur-zhang/touchvg
bool MgCommandDraw::_initialize(MgShape* (*creator)(), const MgMotion* sender)
{
    if (!m_shape) {
        m_shape = creator ? creator() : createShape(sender->view->getShapeFactory());
        if (!m_shape || !m_shape->shape())
            return false;
        m_shape->setParent(sender->view->shapes(), 0);
    }
    sender->view->setNewShapeID(0);
    m_step = 0;
    m_needClear = false;
    m_shape->shape()->clear();
    *m_shape->context() = *sender->view->context();
    
    return true;
}
コード例 #30
0
ファイル: CallDAG.cpp プロジェクト: aonorin/angle
CallDAG::InitResult CallDAG::init(TIntermNode *root, TDiagnostics *diagnostics)
{
    CallDAGCreator creator(diagnostics);

    // Creates the mapping of functions to callees
    root->traverse(&creator);

    // Does the topological sort and detects recursions
    InitResult result = creator.assignIndices();
    if (result != INITDAG_SUCCESS)
    {
        return result;
    }

    creator.fillDataStructures(&mRecords, &mFunctionIdToIndex);
    return INITDAG_SUCCESS;
}