本文整理汇总了C++中CL_Exception函数的典型用法代码示例。如果您正苦于以下问题:C++ CL_Exception函数的具体用法?C++ CL_Exception怎么用?C++ CL_Exception使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CL_Exception函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CL_GUIComponent_Impl
CL_GUIComponent_Impl *CL_GUIComponent_Impl::create_from_manager(CL_GUIManager *manager)
{
if (manager)
return new CL_GUIComponent_Impl(manager->impl, 0, true);
else
throw CL_Exception("Cannot create component with a null manager!");
}
开发者ID:Zenol,项目名称:clanlib-2.4,代码行数:7,代码来源:gui_component_impl.cpp
示例2: catch
CL_Resource CL_ResourceManager::get_resource(
const CL_String &resource_id,
bool resolve_alias,
int reserved)
{
std::map<CL_String, CL_Resource>::const_iterator it;
it = impl->resources.find(resource_id);
if (it != impl->resources.end())
return it->second;
std::vector<CL_ResourceManager>::size_type i;
for (i = 0; i < impl->additional_resources.size(); i++)
{
try
{
return impl->additional_resources[i].get_resource(
resource_id, resolve_alias, reserved);
}
catch (const CL_Exception&)
{
}
}
throw CL_Exception(cl_format("Resource not found: %1", resource_id));
return CL_Resource(impl->document.get_document_element(), *this);
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:26,代码来源:resource_manager.cpp
示例3: get_input
void CL_Collada_Triangles_Impl::create_vertices(CL_Vec2f *destination, int stride, const CL_String &semantic)
{
CL_Collada_Input_Shared &input = get_input(semantic);
CL_Collada_Source &source = input.get_source();
if (source.is_null())
{
throw CL_Exception("unsupported situation. fixme");
}
std::vector<CL_Vec2f> &pos_array = source.get_vec2f_array();
if (!stride)
stride = sizeof(CL_Vec2f);
char *work_ptr = (char *) destination;
int primitive_stride = this->stride;
unsigned int offset = input.get_offset();
unsigned int max = offset + (triangle_count * 3 * primitive_stride);
for (unsigned int cnt=offset; cnt < max; cnt+=primitive_stride)
{
*( (CL_Vec2f *) work_ptr ) = pos_array[ primitive[cnt] ];
work_ptr += stride;
}
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:27,代码来源:collada_triangles.cpp
示例4: while
CL_ListViewColumnHeader CL_ListViewHeader::remove(const CL_StringRef &column_id)
{
CL_SharedPtr<CL_ListViewColumnHeader_Impl> cur = impl->first_column;
while (cur)
{
if (cur->column_id == column_id)
{
CL_ListViewColumnHeader column(cur);
if (!impl->func_column_removed.is_null())
impl->func_column_removed.invoke(column);
if (!cur->prev_sibling.expired())
cur->prev_sibling.lock()->next_sibling = cur->next_sibling;
if (cur->next_sibling)
cur->next_sibling->prev_sibling = cur->prev_sibling;
if (impl->first_column == cur)
impl->first_column = cur->next_sibling;
if (impl->last_column.lock() == cur)
impl->last_column = cur->prev_sibling;
return column;
}
cur = cur->next_sibling;
}
throw CL_Exception(cl_format("No column found with column id: %1", column_id));
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:25,代码来源:listview_header.cpp
示例5: CL_Exception
bool CL_IODeviceProvider_File::seek(int position, CL_IODevice::SeekMode seek_mode)
{
if (handle == invalid_handle)
throw CL_Exception("CL_IODeviceProvider_File::seek(): Unable to get file position pointer, no file open");
#ifdef WIN32
DWORD moveMethod = FILE_BEGIN;
switch (seek_mode)
{
case CL_IODevice::seek_set: moveMethod = FILE_BEGIN; break;
case CL_IODevice::seek_cur: moveMethod = FILE_CURRENT; break;
case CL_IODevice::seek_end: moveMethod = FILE_END; break;
}
DWORD new_pos = SetFilePointer(handle, position, 0, moveMethod);
return (new_pos != INVALID_FILE_SIZE);
#else
int mode = SEEK_SET;
if (seek_mode == CL_File::seek_set)
mode = SEEK_SET;
else if (seek_mode == CL_File::seek_cur)
mode = SEEK_CUR;
else if (seek_mode == CL_File::seek_end)
mode = SEEK_END;
off_t new_pos = lseek(handle, position, mode);
if (new_pos == (off_t) -1)
return false;
else
return true;
#endif
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:32,代码来源:iodevice_provider_file.cpp
示例6: CL_VirtualDirectoryListing
CL_VirtualDirectoryListing CL_VirtualFileSystem::get_directory_listing(const CL_String &path_rel)
{
CL_String path = CL_PathHelp::make_absolute(
"/",
path_rel,
CL_PathHelp::path_type_virtual);
// First see if its a mount point:
int index, size;
size = (int) impl->mounts.size();
for (index = 0; index < size; index++)
{
if (impl->mounts[index].first == path.substr(0, impl->mounts[index].first.length()))
{
return impl->mounts[index].second.get_directory_listing( path.substr(impl->mounts[index].first.length(), path.length()));
}
}
// Try open locally, if we got a file provider attached
if (impl->provider)
{
return CL_VirtualDirectoryListing(
impl->provider,
CL_PathHelp::make_relative(
"/",
path,
CL_PathHelp::path_type_virtual));
}
else
throw CL_Exception(cl_format("Unable to list directory: %1", path));
}
开发者ID:Zenol,项目名称:clanlib-2.4,代码行数:32,代码来源:virtual_file_system.cpp
示例7: AllocConsole
CL_ConsoleWindow_Generic::CL_ConsoleWindow_Generic(
const CL_StringRef &title,
int width,
int height)
{
#ifdef WIN32
AllocConsole();
SetConsoleTitle(CL_StringHelp::utf8_to_ucs2(title).c_str());
COORD coord;
coord.X = width;
coord.Y = height;
scrbuf =
CreateConsoleScreenBuffer(
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
CONSOLE_TEXTMODE_BUFFER,
NULL);
if(scrbuf == INVALID_HANDLE_VALUE)
throw CL_Exception("Unable to allocate console screen buffer");
SetStdHandle(STD_OUTPUT_HANDLE, scrbuf);
SetConsoleActiveScreenBuffer(scrbuf);
SetConsoleScreenBufferSize(scrbuf, coord);
#endif
}
开发者ID:Boerlam001,项目名称:proton_sdk_source,代码行数:28,代码来源:console_window_generic.cpp
示例8: io
void CL_Lib3dsFile::load(CL_IODevice device)
{
CL_Lib3dsIo io(device);
int result = lib3ds_file_read(file, io);
if (!result)
throw CL_Exception("Unable to load 3ds file");
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:7,代码来源:lib3ds_help.cpp
示例9: select_nodes
CL_DomNode CL_DomNode::select_node(const CL_DomString &xpath_expression) const
{
std::vector<CL_DomNode> nodes = select_nodes(xpath_expression);
if (nodes.empty())
throw CL_Exception(cl_format("Xpath did not match any node: %1", xpath_expression));
return nodes[0];
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:7,代码来源:dom_node.cpp
示例10: service_name
CL_Service_Impl::CL_Service_Impl(CL_Service *service, const CL_String &service_name)
: service_name(service_name), service(service)
{
if (instance != 0)
throw CL_Exception("More than one instance of CL_Service not allowed");
instance = this;
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:7,代码来源:service_impl.cpp
示例11: mutex_lock
void CL_NetGameClient_Impl::process()
{
CL_MutexSection mutex_lock(&mutex);
event_arrived.reset();
std::vector<CL_NetGameNetworkEvent> new_events;
new_events.swap(events);
mutex_lock.unlock();
for (unsigned int i = 0; i < new_events.size(); i++)
{
switch (new_events[i].type)
{
case CL_NetGameNetworkEvent::client_connected:
sig_game_connected.invoke();
break;
case CL_NetGameNetworkEvent::event_received:
sig_game_event_received.invoke(new_events[i].game_event);
break;
case CL_NetGameNetworkEvent::client_disconnected:
sig_game_disconnected.invoke();
connection.reset();
break;
default:
throw CL_Exception("Unknown server event type");
}
}
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:26,代码来源:client.cpp
示例12: RegSetValueEx
void CL_RegistryKey::set_value_int(const CL_StringRef &name, int value)
{
DWORD v = value;
LONG result = RegSetValueEx(impl->key, name.empty() ? 0 : CL_StringHelp::utf8_to_ucs2(name).c_str(), 0, REG_DWORD, (const BYTE *) &v, sizeof(DWORD));
if (result != ERROR_SUCCESS)
throw CL_Exception(cl_format("Unable to set registry key value %1", name));
}
开发者ID:Boerlam001,项目名称:proton_sdk_source,代码行数:7,代码来源:registry_key.cpp
示例13: if
int App::start(const std::vector<CL_String> &args)
{
CL_String theme;
if (CL_FileHelp::file_exists("../../../Resources/GUIThemeAero/theme.css"))
theme = "../../../Resources/GUIThemeAero";
else if (CL_FileHelp::file_exists("../../../Resources/GUIThemeBasic/theme.css"))
theme = "../../../Resources/GUIThemeBasic";
else
throw CL_Exception("Not themes found");
CL_GUIManager gui(theme);
CL_DisplayWindowDescription win_desc;
win_desc.set_allow_resize(true);
win_desc.set_title("GUILayout Test Application");
win_desc.set_position(CL_Rect(200, 200, 540, 440), false);
win_desc.set_visible(false);
CL_Window window(&gui, win_desc);
window.func_close().set(this, &App::on_close, &window);
CL_GUILayoutCorners layout;
window.set_layout(layout);
window.create_components("Resources/layout.xml");
CL_PushButton *button = CL_PushButton::get_named_item(&window, "MyButton");
button->func_clicked().set(this, &App::on_button_clicked, button);
label = CL_Label::get_named_item(&window, "MyLabel");
window.set_visible(true);
gui.exec();
return 0;
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:35,代码来源:gui.cpp
示例14: RegCreateKeyEx
CL_RegistryKey CL_RegistryKey::create_key(const CL_StringRef &subkey, unsigned int access_rights, CreateFlags create_flags)
{
DWORD disposition = 0;
HKEY new_key = 0;
LONG result = RegCreateKeyEx(impl->key, CL_StringHelp::utf8_to_ucs2(subkey).c_str(), 0, 0, (create_flags & create_volatile) ? REG_OPTION_VOLATILE : REG_OPTION_NON_VOLATILE, access_rights, 0, &new_key, &disposition);
if (result != ERROR_SUCCESS)
throw CL_Exception(cl_format("Unable to create registry key %1", subkey));
if (disposition != REG_CREATED_NEW_KEY && (create_flags & create_new))
{
RegCloseKey(new_key);
throw CL_Exception(cl_format("Key already exists: %1", subkey));
}
return CL_RegistryKey(new_key);
}
开发者ID:Boerlam001,项目名称:proton_sdk_source,代码行数:16,代码来源:registry_key.cpp
示例15: SHDeleteKey
void CL_RegistryKey::delete_key(PredefinedKey key, const CL_StringRef &subkey, bool recursive)
{
HKEY hkey = CL_RegistryKey_Impl::get_predefined_hkey(key);
if (recursive)
{
DWORD result = SHDeleteKey(hkey, CL_StringHelp::utf8_to_ucs2(subkey).c_str());
if (result != ERROR_SUCCESS)
throw CL_Exception(cl_format("Unable to delete registry key %1", subkey));
}
else
{
LONG result = RegDeleteKey(hkey, CL_StringHelp::utf8_to_ucs2(subkey).c_str());
if (result != ERROR_SUCCESS)
throw CL_Exception(cl_format("Unable to delete registry key %1", subkey));
}
}
开发者ID:Boerlam001,项目名称:proton_sdk_source,代码行数:16,代码来源:registry_key.cpp
示例16: if
CL_CSSBoxLength CL_CSSResourceCache::compute_length(const CL_CSSBoxLength &length, float em_size, float ex_size)
{
float dpi = 96.0f;
float px_size = 1.0f;
/*
if (is_printer)
{
if (printer.dpi == 300)
{
dpi = 300.0f;
px_size = 3.0f;
}
else if (printer.dpi == 600)
{
dpi = 600.0f;
px_size = 5.0f;
}
else
{
dpi = printer.dpi;
px_size = (float)(int)(0.20f * dpi / 25.4f + 0.5f); // Find the closest pixel size matching 0.20mm
}
}
*/
CL_CSSBoxLength new_length;
new_length.type = CL_CSSBoxLength::type_computed_px;
switch (length.type)
{
case CL_CSSBoxLength::type_computed_px:
new_length.value = length.value;
break;
case CL_CSSBoxLength::type_mm:
new_length.value = length.value * dpi / 25.4f;
break;
case CL_CSSBoxLength::type_cm:
new_length.value = length.value * dpi / 2.54f;
break;
case CL_CSSBoxLength::type_in:
new_length.value = length.value * dpi;
break;
case CL_CSSBoxLength::type_pt:
new_length.value = length.value * dpi / 72.0f;
break;
case CL_CSSBoxLength::type_pc:
new_length.value = length.value * dpi * 12.0f / 72.0f;
break;
case CL_CSSBoxLength::type_em:
new_length.value = length.value * em_size;
break;
case CL_CSSBoxLength::type_ex:
new_length.value = length.value * ex_size;
break;
case CL_CSSBoxLength::type_px:
new_length.value = length.value * px_size;
break;
default:
throw CL_Exception("Unknown css length dimension!");
}
return new_length;
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:60,代码来源:css_resource_cache.cpp
示例17: prim_array
void Model_Impl::Draw(CL_GraphicContext &gc, GraphicStore *gs, const CL_Mat4f &modelview_matrix)
{
gc.set_modelview(modelview_matrix);
CL_PrimitivesArray prim_array(gc);
prim_array.set_attributes(0, vbo_positions, 3, cl_type_float, (void *) 0);
prim_array.set_attributes(1, vbo_normals, 3, cl_type_float, (void *) 0);
if (!vbo_texcoords.is_null())
{
prim_array.set_attributes(2, vbo_texcoords, 2, cl_type_float, (void *) 0);
gc.set_texture(0, gs->texture_underwater);
gc.set_texture(1, gs->texture_background);
gs->shader_texture.SetMaterial(material_shininess, material_emission, material_ambient, material_specular);
gs->shader_texture.Use(gc);
}
else
{
throw CL_Exception("What! no texure coordinates?");
}
gc.draw_primitives(cl_triangles, vbo_size, prim_array);
gc.reset_texture(0);
gc.reset_texture(0);
}
开发者ID:Zenol,项目名称:clanlib-2.4,代码行数:28,代码来源:model.cpp
示例18: CL_Exception
int Model_Impl::count_vertices(const struct aiScene* sc, const struct aiNode* nd)
{
int vertex_count = 0;
unsigned int n = 0, t;
// All meshes assigned to this node
for (; n < nd->mNumMeshes; ++n)
{
const struct aiMesh* mesh = sc->mMeshes[nd->mMeshes[n]];
int num_vertex = mesh->mNumFaces * 3;
if (!num_vertex)
continue;
vertex_count += num_vertex;
for (t = 0; t < mesh->mNumFaces; ++t)
{
if (mesh->mFaces[t].mNumIndices != 3)
throw CL_Exception("This example only supports triangles");
}
}
// All children
for (n = 0; n < nd->mNumChildren; ++n)
{
vertex_count += count_vertices(sc, nd->mChildren[n]);
}
return vertex_count;
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:29,代码来源:model.cpp
示例19: PQfnumber
int CL_PgsqlReaderProvider::get_name_index(const CL_StringRef &name) const
{
int index = PQfnumber(result, name.c_str());
if (index < 0)
throw CL_Exception(cl_format("No such column name %1", name));
return index;
}
开发者ID:Zenol,项目名称:clanlib-2.4,代码行数:7,代码来源:pgsql_reader_provider.cpp
示例20: CL_Exception
void LoginEvents::on_event_login_failed(const CL_NetGameEvent &e)
{
CL_String fail_reason = e.get_argument(0);
// TODO: Handle failed login more gracefully
throw CL_Exception("Login failed: " + fail_reason);
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:7,代码来源:login_events.cpp
注:本文中的CL_Exception函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论