hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
48.5k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
b00cb0010d1018cecccfb1d1bf690b0215f103c4
1,168
cpp
C++
DirectX11 Engine 2019/UI/Primitives/UIRectangle.cpp
FirowMD/Luna-Engine
4011a43df48ca85f6d8f8657709471da02bd8301
[ "MIT" ]
2
2021-07-28T23:08:29.000Z
2021-09-14T19:32:36.000Z
DirectX11 Engine 2019/UI/Primitives/UIRectangle.cpp
FirowMD/Luna-Engine
4011a43df48ca85f6d8f8657709471da02bd8301
[ "MIT" ]
null
null
null
DirectX11 Engine 2019/UI/Primitives/UIRectangle.cpp
FirowMD/Luna-Engine
4011a43df48ca85f6d8f8657709471da02bd8301
[ "MIT" ]
null
null
null
#include "pc.h" #include "UIRectangle.h" UIRectangle::UIRectangle(float2 TopLeft, float2 BottomRight) { UIVertex v0{}, v1{}, v2{}; float z = (float)gLayerID; v0.Color = gColor; v1.Color = gColor; v2.Color = gColor; // Tri 1 v0.Position = float3(TopLeft.x, TopLeft.y, z); v1.Position = float3(BottomRight.x, TopLeft.y, z); v2.Position = float3(TopLeft.x, BottomRight.y, z); AddTriangle(v0, v1, v2); // Tri 2 v0.Position = float3(BottomRight.x, TopLeft.y, z); v1.Position = float3(BottomRight.x, BottomRight.y, z); v2.Position = float3(TopLeft.x, BottomRight.y, z); AddTriangle(v0, v1, v2); } UIRectangle::UIRectangle(float x0, float y0, float x1, float y1) { UIVertex v0{}, v1{}, v2{}; float z = (float)gLayerID; v0.Color = gColor; v1.Color = gColor; v2.Color = gColor; // Tri 1 v0.Position = float3(x0, y0, z); v1.Position = float3(x1, y0, z); v2.Position = float3(x0, y1, z); AddTriangle(v0, v1, v2); // Tri 2 v0.Position = float3(x1, y0, z); v1.Position = float3(x1, y1, z); v2.Position = float3(x0, y1, z); AddTriangle(v0, v1, v2); }
24.333333
66
0.605308
FirowMD
b016be99a66187cb8412fce6d9e6da14afaf806a
318
hh
C++
source/geometry/KBGeometry.hh
ggfdsa10/KEBI_AT-TPC
40e00fcd10d3306b93fff93be5fb0988f87715a7
[ "MIT" ]
3
2021-05-24T19:43:30.000Z
2022-01-06T21:03:23.000Z
source/geometry/KBGeometry.hh
ggfdsa10/KEBI_AT-TPC
40e00fcd10d3306b93fff93be5fb0988f87715a7
[ "MIT" ]
4
2020-05-04T15:52:26.000Z
2021-09-13T10:51:03.000Z
source/geometry/KBGeometry.hh
ggfdsa10/KEBI_AT-TPC
40e00fcd10d3306b93fff93be5fb0988f87715a7
[ "MIT" ]
3
2020-06-14T10:53:58.000Z
2022-01-06T21:03:30.000Z
#ifndef KBGEOMETRY_HH #define KBGEOMETRY_HH #include "KBContainer.hh" class KBGeometry { protected: Double_t fRMS = -1; public: KBGeometry() {} virtual ~KBGeometry() {} void SetRMS(Double_t val) { fRMS = val; } Double_t GetRMS() const { return fRMS; } ClassDef(KBGeometry, 1) }; #endif
14.454545
45
0.657233
ggfdsa10
b018d6335bb1a08c5c808c21859adf89cac603f5
7,133
cpp
C++
src/Flownodes/CFlowCUIOutputEntityNode.cpp
CoherentLabs/CoherentUI_CryEngine3
44b30e41e37a92ee16edbc6b738f996cfb3bd67e
[ "BSD-2-Clause" ]
12
2015-04-04T17:21:06.000Z
2021-05-11T16:03:36.000Z
src/Flownodes/CFlowCUIOutputEntityNode.cpp
CoherentLabs/CoherentUI_CryEngine3
44b30e41e37a92ee16edbc6b738f996cfb3bd67e
[ "BSD-2-Clause" ]
1
2015-06-23T21:24:38.000Z
2015-06-25T03:42:39.000Z
src/Flownodes/CFlowCUIOutputEntityNode.cpp
CoherentLabs/CoherentUI_CryEngine3
44b30e41e37a92ee16edbc6b738f996cfb3bd67e
[ "BSD-2-Clause" ]
5
2015-02-11T22:43:43.000Z
2017-12-03T00:38:46.000Z
#include <StdAfx.h> #include <Nodes/G2FlowBaseNode.h> #include <CPluginCoherentUI.h> #include <Coherent/UI/View.h> #include "CoherentViewListener.h" #include "CoherentUISystem.h" #include "ViewConfig.h" namespace CoherentUIPlugin { class CFlowCUIOutputEntityNode : public CFlowBaseNode<eNCT_Instanced> { private: CCoherentViewListener* m_pViewListener; IEntity* m_pEntity; ViewConfig* m_pViewConfig; bool m_bViewNeedsUpdate; enum EInputPorts { EIP_ACTIVATE = 0, EIP_URL, EIP_WIDTH, EIP_HEIGHT, EIP_TRANSPARENT, EIP_CLICKABLE, EIP_MESH, EIP_SHARED_MEMORY, }; enum EOutputPorts { EOP_VIEWID = 0 }; #define INITIALIZE_OUTPUTS(x) \ ActivateOutput<int>(x, EOP_VIEWID, -1); public: CFlowCUIOutputEntityNode( SActivationInfo* pActInfo ) { m_pViewListener = NULL; m_pEntity = NULL; m_pViewConfig = new ViewConfig(); m_bViewNeedsUpdate = false; } virtual ~CFlowCUIOutputEntityNode() { if ( m_pViewListener ) { gCoherentUISystem->DeleteView( m_pViewListener ); } if ( m_pViewConfig ) { delete m_pViewConfig; } } virtual IFlowNodePtr Clone( SActivationInfo* pActInfo ) { return new CFlowCUIOutputEntityNode( pActInfo ); } virtual void GetMemoryUsage( ICrySizer* s ) const { s->Add( *this ); } void Serialize( SActivationInfo* pActInfo, TSerialize ser ) { } virtual void GetConfiguration( SFlowNodeConfig& config ) { static const SInputPortConfig inputs[] = { InputPortConfig_Void( "Activate", _HELP( "Activate View" ) ), InputPortConfig<string>( "Url", "", _HELP( "Initial URL" ) ), InputPortConfig<int>( "Width", 0, _HELP( "Width" ) ), InputPortConfig<int>( "Height", 0, _HELP( "Height" ) ), InputPortConfig<bool>( "Transparent", false, _HELP( "Is Transparent" ) ), InputPortConfig<bool>( "Clickable", true, _HELP( "Is Clickable" ) ), InputPortConfig<string>( "Mesh", "", _HELP( "Collision Mesh" ) ), InputPortConfig<bool>( "SharedMemory", true, _HELP( "Uses Shared Memory" ) ), InputPortConfig_AnyType( NULL ), }; static const SOutputPortConfig outputs[] = { OutputPortConfig<int>( "ViewID", _HELP( "ID for Further Use" ), "nViewID" ), OutputPortConfig_AnyType( NULL ), }; config.pInputPorts = inputs; config.pOutputPorts = outputs; config.sDescription = _HELP( PLUGIN_CONSOLE_PREFIX "CoherentUI on entity" ); config.nFlags |= EFLN_TARGET_ENTITY; config.SetCategory( EFLN_APPROVED ); } virtual void ProcessEvent( EFlowEvent evt, SActivationInfo* pActInfo ) { switch ( evt ) { case eFE_Suspend: break; case eFE_Resume: break; case eFE_Initialize: INITIALIZE_OUTPUTS( pActInfo ); break; case eFE_SetEntityId: m_pEntity = pActInfo->pEntity; break; case eFE_Activate: if ( IsPortActive( pActInfo, EIP_ACTIVATE ) && m_pEntity ) { // get the view definition std::string sUrl = GetPortString( pActInfo, EIP_URL ); std::wstring sUrlW( sUrl.length(), L' ' ); sUrlW.assign( sUrl.begin(), sUrl.end() ); Coherent::UI::ViewInfo info; info.Width = GetPortInt( pActInfo, EIP_WIDTH ); info.Height = GetPortInt( pActInfo, EIP_HEIGHT ); info.IsTransparent = GetPortBool( pActInfo, EIP_TRANSPARENT ); info.UsesSharedMemory = GetPortBool( pActInfo, EIP_SHARED_MEMORY ); info.SupportClickThrough = GetPortBool( pActInfo, EIP_CLICKABLE ); m_pViewConfig->ViewInfo = info; m_pViewConfig->Url = sUrlW; m_pViewConfig->Entity = m_pEntity; m_pViewConfig->CollisionMesh = GetPortString( pActInfo, EIP_MESH ); // indicate that we have to create/update the view later m_bViewNeedsUpdate = true; pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true ); } break; case eFE_Update: // make sure the view is created/updated, after the system is ready if ( m_bViewNeedsUpdate && gCoherentUISystem->IsReady() ) { if ( m_pViewListener ) { gCoherentUISystem->DeleteView( m_pViewListener ); } m_pViewListener = gCoherentUISystem->CreateView( m_pViewConfig ); m_bViewNeedsUpdate = false; } // set the view id output after the view is available if ( m_pViewListener ) { Coherent::UI::View* view = m_pViewListener->GetView(); if ( view ) { ActivateOutput<int>( pActInfo, EOP_VIEWID, view->GetId() ); // updates are not necessary until next initialization pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, false ); } } break; } } }; } REGISTER_FLOW_NODE_EX( "CoherentUI_Plugin:OutputEntity", CoherentUIPlugin::CFlowCUIOutputEntityNode, CFlowCUIOutputEntityNode );
40.299435
147
0.451423
CoherentLabs
b0239bf05d84034f3b609bd5a07f7abcf0fbef94
1,850
cpp
C++
lnetlib/lnetlib/server_session_non_ssl.cpp
cpp11nullptr/lnetlib
cf29b7a6f209e1d174e16992188d25e589c5e181
[ "MIT" ]
39
2015-10-13T22:29:29.000Z
2021-08-14T18:40:51.000Z
lnetlib/lnetlib/server_session_non_ssl.cpp
cpp11nullptr/lnetlib
cf29b7a6f209e1d174e16992188d25e589c5e181
[ "MIT" ]
1
2015-12-29T09:23:29.000Z
2015-12-29T09:41:20.000Z
lnetlib/lnetlib/server_session_non_ssl.cpp
cpp11nullptr/lnetlib
cf29b7a6f209e1d174e16992188d25e589c5e181
[ "MIT" ]
8
2015-10-14T09:17:09.000Z
2022-02-21T06:47:24.000Z
/* The MIT License (MIT) Copyright (c) 2015 Ievgen Polyvanyi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "server_session_non_ssl.h" namespace lnetlib { server_session_non_ssl::server_session_non_ssl(service& srv, std::shared_ptr<tcp::acceptor> acceptor) : _socket(new tcp::socket(srv)), _acceptor(acceptor) { } server_session_non_ssl::~server_session_non_ssl() { } void server_session_non_ssl::start() { auto handler = std::bind(&server_session_non_ssl::accept_handler, this, std::placeholders::_1); _acceptor->async_accept(*_socket.get(), handler); } void server_session_non_ssl::accept_handler(const error_code& err) { std::shared_ptr<connection> conn; if (!err) { std::shared_ptr<socket> sckt = std::make_shared<socket_non_ssl>(_socket); conn = std::make_shared<connection>(sckt); } connected(conn, err); } }
30.327869
102
0.770811
cpp11nullptr
b03041fdb7f4f82abfcfad7c5821828e8b2601cd
885
cpp
C++
src/framework/graphics/opengl/vertexLayout.cpp
oda404/oxu
5df4755f796be976bed767cd889a2e71ed867f9b
[ "MIT" ]
null
null
null
src/framework/graphics/opengl/vertexLayout.cpp
oda404/oxu
5df4755f796be976bed767cd889a2e71ed867f9b
[ "MIT" ]
null
null
null
src/framework/graphics/opengl/vertexLayout.cpp
oda404/oxu
5df4755f796be976bed767cd889a2e71ed867f9b
[ "MIT" ]
null
null
null
#include<oxu/framework/graphics/opengl/vertexLayout.hpp> #include<oxu/framework/graphics/opengl/core.hpp> namespace oxu::framework::graphics::opengl { VertexLayoutElement::VertexLayoutElement( const unsigned int &type, const unsigned int &count ): type(type), count(count) { } template<> void VertexLayout::pushElement<float>(unsigned int count) { m_elements.emplace_back(GL_FLOAT, count); m_stride += count * sizeof(float); } template<> void VertexLayout::pushElement<int>(unsigned int count) { m_elements.emplace_back(GL_INT, count); m_stride += count * sizeof(int); } const std::vector<VertexLayoutElement> &VertexLayout::getElements() const { return m_elements; } const unsigned int &VertexLayout::getStride() const { return m_stride; } }
23.289474
77
0.651977
oda404
b034fd1474d2f021d7be5f5b2df7804d027f879b
1,044
hh
C++
App/app_serv/tx_service.hh
Nimita311/motor-driver
7141e968798fea4a01dbc03481151cd8bfbbefeb
[ "MIT" ]
3
2020-03-12T05:02:50.000Z
2021-07-10T03:33:12.000Z
App/app_serv/tx_service.hh
Nimita311/motor-driver
7141e968798fea4a01dbc03481151cd8bfbbefeb
[ "MIT" ]
null
null
null
App/app_serv/tx_service.hh
Nimita311/motor-driver
7141e968798fea4a01dbc03481151cd8bfbbefeb
[ "MIT" ]
1
2020-12-05T23:11:04.000Z
2020-12-05T23:11:04.000Z
#ifndef _INC_TX_SERVICE_HH #define _INC_TX_SERVICE_HH #include "app_serv/service.hh" #include "app_lib/messenger.hh" #include "app_msg/info.pb.h" #include "stm32h7xx_ll_usart.h" #include "stm32h7xx_ll_dma.h" #include "queue.h" namespace brown { class TXService: public Service, public Sender { private: const UBaseType_t txQueueSize; QueueHandle_t txQueue; hardware: USART_TypeDef* const uart; DMA_TypeDef* const dma; const uint32_t stream; public: TXService(uint8_t* txBuffer, size_t txBufferSize, void (*putblock) (char*, size_t), UBaseType_t txQueueSize, USART_TypeDef* uart, DMA_TypeDef* dma, uint32_t stream): Sender(txBuffer, txBufferSize, putblock), txQueueSize(txQueueSize), uart(uart), dma(dma), stream(stream) { txQueue = xQueueCreate(txQueueSize, sizeof(Info*)); } bool init(); void run(); async: void send(Info* pInfoContainer); isr: void uartISR(); }; } // namespace brown #endif // _INC_TX_SERVICE_HH
21.75
70
0.681992
Nimita311
b03a6852121251eaabfe59690e8bcbdbd146e768
283
hpp
C++
src/KEngine/include/KEngine/Entity/ComponentBuilders/EntityRenderableComponentBuilder.hpp
yxbh/Project-Forecast
8ea2f6249a38c9e7f4d6d7d1e51e11ad0b05c2c4
[ "BSD-3-Clause" ]
4
2019-04-09T13:03:11.000Z
2021-01-27T04:58:29.000Z
src/KEngine/include/KEngine/Entity/ComponentBuilders/EntityRenderableComponentBuilder.hpp
yxbh/Project-Forecast
8ea2f6249a38c9e7f4d6d7d1e51e11ad0b05c2c4
[ "BSD-3-Clause" ]
2
2017-02-06T03:48:45.000Z
2020-08-31T01:30:10.000Z
src/KEngine/include/KEngine/Entity/ComponentBuilders/EntityRenderableComponentBuilder.hpp
yxbh/Project-Forecast
8ea2f6249a38c9e7f4d6d7d1e51e11ad0b05c2c4
[ "BSD-3-Clause" ]
4
2020-06-28T08:19:53.000Z
2020-06-28T16:30:19.000Z
#pragma once #include "KEngine/Interfaces/IEntityComponentBuilder.hpp" namespace ke { class EntityRenderableComponentBuilder : public ke::IEntityComponentBuilder { public: virtual ke::EntityComponentSptr build(const std::any & p_jsonObject) override; }; }
20.214286
86
0.738516
yxbh
b03c7edb2e5c3c242a3dbbc141085d748e1331d2
7,301
cpp
C++
ultra96/ROOT_FS/app/fad/src/fad/OdometryCalculator/PatternMatchingVOCalculator/PatternMatchingVOCalculator.cpp
rits-drsl/ZybotR2-96-fpt19
bed374a70fc6bad637770532244b20002f8e8a28
[ "MIT" ]
14
2019-12-25T10:17:11.000Z
2022-01-18T09:35:05.000Z
ultra96/ROOT_FS/app/fad/src/fad/OdometryCalculator/PatternMatchingVOCalculator/PatternMatchingVOCalculator.cpp
rits-drsl/ZybotR2-96-fpt19
bed374a70fc6bad637770532244b20002f8e8a28
[ "MIT" ]
null
null
null
ultra96/ROOT_FS/app/fad/src/fad/OdometryCalculator/PatternMatchingVOCalculator/PatternMatchingVOCalculator.cpp
rits-drsl/ZybotR2-96-fpt19
bed374a70fc6bad637770532244b20002f8e8a28
[ "MIT" ]
2
2020-02-02T03:12:37.000Z
2020-09-02T00:25:21.000Z
/** * PatternMatchingVOCalculator: 路面の俯瞰画像からVisualOdometryを導出するクラス * * Copyright (C) 2019 Yuya Kudo. * Copyright (C) 2019 Atsushi Takada. * Authors: * Yuya Kudo <ri0049ee@ed.ritsumei.ac.jp> * Atsushi Takada <ri0051rr@ed.ritsumei.ac.jp> * */ #include "PatternMatchingVOCalculator.h" namespace fad { PatternMatchingVOCalculator::PatternMatchingVOCalculator() { if(std::getenv("FAD_ROOT") == nullptr) { throw std::logic_error("[" + std::string(__PRETTY_FUNCTION__) + "] " + "Please set environment value : $ export FAD_ROOT=<path of project root> "); } const auto root_path = std::getenv("FAD_ROOT"); core::YAMLHelper::readStruct(root_path + PARAM_YAML_PATH, param_, "param"); if(param_.match_method == "AKAZE") { pattern_matcher_ = std::make_unique<AKAZEPatternMatcher>(); } else if(param_.match_method == "TM") { pattern_matcher_ = std::make_unique<TMPatternMatcher>(); } else { throw std::logic_error("[" + std::string(__PRETTY_FUNCTION__) + "] " + "Pattern matcher type is invalid."); } } PatternMatchingVOCalculator::~PatternMatchingVOCalculator() { } void PatternMatchingVOCalculator::init(const core::EnvironmentMap<core::RoadType>& ref_world) { ref_world_ = ref_world.clone(); } core::VisualOdometry PatternMatchingVOCalculator::get(const bool reset) { const auto ret_vo = vo_; if(reset) vo_ = core::VisualOdometry(); return ret_vo; } void PatternMatchingVOCalculator::update(const core::VehicleState& current_state, const core::EnvironmentMap<uint8_t>& bird_eye_bin_img, const core::EnvironmentMap<uint8_t>& bird_eye_edge_img) { if(bird_eye_bin_img.map.size() != bird_eye_edge_img.map.size()) { throw std::invalid_argument("[" + std::string(__PRETTY_FUNCTION__) + "] " + "Input image size is different"); } const auto ori_size = bird_eye_bin_img.map.size(); // 二値画像とエッジ画像を合成する // NOTE: 二値画像に対してラベリングを行い、ある一定以上の面積の領域を除去する cv::Mat label_map; auto label_info_map = improc::LabelingExecutor::execute(bird_eye_bin_img.map, label_map); cv::Mat pattern_img = cv::Mat::zeros(cv::Size(ori_size.width * (1.0 - (param_.cutting_left_ratio_of_pattern_image + param_.cutting_right_ratio_of_pattern_image)), ori_size.height * (1.0 - param_.cutting_above_ratio_of_pattern_image)), CV_8UC1); int ori_img_x_offset = ori_size.width * param_.cutting_left_ratio_of_pattern_image; int ori_img_y_offset = ori_size.height * param_.cutting_above_ratio_of_pattern_image; for(int yi = 0; yi < pattern_img.rows; yi++) { for(int xi = 0; xi < pattern_img.cols; xi++) { const auto ori_index = ori_img_x_offset + xi + ori_size.width * (yi + ori_img_y_offset); if(bird_eye_bin_img.map.data[ori_index] != 0 && label_info_map[label_map.data[ori_index]].area * std::pow(bird_eye_bin_img.ratio, 2) <= param_.line_area_thr) { pattern_img.data[xi + pattern_img.cols * yi] = 0xFF; } if(bird_eye_edge_img.map.data[ori_index] != 0) { pattern_img.data[xi + pattern_img.cols * yi] = 0x7F; } } } // 路面の俯瞰画像を正規化する const auto target_center = cv::Point(pattern_img.cols / 2, pattern_img.rows / 2); const auto target_angle = current_state.t + core::Theta(core::PI / 2); const auto w_rot = (int)(std::round(pattern_img.rows * std::abs(std::sin(target_angle.get())) + pattern_img.cols * std::abs(std::cos(target_angle.get())))); const auto h_rot = (int)(std::round(pattern_img.rows * std::abs(std::cos(target_angle.get())) + pattern_img.cols * std::abs(std::sin(target_angle.get())))); const auto target_size = cv::Size(w_rot, h_rot); auto trans_mat = cv::getRotationMatrix2D(target_center, -target_angle.getDegree(), 1.0); trans_mat.at<double>(0, 2) += w_rot / 2 - pattern_img.cols / 2; trans_mat.at<double>(1, 2) += h_rot / 2 - pattern_img.rows / 2; cv::warpAffine(pattern_img, pattern_img, trans_mat, target_size, cv::INTER_CUBIC); // 参照地図の対応する領域を切り取る const auto offset_norm_pix = ref_world_.getCorrespondPixNum(cv::norm(bird_eye_bin_img.offset)); const auto offset_vector = cv::Point(offset_norm_pix * std::cos(current_state.t.get()), offset_norm_pix * std::sin(current_state.t.get())); const auto ref_center = ref_world_.getPixPoint(current_state.x, current_state.y) + offset_vector; const auto half_ref_side_length_pt = cv::Point(ref_world_.getCorrespondPixNum(param_.cutting_size_of_ref_map) / 2, ref_world_.getCorrespondPixNum(param_.cutting_size_of_ref_map) / 2); const auto ref_region_tl = ref_center - half_ref_side_length_pt; const auto ref_region_br = ref_center + half_ref_side_length_pt; const auto corrected_ref_region_tl = cv::Point(core::Util::clamp(ref_region_tl.x, 0, ref_world_.map.cols - 1), core::Util::clamp(ref_region_tl.y, 0, ref_world_.map.rows - 1)); const auto corrected_ref_region_br = cv::Point(core::Util::clamp(ref_region_br.x, 0, ref_world_.map.cols - 1), core::Util::clamp(ref_region_br.y, 0, ref_world_.map.rows - 1)); const auto ref_region = cv::Rect(corrected_ref_region_tl, corrected_ref_region_br); auto ref_img = ref_world_.map(ref_region).clone(); for(int i = 0; i < ref_img.size().area(); i++) { ref_img.data[i] = (ref_img.data[i] == (uint8_t)core::RoadType::EDGE) ? 0x7F : (ref_img.data[i] == (uint8_t)core::RoadType::LINE) ? 0xFF : 0x00; } cv::resize(pattern_img, pattern_img, cv::Size(), param_.scale_ratio, param_.scale_ratio, cv::INTER_CUBIC); cv::resize(ref_img, ref_img, cv::Size(), param_.scale_ratio, param_.scale_ratio, cv::INTER_CUBIC); // パターンマッチングを実行 const auto p_match_is_success = pattern_matcher_->solve(pattern_img, ref_img, cv::Point(ref_img.cols / 2, ref_img.rows / 2), ref_world_.getCorrespondPixNum(param_.pattern_matcher_delta_threshord)); // パターンマッチングの結果をVOとして保持 if(p_match_is_success) { const auto& result = pattern_matcher_->getResult(); vo_ = core::VisualOdometry(result.x * ref_world_.ratio * (1.0 / param_.scale_ratio), result.y * ref_world_.ratio * (1.0 / param_.scale_ratio), result.t); } } }
55.732824
170
0.594028
rits-drsl
b03e29a0f7ec1d4b9c6d83c5a97c1e43d4fd035c
5,668
cpp
C++
src/RemotePhotoTool/UsbDriverSwitcherDlg.cpp
vividos/RemotePhotoTool
d17ae2abbda531acbd0ec8e90ddc4856c4fdfa00
[ "BSD-2-Clause" ]
16
2015-03-26T02:32:43.000Z
2021-10-18T16:34:31.000Z
src/RemotePhotoTool/UsbDriverSwitcherDlg.cpp
vividos/RemotePhotoTool
d17ae2abbda531acbd0ec8e90ddc4856c4fdfa00
[ "BSD-2-Clause" ]
7
2019-02-21T06:07:09.000Z
2022-01-01T10:00:50.000Z
src/RemotePhotoTool/UsbDriverSwitcherDlg.cpp
vividos/RemotePhotoTool
d17ae2abbda531acbd0ec8e90ddc4856c4fdfa00
[ "BSD-2-Clause" ]
6
2019-05-07T09:21:15.000Z
2021-09-01T06:36:24.000Z
// // RemotePhotoTool - remote camera control software // Copyright (C) 2008-2020 Michael Fink // /// \file UsbDriverSwitcherDlg.cpp USB driver switcher dialog // #include "stdafx.h" #include "resource.h" #include "UsbDriverSwitcherDlg.hpp" #include <ulib/Path.hpp> /// timer ID for refreshing USB devices list const UINT_PTR c_timerRefreshList = 1; /// refresh cycle time for USB devices list const UINT c_refreshCycleTime = 1000; LRESULT UsbDriverSwitcherDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { DlgResize_Init(); DoDataExchange(DDX_LOAD); CenterWindow(); SetupList(); RefreshList(); SetTimer(c_timerRefreshList, c_refreshCycleTime); return TRUE; } LRESULT UsbDriverSwitcherDlg::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { KillTimer(c_timerRefreshList); return 0; } LRESULT UsbDriverSwitcherDlg::OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if (wParam == c_timerRefreshList) { KillTimer(c_timerRefreshList); RefreshList(); SetTimer(c_timerRefreshList, c_refreshCycleTime); } return 0; } LRESULT UsbDriverSwitcherDlg::OnButtonUsbSwitchDriver(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { int selectedIndex = m_listUSBDevices.GetSelectedIndex(); if (selectedIndex != -1) { struct wdi_device_info* selectedDeviceInfo = (struct wdi_device_info*)m_listUSBDevices.GetItemData(selectedIndex); if (selectedDeviceInfo != nullptr) { // stop timer or else it will mess up the wdi_device_info struct KillTimer(c_timerRefreshList); SwitchDriver(selectedDeviceInfo); SetTimer(c_timerRefreshList, c_refreshCycleTime); } } return 0; } LRESULT UsbDriverSwitcherDlg::OnButtonUsbOpenDeviceManager(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ShellExecute(m_hWnd, _T("open"), _T("devmgmt.msc"), nullptr, nullptr, SW_SHOWNORMAL); return 0; } void UsbDriverSwitcherDlg::SetupList() { m_listUSBDevices.AddColumn(_T("USB Device"), 0); m_listUSBDevices.AddColumn(_T("Driver status"), 1); m_listUSBDevices.SetColumnWidth(0, 300); m_listUSBDevices.SetColumnWidth(1, LVSCW_AUTOSIZE_USEHEADER); m_listUSBDevices.SetExtendedListViewStyle( LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); } void UsbDriverSwitcherDlg::RefreshList() { CString selectedDeviceId; int selectedIndex = m_listUSBDevices.GetSelectedIndex(); if (selectedIndex != -1) { struct wdi_device_info* selectedDeviceInfo = (struct wdi_device_info*)m_listUSBDevices.GetItemData(selectedIndex); if (selectedDeviceInfo != nullptr) { selectedDeviceId = selectedDeviceInfo->device_id; } } m_listUSBDevices.SetRedraw(FALSE); m_listUSBDevices.DeleteAllItems(); struct wdi_options_create_list cl_options = { 0 }; cl_options.list_all = TRUE; cl_options.list_hubs = FALSE; cl_options.trim_whitespaces = TRUE; int newSelectedIndex = -1; struct wdi_device_info* rawDeviceInfo = nullptr; int ret = wdi_create_list(&rawDeviceInfo, &cl_options); if (ret == WDI_SUCCESS && rawDeviceInfo != nullptr) { m_deviceInfoList.reset(rawDeviceInfo, wdi_destroy_list); for (struct wdi_device_info* deviceInfo = m_deviceInfoList.get(); deviceInfo != nullptr; deviceInfo = deviceInfo->next) { if (deviceInfo->desc == nullptr) continue; int itemIndex = m_listUSBDevices.InsertItem( m_listUSBDevices.GetItemCount(), CString(deviceInfo->desc), 0); bool isWinusbDriver = CStringA(deviceInfo->driver) == "WinUSB"; m_listUSBDevices.SetItemText(itemIndex, 1, isWinusbDriver ? _T("gPhoto2 compatible") : _T("other driver")); m_listUSBDevices.SetItemData(itemIndex, (DWORD_PTR)deviceInfo); if (!selectedDeviceId.IsEmpty() && selectedDeviceId == deviceInfo->device_id) { newSelectedIndex = itemIndex; } } } if (newSelectedIndex != -1) m_listUSBDevices.SelectItem(newSelectedIndex); m_listUSBDevices.SetColumnWidth(1, LVSCW_AUTOSIZE_USEHEADER); m_listUSBDevices.SetRedraw(TRUE); } void UsbDriverSwitcherDlg::SwitchDriver(struct wdi_device_info* deviceInfo) { CString folderPath = Path::Combine(Path::TempFolder(), _T("usb_driver")); CString infName{ _T("default.inf") }; Path::CreateDirectoryRecursive(folderPath); wdi_options_prepare_driver prepareDriverOptions = { }; prepareDriverOptions.driver_type = WDI_WINUSB; int ret = wdi_prepare_driver(deviceInfo, CStringA(folderPath), CStringA(infName), &prepareDriverOptions); if (ret != WDI_SUCCESS) { CString text; text.Format(_T("Error while preparing USB driver: %hs"), wdi_strerror(ret)); AtlMessageBox(m_hWnd, text.GetString(), IDR_MAINFRAME, MB_OK | MB_ICONERROR); return; } wdi_options_install_driver installDriverOptions = { }; installDriverOptions.hWnd = m_hWnd; installDriverOptions.install_filter_driver = false; ret = wdi_install_driver(deviceInfo, CStringA(folderPath), CStringA(infName), &installDriverOptions); if (ret != WDI_SUCCESS) { CString text; text.Format(_T("Error while installing USB driver: %hs"), wdi_strerror(ret)); AtlMessageBox(m_hWnd, text.GetString(), IDR_MAINFRAME, MB_OK | MB_ICONERROR); return; } RefreshList(); }
27.784314
132
0.694425
vividos
b04531e3ba791274c303ebc1421871f9188efc70
13,859
cpp
C++
src/App/glwidget.cpp
snousias/avatree
57493c13f491ba97bfb9d7b294629c9c296e6c57
[ "AAL" ]
8
2020-04-06T14:08:15.000Z
2022-02-15T07:48:14.000Z
src/AVATreeExtensionGUI/glwidget.cpp
snousias/avatree
57493c13f491ba97bfb9d7b294629c9c296e6c57
[ "AAL" ]
null
null
null
src/AVATreeExtensionGUI/glwidget.cpp
snousias/avatree
57493c13f491ba97bfb9d7b294629c9c296e6c57
[ "AAL" ]
4
2020-08-24T13:09:37.000Z
2021-11-08T02:26:15.000Z
#include "glwidget.h" #include "ray.h" #include "modellerToViewer.h" #include <QtWidgets> #include <QWidget> #include <QMouseEvent> #include <QOpenGLShaderProgram> #include <QCoreApplication> #include <math.h> GLWidget::GLWidget(QWidget *parent) : QOpenGLWidget(parent), m_model(NULL), m_wireframe(0), m_bbox(false), m_transparent(true) { setFocusPolicy(Qt::WheelFocus); if (m_transparent) setAttribute(Qt::WA_TranslucentBackground); //connect(&m_camera, SIGNAL(updated()), this, SLOT(update())); connect(&m_camera, &Camera::updated, this, static_cast<void (GLWidget::*)()>(&GLWidget::update)); } GLWidget::~GLWidget() { cleanup(); } void GLWidget::cleanup() { // Make sure the context is current when deleting the buffers. makeCurrent(); delete m_model; m_model = NULL; doneCurrent(); } QSize GLWidget::minimumSizeHint() const { return QSize(50, 50); } QSize GLWidget::sizeHint() const { return QSize(800, 600); } void GLWidget::saveScreenshot() { qDebug() << "Save screenshot..."; // Capture qApp->beep(); m_originalPixmap = QPixmap(); // clear image for low memory situations on embedded devices. QScreen *screen = QGuiApplication::primaryScreen(); if (screen) m_originalPixmap = screen->grabWindow(0); // Save QString format = "png"; QString initialPath = QDir::currentPath() + tr("/untitled.") + format; QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), initialPath, tr("%1 Files (*.%2);;All Files (*)") .arg(format.toUpper()) .arg(format)); if (!fileName.isEmpty()) m_originalPixmap.save(fileName, format.toLatin1().constData()); qDebug() << "Screenshot saved"; } void GLWidget::castRay(const QPoint& pos, Ray& r) { int w = width(); int h = height(); // Constuct ray in camera space // Convert selected pixel from screen space to normalized [-1, 1] cliping space QVector3D target_clipingspace(((pos.x() + 0.5) / (0.5 * w)) - 1, -(((pos.y() + 0.5) / (0.5 * h)) - 1), 0); // Convert target to camera space QVector3D target_cameraspace = m_camera.projectionMatrix().inverted() * target_clipingspace; // Convert ray from camera to model space QVector3D eye_modelspace = m_mvMatrix.inverted() * QVector3D(0, 0, 0); QVector3D target_modelspace = m_mvMatrix.inverted() * target_cameraspace; // Get the ray in model space r.set(eye_modelspace, target_modelspace); } void GLWidget::initializeGL() { // In this example the widget's corresponding top-level window can change // several times during the widget's lifetime. Whenever this happens, the // QOpenGLWidget's associated context is destroyed and a new one is created. // Therefore we have to be prepared to clean up the resources on the // aboutToBeDestroyed() signal, instead of the destructor. The emission of // the signal will be followed by an invocation of initializeGL() where we // can recreate all resources. connect(context(), &QOpenGLContext::aboutToBeDestroyed, this, &GLWidget::cleanup); initializeOpenGLFunctions(); // White backround glClearColor(0, 0, 0, m_transparent ? 0 : 1); // Enable depth test glEnable(GL_DEPTH_TEST); // Accept fragment if it closer to the camera than the former one glDepthFunc(GL_LESS); // Cull triangles which normal is not towards the camera glEnable(GL_CULL_FACE); glLineWidth(1); initShaders(); QString filename = QString(":/Models/cube.obj"); std::string modelstring = filename.toStdString(); dotObj theModel; theModel.initializeFromFile(modelstring); lungmodel.push_back(theModel); initModel(filename, Model::VIEW::FRONT); tempModel = new dotObj; // Our camera changes in this example. m_camera.calibrate(m_model->bbox()); GLfloat dist = m_camera.distance(); // Bind the program m_program.bind(); // Light position is fixed. m_program.setUniformValue("lightPosition_cameraspace", QVector3D(0, 0, 0)); m_program.setUniformValue("lightColor", QVector3D(1, 1, 1)); m_program.setUniformValue("lightPower", dist * dist); m_program.setUniformValue("isBlack", 0); m_program.release(); // Use QBasicTimer because its faster than QTimer //m_timer.start(12, this); } void GLWidget::paintGL() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Get the current world Matrix transformation from model QMatrix4x4 worldMatrix = m_model->worldMatrix(); // Get the current view Matrix transformation from camera QMatrix4x4 viewMatrix = m_camera.viewMatrix(); // Calculate modelview Matrix m_mvMatrix = viewMatrix * worldMatrix; m_program.bind(); m_program.setUniformValue("projMatrix", m_camera.projectionMatrix()); m_program.setUniformValue("mvMatrix", m_mvMatrix); m_program.setUniformValue("viewMatrix", viewMatrix); m_program.setUniformValue("modelMatrix", worldMatrix); m_program.setUniformValue("normalMatrix", m_mvMatrix.normalMatrix()); m_model->draw(&m_program, m_wireframe, m_bbox); m_program.release(); } void GLWidget::resizeGL(int w, int h) { // Calculate aspect ratio qreal aspect = qreal(w) / qreal(h ? h : 1); // Set perspective projection m_camera.setAspect(aspect); } void GLWidget::mousePressEvent(QMouseEvent *event) { std::vector<int> currentSelection; if ((event->buttons() & Qt::RightButton) && !(event->modifiers() & Qt::ControlModifier)) { Ray ray_modelspace; castRay(event->pos(), ray_modelspace); // Get a list with intersecting triangles int closestPointID = m_lastClosestPointID; QList<int> triainter; m_model->intersectWithRay(ray_modelspace, closestPointID, triainter); if (triainter.size() && closestPointID != m_lastClosestPointID) { m_lastClosestPointID = closestPointID; seedPoint = closestPointID; qDebug() << "Last clicked vertex : " << seedPoint; if (partSelectionFunctionality) { std::vector<int> v = lungmodel.at(lungmodel.size() - 1).segment_property_map_per_vertex; if (v.size() > 0){ int group = v.at(seedPoint); lungmodel.at(lungmodel.size() - 1).selectedVertices.clear(); for (int i = 0; i < v.size(); i++){ if (v.at(i) == group){ lungmodel.at(lungmodel.size() - 1).selectedVertices.push_back(i); } } } } if (brushSelectionFunctionality) { currentSelection = lungmodel.at(lungmodel.size() - 1).selectedVertices; lungmodel.at(lungmodel.size() - 1).selectedVertices.clear(); if (_brushdistanceModeIndex==0) { lungmodel.at(lungmodel.size() - 1).selector(seedPoint, _brushSizeBox); } if (_brushdistanceModeIndex==1) { lungmodel.at(lungmodel.size() - 1).selectorBasedOnCenterline(seedPoint, _brushDistance); } lungmodel.at(lungmodel.size() - 1).selectedVertices.insert(lungmodel.at(lungmodel.size() - 1).selectedVertices.end(), currentSelection.begin(), currentSelection.end()); sort(lungmodel.at(lungmodel.size() - 1).selectedVertices.begin(), lungmodel.at(lungmodel.size() - 1).selectedVertices.end()); lungmodel.at(lungmodel.size() - 1).selectedVertices.erase(unique(lungmodel.at(lungmodel.size() - 1).selectedVertices.begin(), lungmodel.at(lungmodel.size() - 1).selectedVertices.end()), lungmodel.at(lungmodel.size() - 1).selectedVertices.end()); } m_model->populateColorsPerVertexUniform(0.8); if (lungmodel.at(lungmodel.size() - 1).segment_property_map.size() > 0){ m_model->populateColorsPerVertexWithSegmentProperty(lungmodel.at(lungmodel.size() - 1).segment_property_map); } m_model->populateColorsPerVertexList(lungmodel.at(lungmodel.size() - 1).selectedVertices); //m_model->populateColorsPerVertex(closestPointID); //m_model->populateColorsWithCorrelations(closestPointID); } else { lungmodel.at(lungmodel.size() - 1).selectedVertices.clear(); m_model->populateColorsPerVertexUniform(0.8); if (lungmodel.at(lungmodel.size() - 1).segment_property_map.size() > 0){ m_model->populateColorsPerVertexWithSegmentProperty(lungmodel.at(lungmodel.size() - 1).segment_property_map); } qDebug() << "No intersection"; } } m_lastPos = QVector2D(event->localPos()); } void GLWidget::mouseMoveEvent(QMouseEvent *event) { // Mouse release position - mouse press position QVector2D diff = QVector2D(event->localPos()) - m_lastPos; if (event->buttons() & Qt::MiddleButton){ m_camera.translate(QVector3D(diff.x()/10, -diff.y()/10, 0)); } if (event->buttons() & Qt::LeftButton) { // Rotation axis is perpendicular to the mouse position difference vector QVector3D rotationAxis(diff.y(), diff.x(), 0.0); // Accelerate angular speed relative to the length of the mouse sweep qreal angle = diff.length() / 10.0; // Update rotation m_camera.rotate(QQuaternion::fromAxisAndAngle(rotationAxis.normalized(), angle)); } if (event->buttons() & Qt::RightButton) { Ray ray_modelspace; castRay(event->pos(), ray_modelspace); // Get a list with intersecting triangles int closestPointID; QList<int> triainter; m_model->intersectWithRay(ray_modelspace, closestPointID, triainter); if (triainter.size()) { if (closestPointID != m_lastClosestPointID) { m_lastClosestPointID = closestPointID; seedPoint = closestPointID; lungmodel.at(lungmodel.size() - 1).selector(seedPoint, _brushSizeBox); m_model->populateColorsPerVertexList(lungmodel.at(lungmodel.size() - 1).selectedVertices); } } else qDebug() << "No intersection"; } m_lastPos = QVector2D(event->localPos()); } void GLWidget::wheelEvent(QWheelEvent *event) { m_camera.setDistance(event->delta()); } void GLWidget::keyPressEvent(QKeyEvent *event) { int modif = mkModif(event); QString c = event->text(); unsigned char key = c.toLatin1()[0]; switch (isprint(key) ? tolower(key) : key) { case 'p': saveScreenshot(); break; case 'w': { m_wireframe = ++m_wireframe % 3; emit wireframeModeChanged((Qt::CheckState) m_wireframe); update(); } break; case 'b': { m_bbox = !m_bbox; emit bboxModeChanged(m_bbox); update(); } break; case 'c': m_camera.calibrate(m_model->bbox()); break; case 'l': { QString format = "obj"; QString initialPath = QDir::currentPath() + tr("/untitled.") + format; QString fileName = QFileDialog::getOpenFileName(this, tr("Load Model"), initialPath, tr("%1 Files (*.%2);;All Files (*)").arg(format.toUpper()).arg(format)); if (!fileName.isEmpty()) loadNewOBJ(fileName); // Our camera changes in this example. m_camera.calibrate(m_model->bbox()); } break; case 's': { QString format = "obj"; QString initialPath = QDir::currentPath() + tr("/untitled.") + format; QString fileName = QFileDialog::getSaveFileName(this, tr("Save Model"), initialPath, tr("%1 Files (*.%2);;All Files (*)").arg(format.toUpper()).arg(format)); if (!fileName.isEmpty()) saveOBJ(fileName); // Our camera changes in this example. m_camera.calibrate(m_model->bbox()); } break; } switch (event->key()) { case Qt::Key_Up: m_camera.translate(QVector3D(0, 1, 0)); break; case Qt::Key_Down: m_camera.translate(QVector3D(0, -1, 0)); break; case Qt::Key_Right: m_camera.translate(QVector3D(1, 0, 0)); break; case Qt::Key_Left: m_camera.translate(QVector3D(-1, 0, 0)); break; case Qt::Key_Escape: qApp->quit(); break; } } void GLWidget::keyReleaseEvent(QKeyEvent *event) {} int GLWidget::mkModif(QInputEvent *event) { int ctrl = event->modifiers() & Qt::ControlModifier ? 1 : 0; int shift = event->modifiers() & Qt::ShiftModifier ? 1 : 0; int alt = event->modifiers() & Qt::AltModifier ? 1 : 0; int modif = (ctrl << 0) | (shift << 1) | (alt << 2); return modif; } /* void GLWidget::timerEvent(QTimerEvent *) { // Decrease angular speed (friction) m_angularSpeed *= 0.99; // Stop rotation when speed goes below threshold if (m_angularSpeed < 0.01) { m_angularSpeed = 0.0; } else { // Update rotation m_rotation = QQuaternion::fromAxisAndAngle(m_rotationAxis, m_angle) * m_rotation; // Request an update update(); } } //*/ void GLWidget::initShaders() { if (!m_program.addShaderFromSourceFile(QOpenGLShader::Vertex, ":/vertShader.glsl")) { GLenum err = glGetError(); qDebug() << "OpenGL ERROR No:" << err; close(); } if (!m_program.addShaderFromSourceFile(QOpenGLShader::Fragment, ":/fragShader.glsl")) { GLenum err = glGetError(); qDebug() << "OpenGL ERROR No:" << err; close(); } if (!m_program.link()) { GLenum err = glGetError(); qDebug() << "OpenGL ERROR No:" << err; close(); } if (!m_program.bind()) { GLenum err = glGetError(); qDebug() << "OpenGL ERROR No:" << err; close(); } else m_program.release(); } void GLWidget::initModel(QString& filename, Model::VIEW type) { if (m_model) { qDebug() << "Model already exist!! Wrong use of this API"; // Disconnect previous signals from slots //disconnect(m_model, SIGNAL(verticesChanged()), this, SLOT(update())); //disconnect(m_model, SIGNAL(normalsChanged()), this, SLOT(update())); //disconnect(m_model, SIGNAL(colorsChanged()), this, SLOT(update())); delete m_model; m_model = NULL; } // Load the model m_model = new Model(filename, &m_program, type); // Connect new signals to slots //connect(m_model, SIGNAL(verticesChanged()), this, SLOT(update())); //connect(m_model, SIGNAL(normalsChanged()), this, SLOT(update())); //connect(m_model, SIGNAL(colorsChanged()), this, SLOT(update())); connect(m_model, &Model::verticesChanged, this, static_cast<void (GLWidget::*)()>(&GLWidget::update)); connect(m_model, &Model::normalsChanged, this, static_cast<void (GLWidget::*)()>(&GLWidget::update)); connect(m_model, &Model::colorsChanged, this, static_cast<void (GLWidget::*)()>(&GLWidget::update)); } void GLWidget::loadNewOBJ(QString& filename) { // Load the model m_model->loadNewOBJ(filename); } void GLWidget::loadNewOBJ(dotObj * input) { // Load the model m_model->loadNewOBJ(input); } void GLWidget::saveOBJ(QString& filename) { // Load the model m_model->saveOBJ(filename); }
27.829317
249
0.702576
snousias
b05048428fada06c56821557b744777672c9c008
13,745
cpp
C++
src/AES.cpp
BlazingNova/APT
ba1fadb9a44588c2285646fac4a6f001ed6e065d
[ "MIT" ]
null
null
null
src/AES.cpp
BlazingNova/APT
ba1fadb9a44588c2285646fac4a6f001ed6e065d
[ "MIT" ]
1
2018-04-20T20:30:58.000Z
2018-04-20T20:30:58.000Z
src/AES.cpp
BlazingNova/APT
ba1fadb9a44588c2285646fac4a6f001ed6e065d
[ "MIT" ]
null
null
null
//============================================================================ // Name : AES.cpp // Author : Mathew Prabakar // Version : 2.0 // Copyright : Keep your hands off my code // Description : AES Encryption and Decryption in C++ //============================================================================ #include <iostream> #include <stdio.h> #include <bitset> #include <vector> #include <string> using namespace std; class AES{ private: uint8_t sbox [256]= { 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; uint8_t sibox [256]= { 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d }; uint8_t KEY[16]; vector<uint32_t> Text; vector<uint32_t> W; vector<uint32_t> Result; int peak(uint32_t a) { int j = 0; for(j=31;j>=0;j--){ if(a&(1<<j)){ //cout<<"\n"<<j<<"\n"; break; } } return j; } uint32_t modulo(uint32_t a) { uint32_t q=0x11b; uint32_t temp=a; while(peak(temp)>=8) { // cout<<"Peak is "<<peak(temp)<<" "<<bitset<32>(temp)<<"\n"; // cout<<"MOD is "<<bitset<32>(q<<abs(8-peak(temp)))<<"\n "; temp ^=(q<<abs(8-peak(temp))); } //cout<<"BYE\n"; return temp; } void SubBytes(uint32_t state[4]) { uint8_t t[4]; for(int i=0;i<4;i++){ t[0] = sbox[ ((state[i]&0x000000f0)>>4 ) * 16 + (state[i]&0x0000000f ) ]; t[1] = sbox[ ((state[i]&0x0000f000)>>12) * 16 + ((state[i]&0x00000f00)>>8) ]; t[2] = sbox[ ((state[i]&0x00f00000)>>20) * 16 + ((state[i]&0x000f0000)>>16) ]; t[3] = sbox[ ((state[i]&0xf0000000)>>28) * 16 + ((state[i]&0x0f000000)>>24) ]; state[i] = t[3]<<24 | t[2]<<16 | t[1]<<8 | t[0]; } } void InvSubBytes(uint32_t state[4]) { uint8_t t[4]; for(int i=0;i<4;i++){ t[0] = sibox[ ((state[i]&0x000000f0)>>4 ) * 16 + (state[i]&0x0000000f ) ]; t[1] = sibox[ ((state[i]&0x0000f000)>>12) * 16 + ((state[i]&0x00000f00)>>8) ]; t[2] = sibox[ ((state[i]&0x00f00000)>>20) * 16 + ((state[i]&0x000f0000)>>16) ]; t[3] = sibox[ ((state[i]&0xf0000000)>>28) * 16 + ((state[i]&0x0f000000)>>24) ]; state[i] = t[3]<<24 | t[2]<<16 | t[1]<<8 | t[0]; } } uint32_t ShiftBytes(uint32_t a, int b) { for(int i=0;i<b;i++) { bool t=a&(1<<31); a<<=1; if(t) a|=1; } return a; } void ShiftBytes(uint32_t state[4], int b, int c) { uint32_t t[4]; for(int i=0;i<c;i++) { t[0]=state[0]&(0xff<<(24-8*b)); t[1]=state[1]&(0xff<<(24-8*b)); t[2]=state[2]&(0xff<<(24-8*b)); t[3]=state[3]&(0xff<<(24-8*b)); state[0]&=~(0xff<<(24-8*b)); state[1]&=~(0xff<<(24-8*b)); state[2]&=~(0xff<<(24-8*b)); state[3]&=~(0xff<<(24-8*b)); state[0]|=t[1]; state[1]|=t[2]; state[2]|=t[3]; state[3]|=t[0]; } } void InvShiftBytes(uint32_t state[4], int b, int c) { uint32_t t[4]; for(int i=0;i<c;i++) { t[0]=state[0]&(0xff<<(24-8*b)); t[1]=state[1]&(0xff<<(24-8*b)); t[2]=state[2]&(0xff<<(24-8*b)); t[3]=state[3]&(0xff<<(24-8*b)); state[0]&=~(0xff<<(24-8*b)); state[1]&=~(0xff<<(24-8*b)); state[2]&=~(0xff<<(24-8*b)); state[3]&=~(0xff<<(24-8*b)); state[0]|=t[3]; state[1]|=t[0]; state[2]|=t[1]; state[3]|=t[2]; } } void MixColumns(uint32_t &a) { uint8_t temp[4]; uint8_t r[4]; uint8_t b[4]; uint8_t h; for(int i=3;i>=0;i--) { temp[i]=a&(0xff); a>>=8; //cout<<hex<<(int)temp[i]<<" "; h = (temp[i]>>7) ? 0xff:0; b[i]=temp[i]<<1; b[i] ^= 0x1B & h; } r[0] = b[0] ^ temp[3] ^ temp[2] ^ b[1] ^ temp[1]; r[1] = b[1] ^ temp[0] ^ temp[3] ^ b[2] ^ temp[2]; r[2] = b[2] ^ temp[1] ^ temp[0] ^ b[3] ^ temp[3]; r[3] = b[3] ^ temp[2] ^ temp[1] ^ b[0] ^ temp[0]; a = r[0]<<24 | r[1]<<16 | r[2]<<8 | r[3]; } void InvMixColumns(uint32_t &a) { uint8_t temp[4]; uint8_t r[4]; for(int i=3;i>=0;i--) { temp[i]=a&(0xff); a>>=8; //cout<<hex<<(int)temp[i]<<" "; } r[0] = mult(temp[0],0xe)^mult(temp[1],0xb)^mult(temp[2],0xd)^mult(temp[3],0x9); r[1] = mult(temp[0],0x9)^mult(temp[1],0xe)^mult(temp[2],0xb)^mult(temp[3],0xd); r[2] = mult(temp[0],0xd)^mult(temp[1],0x9)^mult(temp[2],0xe)^mult(temp[3],0xb); r[3] = mult(temp[0],0xb)^mult(temp[1],0xd)^mult(temp[2],0x9)^mult(temp[3],0xe); a = r[0]<<24 | r[1]<<16 | r[2]<<8 | r[3]; } uint32_t mult (uint32_t a, uint32_t b) { uint32_t temp=0; for(int i=0; i<32;i++) { if(b&1){ temp ^= (a<<i); } b=b>>1; } temp = modulo(temp); return temp; } void AddRoundKey(uint32_t in[4], int index,bool rev) { //cout<<dec<<index<<" ADD\n\n"; // //cout<<hex<<in[0]<<"\n"; //cout<<hex<<in[1]<<"\n"; //cout<<hex<<in[2]<<"\n"; //cout<<hex<<in[3]<<"\n\n"; // //cout<<"PLUS \n"; //cout<<hex<<W[index+0]<<"\n"; //cout<<hex<<W[index+1]<<"\n"; //cout<<hex<<W[index+2]<<"\n"; //cout<<hex<<W[index+3]<<"\n\n"; if(!rev) for(int i=0;i<4;i++) in[i] = in[i]^W[index+i]; else for(int i=0;i<4;i++) in[i] = in[i]^W[index+3-i]; //cout<<"EQUALS \n"; //cout<<hex<<in[0]<<"\n"; //cout<<hex<<in[1]<<"\n"; //cout<<hex<<in[2]<<"\n"; //cout<<hex<<in[3]<<"\n\n"; } uint8_t mulx(uint8_t ip) { uint16_t a=ip; a=a<<1; if(a &0x100) a^=0x1b; return a; } uint8_t genRC(int i) { if(i<=1) return 0x01; else return mulx(genRC(i-1)); } uint32_t g(uint32_t a, int i) { uint32_t temp; uint32_t res; temp = ShiftBytes(a,8); //cout<<"After ROT \n"; //cout<<hex<<temp; uint8_t b[4]; //cout<<"\n"<<hex<<((temp &0xf0000000)>>28)<<" "<<((temp &0x0f000000)>>24)<<"\n"; b[0] = sbox[ ((temp&0x000000f0)>>4 ) * 16 + (temp&0x0000000f ) ]; b[1] = sbox[ ((temp&0x0000f000)>>12) * 16 + ((temp&0x00000f00)>>8) ]; b[2] = sbox[ ((temp&0x00f00000)>>20) * 16 + ((temp&0x000f0000)>>16) ]; b[3] = sbox[ ((temp&0xf0000000)>>28) * 16 + ((temp &0x0f000000)>>24) ]; //cout<<"After Sbox\n"; //cout<<hex<<(int)b[3]; res =b[3]<<24 | b[2]<<16 | b[1]<<8 | b[0]; //cout<<hex<<(int)res<<"\n"; uint32_t RC=(genRC(i/4)<<24); //cout<<hex<<(int)RC<<"\n"; return res ^ RC; } void SetIP(string str) { Text.clear(); char *myarr = new char[str.length()+1]; str.copy(myarr,str.length()); uint8_t t[4]; //cout<<char_traits<char>::length(myarr); for(unsigned i=0;i<str.length();i+=4){ // cout<<i<<" "; for(int j=0; j<4;j++){ if(i+j<str.length()) t[j] = (int)myarr[i+j]; else t[j] = 0x00; // cout<<t[j]<<" "; } Text.push_back(t[0]<<24 | t[1]<<16 | t[2]<<8 | t[3]); // cout<<"\n"; } for(unsigned i=0;i<Text.size()%4;i++) Text.push_back(0x00000000); delete myarr; } void keyexpansion() { uint32_t wt [4]; for(int i=0;i<4;i++) wt[i] = (KEY[i*4]<<24)|(KEY[i*4+1]<<16)|(KEY[i*4+2]<<8)|(KEY[i*4+3]); //cout<<hex<<(int)wt[0]<<" "<<(int)wt[1]<<" "<<(int)wt[2]<<" "<<(int)wt[3]<<"\n"; W.clear(); W.push_back(wt[0]); W.push_back(wt[1]); W.push_back(wt[2]); W.push_back(wt[3]); for(int i=3;i<43;i+=4) { uint32_t gt=g(wt[3],i+1); //cout<<hex<<gt<<"\n"; wt[0] ^= gt; wt[1] ^= wt[0]; wt[2] ^= wt[1]; wt[3] ^= wt[2]; //cout<<hex<<(int)wt[0]<<" "<<(int)wt[1]<<" "<<(int)wt[2]<<" "<<(int)wt[3]<<"\n"; W.push_back(wt[0]); W.push_back(wt[1]); W.push_back(wt[2]); W.push_back(wt[3]); } } void cypher(uint32_t in[4]) { AddRoundKey(in,0,0); for(int i=1;i<=9;i++) { SubBytes(in); //cout<<"SUB BYTES EQUALS \n"; //cout<<hex<<in[0]<<"\n"; //cout<<hex<<in[1]<<"\n"; //cout<<hex<<in[2]<<"\n"; //cout<<hex<<in[3]<<"\n\n"; ShiftBytes(in,1,1); ShiftBytes(in,2,2); ShiftBytes(in,3,3); //cout<<"ShiftBytes EQUALS \n"; //cout<<hex<<in[0]<<"\n"; //cout<<hex<<in[1]<<"\n"; //cout<<hex<<in[2]<<"\n"; //cout<<hex<<in[3]<<"\n\n"; MixColumns(in[0]); MixColumns(in[1]); MixColumns(in[2]); MixColumns(in[3]); //cout<<"MixColumns EQUALS \n"; //cout<<hex<<in[0]<<"\n"; //cout<<hex<<in[1]<<"\n"; //cout<<hex<<in[2]<<"\n"; //cout<<hex<<in[3]<<"\n\n"; AddRoundKey(in,i*4,0); } SubBytes(in); ShiftBytes(in,1,1); ShiftBytes(in,2,2); ShiftBytes(in,3,3); AddRoundKey(in,40,0); } void decypher(uint32_t in[4]) { AddRoundKey(in,40,0); for(int i=9;i>=1;i--) { //cout<<"SUB BYTES EQUALS \n"; //cout<<hex<<in[0]<<"\n"; //cout<<hex<<in[1]<<"\n"; //cout<<hex<<in[2]<<"\n"; //cout<<hex<<in[3]<<"\n\n"; InvShiftBytes(in,1,1); InvShiftBytes(in,2,2); InvShiftBytes(in,3,3); InvSubBytes(in); //cout<<"ShiftBytes EQUALS \n"; //cout<<hex<<in[0]<<"\n"; //cout<<hex<<in[1]<<"\n"; //cout<<hex<<in[2]<<"\n"; //cout<<hex<<in[3]<<"\n\n"; //cout<<"MixColumns EQUALS \n"; //cout<<hex<<in[0]<<"\n"; //cout<<hex<<in[1]<<"\n"; //cout<<hex<<in[2]<<"\n"; //cout<<hex<<in[3]<<"\n\n"; AddRoundKey(in,i*4,0); InvMixColumns(in[0]); InvMixColumns(in[1]); InvMixColumns(in[2]); InvMixColumns(in[3]); } InvShiftBytes(in,1,1); InvShiftBytes(in,2,2); InvShiftBytes(in,3,3); InvSubBytes(in); AddRoundKey(in,0,0); } public: void SetKey(string str) { char myarr[16]; str.copy(myarr,16); for(int i=0;i<16;i++) KEY[i] = (int)myarr[i]; keyexpansion(); /*cout<<"\nKEY\n"; for(int i=0;i<16;i++) cout<<hex<<(int)KEY[i]<<" "; cout<<"\n";*/ } vector<uint32_t> encrypt(string str) { SetIP(str); Result.clear(); //cout<<"\nText\n"; /* for(unsigned i=0;i<Text.size();i++){ cout<<hex<<Text[i]<<"\n"; if(i%4==3) cout<<"-------------\n"; } */ uint32_t in[4]; // cout<<Text.size()/4<<"\n"; for(unsigned i=0;i<Text.size()/4;i++) { in[0]=Text[i*4+0]; in[1]=Text[i*4+1]; in[2]=Text[i*4+2]; in[3]=Text[i*4+3]; cypher(in); /* cout<<hex<<in[0]<<"\n"; cout<<hex<<in[1]<<"\n"; cout<<hex<<in[2]<<"\n"; cout<<hex<<in[3]<<"\n"; */ Result.push_back(in[0]); Result.push_back(in[1]); Result.push_back(in[2]); Result.push_back(in[3]); } return Result; } vector<uint32_t> decrypt(vector<uint32_t> Text) { Result.clear(); for(unsigned i=0;i<Text.size();i++){ cout<<hex<<Text[i]<<"\n"; if(i%4==3) cout<<"-------------\n"; } uint32_t in[4]; // cout<<Text.size()/4<<"\n"; for(unsigned i=0;i<Text.size()/4;i++) { in[0]=Text[i*4+0]; in[1]=Text[i*4+1]; in[2]=Text[i*4+2]; in[3]=Text[i*4+3]; decypher(in); /* cout<<hex<<in[0]<<"\n"; cout<<hex<<in[1]<<"\n"; cout<<hex<<in[2]<<"\n"; cout<<hex<<in[3]<<"\n"; */ Result.push_back(in[0]); Result.push_back(in[1]); Result.push_back(in[2]); Result.push_back(in[3]); } return Result; } const vector<uint32_t> getResult() { return Result; } const uint8_t* getKey() { return KEY; } void PrintResult() { cout<<"\nRESULT "<<"\n"; for(unsigned i=0;i<Result.size();i++) cout<<hex<<Result[i]<<"\n"; } void PrintKey() { cout<<"KEY\n"; for(int i=0;i<16;i++) cout<<hex<<(int)KEY[i]<<" "; } }; // CLASS USAGE /* int main() { vector<uint32_t> Enc; AES obj; // SET THE KEY obj.SetKey("Thats my Kung Fu"); obj.PrintKey(); //ENCRYPT Enc=obj.encrypt("Two One Nine Two"); obj.PrintResult(); //DECRYPT obj.decrypt(Enc); obj.PrintResult(); return 0; }*/
22.870216
98
0.549218
BlazingNova
b0512767d9caf48c7a0ad86678a4225cdd9dd711
2,386
cpp
C++
AtCoder/Educational_DP_Contest/F.cpp
arlechann/atcoder
1af08efa6d3a0e8c75e4eaf13e1eda994820b9e2
[ "CC0-1.0" ]
null
null
null
AtCoder/Educational_DP_Contest/F.cpp
arlechann/atcoder
1af08efa6d3a0e8c75e4eaf13e1eda994820b9e2
[ "CC0-1.0" ]
null
null
null
AtCoder/Educational_DP_Contest/F.cpp
arlechann/atcoder
1af08efa6d3a0e8c75e4eaf13e1eda994820b9e2
[ "CC0-1.0" ]
null
null
null
#include <algorithm> #include <boost/optional.hpp> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <tuple> #include <type_traits> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++) #define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++) #define EACH(e, a) for(auto&& e : a) #define ALL(a) std::begin(a), std::end(a) #define RALL(a) std::rbegin(a), std::rend(a) #define FILL(a, n) memset((a), n, sizeof(a)) #define FILLZ(a) FILL(a, 0) #define INT(x) (static_cast<int>(x)) using namespace std; using ll = long long; using VI = vector<int>; using VI2D = vector<vector<int>>; constexpr int INF = 2e9; constexpr double EPS = 1e-10; constexpr double PI = acos(-1.0); constexpr int dx[] = {-1, 0}; constexpr int dy[] = {0, -1}; template <typename T> constexpr int sign(T x) { return x < 0 ? -1 : x > 0 ? 1 : 0; } template <> constexpr int sign(double x) { return x < -EPS ? -1 : x > EPS ? 1 : 0; } template <typename T, typename U> constexpr bool chmax(T& m, U x) { if(m < x) { m = x; return true; } return false; } template <typename T, typename U> constexpr bool chmin(T& m, U x) { if(m > x) { m = x; return true; } return false; } template <typename T> constexpr T square(T x) { return x * x; } int main() { string s, t; cin >> s; cin >> t; int n, m; n = s.size(); m = t.size(); VI2D dp(n, VI(m, 0)); vector<vector<pair<int, int>>> prev( n, vector<pair<int, int>>(m, make_pair(-1, -1))); REP(i, n) { REP(j, m) { if(s[i] == t[j]) { dp[i][j] = ((i > 0 && j > 0) ? dp[i - 1][j - 1] : 0) + 1; prev[i][j] = make_pair(i - 1, j - 1); continue; } REP(k, 2) { if(i + dy[k] < 0 || j + dx[k] < 0) { continue; } if(chmax(dp[i][j], dp[i + dy[k]][j + dx[k]])) { prev[i][j] = make_pair(i + dy[k], j + dx[k]); } } } } int i = n - 1; int j = m - 1; string result = ""; while(i >= 0 && j >= 0) { auto p = prev[i][j]; if(s[i] == t[j]) { result = s[i] + move(result); } i = p.first; j = p.second; } cout << result << endl; return 0; }
19.398374
76
0.564543
arlechann
b0513d443f9110a3bfb8ae4276f086a2bfaad699
6,499
cpp
C++
Strings/AhoCorasick.cpp
NhatMinh0208/CP-Library
4d174b01a569106d2d7ad0fa5e3594175e97de31
[ "MIT" ]
null
null
null
Strings/AhoCorasick.cpp
NhatMinh0208/CP-Library
4d174b01a569106d2d7ad0fa5e3594175e97de31
[ "MIT" ]
null
null
null
Strings/AhoCorasick.cpp
NhatMinh0208/CP-Library
4d174b01a569106d2d7ad0fa5e3594175e97de31
[ "MIT" ]
null
null
null
#ifndef CPL_TEMPLATE #define CPL_TEMPLATE /* Normie's Aho-Corasick, version 2.0. This data structure receives a set of strings and builds 2 trees: +) A trie of the strings +) A suffix link tree of the strings The implementation is kept as barebones as possible to promote flexibility. Tested with https://codeforces.com/problemset/problem/1202/E */ // Standard library in one include. #include <bits/stdc++.h> using namespace std; // ordered_set library. #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set(el) tree<el,null_type,less<el>,rb_tree_tag,tree_order_statistics_node_update> // AtCoder library. (Comment out these two lines if you're not submitting in AtCoder.) (Or if you want to use it in other judges, run expander.py first.) //#include <atcoder/all> //using namespace atcoder; //Pragmas (Comment out these three lines if you're submitting in szkopul or USACO.) #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast,unroll-loops,tree-vectorize") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") //File I/O. #define FILE_IN "cseq.inp" #define FILE_OUT "cseq.out" #define ofile freopen(FILE_IN,"r",stdin);freopen(FILE_OUT,"w",stdout) //Fast I/O. #define fio ios::sync_with_stdio(0);cin.tie(0) #define nfio cin.tie(0) #define endl "\n" //Order checking. #define ord(a,b,c) ((a>=b)and(b>=c)) //min/max redefines, so i dont have to resolve annoying compile errors. #define min(a,b) (((a)<(b))?(a):(b)) #define max(a,b) (((a)>(b))?(a):(b)) // Fast min/max assigns to use with AVX. // Requires g++ 9.2.0. template<typename T> __attribute__((always_inline)) void chkmin(T& a, const T& b) { a=(a<b)?a:b; } template<typename T> __attribute__((always_inline)) void chkmax(T& a, const T& b) { a=(a>b)?a:b; } //Constants. #define MOD (ll(998244353)) #define MAX 300001 #define mag 320 const long double PI=3.14159265358979; //Pairs and 3-pairs. #define p1 first #define p2 second.first #define p3 second.second #define fi first #define se second #define pii(element_type) pair<element_type,element_type> #define piii(element_type) pair<element_type,pii(element_type)> //Quick power of 2. #define pow2(x) (ll(1)<<x) //Short for-loops. #define ff(i,__,___) for(int i=__;i<=___;i++) #define rr(i,__,___) for(int i=__;i>=___;i--) //Typedefs. #define bi BigInt typedef long long ll; typedef long double ld; typedef short sh; // Binpow and stuff ll BOW(ll a, ll x, ll p) { if (!x) return 1; ll res=BOW(a,x/2,p); res*=res; res%=p; if (x%2) res*=a; return res%p; } ll INV(ll a, ll p) { return BOW(a,p-2,p); } //---------END-------// #endif namespace CP_Library { const int ALPHA_SZ=26; const int SHIFT_CONST=-97; struct Node { unordered_map<int,int> ch_trie; vector<int> ch2_trie; int p_trie; vector<int> ch_suff; int p_suff=0; vector<int> leaf; int ch; int nxt[ALPHA_SZ]; Node(int par=0, int _ch=0) { p_trie=par; ch=_ch; } }; struct Aho_Corasick { vector<Node*> trie; vector<int> str_store; Aho_Corasick() { trie.push_back(new Node); trie.push_back(new Node); } void add_str(string s) { // Adds a string to the Aho_Corasick trie int u=1; for (auto g : s) { if (trie[u]->ch_trie[g+SHIFT_CONST]==0) { trie.push_back(new Node(u, g+SHIFT_CONST)); trie[u]->ch_trie[g+SHIFT_CONST]=trie.size()-1; } u=trie[u]->ch_trie[g+SHIFT_CONST]; } trie[u]->leaf.push_back(str_store.size()); str_store.push_back(u); } void build_suff() { // Finalizes the trie and builds the suffix tree vector<int> dq; dq.push_back(1); int u,v; for (int j=0;j<dq.size();j++) { u=dq[j]; // cout<<"suflink "<<u<<endl; if (u==1) { trie[u]->p_suff=u; for (int i=0;i<ALPHA_SZ;i++) { if (trie[u]->ch_trie[i]) trie[u]->nxt[i]=trie[u]->ch_trie[i]; else trie[u]->nxt[i]=1; } } else if (trie[u]->p_trie==1) { trie[u]->p_suff=1; trie[1]->ch_suff.push_back(u); for (int i=0;i<ALPHA_SZ;i++) { if (trie[u]->ch_trie[i]) trie[u]->nxt[i]=trie[u]->ch_trie[i]; else trie[u]->nxt[i]=trie[1]->nxt[i]; } } else { v=trie[trie[trie[u]->p_trie]->p_suff]->nxt[trie[u]->ch]; trie[u]->p_suff=v; trie[v]->ch_suff.push_back(u); for (int i=0;i<ALPHA_SZ;i++) { if (trie[u]->ch_trie[i]) trie[u]->nxt[i]=trie[u]->ch_trie[i]; else trie[u]->nxt[i]=trie[trie[u]->p_suff]->nxt[i]; } } // cout<<"result: "<<u<<' '<<trie[u]->p_suff<<endl; // for (int i=97;i<123;i++) { // cout<<"trans "<<char(i)<<' '<<trie[u]->nxt[i]<<endl; // } for (auto g : trie[u]->ch_trie) { // cout<<char(g.fi)<<' '<<g.se<<endl; if (g.se) dq.push_back(g.se); } trie[u]->ch_trie.clear(); // cout<<endl; } } void debug() { for (int i=1;i<trie.size();i++) { cout<<"Debugging node "<<i<<endl; cout<<trie[i]->ch<<' '<<trie[i]->p_trie<<' '<<trie[i]->p_suff<<endl; for (int j=0;j<26;j++) { cout<<char(j-SHIFT_CONST)<<' '<<trie[i]->nxt[j]<<' '; } cout<<endl; } } }; } // Sample usage follows. // Source: https://codeforces.com/contest/1202/submission/132412398 using namespace CP_Library; Aho_Corasick ah1,ah2; ll r1[200011]; ll r2[200011]; ll dep[200011]; string s[200011]; string tr; ll n,m,i,j,k,t,t1,u,v,a,b; void dfs1(int x) { dep[x]=dep[ah1.trie[x]->p_suff]+ah1.trie[x]->leaf.size(); for (auto g : ah1.trie[x]->ch_suff) dfs1(g); // cout<<"dfs1 "<<x<<' '<<dep[x]<<endl; } void dfs2(int x) { dep[x]=dep[ah2.trie[x]->p_suff]+ah2.trie[x]->leaf.size(); for (auto g : ah2.trie[x]->ch_suff) dfs2(g); } int main() { fio; cin>>tr; m=tr.size(); cin>>n; for (i=0;i<n;i++) { cin>>s[i]; } for (i=0;i<n;i++) { ah1.add_str(s[i]); } ah1.build_suff(); dfs1(1); u=1; // ah1.debug(); for (i=0;i<m-1;i++) { // cout<<u<<endl; v=int(tr[i]+SHIFT_CONST); // cout<<v<<endl; u=ah1.trie[u]->nxt[v]; r1[i]=dep[u]; // cout<<u<<' '<<dep[u]<<endl; } for (i=0;i<n;i++) { reverse(s[i].begin(),s[i].end()); } reverse(tr.begin(),tr.end()); for (i=0;i<n;i++) { ah2.add_str(s[i]); } ah2.build_suff(); dfs2(1); u=1; for (i=0;i<m-1;i++) { // cout<<u<<endl; v=int(tr[i]+SHIFT_CONST); // cout<<v<<endl; u=ah2.trie[u]->nxt[v]; r2[i]=dep[u]; // cout<<u<<' '<<dep[u]<<endl; } ll res=0; for (i=0;i<m-1;i++) { res+=r1[i]*r2[m-2-i]; // cout<<r1[i]<<' '<<r2[i]<<endl; } // if (res==1815024) cout<<n<<' '<<m<<' '<<ah2.trie.size()<<endl; cout<<res; }
22.333333
153
0.613325
NhatMinh0208
b053f3dc61b03fc60286aed7d619458ac382da19
442
hpp
C++
includes/SpecialFood.hpp
tiboitel/Nibbler
f95341206d6750d2b85deb4ee6bb789234229201
[ "MIT" ]
null
null
null
includes/SpecialFood.hpp
tiboitel/Nibbler
f95341206d6750d2b85deb4ee6bb789234229201
[ "MIT" ]
null
null
null
includes/SpecialFood.hpp
tiboitel/Nibbler
f95341206d6750d2b85deb4ee6bb789234229201
[ "MIT" ]
null
null
null
#ifndef SPECIALFOOD_HPP # define SPECIALFOOD_HPP # include <Food.hpp> class SpecialFood : public Food { public: SpecialFood(int x, int y, size_t score = 200, size_t lifespan = 10000); ~SpecialFood(); SpecialFood (SpecialFood const &rhs); SpecialFood &operator=(SpecialFood const &rhs); size_t getLifeSpan() const; void setLifeSpan(size_t val); private: SpecialFood(); size_t _lifeSpan; //lifespan in ms }; #endif
20.090909
73
0.71267
tiboitel
b057f910197a2efb139b6ef20d02a1bfb1b9afee
4,748
cc
C++
src/native/VMem.cc
jappavoo/EbbRT
b0aacb6cafebd2b3e43b6636f1325e0ae10d7fba
[ "BSL-1.0" ]
67
2015-02-26T17:55:43.000Z
2022-01-06T09:30:59.000Z
src/native/VMem.cc
jmcadden/EbbRT
d213abd76f3cc065755170876cc269d97591abd3
[ "BSL-1.0" ]
146
2015-02-11T16:39:58.000Z
2021-02-21T21:27:09.000Z
src/native/VMem.cc
jmcadden/EbbRT
d213abd76f3cc065755170876cc269d97591abd3
[ "BSL-1.0" ]
12
2015-02-04T05:49:54.000Z
2019-08-07T10:20:09.000Z
// Copyright Boston University SESA Group 2013 - 2014. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include "VMem.h" #include <atomic> #include <cinttypes> #include <cstdint> #include <cstring> #include "../Align.h" #include "CpuAsm.h" #include "Debug.h" #include "E820.h" #include "EarlyPageAllocator.h" #include "PageAllocator.h" namespace { ebbrt::ExplicitlyConstructed<ebbrt::vmem::Pte> page_table_root; } void ebbrt::vmem::Init() { page_table_root.construct(); } void ebbrt::vmem::EarlyMapMemory(uint64_t addr, uint64_t length) { auto aligned_addr = align::Down(addr, pmem::kPageSize); auto aligned_length = align::Up(length + (addr - aligned_addr), pmem::kPageSize); TraversePageTable( GetPageTableRoot(), aligned_addr, aligned_addr + aligned_length, 0, 4, [=](Pte& entry, uint64_t base_virt, size_t level) { if (entry.Present()) { kassert(entry.Addr(level > 0) == base_virt); return; } entry.Set(base_virt, level > 0); std::atomic_thread_fence(std::memory_order_release); asm volatile("invlpg (%[addr])" : : [addr] "r"(base_virt) : "memory"); }, [=](Pte& entry) { auto page = early_page_allocator::AllocatePage(); auto page_addr = page.ToAddr(); new (reinterpret_cast<void*>(page_addr)) Pte[512]; entry.SetNormal(page_addr); return true; }); } void ebbrt::vmem::EarlyUnmapMemory(uint64_t addr, uint64_t length) { auto aligned_addr = align::Down(addr, pmem::kPageSize); auto aligned_length = align::Up(length + (addr - aligned_addr), pmem::kPageSize); TraversePageTable( GetPageTableRoot(), aligned_addr, aligned_addr + aligned_length, 0, 4, [=](Pte& entry, uint64_t base_virt, size_t level) { kassert(entry.Present()); entry.SetPresent(false); std::atomic_thread_fence(std::memory_order_release); asm volatile("invlpg (%[addr])" : : [addr] "r"(base_virt) : "memory"); }, [=](Pte& entry) { kprintf("Asked to unmap memory that wasn't mapped!\n"); kabort(); return false; }); } void ebbrt::vmem::MapMemory(Pfn vfn, Pfn pfn, uint64_t length) { auto pte_root = Pte(ReadCr3()); auto vaddr = vfn.ToAddr(); TraversePageTable(pte_root, vaddr, vaddr + length, 0, 4, [=](Pte& entry, uint64_t base_virt, size_t level) { kassert(!entry.Present()); entry.Set(pfn.ToAddr() + (base_virt - vaddr), level > 0); std::atomic_thread_fence(std::memory_order_release); }, [](Pte& entry) { auto page = page_allocator->Alloc(); kbugon(page == Pfn::None()); auto page_addr = page.ToAddr(); new (reinterpret_cast<void*>(page_addr)) Pte[512]; entry.SetNormal(page_addr); return true; }); } // traverses per core page table and backs vaddr with physical pages // in pfn void ebbrt::vmem::MapMemoryLarge(uintptr_t vaddr, Pfn pfn, uint64_t length) { auto pte_root = Pte(ReadCr3()); TraversePageTable( pte_root, vaddr, vaddr + length, 0, 4, [=](Pte& entry, uint64_t base_virt, size_t level) { kassert(!entry.Present()); entry.Set(pfn.ToAddr() + (base_virt - vaddr), level > 0); std::atomic_thread_fence(std::memory_order_release); }, [](Pte& entry) { auto page = page_allocator->Alloc(); kbugon(page == Pfn::None()); auto page_addr = page.ToAddr(); new (reinterpret_cast<void*>(page_addr)) Pte[512]; entry.SetNormal(page_addr); return true; }); } void ebbrt::vmem::EnableRuntimePageTable() { asm volatile("mov %[page_table], %%cr3" : : [page_table] "r"(GetPageTableRoot())); } void ebbrt::vmem::ApInit(size_t index) { EnableRuntimePageTable(); Pte ap_pte_root; auto nid = Cpu::GetByIndex(index)->nid(); auto& p_allocator = (*PageAllocator::allocators)[nid.val()]; auto page = p_allocator.Alloc(0, nid); kbugon(page == Pfn::None(), "Failed to allocate page for initial page tables\n"); auto page_addr = page.ToAddr(); std::memcpy(reinterpret_cast<void*>(page_addr), reinterpret_cast<void*>(GetPageTableRoot().Addr(false)), 4096); ap_pte_root.SetNormal(page_addr); asm volatile("mov %[page_table], %%cr3" : : [page_table] "r"(ap_pte_root)); } ebbrt::vmem::Pte& ebbrt::vmem::GetPageTableRoot() { return *page_table_root; }
35.432836
79
0.609941
jappavoo
b059fcafa945380b1b4df080e5ee6682f2127d55
997
hpp
C++
include/dracosha/validator/utils/adjust_storable_ignore.hpp
evgeniums/cpp-validator
e4feccdce19c249369ddb631571b60613926febd
[ "BSL-1.0" ]
27
2020-09-18T13:45:33.000Z
2022-03-16T21:14:37.000Z
include/dracosha/validator/utils/adjust_storable_ignore.hpp
evgeniums/cpp-validator
e4feccdce19c249369ddb631571b60613926febd
[ "BSL-1.0" ]
7
2020-08-07T21:48:14.000Z
2021-01-14T12:25:37.000Z
include/dracosha/validator/utils/adjust_storable_ignore.hpp
evgeniums/cpp-validator
e4feccdce19c249369ddb631571b60613926febd
[ "BSL-1.0" ]
1
2021-03-30T09:17:58.000Z
2021-03-30T09:17:58.000Z
/** @copyright Evgeny Sidorov 2020 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ /****************************************************************************/ /** @file validator/utils/adjust_storable_ignore.hpp * * Defines adjust_storable_ignore. * */ /****************************************************************************/ #ifndef DRACOSHA_VALIDATOR_ADJUST_STORABLE_IGNORE_HPP #define DRACOSHA_VALIDATOR_ADJUST_STORABLE_IGNORE_HPP #include <dracosha/validator/config.hpp> DRACOSHA_VALIDATOR_NAMESPACE_BEGIN //------------------------------------------------------------- /** * @brief Struct to be used as a base struct for objects that must be copied as is to adjust_storable_t wrapper. */ struct adjust_storable_ignore{}; //------------------------------------------------------------- DRACOSHA_VALIDATOR_NAMESPACE_END #endif // DRACOSHA_VALIDATOR_ADJUST_STORABLE_IGNORE_HPP
26.236842
112
0.57673
evgeniums
b05aea2b808eb84be88a18b8efded02a244b1b12
4,551
cpp
C++
kari_localization/src/mesh.cpp
karrykarry/kari_localization
e81e1fda587958e87771e149b5ca3769eae891fc
[ "MIT" ]
null
null
null
kari_localization/src/mesh.cpp
karrykarry/kari_localization
e81e1fda587958e87771e149b5ca3769eae891fc
[ "MIT" ]
null
null
null
kari_localization/src/mesh.cpp
karrykarry/kari_localization
e81e1fda587958e87771e149b5ca3769eae891fc
[ "MIT" ]
null
null
null
//meshビューア #include <ros/ros.h> #include <stdio.h> #include <iostream> #include <string> #include <pcl/point_types.h> #include <pcl/io/pcd_io.h> #include <pcl/kdtree/kdtree_flann.h> #include <pcl/features/normal_3d.h> #include <pcl/surface/gp3.h> #include <pcl/visualization/pcl_visualizer.h> #include <pcl/io/vtk_io.h> #include <pcl/PolygonMesh.h> #include <boost/thread/thread.hpp> #include <sensor_msgs/PointCloud.h> #include <sensor_msgs/PointCloud2.h> #include <geometry_msgs/Point.h> #include <pcl_conversions/pcl_conversions.h> #include <tf/transform_broadcaster.h> #include <local_tool/filters.hpp> #include <local_tool/mathematics.hpp> #include <local_tool/registration.hpp> using namespace std; class Mesh { private: ros::NodeHandle n; ros::Rate r; ros::Publisher input_pub; ros::Publisher output_pub; double MU; double M_NEIGHBORS;//max double G_RADIUS; double K_SEARCH; string file_input; bool NORMAL_C; pcl::PolygonMesh::Ptr triangles; pcl::PointCloud<pcl::PointXYZ>::Ptr cloud ; public: Mesh(ros::NodeHandle& n); void create_polygon(void); void vis_polygon(void); }; Mesh::Mesh(ros::NodeHandle &n) : r(10) { n.getParam("mesh_mu",MU); n.getParam("mesh_max_neighbors",M_NEIGHBORS); n.getParam("mesh_radius",G_RADIUS); n.getParam("mesh_normalconsistency",NORMAL_C); n.getParam("normal_ksearch",K_SEARCH); n.getParam("input/cloud",file_input); input_pub = n.advertise<sensor_msgs::PointCloud2>("/input_cloud", 10); output_pub = n.advertise<sensor_msgs::PointCloud2>("/output_cloud", 10); triangles.reset (new pcl::PolygonMesh()); cloud.reset (new pcl::PointCloud<pcl::PointXYZ>); } void Mesh::create_polygon(void){ pcl::PointCloud<pcl::PointXYZI>::Ptr output_cloud (new pcl::PointCloud<pcl::PointXYZI>); // Load input file into a PointCloud<T> with an appropriate type pcl::PCLPointCloud2 cloud_blob; pcl::io::loadPCDFile(file_input, cloud_blob); pcl::fromPCLPointCloud2 (cloud_blob, *cloud); //* the data should be available in cloud // Normal estimation* pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> nor; pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>); pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ>); tree->setInputCloud (cloud); nor.setInputCloud (cloud); nor.setSearchMethod (tree); nor.setKSearch (K_SEARCH); nor.compute (*normals); //* normals should not contain the point normals + surface curvatures // Concatenate the XYZ and normal fields* pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals (new pcl::PointCloud<pcl::PointNormal>); pcl::concatenateFields (*cloud, *normals, *cloud_with_normals); //* cloud_with_normals = cloud + normals // Create search tree* pcl::search::KdTree<pcl::PointNormal>::Ptr tree2 (new pcl::search::KdTree<pcl::PointNormal>); tree2->setInputCloud (cloud_with_normals); // Initialize objects pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3; // Set the maximum distance between connected points (maximum edge length) // gp3.setSearchRadius (0.025); gp3.setSearchRadius (G_RADIUS); // Set typical values for the parameters gp3.setMu (MU);//defalut 2.5 gp3.setMaximumNearestNeighbors (M_NEIGHBORS); gp3.setMaximumSurfaceAngle(M_PI/4); // 45 degrees gp3.setMinimumAngle(M_PI/18); // 10 degrees gp3.setMaximumAngle(2*M_PI/3); // 120 degrees gp3.setNormalConsistency(NORMAL_C); // gp3.setNormalConsistency(true); // Get result gp3.setInputCloud (cloud_with_normals); gp3.setSearchMethod (tree2); gp3.reconstruct (*triangles); // Additional vertex information std::vector<int> parts = gp3.getPartIDs(); std::vector<int> states = gp3.getPointStates(); cout <<triangles->polygons.size() <<"triangles created" << endl; //ros // pcl::fromPCLPointCloud2 (triangles->cloud, *output_cloud); // sensor_msgs::PointCloud2 pc, pc2; // pcl_msgs::PolygonMesh pc3; // pcl::toROSMsg(*cloud, pc); // pcl::toROSMsg(*output_cloud, pc2); // pc3.cloud = pc2; } void Mesh::vis_polygon(void) { // 点群のビューア pcl::visualization::PCLVisualizer viewer("Cloud Viewer"); viewer.setBackgroundColor (0.0, 0.2, 0.6); viewer.addPolygonMesh(*triangles); while (!viewer.wasStopped ()) { viewer.spinOnce(10); boost::this_thread::sleep (boost::posix_time::microseconds (100000)); } } int main(int argc, char** argv){ ros::init(argc, argv, "mesh"); ros::NodeHandle n; cout<<"-------mesh ok--------"<<endl; Mesh mesh(n); mesh.create_polygon(); mesh.vis_polygon(); ros::spin(); return 0; }
23.703125
99
0.725775
karrykarry
b05b855e9987739443d02d6f052641352b9d86cb
17,149
cpp
C++
src/entity/RDimensionEntity.cpp
ouxianghui/ezcam
195fb402202442b6d035bd70853f2d8c3f615de1
[ "MIT" ]
12
2021-03-26T03:23:30.000Z
2021-12-31T10:05:44.000Z
src/entity/RDimensionEntity.cpp
15831944/ezcam
195fb402202442b6d035bd70853f2d8c3f615de1
[ "MIT" ]
null
null
null
src/entity/RDimensionEntity.cpp
15831944/ezcam
195fb402202442b6d035bd70853f2d8c3f615de1
[ "MIT" ]
9
2021-06-23T08:26:40.000Z
2022-01-20T07:18:10.000Z
/** * Copyright (c) 2011-2016 by Andrew Mustun. All rights reserved. * * This file is part of the QCAD project. * * QCAD is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * QCAD is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with QCAD. */ #include "RDimensionEntity.h" #include "RExporter.h" #include "RStorage.h" RPropertyTypeId RDimensionEntity::PropertyCustom; RPropertyTypeId RDimensionEntity::PropertyHandle; RPropertyTypeId RDimensionEntity::PropertyProtected; RPropertyTypeId RDimensionEntity::PropertyType; RPropertyTypeId RDimensionEntity::PropertyBlock; RPropertyTypeId RDimensionEntity::PropertyLayer; RPropertyTypeId RDimensionEntity::PropertyLinetype; RPropertyTypeId RDimensionEntity::PropertyLinetypeScale; RPropertyTypeId RDimensionEntity::PropertyLineweight; RPropertyTypeId RDimensionEntity::PropertyColor; RPropertyTypeId RDimensionEntity::PropertyDisplayedColor; RPropertyTypeId RDimensionEntity::PropertyDrawOrder; RPropertyTypeId RDimensionEntity::PropertyDefinitionPointX; RPropertyTypeId RDimensionEntity::PropertyDefinitionPointY; RPropertyTypeId RDimensionEntity::PropertyDefinitionPointZ; RPropertyTypeId RDimensionEntity::PropertyMiddleOfTextX; RPropertyTypeId RDimensionEntity::PropertyMiddleOfTextY; RPropertyTypeId RDimensionEntity::PropertyMiddleOfTextZ; RPropertyTypeId RDimensionEntity::PropertyText; RPropertyTypeId RDimensionEntity::PropertyUpperTolerance; RPropertyTypeId RDimensionEntity::PropertyLowerTolerance; RPropertyTypeId RDimensionEntity::PropertyLinearFactor; RPropertyTypeId RDimensionEntity::PropertyDimScale; RPropertyTypeId RDimensionEntity::PropertyDimBlockName; RPropertyTypeId RDimensionEntity::PropertyAutoTextPos; RPropertyTypeId RDimensionEntity::PropertyFontName; //RPropertyTypeId RDimensionEntity::PropertyHeight; //RPropertyTypeId RDimensionEntity::PropertyAngle; //RPropertyTypeId RDimensionEntity::PropertyLineSpacingFactor; //RPropertyTypeId RDimensionEntity::PropertyHAlign; //RPropertyTypeId RDimensionEntity::PropertyVAlign; RPropertyTypeId RDimensionEntity::PropertyAutoLabel; RPropertyTypeId RDimensionEntity::PropertyMeasuredValue; RDimensionEntity::RDimensionEntity(RDocument* document) : REntity(document) { } RDimensionEntity::~RDimensionEntity() { } void RDimensionEntity::init() { RDimensionEntity::PropertyCustom.generateId(typeid(RDimensionEntity), RObject::PropertyCustom); RDimensionEntity::PropertyHandle.generateId(typeid(RDimensionEntity), RObject::PropertyHandle); RDimensionEntity::PropertyProtected.generateId(typeid(RDimensionEntity), RObject::PropertyProtected); RDimensionEntity::PropertyType.generateId(typeid(RDimensionEntity), REntity::PropertyType); RDimensionEntity::PropertyBlock.generateId(typeid(RDimensionEntity), REntity::PropertyBlock); RDimensionEntity::PropertyLayer.generateId(typeid(RDimensionEntity), REntity::PropertyLayer); RDimensionEntity::PropertyLinetype.generateId(typeid(RDimensionEntity), REntity::PropertyLinetype); RDimensionEntity::PropertyLinetypeScale.generateId(typeid(RDimensionEntity), REntity::PropertyLinetypeScale); RDimensionEntity::PropertyLineweight.generateId(typeid(RDimensionEntity), REntity::PropertyLineweight); RDimensionEntity::PropertyColor.generateId(typeid(RDimensionEntity), REntity::PropertyColor); RDimensionEntity::PropertyDisplayedColor.generateId(typeid(RDimensionEntity), REntity::PropertyDisplayedColor); RDimensionEntity::PropertyDrawOrder.generateId(typeid(RDimensionEntity), REntity::PropertyDrawOrder); RDimensionEntity::PropertyText.generateId(typeid(RDimensionEntity), "", QT_TRANSLATE_NOOP("REntity", "Label")); RDimensionEntity::PropertyUpperTolerance.generateId(typeid(RDimensionEntity), QT_TRANSLATE_NOOP("REntity", "Tolerance"), QT_TRANSLATE_NOOP("REntity", "Upper Limit")); RDimensionEntity::PropertyLowerTolerance.generateId(typeid(RDimensionEntity), QT_TRANSLATE_NOOP("REntity", "Tolerance"), QT_TRANSLATE_NOOP("REntity", "Lower Limit")); RDimensionEntity::PropertyDefinitionPointX.generateId(typeid(RDimensionEntity), QT_TRANSLATE_NOOP("REntity", "Definition Point"), QT_TRANSLATE_NOOP("REntity", "X")); RDimensionEntity::PropertyDefinitionPointY.generateId(typeid(RDimensionEntity), QT_TRANSLATE_NOOP("REntity", "Definition Point"), QT_TRANSLATE_NOOP("REntity", "Y")); RDimensionEntity::PropertyDefinitionPointZ.generateId(typeid(RDimensionEntity), QT_TRANSLATE_NOOP("REntity", "Definition Point"), QT_TRANSLATE_NOOP("REntity", "Z")); RDimensionEntity::PropertyMiddleOfTextX.generateId(typeid(RDimensionEntity), QT_TRANSLATE_NOOP("REntity", "Text Position"), QT_TRANSLATE_NOOP("REntity", "X")); RDimensionEntity::PropertyMiddleOfTextY.generateId(typeid(RDimensionEntity), QT_TRANSLATE_NOOP("REntity", "Text Position"), QT_TRANSLATE_NOOP("REntity", "Y")); RDimensionEntity::PropertyMiddleOfTextZ.generateId(typeid(RDimensionEntity), QT_TRANSLATE_NOOP("REntity", "Text Position"), QT_TRANSLATE_NOOP("REntity", "Z")); // RDimensionEntity::PropertyFontName.generateId(typeid(RDimensionEntity), "", QT_TRANSLATE_NOOP("REntity", "Font")); // RDimensionEntity::PropertyHeight.generateId(typeid(RDimensionEntity), "", QT_TRANSLATE_NOOP("REntity", "Height")); // RDimensionEntity::PropertyAngle.generateId(typeid(RDimensionEntity), "", QT_TRANSLATE_NOOP("REntity", "Angle")); // RDimensionEntity::PropertyLineSpacingFactor.generateId(typeid(RDimensionEntity), "", QT_TRANSLATE_NOOP("REntity", "Line Spacing")); // RDimensionEntity::PropertyHAlign.generateId(typeid(RDimensionEntity), QT_TRANSLATE_NOOP("REntity", "Alignment"), QT_TRANSLATE_NOOP("REntity", "Horizontal")); // RDimensionEntity::PropertyVAlign.generateId(typeid(RDimensionEntity), QT_TRANSLATE_NOOP("REntity", "Alignment"), QT_TRANSLATE_NOOP("REntity", "Vertical")); RDimensionEntity::PropertyAutoLabel.generateId(typeid(RDimensionEntity), "", QT_TRANSLATE_NOOP("REntity", "Auto Label")); RDimensionEntity::PropertyMeasuredValue.generateId(typeid(RDimensionEntity), "", QT_TRANSLATE_NOOP("REntity", "Measured Value")); RDimensionEntity::PropertyLinearFactor.generateId(typeid(RDimensionEntity), "", QT_TRANSLATE_NOOP("REntity", "Linear Factor")); RDimensionEntity::PropertyDimScale.generateId(typeid(RDimensionEntity), "", QT_TRANSLATE_NOOP("REntity", "Scale")); RDimensionEntity::PropertyDimBlockName.generateId(typeid(RDimensionEntity), "", QT_TRANSLATE_NOOP("REntity", "Block Name")); RDimensionEntity::PropertyAutoTextPos.generateId(typeid(RDimensionEntity), "", QT_TRANSLATE_NOOP("REntity", "Auto Label Position")); } bool RDimensionEntity::setProperty(RPropertyTypeId propertyTypeId, const QVariant& value, RTransaction* transaction) { bool ret = REntity::setProperty(propertyTypeId, value, transaction); ret = ret || RObject::setMember(getData().definitionPoint.x, value, PropertyDefinitionPointX == propertyTypeId); ret = ret || RObject::setMember(getData().definitionPoint.y, value, PropertyDefinitionPointY == propertyTypeId); ret = ret || RObject::setMember(getData().definitionPoint.z, value, PropertyDefinitionPointZ == propertyTypeId); if (RObject::setMember(getData().textPositionCenter.x, value, PropertyMiddleOfTextX == propertyTypeId)) { ret = true; getData().autoTextPos = false; getData().textPositionSide = RVector::invalid; //getData().updateFromTextPosition(); } if (RObject::setMember(getData().textPositionCenter.y, value, PropertyMiddleOfTextY == propertyTypeId)) { ret = true; getData().autoTextPos = false; getData().textPositionSide = RVector::invalid; //getData().updateFromTextPosition(); } if (RObject::setMember(getData().textPositionCenter.z, value, PropertyMiddleOfTextZ == propertyTypeId)) { ret = true; getData().autoTextPos = false; getData().textPositionSide = RVector::invalid; //getData().updateFromTextPosition(); } ret = ret || RObject::setMember(getData().text, value, PropertyText == propertyTypeId); ret = ret || RObject::setMember(getData().upperTolerance, value, PropertyUpperTolerance == propertyTypeId); ret = ret || RObject::setMember(getData().lowerTolerance, value, PropertyLowerTolerance == propertyTypeId); ret = ret || RObject::setMember(getData().linearFactor, value, PropertyLinearFactor == propertyTypeId); ret = ret || RObject::setMember(getData().dimScale, value, PropertyDimScale == propertyTypeId); ret = ret || RObject::setMember(getData().dimBlockName, value, PropertyDimBlockName == propertyTypeId); ret = ret || RObject::setMember(getData().autoTextPos, value, PropertyAutoTextPos == propertyTypeId); // if (RPluginLoader::hasPlugin("DWG")) { // ret = ret || RObject::setMember(getData().fontName, value, PropertyFontName == propertyTypeId); // } // ret = ret || RObject::setMember(getData().textHeight, value, PropertyHeight == propertyTypeId); // ret = ret || RObject::setMember(getData().angle, value, PropertyAngle == propertyTypeId); // ret = ret || RObject::setMember(getData().lineSpacingFactor, value, PropertyLineSpacingFactor == propertyTypeId); // ret = ret || RObject::setMember((int&)getData().horizontalAlignment, value.value<int>(), PropertyHAlign == propertyTypeId); // ret = ret || RObject::setMember((int&)getData().verticalAlignment, value.value<int>(), PropertyVAlign == propertyTypeId); if (ret) { getData().update(); } return ret; } QPair<QVariant, RPropertyAttributes> RDimensionEntity::getProperty( RPropertyTypeId& propertyTypeId, bool humanReadable, bool noAttributes) { if (propertyTypeId == PropertyDefinitionPointX) { return qMakePair(QVariant(getData().definitionPoint.x), RPropertyAttributes()); } else if (propertyTypeId == PropertyDefinitionPointY) { return qMakePair(QVariant(getData().definitionPoint.y), RPropertyAttributes()); } else if (propertyTypeId == PropertyDefinitionPointZ) { return qMakePair(QVariant(getData().definitionPoint.z), RPropertyAttributes()); } else if (propertyTypeId == PropertyMiddleOfTextX) { if (getData().textPositionSide.isValid()) { return qMakePair(QVariant(getData().textPositionSide.x), RPropertyAttributes()); } else { return qMakePair(QVariant(getData().textPositionCenter.x), RPropertyAttributes()); } } else if (propertyTypeId == PropertyMiddleOfTextY) { if (getData().textPositionSide.isValid()) { return qMakePair(QVariant(getData().textPositionSide.y), RPropertyAttributes()); } else { return qMakePair(QVariant(getData().textPositionCenter.y), RPropertyAttributes()); } } else if (propertyTypeId == PropertyMiddleOfTextZ) { if (getData().textPositionSide.isValid()) { return qMakePair(QVariant(getData().textPositionSide.z), RPropertyAttributes()); } else { return qMakePair(QVariant(getData().textPositionCenter.z), RPropertyAttributes()); } } else if (propertyTypeId == PropertyText) { return qMakePair(QVariant(getData().text), RPropertyAttributes(RPropertyAttributes::DimensionLabel)); } else if (propertyTypeId == PropertyUpperTolerance) { return qMakePair(QVariant(getData().upperTolerance), RPropertyAttributes(RPropertyAttributes::Label)); } else if (propertyTypeId == PropertyLowerTolerance) { return qMakePair(QVariant(getData().lowerTolerance), RPropertyAttributes(RPropertyAttributes::Label)); } else if (propertyTypeId == PropertyAutoLabel) { if (getType()==RS::EntityDimAngular) { return qMakePair(QVariant(getData().getAutoLabel()), RPropertyAttributes(RPropertyAttributes::ReadOnly | RPropertyAttributes::Angle)); } else { return qMakePair(QVariant(getData().getAutoLabel()), RPropertyAttributes(RPropertyAttributes::ReadOnly)); } } else if (propertyTypeId == PropertyMeasuredValue) { if (getType()==RS::EntityDimAngular) { return qMakePair(QVariant(getData().getMeasuredValue()), RPropertyAttributes(RPropertyAttributes::ReadOnly | RPropertyAttributes::Angle)); } else { return qMakePair(QVariant(getData().getMeasuredValue()), RPropertyAttributes(RPropertyAttributes::ReadOnly)); } } else if (propertyTypeId == PropertyLinearFactor) { return qMakePair(QVariant(getData().linearFactor), RPropertyAttributes()); } else if (propertyTypeId == PropertyDimScale) { return qMakePair(QVariant(getData().dimScale), RPropertyAttributes()); } else if (propertyTypeId == PropertyDimBlockName) { return qMakePair(QVariant(getData().dimBlockName), RPropertyAttributes(RPropertyAttributes::ReadOnly)); } else if (propertyTypeId == PropertyAutoTextPos) { return qMakePair(QVariant(getData().autoTextPos), RPropertyAttributes(RPropertyAttributes::Invisible)); } // else if (propertyTypeId == PropertyFontName) { // return qMakePair(QVariant(getData().fontName), // RPropertyAttributes(RPropertyAttributes::Style)); // } /*else if (propertyTypeId == PropertyHeight) { return qMakePair(QVariant(getData().textHeight), RPropertyAttributes()); } else if (propertyTypeId == PropertyAngle) { return qMakePair(QVariant(getData().angle), RPropertyAttributes( RPropertyAttributes::Angle)); } else if (propertyTypeId == PropertyLineSpacingFactor) { return qMakePair(QVariant(getData().lineSpacingFactor), RPropertyAttributes()); } else if (propertyTypeId == PropertyHAlign) { return qMakePair(QVariant(getData().horizontalAlignment), RPropertyAttributes()); } else if (propertyTypeId == PropertyVAlign) { return qMakePair(QVariant(getData().verticalAlignment), RPropertyAttributes()); }*/ return REntity::getProperty(propertyTypeId, humanReadable, noAttributes); } void RDimensionEntity::exportEntity(RExporter& e, bool preview, bool forceSelected) const { Q_UNUSED(preview); // make sure text data is removed: //e.unexportEntity(e.getBlockRefOrEntity()->getId()); const RDimensionData& data = getData(); // if a block is assiciated with this dimension, look up and export block: QSharedPointer<RBlockReferenceEntity> dimBlockReference = data.getDimensionBlockReference(); if (!dimBlockReference.isNull()) { getDocument()->getStorage().setObjectId(*dimBlockReference, getId()); e.exportEntity(*dimBlockReference, preview, false, isSelected()); return; } data.dirty = true; // export shapes: QList<QSharedPointer<RShape> > shapes = getShapes(); //e.setBrush(Qt::NoBrush); //e.exportShapes(shapes); QBrush brush = e.getBrush(); for (int i=0; i<shapes.size(); i++) { QSharedPointer<RShape> s = shapes.at(i); if (s.isNull()) { continue; } // triangles (arrows) are filled: if (!s.dynamicCast<RTriangle>().isNull()) { e.setBrush(brush); } // lines are not filled: else { e.setBrush(Qt::NoBrush); } e.exportShape(s); } // export text label: RTextData& textData = data.getTextData(); //qDebug() << "export dim: angle: " << textData.getAngle(); if (RSettings::isTextRenderedAsText()) { QList<RPainterPath> paths = e.exportText(textData, forceSelected); e.exportPainterPaths(paths); } else { e.setBrush(brush); e.exportPainterPathSource(textData); } e.setBrush(Qt::NoBrush); data.dirty = false; } void RDimensionEntity::print(QDebug dbg) const { dbg.nospace() << "RDimensionEntity("; REntity::print(dbg); dbg.nospace() << ", definitionPoint: " << getData().definitionPoint << ", autoTextPos: " << getData().autoTextPos << ", middleOfText: " << getData().getTextPosition() << ", text: " << getData().text << ", upper tolerance: " << getData().upperTolerance << ", lower tolerance: " << getData().lowerTolerance << ", measurement (label): " << getData().getMeasurement(true) << ", measurement (stored): " << getData().getMeasurement(false) << ", dimscale: " << getData().getDimScale() << ")"; }
54.61465
170
0.72115
ouxianghui
b0601f9cf3454394bcedea54ce2f50e5069a8e59
397
cpp
C++
Level_4/1_ExamGrade/ExamGrade.cpp
LeeHeungrok/BaekjoonAlgorithm
fca6ce5729938df64099074e9276325ca5e11c8a
[ "MIT" ]
null
null
null
Level_4/1_ExamGrade/ExamGrade.cpp
LeeHeungrok/BaekjoonAlgorithm
fca6ce5729938df64099074e9276325ca5e11c8a
[ "MIT" ]
null
null
null
Level_4/1_ExamGrade/ExamGrade.cpp
LeeHeungrok/BaekjoonAlgorithm
fca6ce5729938df64099074e9276325ca5e11c8a
[ "MIT" ]
null
null
null
#include <iostream> using namespace std; int main(void){ int examGrade; cin>>examGrade; if(examGrade >= 90){ cout<<"A"<<endl; } else if(examGrade >= 80){ cout<<"B"<<endl; } else if(examGrade >= 70){ cout<<"C"<<endl; } else if(examGrade >= 60){ cout<<"D"<<endl; } else { cout<<"F"<<endl; } return 0; }
14.703704
29
0.471033
LeeHeungrok
b061614cac6d8d343308adb38f0ef5047c6ea317
1,346
cpp
C++
TSS/src/locotrain.cpp
valdiz777/TSS
49c915a2da83eab202a2c5ea992c95f8e0d3d06b
[ "MIT" ]
null
null
null
TSS/src/locotrain.cpp
valdiz777/TSS
49c915a2da83eab202a2c5ea992c95f8e0d3d06b
[ "MIT" ]
null
null
null
TSS/src/locotrain.cpp
valdiz777/TSS
49c915a2da83eab202a2c5ea992c95f8e0d3d06b
[ "MIT" ]
null
null
null
#include "locotrain.h" bool LocoTrain::debug = false; LocoTrain::LocoTrain() { name = ""; slot = LocoByte("00"); adr = LocoByte("00"); speed = LocoByte("00"); reverse = 1; } LocoTrain::~LocoTrain() { } QString LocoTrain::timeStamp() { return(QTime::currentTime().toString("[HH:mm:ss:zzz] ")); } bool LocoTrain::operator ==(LocoTrain _arg) { return((this->get_adr() == _arg.get_adr()) && (this->get_slot() == _arg.get_slot())); } void LocoTrain::set_name(QString _name) { name = _name; } void LocoTrain::set_adr(LocoByte _adr) { adr = _adr; } void LocoTrain::set_slot(LocoByte _slot) { slot = _slot; } void LocoTrain::set_reverse(bool _forward) { reverse = _forward; } void LocoTrain::set_speed(LocoByte _speed) { speed = _speed; } void LocoTrain::set_state(QString _state) { state = _state; } QString LocoTrain::get_state() { return(state); } LocoByte LocoTrain::get_adr() { return (adr); } LocoByte LocoTrain::get_slot() { return(slot); } LocoByte LocoTrain::get_speed() { return(speed); } bool LocoTrain::get_direction() { return(reverse); } QString LocoTrain::get_descrtiption() { QString _desc = "Train[" + adr.get_hex() + "]"; _desc.append(" Slot[" + slot.get_hex() + "]"); _desc.append(" Speed[" + speed.get_hex() + "]"); _desc.append(" Reverse[" + QString::number(reverse) + "]"); return(_desc); }
14.630435
86
0.661218
valdiz777
b0648b54dbf40086ac386e7e90446ccf2e32c4ae
3,913
cpp
C++
stl/src/wlocale.cpp
elay00/STL
7f04137880e1c3df5125c1baf808f16f399dee2e
[ "Apache-2.0" ]
null
null
null
stl/src/wlocale.cpp
elay00/STL
7f04137880e1c3df5125c1baf808f16f399dee2e
[ "Apache-2.0" ]
null
null
null
stl/src/wlocale.cpp
elay00/STL
7f04137880e1c3df5125c1baf808f16f399dee2e
[ "Apache-2.0" ]
null
null
null
// Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // class locale wide member functions #include <istream> #include <locale> _STD_BEGIN #pragma warning(disable : 4074) #pragma init_seg(compiler) // facets associated with C categories #define ADDFAC(Facet, cat, ptrimp, ptrloc) \ if ((_CATMASK(Facet::_Getcat()) & cat) == 0) { \ ; \ } else if (ptrloc == nullptr) { \ ptrimp->_Addfac(new Facet(lobj), Facet::id); \ } else { \ ptrimp->_Addfac( \ const_cast<locale::facet*>(static_cast<const locale::facet*>(&_STD use_facet<Facet>(*ptrloc))), \ Facet::id); \ } // moved from locale to ease subsetting using _Tw1 = ctype<wchar_t>; using _Tw2 = num_get<wchar_t>; using _Tw3 = num_put<wchar_t>; using _Tw4 = numpunct<wchar_t>; using _Tw5 = collate<wchar_t>; using _Tw6 = messages<wchar_t>; using _Tw7 = money_get<wchar_t>; using _Tw8 = money_put<wchar_t>; using _Tw9 = moneypunct<wchar_t, false>; using _Tw10 = moneypunct<wchar_t, true>; using _Tw11 = time_get<wchar_t>; using _Tw12 = time_put<wchar_t>; using _Tw13 = codecvt<wchar_t, char, _Mbstatet>; __PURE_APPDOMAIN_GLOBAL locale::id time_put<wchar_t>::id(0); void __CLRCALL_OR_CDECL locale::_Locimp::_Makewloc(const _Locinfo& lobj, locale::category cat, _Locimp* ptrimp, const locale* ptrloc) { // setup wide part of a new locale ADDFAC(_Tw1, cat, ptrimp, ptrloc); ADDFAC(_Tw2, cat, ptrimp, ptrloc); ADDFAC(_Tw3, cat, ptrimp, ptrloc); ADDFAC(_Tw4, cat, ptrimp, ptrloc); ADDFAC(_Tw5, cat, ptrimp, ptrloc); ADDFAC(_Tw6, cat, ptrimp, ptrloc); ADDFAC(_Tw7, cat, ptrimp, ptrloc); ADDFAC(_Tw8, cat, ptrimp, ptrloc); ADDFAC(_Tw9, cat, ptrimp, ptrloc); ADDFAC(_Tw10, cat, ptrimp, ptrloc); ADDFAC(_Tw11, cat, ptrimp, ptrloc); ADDFAC(_Tw12, cat, ptrimp, ptrloc); ADDFAC(_Tw13, cat, ptrimp, ptrloc); } // moved from locale to ease subsetting using _Tu1 = ctype<unsigned short>; using _Tu2 = num_get<unsigned short>; using _Tu3 = num_put<unsigned short>; using _Tu4 = numpunct<unsigned short>; using _Tu5 = collate<unsigned short>; using _Tu6 = messages<unsigned short>; using _Tu7 = money_get<unsigned short>; using _Tu8 = money_put<unsigned short>; using _Tu9 = moneypunct<unsigned short, false>; using _Tu10 = moneypunct<unsigned short, true>; using _Tu11 = time_get<unsigned short>; using _Tu12 = time_put<unsigned short>; using _Tu13 = codecvt<unsigned short, char, _Mbstatet>; void __CLRCALL_OR_CDECL locale::_Locimp::_Makeushloc(const _Locinfo& lobj, locale::category cat, _Locimp* ptrimp, const locale* ptrloc) { // setup wide part of a new locale ADDFAC(_Tu1, cat, ptrimp, ptrloc); ADDFAC(_Tu2, cat, ptrimp, ptrloc); ADDFAC(_Tu3, cat, ptrimp, ptrloc); ADDFAC(_Tu4, cat, ptrimp, ptrloc); ADDFAC(_Tu5, cat, ptrimp, ptrloc); ADDFAC(_Tu6, cat, ptrimp, ptrloc); ADDFAC(_Tu7, cat, ptrimp, ptrloc); ADDFAC(_Tu8, cat, ptrimp, ptrloc); ADDFAC(_Tu9, cat, ptrimp, ptrloc); ADDFAC(_Tu10, cat, ptrimp, ptrloc); ADDFAC(_Tu11, cat, ptrimp, ptrloc); ADDFAC(_Tu12, cat, ptrimp, ptrloc); ADDFAC(_Tu13, cat, ptrimp, ptrloc); } _STD_END
43
114
0.567851
elay00
b065bddc05ce7632d3e5cdc60ef43a602ce47995
6,820
cpp
C++
Code/src/OE/Misc/RectsPacker.cpp
mlomb/OrbitEngine
41f053626f05782e81c2e48f5c87b04972f9be2c
[ "Apache-2.0" ]
21
2018-06-26T16:37:36.000Z
2022-01-11T01:19:42.000Z
Code/src/OE/Misc/RectsPacker.cpp
mlomb/OrbitEngine
41f053626f05782e81c2e48f5c87b04972f9be2c
[ "Apache-2.0" ]
null
null
null
Code/src/OE/Misc/RectsPacker.cpp
mlomb/OrbitEngine
41f053626f05782e81c2e48f5c87b04972f9be2c
[ "Apache-2.0" ]
3
2019-10-01T14:10:50.000Z
2021-11-19T20:30:18.000Z
#include "OE/Misc/RectsPacker.hpp" /* This is a modified version of this algorithm: http://blackpawn.com/texts/lightmaps/default.html */ #include "OE/Math/Math.hpp" namespace OrbitEngine { namespace Misc { bool area(Packeable2D* a, Packeable2D* b) { return a->area() > b->area(); } bool perimeter(Packeable2D* a, Packeable2D* b) { return a->perimeter() > b->perimeter(); } bool max_side(Packeable2D* a, Packeable2D* b) { return std::max(a->w, a->h) > std::max(b->w, b->h); } bool max_width(Packeable2D* a, Packeable2D* b) { return a->w > b->w; } bool max_height(Packeable2D* a, Packeable2D* b) { return a->h > b->h; } bool(*cmpf[])(Packeable2D*, Packeable2D*) = { area, perimeter, max_side, max_width, max_height }; struct Packeable2DNode { struct pnode { Packeable2DNode* pn; bool fill; pnode() : fill(false), pn(0) {} void set(int l, int t, int r, int b) { if (!pn) pn = new Packeable2DNode(Packeable2DRectLTRB(l, t, r, b)); else { (*pn).rc = Packeable2DRectLTRB(l, t, r, b); (*pn).id = false; } fill = true; } }; pnode c[2]; Packeable2DRectLTRB rc; bool id; Packeable2DNode(Packeable2DRectLTRB rc = Packeable2DRectLTRB()) : id(false), rc(rc) {} void reset(const Packeable2DRectWH& r) { id = false; rc = Packeable2DRectLTRB(0, 0, r.w, r.h); delcheck(); } Packeable2DNode* insert(Packeable2D& img) { if (c[0].pn && c[0].fill) { Packeable2DNode* newn; if (newn = c[0].pn->insert(img)) return newn; return c[1].pn->insert(img); } if (id) return 0; int f = img.fits(Packeable2DRectXYWH(rc)); switch (f) { case 0: return 0; case 1: img.flipped = false; break; case 2: img.flipped = true; break; case 3: id = true; img.flipped = false; return this; case 4: id = true; img.flipped = true; return this; } int iw = (img.flipped ? img.h : img.w), ih = (img.flipped ? img.w : img.h); if (rc.w() - iw > rc.h() - ih) { c[0].set(rc.l, rc.t, rc.l + iw, rc.b); c[1].set(rc.l + iw, rc.t, rc.r, rc.b); } else { c[0].set(rc.l, rc.t, rc.r, rc.t + ih); c[1].set(rc.l, rc.t + ih, rc.r, rc.b); } return c[0].pn->insert(img); } void delcheck() { if (c[0].pn) { c[0].fill = false; c[0].pn->delcheck(); } if (c[1].pn) { c[1].fill = false; c[1].pn->delcheck(); } } ~Packeable2DNode() { if (c[0].pn) delete c[0].pn; if (c[1].pn) delete c[1].pn; } }; bool Packer2D::Pack(std::vector<Packeable2D*>& rects, int max_side, unsigned int& out_width, unsigned int& out_height, int discard_step) { Packeable2DRectWH size(max_side, max_side); for (Packeable2D* p : rects) if (!p->fits(size)) return false; Packeable2DNode root; const int funcs = (sizeof(cmpf) / sizeof(bool(*)(Packeable2D*, Packeable2D*))); std::vector<Packeable2D*> order[funcs]; for (int f = 0; f < funcs; ++f) { order[f] = std::vector<Packeable2D*>(rects); std::sort(order[f].begin(), order[f].end(), cmpf[f]); } int min_func = -1, best_func = 0, best_area = 0, _area = 0, step, fit; size_t i; bool fail = false; for (int f = 0; f < funcs; ++f) { rects = order[f]; step = size.w / 2; root.reset(size); while (true) { if (root.rc.w() > size.w) { if (min_func > -1) break; _area = 0; root.reset(size); for (i = 0; i < rects.size(); ++i) if (root.insert(*rects[i])) _area += rects[i]->area(); fail = true; break; } fit = -1; for (i = 0; i < rects.size(); ++i) if (!root.insert(*rects[i])) { fit = 1; break; } if (fit == -1 && step <= discard_step) break; root.reset(Packeable2DRectWH(root.rc.w() + fit*step, root.rc.h() + fit*step)); step /= 2; if (!step) step = 1; } if (!fail && (size.area() >= root.rc.area())) { size = Packeable2DRectWH(root.rc); min_func = f; } else if (fail && (_area > best_area)) { best_area = _area; best_func = f; } fail = false; } rects = order[min_func == -1 ? best_func : min_func]; int clip_x = 0, clip_y = 0; Packeable2DNode* ret; root.reset(size); for (i = 0; i < rects.size(); ++i) { if (ret = root.insert(*rects[i])) { rects[i]->x = ret->rc.l; rects[i]->y = ret->rc.t; if (rects[i]->flipped) { rects[i]->flipped = false; rects[i]->flip(); } clip_x = std::max(clip_x, ret->rc.r); clip_y = std::max(clip_y, ret->rc.b); } else return false; } for (int f = 0; f < funcs; ++f) { order[f].clear(); order[f].shrink_to_fit(); } out_width = clip_x; out_height = clip_y; return true; } Packeable2DRectWH::Packeable2DRectWH(const Packeable2DRectLTRB& rr) : w(rr.w()), h(rr.h()) {} Packeable2DRectWH::Packeable2DRectWH(const Packeable2DRectXYWH& rr) : w(rr.w), h(rr.h) {} Packeable2DRectWH::Packeable2DRectWH(int w, int h) : w(w), h(h) {} int Packeable2DRectWH::fits(const Packeable2DRectWH& r) const { if (w == r.w && h == r.h) return 3; if (h == r.w && w == r.h) return 4; if (w <= r.w && h <= r.h) return 1; if (h <= r.w && w <= r.h) return 2; return 0; } Packeable2DRectLTRB::Packeable2DRectLTRB() : l(0), t(0), r(0), b(0) {} Packeable2DRectLTRB::Packeable2DRectLTRB(int l, int t, int r, int b) : l(l), t(t), r(r), b(b) {} int Packeable2DRectLTRB::w() const { return r - l; } int Packeable2DRectLTRB::h() const { return b - t; } int Packeable2DRectLTRB::area() const { return w()*h(); } int Packeable2DRectLTRB::perimeter() const { return 2 * w() + 2 * h(); } void Packeable2DRectLTRB::w(int ww) { r = l + ww; } void Packeable2DRectLTRB::h(int hh) { b = t + hh; } Packeable2DRectXYWH::Packeable2DRectXYWH() : x(0), y(0) {} Packeable2DRectXYWH::Packeable2DRectXYWH(const Packeable2DRectLTRB& rc) : x(rc.l), y(rc.t) { b(rc.b); r(rc.r); } Packeable2DRectXYWH::Packeable2DRectXYWH(int x, int y, int w, int h) : x(x), y(y), Packeable2DRectWH(w, h) {} Packeable2DRectXYWH::operator Packeable2DRectLTRB() { Packeable2DRectLTRB rr(x, y, 0, 0); rr.w(w); rr.h(h); return rr; } int Packeable2DRectXYWH::r() const { return x + w; }; int Packeable2DRectXYWH::b() const { return y + h; } void Packeable2DRectXYWH::r(int right) { w = right - x; } void Packeable2DRectXYWH::b(int bottom) { h = bottom - y; } int Packeable2DRectWH::area() { return w * h; } int Packeable2DRectWH::perimeter() { return 2 * w + 2 * h; } Packeable2D::Packeable2D(const Packeable2DRectLTRB& rr) : Packeable2DRectXYWH(rr), flipped(false) {} Packeable2D::Packeable2D(int x, int y, int width, int height) : Packeable2DRectXYWH(x, y, width, height), flipped(false) {} Packeable2D::Packeable2D() : flipped(false) {} void Packeable2D::flip() { flipped = !flipped; std::swap(w, h); } } }
23.197279
139
0.589589
mlomb
b06e2b3129c556cc581ea35d8dc3a568e688b64b
8,756
cpp
C++
src/Generation/BuildQueueBuilder.cpp
PoetaKodu/cpp-pkg
3d5cabf4e015f4727328db430a003c189aeed88a
[ "MIT" ]
9
2021-05-07T21:18:26.000Z
2022-02-01T20:44:13.000Z
src/Generation/BuildQueueBuilder.cpp
PoetaKodu/pacc
3d5cabf4e015f4727328db430a003c189aeed88a
[ "MIT" ]
null
null
null
src/Generation/BuildQueueBuilder.cpp
PoetaKodu/pacc
3d5cabf4e015f4727328db430a003c189aeed88a
[ "MIT" ]
null
null
null
#include PACC_PCH #include <Pacc/Generation/BuildQueueBuilder.hpp> #include <Pacc/Generation/OutputFormatter.hpp> #include <Pacc/System/Filesystem.hpp> #include <Pacc/System/Environment.hpp> /////////////////////////////////////////////////////////////// // Private functions (forward declaration) /////////////////////////////////////////////////////////////// bool wasDependencyQueued(Dependency const& dep, BuildQueueBuilder::DepQueue const& readyQueue_); bool projectHasPendingDependencies(Project const& project, BuildQueueBuilder::DepQueue const& readyQueue_); bool packageHasPendingDependencies(PackageDependency & dep, BuildQueueBuilder::DepQueue const& readyQueue_); bool selfPackageHasPendingDependencies(SelfDependency & dep, BuildQueueBuilder::DepQueue const& readyQueue_); /////////////////////////////////////////////////////////////// // Public functions: /////////////////////////////////////////////////////////////// void BuildQueueBuilder::performConfigurationMerging() { auto const& q = this->getQueue(); // fmt::print("Configuration steps: {}\n", q.size()); // size_t stepCounter = 0; for(auto & step : q) { // fmt::print("Step {}: [ ", stepCounter++); // size_t depCounter = 0; for(auto & depInfo : step) { // if (depCounter++ != 0) // fmt::print(", "); // fmt::print("\"{}\"", dep.project->name); Project& mergeTarget = *(depInfo.project); AccessType mergeMode = depInfo.dep->accessType; if (depInfo.dep->isSelf()) { auto &selfDependency = depInfo.dep->self(); Project const& depProj = selfDependency.package->requireProject(selfDependency.depProjName); mergeTarget.inheritConfigurationFrom(*selfDependency.package, depProj, mergeMode ); } else if (depInfo.dep->isPackage()) { auto& packageDependency = depInfo.dep->package(); // Should be loaded by now auto& depReferencedPkg = *packageDependency.package; for (auto const & depProjName : packageDependency.projects) { Project const& depProj = depReferencedPkg.requireProject(depProjName); mergeTarget.inheritConfigurationFrom(depReferencedPkg, depProj, mergeMode ); } } } // fmt::print(" ]\n", stepCounter++); } } ///////////////////////////////////////////////// void BuildQueueBuilder::recursiveLoad(Package & pkg_) { const std::array<AccessType, 3> methodsLoop = { AccessType::Private, AccessType::Public, AccessType::Interface }; size_t methodIdx = 0; for(auto & p : pkg_.projects) { std::vector<Configuration*> configs; configs.reserve(1 + p.premakeFilters.size()); configs.push_back(&p); for(auto& [key, value] : p.premakeFilters) { configs.push_back(&value); } for(Configuration* cfg : configs) { methodIdx = 0; for(auto* access : getAccesses(cfg->dependencies.self)) { for(auto& dep : *access) { dep.accessType = methodsLoop[methodIdx]; switch(dep.type()) { case Dependency::Raw: { auto& rawDep = dep.raw(); // fmt::print("Added raw dependency \"{}\"\n", rawDep); auto& target = targetByAccessType(cfg->linkedLibraries.computed, dep.accessType); // TODO: improve this: target.push_back( rawDep ); break; } case Dependency::Self: { pendingDeps.push_back( { &p, &dep } ); break; } case Dependency::Package: { pendingDeps.push_back( { &p, &dep } ); auto& pkgDep = dep.package(); PackagePtr pkgPtr; // Load dependency (and bind it to shared pointer) { UPtr<Package> pkg; try { pkg = Package::loadByName(pkgDep.packageName, pkgDep.version, &pkg); } catch(PaccException &) { // This means that the package was loaded, but does not meet version requirements. if (pkg && !pkg->name.empty()) { throw PaccException("Could not load package \"{}\". Version \"{}\" is incompatible with requirement \"{}\"", pkgDep.packageName, pkg->version.toString(), pkgDep.version.toString() ) .withHelp( "Consider installing version of the package that meets requirements.\n" "You can list available package versions with \"pacc lsver [package_name]\"\n" "To install package at a specific version, use \"pacc install [package_name]@[version]\"" ); } else throw; // Rethrow exception } if (this->isPackageLoaded(pkg->root)) continue; // ignore package, was loaded yet // if (pkgDep.version.empty()) // fmt::print("Loaded dependency \"{}\"\n", pkgDep.packageName); // else // fmt::print("Loaded dependency \"{}\"@\"{}\"\n", pkgDep.packageName, pkgDep.version); pkgPtr = std::move(pkg); } // Assign loaded package: pkgDep.package = pkgPtr; // Insert in sorted order: { auto it = rg::upper_bound( loadedPackages, pkgPtr->root, {}, [](auto& elem) -> fs::path const& { return elem->root; } ); loadedPackages.insert(it, pkgPtr); } this->recursiveLoad(*pkgPtr); break; } } } methodIdx++; } } } } ///////////////////////////////////////////////// BuildQueueBuilder::DepQueue const& BuildQueueBuilder::setup() { std::size_t totalDeps = pendingDeps.size(); std::size_t totalCollected = 0; while(totalCollected < totalDeps) { DepQueueStep step = this->collectReadyDependencies(queue, pendingDeps); // Could not collect any? if (step.empty()) throw PaccException("cyclic dependency detected"); totalCollected += step.size(); queue.push_back( std::move(step) ); } return queue; } ///////////////////////////////////////////////// BuildQueueBuilder::DepQueueStep BuildQueueBuilder::collectReadyDependencies(DepQueue const& ready_, PendingDeps & pending_) { PendingDeps newPending; newPending.reserve(pending_.size()); DepQueueStep nextStep; for(auto& dep : pending_) { bool ready = false; if (dep.dep->isPackage()) { ready = !packageHasPendingDependencies(dep.dep->package(), ready_); } else if (dep.dep->isSelf()) { ready = !selfPackageHasPendingDependencies(dep.dep->self(), ready_); } if (!ready) newPending.push_back(dep); else nextStep.push_back(dep); } pending_ = std::move(newPending); return nextStep; } ///////////////////////////////////////////////// PackagePtr BuildQueueBuilder::findPackageByRoot(fs::path root_) const { auto it = rg::lower_bound( loadedPackages, root_, {}, [](auto& elem) { return elem->root; } ); if (it != loadedPackages.end() && (*it)->root == root_) return *it; return nullptr; } ///////////////////////////////////////////////// bool BuildQueueBuilder::isPackageLoaded(fs::path root_) const { return rg::binary_search( loadedPackages, root_, {}, [](auto& elem) { return elem->root; } ); } /////////////////////////////////////////////////////////////// // Private functions: /////////////////////////////////////////////////////////////// ///////////////////////////////////////////////// bool wasDependencyQueued(Dependency const& dep, BuildQueueBuilder::DepQueue const& readyQueue_) { for (auto const& step : readyQueue_) { // TODO: Can be done better (binary search on sorted range) auto it = rg::find(step, &dep, &BuildQueueBuilder::ProjectDep::dep); if (it != step.end()) { return true; } } return false; } ///////////////////////////////////////////////// bool projectHasPendingDependencies(Project const& project, BuildQueueBuilder::DepQueue const& readyQueue_) { auto selfDepsAcc = getAccesses(project.dependencies.self); for (auto access : selfDepsAcc) { for(auto& selfDep : *access) { if (!selfDep.isPackage() && !selfDep.isSelf()) continue; if (!wasDependencyQueued(selfDep, readyQueue_)) return true; } } return false; } ///////////////////////////////////////////////// bool packageHasPendingDependencies(PackageDependency & dep, BuildQueueBuilder::DepQueue const& readyQueue_) { auto& packagePtr = dep.package; for (auto const& projectName : dep.projects) { // Find pointer to project: auto& project = packagePtr->requireProject(projectName); if (projectHasPendingDependencies(project, readyQueue_)) return true; } return false; } ///////////////////////////////////////////////// bool selfPackageHasPendingDependencies(SelfDependency & dep, BuildQueueBuilder::DepQueue const& readyQueue_) { auto& packagePtr = dep.package; // Find pointer to project: auto& project = packagePtr->requireProject(dep.depProjName); if (projectHasPendingDependencies(project, readyQueue_)) return true; return false; }
26.137313
123
0.596962
PoetaKodu
b070791a72d7c010876e8671ba5721a4179d900f
4,388
cpp
C++
src/dicebot/data/manual_dice_control.cpp
DrakeOu/coolq-dicebot
a38a500bbecbb44ee82adbbd191d9a5b73324606
[ "MIT" ]
2
2019-06-01T13:52:28.000Z
2019-06-03T08:17:56.000Z
src/dicebot/data/manual_dice_control.cpp
DrakeOu/coolq-dicebot
a38a500bbecbb44ee82adbbd191d9a5b73324606
[ "MIT" ]
null
null
null
src/dicebot/data/manual_dice_control.cpp
DrakeOu/coolq-dicebot
a38a500bbecbb44ee82adbbd191d9a5b73324606
[ "MIT" ]
null
null
null
#include "./manual_dice_control.h" #include <iostream> #include <sstream> #include "../entity/manual_dice.h" #include "./database_manager.h" using namespace dicebot; using namespace dicebot::manual; using namespace dicebot::database; using db_manager = dicebot::database::database_manager; #define MANUALDICE_TABLE_NAME "manualdice" #define MANUALDICE_TABLE_DEFINE \ "create table " MANUALDICE_TABLE_NAME \ "(qqid int NOT NULL," \ "groupid int NOT NULL," \ "source text NOT NULL," \ "primary key (QQID,GROUPID));" static bool insert_database(const utils::pair_t &manual_dice_key, const manual_dice &manual_dice_target) { std::ostringstream ostrs_sql_command; ostrs_sql_command << "insert into " MANUALDICE_TABLE_NAME " (qqid, groupid, source) " << "values ( " << manual_dice_key.first << ", " << manual_dice_key.second << ", '" << manual_dice_target.encode() << "'" << ");"; return db_manager::get_instance()->exec_noquery(ostrs_sql_command.str().c_str()); } static bool update_database(const utils::pair_t &manual_dice_key, const manual_dice &manual_dice_target) { std::ostringstream ostrs_sql_command; ostrs_sql_command << "update " MANUALDICE_TABLE_NAME " set " << " source='" << manual_dice_target.encode() << "'" << " where qqid=" << manual_dice_key.first << " and groupid=" << manual_dice_key.second; return db_manager::get_instance()->exec_noquery(ostrs_sql_command.str().c_str()); } static bool read_database(const utils::pair_t &manual_dice_key, manual_dice &manual_dice_target) { std::ostringstream ostrs_sql_command; ostrs_sql_command << "SELECT source FROM " MANUALDICE_TABLE_NAME " where qqid=" << manual_dice_key.first << " and groupid=" << manual_dice_key.second; std::string str_manualdice_read; return db_manager::get_instance()->exec( ostrs_sql_command.str().c_str(), &manual_dice_target, [](void *data, int argc, char **argv, char **azColName) -> int { if (argc == 1) { manual_dice *pstr_ret = reinterpret_cast<manual_dice *>(data); pstr_ret->decode(argv[0]); return SQLITE_OK; } return SQLITE_ABORT; }); } static bool exist_database(const utils::pair_t &manual_dice_key) { bool ret = false; std::ostringstream ostrs_sql_command; ostrs_sql_command << "SELECT count(*) FROM " MANUALDICE_TABLE_NAME " where qqid=" << manual_dice_key.first << " and groupid=" << manual_dice_key.second; database::database_manager::get_instance()->exec( ostrs_sql_command.str().c_str(), &ret, [](void *data, int argc, char **argv, char **azColName) -> int { *(reinterpret_cast<bool *>(data)) = std::stoi(argv[0]) > 0; return SQLITE_OK; }); return ret; } std::unique_ptr<manual_dice_control> manual_dice_control::instance = nullptr; manual_dice_control *manual_dice_control::create_instance() { db_manager::get_instance()->register_table(MANUALDICE_TABLE_NAME, MANUALDICE_TABLE_DEFINE); manual_dice_control::instance = std::make_unique<manual_dice_control>(); return manual_dice_control::instance.get(); } manual_dice_control *manual_dice_control::get_instance() { return instance.get(); } void manual_dice_control::destroy_instance() { instance = nullptr; } manual_dice_control::md_map_t::iterator manual_dice_control::find_manual_dice(const event_info &event) { auto iter = this->manual_dice_map.find(event.pair()); if (iter != this->manual_dice_map.end()) return iter; auto insert_result = this->manual_dice_map.insert({event.pair(), manual_dice()}); if (!insert_result.second) return this->manual_dice_map.end(); if (exist_database(insert_result.first->first)) { read_database(insert_result.first->first, insert_result.first->second); return insert_result.first; } else { insert_database(insert_result.first->first, insert_result.first->second); return insert_result.first; } } void manual_dice_control::sync_database(const md_map_t::iterator iter) const { if (iter != this->manual_dice_map.end()) { update_database(iter->first, iter->second); } }
43.019608
126
0.670465
DrakeOu
b073ffe0a2281614d0f089894080910fc40ff001
860
cpp
C++
apps/concepts/api-cpp/assfire/concepts/Speed.cpp
Eaglegor/assfire-suite
6c8140e848932b6ce22b6addd07a93abba652c01
[ "MIT" ]
null
null
null
apps/concepts/api-cpp/assfire/concepts/Speed.cpp
Eaglegor/assfire-suite
6c8140e848932b6ce22b6addd07a93abba652c01
[ "MIT" ]
null
null
null
apps/concepts/api-cpp/assfire/concepts/Speed.cpp
Eaglegor/assfire-suite
6c8140e848932b6ce22b6addd07a93abba652c01
[ "MIT" ]
null
null
null
#include "Speed.hpp" using namespace assfire; assfire::Speed::Speed(double meters_per_second) : meters_per_second(meters_per_second) {} double assfire::Speed::toMetersPerSecond() const { return meters_per_second; } double assfire::Speed::toMetersPerSecondWithPrecision(double precision) const { return round(meters_per_second / precision) * precision; } double assfire::Speed::toKilometersPerHour() const { return meters_per_second / 1000.0 * 3600; } assfire::TimeInterval assfire::Speed::getSecondsToTravel(const assfire::Distance &distance) { return TimeInterval::fromSeconds(distance.toMeters() / meters_per_second); } assfire::Speed assfire::Speed::fromMetersPerSecond(double value) { return Speed(value); } assfire::Speed assfire::Speed::fromKilometersPerHour(double value) { return Speed(value / 3600.0 * 1000); }
22.631579
91
0.756977
Eaglegor
b076a108878a3ecc3e24a423777b6e2bf14034ce
263
hpp
C++
Modules/TinyOBJ/Public/Toon/TinyOBJ/TinyOBJConfig.hpp
benjinx/Toon
f21032b2f9ad5fbc9a3618a7719c33159257d954
[ "MIT" ]
2
2021-01-28T03:08:08.000Z
2021-01-28T03:08:21.000Z
Modules/TinyOBJ/Public/Toon/TinyOBJ/TinyOBJConfig.hpp
benjinx/Toon
f21032b2f9ad5fbc9a3618a7719c33159257d954
[ "MIT" ]
null
null
null
Modules/TinyOBJ/Public/Toon/TinyOBJ/TinyOBJConfig.hpp
benjinx/Toon
f21032b2f9ad5fbc9a3618a7719c33159257d954
[ "MIT" ]
null
null
null
#ifndef TOON_TINYOBJ_CONFIG_HPP #define TOON_TINYOBJ_CONFIG_HPP #include <Toon/Config.hpp> #if defined(TOON_TINYOBJ_EXPORT) #define TOON_TINYOBJ_API TOON_API_EXPORT #else #define TOON_TINYOBJ_API TOON_API_IMPORT #endif #endif // TOON_TINYOBJ_CONFIG_HPP
21.916667
44
0.825095
benjinx
b0794a6bbc80df3023456cefb0d31b2a2161a6cd
2,512
cpp
C++
engine/core/object/Light.cpp
supernovaengine/supernova
54dfdc1032a0e7cf2de10a2dd72ae6654e75c8b8
[ "MIT" ]
10
2020-05-17T15:19:11.000Z
2022-03-31T13:46:19.000Z
engine/core/object/Light.cpp
supernovaengine/supernova
54dfdc1032a0e7cf2de10a2dd72ae6654e75c8b8
[ "MIT" ]
null
null
null
engine/core/object/Light.cpp
supernovaengine/supernova
54dfdc1032a0e7cf2de10a2dd72ae6654e75c8b8
[ "MIT" ]
2
2020-06-17T21:43:02.000Z
2022-03-31T13:46:21.000Z
// // (c) 2021 Eduardo Doria. // #include "Light.h" #include "math/Angle.h" #include "math/Color.h" #include <math.h> using namespace Supernova; Light::Light(Scene* scene): Object(scene){ addComponent<LightComponent>({}); } Light::~Light(){ } void Light::setType(LightType type){ LightComponent& lightcomp = getComponent<LightComponent>(); lightcomp.type = type; } void Light::setDirection(Vector3 direction){ LightComponent& lightcomp = getComponent<LightComponent>(); Transform& transform = getComponent<Transform>(); lightcomp.direction = direction; transform.needUpdate = true; //Does not affect children } void Light::setDirection(const float x, const float y, const float z){ setDirection(Vector3(x,y,z)); } void Light::setColor(Vector3 color){ LightComponent& lightcomp = getComponent<LightComponent>(); lightcomp.color = Color::sRGBToLinear(color); } void Light::setColor(const float r, const float g, const float b){ setColor(Vector3(r,g,b)); } void Light::setRange(float range){ LightComponent& lightcomp = getComponent<LightComponent>(); lightcomp.range = range; } void Light::setIntensity(float intensity){ LightComponent& lightcomp = getComponent<LightComponent>(); Transform& transform = getComponent<Transform>(); if (intensity > 0 && lightcomp.intensity == 0) transform.needUpdate = true; //Does not affect children lightcomp.intensity = intensity; } void Light::setConeAngle(float inner, float outer){ LightComponent& lightcomp = getComponent<LightComponent>(); lightcomp.innerConeCos = cos(Angle::defaultToRad(inner / 2)); lightcomp.outerConeCos = cos(Angle::defaultToRad(outer / 2)); } void Light::setShadows(bool shadows){ LightComponent& lightcomp = getComponent<LightComponent>(); lightcomp.shadows = shadows; } void Light::setBias(float bias){ LightComponent& lightcomp = getComponent<LightComponent>(); lightcomp.shadowBias = bias; } void Light::setShadowMapSize(unsigned int size){ LightComponent& lightcomp = getComponent<LightComponent>(); lightcomp.mapResolution = size; } void Light::setShadowCameraNearFar(float near, float far){ LightComponent& lightcomp = getComponent<LightComponent>(); lightcomp.shadowCameraNearFar = Vector2(near, far); } void Light::setNumCascades(unsigned int numCascades){ LightComponent& lightcomp = getComponent<LightComponent>(); lightcomp.numShadowCascades = numCascades; }
24.871287
70
0.717755
supernovaengine
b0837617a00055bac00c5c0e00752c31637a81b0
844
cpp
C++
999_Practice/Day_25/0116_transpose_matrix.cpp
Gandham-Srinithya/Data-Structure-and-Algorithms
177d03105188c83a157947ca9870bf8037e92528
[ "MIT" ]
126
2019-12-22T17:49:08.000Z
2021-12-14T18:45:51.000Z
999_Practice/Day_25/0116_transpose_matrix.cpp
Gandham-Srinithya/Data-Structure-and-Algorithms
177d03105188c83a157947ca9870bf8037e92528
[ "MIT" ]
7
2019-12-25T18:03:41.000Z
2021-02-20T06:25:27.000Z
999_Practice/Day_25/0116_transpose_matrix.cpp
Gandham-Srinithya/Data-Structure-and-Algorithms
177d03105188c83a157947ca9870bf8037e92528
[ "MIT" ]
54
2019-12-26T06:28:39.000Z
2022-02-01T05:04:43.000Z
// Given a square matrix A and its number of rows (or columns) N, // return the transpose of A. // // The transpose of a matrix is the matrix flipped over it's main // diagonal, switching the row and column indices of the matrix. // // CONSTRAINS // 1 <= N <= 1000 #include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int arr[n][n]; for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { cin>>arr[i][j]; } } for(int i=0; i<n; i++) { for(int j=i; i+j<n; j++) { int temp = arr[i][j]; arr[i][j] = arr[j][i]; arr[j][i] = temp; } } for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { cout<<arr[i][j]<<" "; } cout<<endl; } return 0; }
17.583333
65
0.438389
Gandham-Srinithya
b087ef516e123f5e6a886e665388daaace3cad99
1,056
cpp
C++
Linked Lists/Add Two Numbers as Lists.cpp
torquecoder/InterviewBit-Solutions
7c5e2e5c904c9354f3eb213739a8dd4aaf13b7b2
[ "MIT" ]
null
null
null
Linked Lists/Add Two Numbers as Lists.cpp
torquecoder/InterviewBit-Solutions
7c5e2e5c904c9354f3eb213739a8dd4aaf13b7b2
[ "MIT" ]
null
null
null
Linked Lists/Add Two Numbers as Lists.cpp
torquecoder/InterviewBit-Solutions
7c5e2e5c904c9354f3eb213739a8dd4aaf13b7b2
[ "MIT" ]
null
null
null
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ ListNode* Solution::addTwoNumbers(ListNode* A, ListNode* B) { ListNode *currA = A; ListNode *currB = B; int sum = 0, carry = 0; if (!A) return B; if (!B) return A; while (currA->next && currB->next) { sum = currA->val + currB->val + carry; carry = sum / 10; currA->val = sum % 10; currA = currA->next; currB = currB->next; } sum = currA->val + currB->val + carry; carry = sum / 10; currA->val = sum % 10; if (!(currA->next)) currA->next = currB->next; while (currA->next) { currA = currA->next; sum = currA->val + carry; carry = sum / 10; currA->val = sum % 10; } if (carry > 0) { ListNode *l = new ListNode(carry); currA->next = l; l->next = NULL; } return A; }
23.466667
62
0.466856
torquecoder
b08b0e1cabd5291ee1dc735c7ac91f9df52a38b4
4,215
cpp
C++
sample/main.cpp
xerdink/enetpp
57b6f030eed7bc42347eec6df2b27d37e6c14925
[ "MIT" ]
77
2015-10-03T01:02:20.000Z
2022-01-17T14:39:43.000Z
third_party/enetpp/sample/main.cpp
Zephilinox/Enki
5f405fec9ae0f3c3344a99fbee590d76ed4dbe55
[ "MIT" ]
45
2017-05-03T16:47:29.000Z
2019-12-02T14:49:50.000Z
third_party/enetpp/sample/main.cpp
Zephilinox/Enki
5f405fec9ae0f3c3344a99fbee590d76ed4dbe55
[ "MIT" ]
16
2015-10-03T04:00:19.000Z
2021-10-01T03:18:11.000Z
#include <iostream> #include <string> #include <random> #include <conio.h> #include "enetpp/client.h" #include "enetpp/server.h" static const int CLIENT_COUNT = 10; static const int PORT = 123; static bool s_exit = false; static std::mutex s_cout_mutex; class server_client { public: unsigned int _uid; public: server_client() : _uid(0) { } unsigned int get_uid() const { return _uid; } }; void run_server() { auto trace_handler = [&](const std::string& msg) { std::lock_guard<std::mutex> lock(s_cout_mutex); std::cout << "server: " << msg << std::endl; }; enetpp::server<server_client> server; server.set_trace_handler(trace_handler); unsigned int next_uid = 0; auto init_client_func = [&](server_client& client, const char* ip) { client._uid = next_uid; next_uid++; }; server.start_listening(enetpp::server_listen_params<server_client>() .set_max_client_count(CLIENT_COUNT) .set_channel_count(1) .set_listen_port(PORT) .set_initialize_client_function(init_client_func)); while (server.is_listening()) { auto on_client_connected = [&](server_client& client) { trace_handler("on_client_connected"); }; auto on_client_disconnected = [&](unsigned int client_uid) { trace_handler("on_client_disconnected"); }; auto on_client_data_received = [&](server_client& client, const enet_uint8* data, size_t data_size) { trace_handler("received packet from client : '" + std::string(reinterpret_cast<const char*>(data), data_size) + "'"); trace_handler("forwarding packet to all other clients..."); server.send_packet_to_all_if(0, data, data_size, ENET_PACKET_FLAG_RELIABLE, [&](const server_client& destination) { return destination.get_uid() != client.get_uid(); }); }; server.consume_events( on_client_connected, on_client_disconnected, on_client_data_received); if (s_exit) { server.stop_listening(); } std::this_thread::sleep_for(std::chrono::milliseconds(1)); } } void run_client(int client_index) { auto trace_handler = [&](const std::string& msg) { std::lock_guard<std::mutex> lock(s_cout_mutex); std::cout << "client(" << client_index << "): " << msg << std::endl; }; enetpp::client client; client.set_trace_handler(trace_handler); client.connect(enetpp::client_connect_params() .set_channel_count(1) .set_server_host_name_and_port("localhost", PORT)); std::mt19937 rand; rand.seed(static_cast<unsigned long>(client_index)); std::uniform_int_distribution<> rand_distribution(5000, 20000); auto last_send_time = std::chrono::system_clock::now(); unsigned int next_send_time_delta = rand_distribution(rand); while (client.is_connecting_or_connected()) { if (std::chrono::system_clock::now() - last_send_time > std::chrono::milliseconds(next_send_time_delta)) { last_send_time = std::chrono::system_clock::now(); next_send_time_delta = rand_distribution(rand); trace_handler("sending packet to server"); std::string packet = "hello from client:" + std::to_string(client_index); assert(sizeof(char) == sizeof(enet_uint8)); client.send_packet(0, reinterpret_cast<const enet_uint8*>(packet.data()), packet.length(), ENET_PACKET_FLAG_RELIABLE); } auto on_connected = [&](){ trace_handler("on_connected"); }; auto on_disconnected = [&]() { trace_handler("on_disconnected"); }; auto on_data_received = [&](const enet_uint8* data, size_t data_size) { trace_handler("received packet from server : '" + std::string(reinterpret_cast<const char*>(data), data_size) + "'"); }; client.consume_events( on_connected, on_disconnected, on_data_received); std::this_thread::sleep_for(std::chrono::milliseconds(1)); } } int main(int argc, char** argv) { enetpp::global_state::get().initialize(); auto server_thread = std::make_unique<std::thread>(&run_server); std::vector<std::unique_ptr<std::thread>> client_threads; for (int i = 0; i < CLIENT_COUNT; ++i) { client_threads.push_back(std::make_unique<std::thread>(&run_client, i)); } std::cout << "press any key to exit..." << std::endl; _getch(); s_exit = true; server_thread->join(); for (auto& ct : client_threads) { ct->join(); } enetpp::global_state::get().deinitialize(); return 0; }
29.475524
121
0.714116
xerdink
b08b55ecfe251456b1271ff39c5938171f494de9
75
cpp
C++
tests/test_serialization/main_test_serialization.cpp
Xoanis/s2smtp
2262d39cbe8c1c0cfd4e7dfb7761f6bd15e7caeb
[ "MIT" ]
null
null
null
tests/test_serialization/main_test_serialization.cpp
Xoanis/s2smtp
2262d39cbe8c1c0cfd4e7dfb7761f6bd15e7caeb
[ "MIT" ]
null
null
null
tests/test_serialization/main_test_serialization.cpp
Xoanis/s2smtp
2262d39cbe8c1c0cfd4e7dfb7761f6bd15e7caeb
[ "MIT" ]
null
null
null
#define BOOST_TEST_MODULE serialization #include <boost/test/unit_test.hpp>
37.5
39
0.853333
Xoanis
b0906fe8bfa5157f850e330e16d18d614c771f72
1,007
cpp
C++
test/zoneserver.test/MockPlayerPartyController.cpp
mark-online/server
ca24898e2e5a9ccbaa11ef1ade57bb25260b717f
[ "MIT" ]
null
null
null
test/zoneserver.test/MockPlayerPartyController.cpp
mark-online/server
ca24898e2e5a9ccbaa11ef1ade57bb25260b717f
[ "MIT" ]
null
null
null
test/zoneserver.test/MockPlayerPartyController.cpp
mark-online/server
ca24898e2e5a9ccbaa11ef1ade57bb25260b717f
[ "MIT" ]
null
null
null
#include "ZoneServerTestPCH.h" #include "MockPlayerPartyController.h" using namespace gideon::zoneserver; MockPlayerPartyController::MockPlayerPartyController(zoneserver::go::Entity* owner) : PlayerPartyController(owner), lastErrorCode_(ecWhatDidYouTest) { } // = rpc::PartyRpc overriding DEFINE_SRPC_METHOD_6(MockPlayerPartyController, onPartyMemberSubInfo, ObjectId, objectId, CharacterClass, characterClass, CreatureLevel, level, HitPoints, hitPoints, ManaPoints, manaPoints, Position, position) { addCallCount("onPartyMemberSubInfo"); objectId, characterClass, level, hitPoints, manaPoints, position; } DEFINE_SRPC_METHOD_2(MockPlayerPartyController, evPartyMemberLevelup, ObjectId, objectId, CreatureLevel, level) { addCallCount("evPartyMemberLevelup"); objectId, level; } DEFINE_SRPC_METHOD_2(MockPlayerPartyController, evPartyMemberMoved, ObjectId, objectId, Position, position) { addCallCount("evPartyMemberMoved"); objectId, position; }
26.5
85
0.784508
mark-online
b091c971338652de7f1d45a3da43fe9badcaf11a
4,676
cpp
C++
aws-cpp-sdk-kendra/source/model/WorkDocsConfiguration.cpp
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-02-12T08:09:30.000Z
2022-02-12T08:09:30.000Z
aws-cpp-sdk-kendra/source/model/WorkDocsConfiguration.cpp
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-01-03T23:59:37.000Z
2022-01-03T23:59:37.000Z
aws-cpp-sdk-kendra/source/model/WorkDocsConfiguration.cpp
ravindra-wagh/aws-sdk-cpp
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
[ "Apache-2.0" ]
1
2021-11-09T11:58:03.000Z
2021-11-09T11:58:03.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/kendra/model/WorkDocsConfiguration.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace kendra { namespace Model { WorkDocsConfiguration::WorkDocsConfiguration() : m_organizationIdHasBeenSet(false), m_crawlComments(false), m_crawlCommentsHasBeenSet(false), m_useChangeLog(false), m_useChangeLogHasBeenSet(false), m_inclusionPatternsHasBeenSet(false), m_exclusionPatternsHasBeenSet(false), m_fieldMappingsHasBeenSet(false) { } WorkDocsConfiguration::WorkDocsConfiguration(JsonView jsonValue) : m_organizationIdHasBeenSet(false), m_crawlComments(false), m_crawlCommentsHasBeenSet(false), m_useChangeLog(false), m_useChangeLogHasBeenSet(false), m_inclusionPatternsHasBeenSet(false), m_exclusionPatternsHasBeenSet(false), m_fieldMappingsHasBeenSet(false) { *this = jsonValue; } WorkDocsConfiguration& WorkDocsConfiguration::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("OrganizationId")) { m_organizationId = jsonValue.GetString("OrganizationId"); m_organizationIdHasBeenSet = true; } if(jsonValue.ValueExists("CrawlComments")) { m_crawlComments = jsonValue.GetBool("CrawlComments"); m_crawlCommentsHasBeenSet = true; } if(jsonValue.ValueExists("UseChangeLog")) { m_useChangeLog = jsonValue.GetBool("UseChangeLog"); m_useChangeLogHasBeenSet = true; } if(jsonValue.ValueExists("InclusionPatterns")) { Array<JsonView> inclusionPatternsJsonList = jsonValue.GetArray("InclusionPatterns"); for(unsigned inclusionPatternsIndex = 0; inclusionPatternsIndex < inclusionPatternsJsonList.GetLength(); ++inclusionPatternsIndex) { m_inclusionPatterns.push_back(inclusionPatternsJsonList[inclusionPatternsIndex].AsString()); } m_inclusionPatternsHasBeenSet = true; } if(jsonValue.ValueExists("ExclusionPatterns")) { Array<JsonView> exclusionPatternsJsonList = jsonValue.GetArray("ExclusionPatterns"); for(unsigned exclusionPatternsIndex = 0; exclusionPatternsIndex < exclusionPatternsJsonList.GetLength(); ++exclusionPatternsIndex) { m_exclusionPatterns.push_back(exclusionPatternsJsonList[exclusionPatternsIndex].AsString()); } m_exclusionPatternsHasBeenSet = true; } if(jsonValue.ValueExists("FieldMappings")) { Array<JsonView> fieldMappingsJsonList = jsonValue.GetArray("FieldMappings"); for(unsigned fieldMappingsIndex = 0; fieldMappingsIndex < fieldMappingsJsonList.GetLength(); ++fieldMappingsIndex) { m_fieldMappings.push_back(fieldMappingsJsonList[fieldMappingsIndex].AsObject()); } m_fieldMappingsHasBeenSet = true; } return *this; } JsonValue WorkDocsConfiguration::Jsonize() const { JsonValue payload; if(m_organizationIdHasBeenSet) { payload.WithString("OrganizationId", m_organizationId); } if(m_crawlCommentsHasBeenSet) { payload.WithBool("CrawlComments", m_crawlComments); } if(m_useChangeLogHasBeenSet) { payload.WithBool("UseChangeLog", m_useChangeLog); } if(m_inclusionPatternsHasBeenSet) { Array<JsonValue> inclusionPatternsJsonList(m_inclusionPatterns.size()); for(unsigned inclusionPatternsIndex = 0; inclusionPatternsIndex < inclusionPatternsJsonList.GetLength(); ++inclusionPatternsIndex) { inclusionPatternsJsonList[inclusionPatternsIndex].AsString(m_inclusionPatterns[inclusionPatternsIndex]); } payload.WithArray("InclusionPatterns", std::move(inclusionPatternsJsonList)); } if(m_exclusionPatternsHasBeenSet) { Array<JsonValue> exclusionPatternsJsonList(m_exclusionPatterns.size()); for(unsigned exclusionPatternsIndex = 0; exclusionPatternsIndex < exclusionPatternsJsonList.GetLength(); ++exclusionPatternsIndex) { exclusionPatternsJsonList[exclusionPatternsIndex].AsString(m_exclusionPatterns[exclusionPatternsIndex]); } payload.WithArray("ExclusionPatterns", std::move(exclusionPatternsJsonList)); } if(m_fieldMappingsHasBeenSet) { Array<JsonValue> fieldMappingsJsonList(m_fieldMappings.size()); for(unsigned fieldMappingsIndex = 0; fieldMappingsIndex < fieldMappingsJsonList.GetLength(); ++fieldMappingsIndex) { fieldMappingsJsonList[fieldMappingsIndex].AsObject(m_fieldMappings[fieldMappingsIndex].Jsonize()); } payload.WithArray("FieldMappings", std::move(fieldMappingsJsonList)); } return payload; } } // namespace Model } // namespace kendra } // namespace Aws
28.687117
134
0.767109
perfectrecall
b093a41a060dc900cfc4dd72b779a8e8ade57c40
652
hpp
C++
Include/Oak/Platform/AtomicDataTypes.hpp
n-suudai/OakPlanet
fd13328ad97b87151bf3fafb00fc01440832393a
[ "MIT" ]
null
null
null
Include/Oak/Platform/AtomicDataTypes.hpp
n-suudai/OakPlanet
fd13328ad97b87151bf3fafb00fc01440832393a
[ "MIT" ]
null
null
null
Include/Oak/Platform/AtomicDataTypes.hpp
n-suudai/OakPlanet
fd13328ad97b87151bf3fafb00fc01440832393a
[ "MIT" ]
null
null
null
 #pragma once #include <cstdint> #include <cstddef> namespace Oak { typedef std::int8_t Int8; typedef std::int16_t Int16; typedef std::int32_t Int32; typedef std::int64_t Int64; typedef std::uint8_t UInt8; typedef std::uint16_t UInt16; typedef std::uint32_t UInt32; typedef std::uint64_t UInt64; typedef float Float; typedef double Double; typedef char Char; typedef char16_t Char16; typedef char32_t Char32; typedef wchar_t WChar; #if defined(UNICODE) typedef WChar TChar; #else typedef Char TChar; #endif typedef bool Bool; typedef void Void; typedef size_t SizeT; typedef time_t TimeT; typedef std::ptrdiff_t PtrDiff; } // namespace Oak
15.162791
31
0.773006
n-suudai
b097e42d11d1f08a92f9032f0802f8df03490101
2,131
cpp
C++
examples/WolfEggs/Egg.cpp
geegrow/Geegrow_ILI9341
f2b5f3d70f4f5e36c7a8817b54b10eee5350cbad
[ "BSD-3-Clause" ]
null
null
null
examples/WolfEggs/Egg.cpp
geegrow/Geegrow_ILI9341
f2b5f3d70f4f5e36c7a8817b54b10eee5350cbad
[ "BSD-3-Clause" ]
null
null
null
examples/WolfEggs/Egg.cpp
geegrow/Geegrow_ILI9341
f2b5f3d70f4f5e36c7a8817b54b10eee5350cbad
[ "BSD-3-Clause" ]
null
null
null
#include "Egg.h" uint8_t Egg::id_counter = 0; Egg::Egg(){ this->_obj = Drawer::instance().createCircleObj(); this->_obj->setColorBG(WHITE); this->id = Egg::id_counter; Egg::id_counter++; this->callbackID = Tweak::attachMsMemberCallback(this, 1000); Tweak::setCallbackActive(this->callbackID, false); } void Egg::tweakHandler(){ this->step(); } void Egg::born(uint8_t new_slide){ if (!this->isAlive){ this->currentSlide = new_slide; this->currentState = EGG_STATE_1; this->isAlive = true; this->step(); Tweak::setCallbackActive(this->callbackID, true); } } void Egg::step(){ CommonInfo::safeDelayAfterUpdateCounter = TICKS_SAFE_DELAY_AFTER_UPDATE; this->beep(); if (this->currentState == EGG_STATE_LAST){ this->lastStep(); return; } this->_obj->moveTo( slides[this->currentSlide][this->currentState][0], slides[this->currentSlide][this->currentState][1], this->radius, this->color ); this->currentState++; } void Egg::lastStep(){ if (this->currentSlide == Wolf::basket_position){ this->catched(); } else { this->broken(); } this->die(); } void Egg::die(){ this->_obj->disappear(); this->isAlive = false; Tweak::setCallbackActive(this->callbackID, false); } void Egg::catched(){ CommonInfo::updateScore(CommonInfo::score + 1); if (CommonInfo::score%20 == 0) CommonInfo::difficulty += 1; if (CommonInfo::score%100 == 0){ CommonInfo::difficulty -= 3; CommonInfo::updateScoreBroken(0); } } void Egg::broken(){ CommonInfo::updateScoreBroken(CommonInfo::score_broken + 1); if (this->currentSlide == LEFT_DOWN || this->currentSlide == LEFT_UP){ CommonInfo::showLeftBroken(); } if (this->currentSlide == RIGHT_DOWN || this->currentSlide == RIGHT_UP){ CommonInfo::showRightBroken(); } if (CommonInfo::score_broken == 3){ CommonInfo::isGameover = true; } } void Egg::beep(){ tone(BUZZER_PWM, 10000 + (this->currentSlide*2000), 100); }
23.677778
76
0.614735
geegrow
b0992c467b5ba4b533ab958e1d45b4a89dab736d
1,589
cpp
C++
test-example.cpp
bhargavthriler/OpenGL-env-setup
a40e2fbb98b76a818ffcaaa1a8a65bc638751b69
[ "MIT" ]
null
null
null
test-example.cpp
bhargavthriler/OpenGL-env-setup
a40e2fbb98b76a818ffcaaa1a8a65bc638751b69
[ "MIT" ]
null
null
null
test-example.cpp
bhargavthriler/OpenGL-env-setup
a40e2fbb98b76a818ffcaaa1a8a65bc638751b69
[ "MIT" ]
null
null
null
#include <glad/glad.h> #include <GLFW/glfw3.h> #include <iostream> void framebuffer_size_callback(GLFWwindow* window, int width, int height); //test flow //default height and width const unsigned int SCR_WIDTH = 800; const unsigned int SCR_HEIGHT = 600; int main(){ //initialising OpenGL with version OpenGL3.3 and Core profile glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //Creating window object GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "Hello OpenGL", NULL, NULL); if(window == NULL){ std::cout << "Failed to create GLFW window" << std::endl; glfwTerminate(); return -1; } //call window object glfwMakeContextCurrent(window); //initialise GLAD if(!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)){ std::cout << "Failed to initialize GLAD" << std::endl; return -1; } //the openGL rendering window glViewport(0, 0, 800, 600); //call framebuffer_size_callback whenver screen is resized glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); //till stopped by the user while(!glfwWindowShouldClose(window)){ glfwSwapBuffers(window); glfwPollEvents(); } //clean GLFW resources glfwTerminate(); return 0; } //framebuffer size callback function defination void framebuffer_size_callback(GLFWwindow* window, int width, int height){ glViewport(0, 0, width, height); }
27.396552
93
0.701699
bhargavthriler
b09d7c777a68c7968fa2ac5b2234b885b2ba23d5
350
cpp
C++
Linked Lists/Reverse Linked List/soln(iterative).cpp
shrustimy/LeetCode_Solutions-C_Cpp
b6f7da9dbfa83f6fc13573e22c4ee4086921e148
[ "MIT" ]
null
null
null
Linked Lists/Reverse Linked List/soln(iterative).cpp
shrustimy/LeetCode_Solutions-C_Cpp
b6f7da9dbfa83f6fc13573e22c4ee4086921e148
[ "MIT" ]
null
null
null
Linked Lists/Reverse Linked List/soln(iterative).cpp
shrustimy/LeetCode_Solutions-C_Cpp
b6f7da9dbfa83f6fc13573e22c4ee4086921e148
[ "MIT" ]
null
null
null
class Solution { //Iterative public: ListNode* reverseList(ListNode* head) { ListNode* curr=head; ListNode* prev=NULL; ListNode* next=NULL; while(curr!=NULL) { next=curr->next; curr->next=prev; prev=curr; curr=next; } return prev; } };
19.444444
43
0.485714
shrustimy
b09f3fbb569dbf65749bc6c715062b058c59d570
835
cpp
C++
Framework/AI/Src/FleeBehavior.cpp
TheJimmyGod/JimmyGod_Engine
b9752c6fbd9db17dc23f03330b5e4537bdcadf8e
[ "MIT" ]
null
null
null
Framework/AI/Src/FleeBehavior.cpp
TheJimmyGod/JimmyGod_Engine
b9752c6fbd9db17dc23f03330b5e4537bdcadf8e
[ "MIT" ]
null
null
null
Framework/AI/Src/FleeBehavior.cpp
TheJimmyGod/JimmyGod_Engine
b9752c6fbd9db17dc23f03330b5e4537bdcadf8e
[ "MIT" ]
null
null
null
#include "Precompiled.h" #include "FleeBehavior.h" using namespace JimmyGod::AI; JimmyGod::Math::Vector2 FleeBehavior::Calculate(Agent & agent) { if (IsActive()) { const float PanicDistanceSq = panicDistance * panicDistance; if (JimmyGod::Math::DistanceSqr(agent.Position, agent.Destination) > PanicDistanceSq) return JimmyGod::Math::Vector2{ 0,0 }; if (IsDebugUIActive()) { JimmyGod::Graphics::SimpleDraw::AddScreenLine(agent.Destination, agent.Position, JimmyGod::Graphics::Colors::Aqua); JimmyGod::Graphics::SimpleDraw::AddScreenCircle(JimmyGod::Math::Circle{ agent.Destination,10.0f },JimmyGod::Graphics::Colors::Aqua); } return ((JimmyGod::Math::Normalize(agent.Position - agent.Destination) *agent.MaxSpeed) - agent.Velocity); } else { return JimmyGod::Math::Vector2(); } }
33.4
136
0.71497
TheJimmyGod
b0a2be33f92e8c476ad3d32a0334756134f8f966
2,841
cpp
C++
source/FileControl.cpp
mystesPF/Raw-Format-Convert-to-BMP
8e0640b488a0cc441e7a9d8db2a2e79976e89eb2
[ "BSD-3-Clause" ]
1
2021-01-25T03:19:13.000Z
2021-01-25T03:19:13.000Z
source/FileControl.cpp
mystesPF/Raw-Format-Convert-to-BMP
8e0640b488a0cc441e7a9d8db2a2e79976e89eb2
[ "BSD-3-Clause" ]
null
null
null
source/FileControl.cpp
mystesPF/Raw-Format-Convert-to-BMP
8e0640b488a0cc441e7a9d8db2a2e79976e89eb2
[ "BSD-3-Clause" ]
1
2019-05-28T09:55:42.000Z
2019-05-28T09:55:42.000Z
#include "StdAfx.h" #include "FileControl.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif CFileControl::CFileControl(void){} CFileControl::~CFileControl(void){} BOOL CFileControl::DoConvertRawFile(CFiles* pFile) { // Create File Data if( !OpenRawFile(pFile)) { AfxMessageBox(_T("Cannot Create File")); return FALSE; } // Do interpolation if(!Interpolation.DoInterpolation(pFile)) { return FALSE; } else { delete[] pFile->getRawFileData(); } // Create Full Image ( Headers + Data ) if(pFile->getFileExt() == "BMP") { if( !MakeBmpImage(pFile, pFile->getInterpolatedData()) ) { return FALSE; } delete[] pFile->getInterpolatedData(); } else // JPG, PNG, etc { AfxMessageBox(_T("Cannot Support yet")); exit(0); } return TRUE; } BOOL CFileControl::OpenRawFile(CFiles* pFile) { FILE* fp; CT2A ascii(pFile->getFileName(), CP_UTF8); // CString to const char* if((fopen_s(&fp, ascii.m_psz, "rb")) != 0) { AfxMessageBox(_T("fopen_s() Error")); return FALSE ; } switch(pFile->getBitDepth()) // File Bit Depth Check { case 8: fread(pFile->getRawFileData(), 1, pFile->getImageSize(), fp); break; case 10: BYTE* szTemp = new BYTE[(pFile->getImageSize()) * 2]; fread(szTemp, 2, pFile->getImageSize(), fp); // Convert 10bit to 8bit for(int i = 0; i < pFile->getImageSize(); i++) { // and Normalization 0~1023 to 0~255 pFile->getRawFileData()[i] = (szTemp[2 * i] + (szTemp[(2 * i) + 1] * 256)) >> 2; // 16^0 and 16^1 -> 16^2 and 16^3 Because Little Endian } delete[] szTemp; break; } fclose(fp); return TRUE; } BOOL CFileControl::MakeBmpImage(CFiles* pFile, BYTE* szInputData) { FILE* fp2; CBmpClass BmpFile(pFile); BmpFile.CreateBmpImage(pFile->getResultFileData(), szInputData); CT2A ascii(MakeFileName(pFile->getFileName(), pFile->getFileExt()), CP_UTF8); // CString to const char* if( (fopen_s(&fp2, ascii.m_psz, "wb")) != NULL) { AfxMessageBox(_T("Cannot Save File")); return FALSE; } // Write Bitmap Headers fwrite(&BmpFile.bfh, sizeof(BITMAPFILEHEADER), 1, fp2); fwrite(&BmpFile.bih, sizeof(BITMAPINFOHEADER), 1, fp2); if(pFile->getColorType() == GRAY_SCALE) { fwrite(&BmpFile.rgb, sizeof(RGBQUAD), 256, fp2); } fwrite(pFile->getResultFileData(), 1, pFile->getResultImageSize(), fp2); fclose(fp2); return TRUE; } CString CFileControl::MakeFileName(CString fName, CString ext) { int nPos; CString originFileName = fName; CString strNewPath; nPos = originFileName.ReverseFind('.'); if(nPos == -1) { strNewPath = originFileName + _T(".") + ext; } else { strNewPath = originFileName.Left(nPos) + _T(".") + ext; } return strNewPath; }
22.023256
140
0.637804
mystesPF
b0aad6c22b4c85330c066ca5ff4b0a640c10e449
7,092
hpp
C++
SharedPtr.hpp
avinarsale/Smart-Pointers
a5cae680012710a99008eef2fda2b9b4b1db02af
[ "Apache-2.0" ]
null
null
null
SharedPtr.hpp
avinarsale/Smart-Pointers
a5cae680012710a99008eef2fda2b9b4b1db02af
[ "Apache-2.0" ]
null
null
null
SharedPtr.hpp
avinarsale/Smart-Pointers
a5cae680012710a99008eef2fda2b9b4b1db02af
[ "Apache-2.0" ]
null
null
null
#ifndef SHARED_PTR #define SHARED_PTR #include<iostream> #include <mutex> namespace cs540 { std::mutex myMutex; class ReferenceCount{ public: int refCount; ReferenceCount() : refCount(0) {} virtual ~ReferenceCount() {} }; template <typename T> class CriticalSection : public ReferenceCount { public: T *obj; CriticalSection(T* tempObj) : obj(tempObj){} ~CriticalSection(){ delete obj; obj=nullptr; } }; template <typename T> class SharedPtr{ public: T* myPtr; ReferenceCount* objShared; SharedPtr() : objShared(nullptr),myPtr(nullptr) {} template <typename U> explicit SharedPtr(U *obj) : myPtr(obj),objShared(new CriticalSection<U>(obj)) { if(objShared!=nullptr){ myMutex.lock(); objShared->refCount=1; myMutex.unlock(); } } SharedPtr(const SharedPtr &p) : objShared(p.objShared),myPtr(p.myPtr) { if(objShared!=nullptr){ myMutex.lock(); objShared->refCount++; myMutex.unlock(); } } template <typename U> SharedPtr(const SharedPtr<U>& p) : objShared(p.objShared), myPtr(p.myPtr) { if(objShared!=nullptr){ myMutex.lock(); objShared->refCount++; myMutex.unlock(); } } SharedPtr(SharedPtr &&p) : objShared(p.objShared), myPtr(p.myPtr) { if(p!=nullptr) { //delete p.objShared; p.objShared=nullptr; p.myPtr=nullptr; } } template <typename U> SharedPtr(SharedPtr<U> &&p) : objShared(p.objShared), myPtr(p.myPtr) { if(p!=nullptr) { //delete p.objShared; p.objShared=nullptr; p.myPtr=nullptr; } } SharedPtr &operator=(const SharedPtr &p) { if(p!=nullptr) { if (objShared == p.objShared) { return *this; }else{ if(objShared!=nullptr){ myMutex.lock(); int tempCount=--objShared->refCount; myMutex.unlock(); if( tempCount == 0) { if(objShared!=nullptr) delete objShared; } } objShared = p.objShared; myMutex.lock(); objShared->refCount++; myMutex.unlock(); } } return *this; } template <typename U> SharedPtr<T> &operator=(const SharedPtr<U> &p) { if(p!=nullptr) { if (objShared == p.objShared) { return *this; }else{ if(objShared!=nullptr) { myMutex.lock(); int tempCount=--objShared->refCount; myMutex.unlock(); if( tempCount == 0) { if(objShared!=nullptr) delete objShared; } } objShared = p.objShared; myMutex.lock(); objShared->refCount++; myMutex.unlock(); } } return *this; } SharedPtr &operator=(SharedPtr &&p) { if(p!=nullptr) { if (objShared == p.objShared) { return *this; }else{ if(objShared!=nullptr) { myMutex.lock(); int tempCount=--objShared->refCount; myMutex.unlock(); if( tempCount == 0) { if(objShared!=nullptr) delete objShared; } } objShared = p.objShared; } p.objShared=nullptr; p.myPtr=nullptr; } return *this; } template <typename U> SharedPtr &operator=(SharedPtr<U> &&p) { if(p!=nullptr) { if (objShared == p.objShared) { return *this; }else{ if(objShared!=nullptr) { myMutex.lock(); int tempCount=--objShared->refCount; myMutex.unlock(); if( tempCount == 0) { if(objShared!=nullptr) delete objShared; } } objShared = p.objShared; } p.objShared=nullptr; p.myPtr=nullptr; } return *this; } ~SharedPtr() { if(objShared!=nullptr) { myMutex.lock(); int tempCount=--objShared->refCount; myMutex.unlock(); if( tempCount == 0) { delete objShared; objShared=nullptr; myPtr=nullptr; } } } void reset() { if(objShared!=nullptr) { myMutex.lock(); int tempCount=--objShared->refCount; myMutex.unlock(); if(tempCount == 0) { delete objShared; } objShared=nullptr; myPtr=nullptr; } } template <typename U> void reset(U *p) { if(objShared!=nullptr) { myMutex.lock(); int tempCount=--objShared->refCount; myMutex.unlock(); if(tempCount==0) { delete objShared; } objShared=nullptr; } myPtr=p; objShared= new CriticalSection<U>(p); myMutex.lock(); objShared->refCount++; myMutex.unlock(); } T *get() const { return myPtr; } T &operator*() const { return *myPtr; } T *operator->() const { return myPtr; } explicit operator bool() const { if(myPtr!=nullptr) { return true; } return false; } template <typename T1, typename T2> friend bool operator==(const SharedPtr<T1> &, const SharedPtr<T2> &); template <typename T1> friend bool operator==(const SharedPtr<T1> &, std::nullptr_t); template <typename T1> friend bool operator==(std::nullptr_t, const SharedPtr<T1> &); template <typename T1, typename T2> friend bool operator!=(const SharedPtr<T1>&, const SharedPtr<T2> &); template <typename T1> friend bool operator!=(const SharedPtr<T1> &, std::nullptr_t); template <typename T1> friend bool operator!=(std::nullptr_t, const SharedPtr<T1> &); template <typename T1, typename U1> friend SharedPtr<T1> static_pointer_cast(const SharedPtr<U1> &sp); template <typename T1, typename U1> friend SharedPtr<T1> dynamic_pointer_cast(const SharedPtr<U1> &sp); }; template <typename T1, typename T2> bool operator==(const SharedPtr<T1>& p1, const SharedPtr<T2>& p2){ if(p1.myPtr==p2.myPtr){ return true; } if(p1==nullptr && p2==nullptr){ return true; } return false; } template <typename T1> bool operator==(const SharedPtr<T1>& p1, std::nullptr_t p2){ if(p1.objShared == p2){ return true; } return false; } template <typename T1> bool operator==(std::nullptr_t p1, const SharedPtr<T1>& p2){ if(p1 == p2){ return true; } return false; } template <typename T1, typename T2> bool operator!=(const SharedPtr<T1>& p1, const SharedPtr<T2>& p2){ if (p1 == p2) { return false; } return true; } template <typename T1> bool operator!=(const SharedPtr<T1>& p1, std::nullptr_t p2){ if (p1 == p2) { return false; } return true; } template <typename T1> bool operator!=(std::nullptr_t p1, const SharedPtr<T1>& p2){ if (p1 == p2) { return false; } return true; } template <typename T1, typename U1> SharedPtr<T1> static_pointer_cast(const SharedPtr<U1>& sp){ SharedPtr<T1> castPtr; castPtr.objShared=sp.objShared; myMutex.lock(); ++castPtr.objShared->refCount; myMutex.unlock(); castPtr.myPtr=static_cast<T1 *>(sp.myPtr); return castPtr; } template <typename T1, typename U1> SharedPtr<T1> dynamic_pointer_cast(const SharedPtr<U1> &sp){ SharedPtr<T1> castPtr; castPtr.objShared=sp.objShared; myMutex.lock(); ++castPtr.objShared->refCount; myMutex.unlock(); castPtr.myPtr=dynamic_cast<T1 *>(sp.myPtr); return castPtr; } }//namespace #endif
21.956656
82
0.609278
avinarsale
b0ad5831b8e4ecfb9ccb44e5b5855e0ac5f9b01c
1,911
cpp
C++
NAS2D/Renderer/Color.cpp
cugone/nas2d-core
632983fa6e9d334d79fdf2dfc54719eee5b5d3ca
[ "Zlib" ]
13
2017-03-23T06:11:30.000Z
2021-09-15T16:22:56.000Z
NAS2D/Renderer/Color.cpp
cugone/nas2d-core
632983fa6e9d334d79fdf2dfc54719eee5b5d3ca
[ "Zlib" ]
467
2016-06-28T22:47:06.000Z
2022-02-08T18:08:12.000Z
NAS2D/Renderer/Color.cpp
cugone/nas2d-core
632983fa6e9d334d79fdf2dfc54719eee5b5d3ca
[ "Zlib" ]
8
2015-10-12T21:36:10.000Z
2021-06-24T07:46:31.000Z
// ================================================================================== // = NAS2D // = Copyright © 2008 - 2020 New Age Software // ================================================================================== // = NAS2D is distributed under the terms of the zlib license. You are free to copy, // = modify and distribute the software under the terms of the zlib license. // = // = Acknowledgment of your use of NAS2D is appreciated but is not required. // ================================================================================== #include "Color.h" using namespace NAS2D; const Color Color::Black{0, 0, 0}; const Color Color::Blue{0, 0, 255}; const Color Color::Green{0, 255, 0}; const Color Color::Cyan{0, 255, 255}; const Color Color::DarkGreen{0, 128, 0}; const Color Color::DarkGray{64, 64, 64}; const Color Color::Gray{128, 128, 128}; const Color Color::LightGray{192, 192, 192}; const Color Color::CoolGray{128, 128, 143}; const Color Color::CoolLightGray{192, 192, 207}; const Color Color::CoolDarkGray{64, 64, 79}; const Color Color::WarmGray{143, 143, 128}; const Color Color::WarmLightGray{207, 207, 192}; const Color Color::WarmDarkGray{79, 79, 64}; const Color Color::Magenta{255, 0, 255}; const Color Color::Navy{35, 60, 85}; const Color Color::Orange{255, 128, 0}; const Color Color::Red{255, 0, 0}; const Color Color::Silver{192, 192, 192}; const Color Color::White{255, 255, 255}; const Color Color::Yellow{255, 255, 0}; const Color Color::Normal{255, 255, 255}; const Color Color::NormalZ{128, 128, 255}; const Color Color::NoAlpha{0, 0, 0, 0}; bool Color::operator==(Color other) const { return (red == other.red) && (green == other.green) && (blue == other.blue) && (alpha == other.alpha); } bool Color::operator!=(Color other) const { return !(*this == other); } Color Color::alphaFade(uint8_t newAlpha) const { return {red, green, blue, newAlpha}; }
34.125
103
0.603349
cugone
b0b090a596b98fbbe44d008d616dc42b567a5992
76,642
cpp
C++
FPSLighting/Dependencies/DIRECTX/Samples/C++/Direct3D10/AdvancedParticles/AdvancedParticles.cpp
billionare/FPSLighting
c7d646f51cf4dee360dcc7c8e2fd2821b421b418
[ "MIT" ]
null
null
null
FPSLighting/Dependencies/DIRECTX/Samples/C++/Direct3D10/AdvancedParticles/AdvancedParticles.cpp
billionare/FPSLighting
c7d646f51cf4dee360dcc7c8e2fd2821b421b418
[ "MIT" ]
null
null
null
FPSLighting/Dependencies/DIRECTX/Samples/C++/Direct3D10/AdvancedParticles/AdvancedParticles.cpp
billionare/FPSLighting
c7d646f51cf4dee360dcc7c8e2fd2821b421b418
[ "MIT" ]
null
null
null
//-------------------------------------------------------------------------------------- // File: ParticlesGS.cpp // // Copyright (c) Microsoft Corporation. All rights reserved. //-------------------------------------------------------------------------------------- #include "DXUT.h" #include "DXUTgui.h" #include "DXUTsettingsdlg.h" #include "DXUTcamera.h" #include "SDKmisc.h" #include "SDKmesh.h" #include "resource.h" #include "Commdlg.h" #define MAX_BONE_MATRICES 255 //-------------------------------------------------------------------------------------- // Global variables //-------------------------------------------------------------------------------------- CModelViewerCamera g_Camera; // A model viewing camera CDXUTDialogResourceManager g_DialogResourceManager; // manager for shared resources of dialogs CD3DSettingsDlg g_D3DSettingsDlg; // Device settings dialog CDXUTDialog g_HUD; // manages the 3D UI CDXUTDialog g_SampleUI; // dialog for sample specific controls bool g_bFirst = true; ID3DX10Font* g_pFont10 = NULL; ID3DX10Sprite* g_pSprite10 = NULL; CDXUTTextHelper* g_pTxtHelper = NULL; ID3D10Effect* g_pParticleEffect10 = NULL; ID3D10Effect* g_pMeshEffect10 = NULL; ID3D10Effect* g_pVolEffect10 = NULL; ID3D10Effect* g_pPaintEffect10 = NULL; ID3D10InputLayout* g_pParticleVertexLayout = NULL; ID3D10InputLayout* g_pMeshVertexLayout = NULL; ID3D10InputLayout* g_pQuadVertexLayout = NULL; ID3D10InputLayout* g_pAnimVertexLayout = NULL; ID3D10InputLayout* g_pPaintAnimVertexLayout = NULL; struct QUAD_VERTEX { D3DXVECTOR3 Pos; D3DXVECTOR2 Tex; }; ID3D10Buffer* g_pQuadVB = NULL; // particle necessities D3DXVECTOR4 g_vGravity( 0,-0.5f,0,0 ); D3DXVECTOR3 g_vParticleColor( 1,0,0 ); float g_fParticleOpacity = 1.0f; ID3D10Buffer* g_pParticleStart = NULL; ID3D10Buffer* g_pParticleStreamTo = NULL; ID3D10Buffer* g_pParticleDrawFrom = NULL; ID3D10ShaderResourceView* g_pParticleStreamToRV = NULL; ID3D10ShaderResourceView* g_pParticleDrawFromRV = NULL; ID3D10ShaderResourceView* g_pParticleTexRV = NULL; ID3D10Texture1D* g_pRandomTexture = NULL; ID3D10ShaderResourceView* g_pRandomTexRV = NULL; // render to volume necessities D3DXVECTOR3 g_vEmitterPos( 0,1.5f,0 ); UINT g_VolumeWidth = 32; UINT g_VolumeHeight = 32; UINT g_VolumeDepth = 32; float g_VolumeSize = 2.0f; float g_fEmitterSize = 0.3f; ID3D10Texture3D* g_pVolumeTexture = NULL; ID3D10ShaderResourceView* g_pVolumeTexRV = NULL; ID3D10RenderTargetView** g_pVolumeTexRTVs = NULL; ID3D10RenderTargetView* g_pVolumeTexTotalRTV = NULL; ID3D10Texture3D* g_pVelocityTexture = NULL; ID3D10ShaderResourceView* g_pVelocityTexRV = NULL; ID3D10RenderTargetView** g_pVelocityTexRTVs = NULL; ID3D10RenderTargetView* g_pVelocityTexTotalRTV = NULL; // paint necessities int g_iControlMesh = 1; bool g_bPaint = false; bool g_bRandomizeColor = false; UINT g_PositionWidth = 256; UINT g_PositionHeight = 256; UINT g_iParticleStart = 0; UINT g_iParticleStep = 0; float g_fParticlePaintRadSq = 0.0005f; struct MESH { CDXUTSDKMesh Mesh; ID3D10Texture2D* pMeshPositionTexture; ID3D10ShaderResourceView* pMeshPositionRV; ID3D10RenderTargetView* pMeshPositionRTV; UINT MeshTextureWidth; UINT MeshTextureHeight; ID3D10Texture2D* pMeshTexture; ID3D10ShaderResourceView* pMeshRV; ID3D10RenderTargetView* pMeshRTV; D3DXMATRIX mWorld; D3DXMATRIX mWorldPrev; D3DXVECTOR3 vPosition; D3DXVECTOR3 vRotation; }; #define NUM_MESHES 2 MESH g_WorldMesh[NUM_MESHES]; // particle fx ID3D10EffectTechnique* g_pRenderParticles_Particle; ID3D10EffectTechnique* g_pAdvanceParticles_Particle; ID3D10EffectMatrixVariable* g_pmWorldViewProj_Particle; ID3D10EffectMatrixVariable* g_pmInvView_Particle; ID3D10EffectScalarVariable* g_pfGlobalTime_Particle; ID3D10EffectScalarVariable* g_pfElapsedTime_Particle; ID3D10EffectScalarVariable* g_pfVolumeSize_Particle; ID3D10EffectScalarVariable* g_pfEmitterSize_Particle; ID3D10EffectVectorVariable* g_pvVolumeOffsets_Particle; ID3D10EffectVectorVariable* g_pvFrameGravity_Particle; ID3D10EffectVectorVariable* g_pvParticleColor_Particle; ID3D10EffectVectorVariable* g_pvEmitterPos_Particle; ID3D10EffectShaderResourceVariable* g_ptxDiffuse_Particle; ID3D10EffectShaderResourceVariable* g_ptxRandom_Particle; ID3D10EffectShaderResourceVariable* g_ptxVolume_Particle; ID3D10EffectShaderResourceVariable* g_ptxVelocity_Particle; // mesh fx ID3D10EffectTechnique* g_pRenderScene_Mesh; ID3D10EffectTechnique* g_pRenderAnimScene_Mesh; ID3D10EffectMatrixVariable* g_pmWorldViewProj_Mesh; ID3D10EffectMatrixVariable* g_pmViewProj_Mesh; ID3D10EffectMatrixVariable* g_pmWorld_Mesh; ID3D10EffectMatrixVariable* g_pmBoneWorld_Mesh; ID3D10EffectMatrixVariable* g_pmBonePrev_Mesh; ID3D10EffectVectorVariable* g_pvLightDir_Mesh; ID3D10EffectVectorVariable* g_pvEyePt_Mesh; ID3D10EffectShaderResourceVariable* g_ptxDiffuse_Mesh; ID3D10EffectShaderResourceVariable* g_ptxNormal_Mesh; ID3D10EffectShaderResourceVariable* g_ptxSpecular_Mesh; ID3D10EffectShaderResourceVariable* g_ptxPaint_Mesh; // render to volume fx ID3D10EffectTechnique* g_pRenderScene_Vol; ID3D10EffectTechnique* g_pRenderAnimScene_Vol; ID3D10EffectTechnique* g_pRenderAnimVelocity_Vol; ID3D10EffectTechnique* g_pRenderVelocity_Vol; ID3D10EffectMatrixVariable* g_pmWorldViewProj_Vol; ID3D10EffectMatrixVariable* g_pmViewProj_Vol; ID3D10EffectMatrixVariable* g_pmWorld_Vol; ID3D10EffectMatrixVariable* g_pmWorldPrev_Vol; ID3D10EffectMatrixVariable* g_pmBoneWorld_Vol; ID3D10EffectMatrixVariable* g_pmBonePrev_Vol; ID3D10EffectScalarVariable* g_pfElapsedTime_Vol; ID3D10EffectScalarVariable* g_pfPlaneStart_Vol; ID3D10EffectScalarVariable* g_pfPlaneStep_Vol; ID3D10EffectVectorVariable* g_pvFarClipPlane_Vol; ID3D10EffectVectorVariable* g_pvNearClipPlane_Vol; // paint fx ID3D10EffectTechnique* g_pRenderToUV_Paint; ID3D10EffectTechnique* g_pRenderAnimToUV_Paint; ID3D10EffectTechnique* g_pPaint_Paint; ID3D10EffectMatrixVariable* g_pmWorld_Paint; ID3D10EffectMatrixVariable* g_pmBoneWorld_Paint; ID3D10EffectScalarVariable* g_pNumParticles_Paint; ID3D10EffectScalarVariable* g_pParticleStart_Paint; ID3D10EffectScalarVariable* g_pParticleStep_Paint; ID3D10EffectScalarVariable* g_pfParticleRadiusSq_Paint; ID3D10EffectVectorVariable* g_pvParticleColor_Paint; ID3D10EffectShaderResourceVariable* g_ptxDiffuse_Paint; ID3D10EffectShaderResourceVariable* g_pParticleBuffer_Paint; // for the dynamic mesh struct PARTICLE_VERTEX { D3DXVECTOR4 pos; D3DXVECTOR4 lastpos; D3DXVECTOR4 color; D3DXVECTOR3 vel; UINT ID; }; #define MAX_PARTICLES 5000 UINT g_OptimalParticlesPerShader = 200; //-------------------------------------------------------------------------------------- // UI control IDs //-------------------------------------------------------------------------------------- #define IDC_TOGGLEFULLSCREEN 1 #define IDC_TOGGLEREF 3 #define IDC_CHANGEDEVICE 4 #define IDC_TOGGLEWARP 5 // sample UI #define IDC_TOGGLEMESH 49 #define IDC_PAINTTOGGLE 50 #define IDC_PARTICLECOLOR 51 #define IDC_PARTICLEOPACITY_STATIC 52 #define IDC_PARTICLEOPACITY 53 #define IDC_RANDOMIZECOLOR 54 //-------------------------------------------------------------------------------------- // Forward declarations //-------------------------------------------------------------------------------------- bool CALLBACK ModifyDeviceSettings( DXUTDeviceSettings* pDeviceSettings, void* pUserContext ); void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext ); LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing, void* pUserContext ); void CALLBACK KeyboardProc( UINT nChar, bool bKeyDown, bool bAltDown, void* pUserContext ); void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext ); bool CALLBACK IsD3D10DeviceAcceptable( UINT Adapter, UINT Output, D3D10_DRIVER_TYPE DeviceType, DXGI_FORMAT BackBufferFormat, bool bWindowed, void* pUserContext ); HRESULT CALLBACK OnD3D10CreateDevice( ID3D10Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ); HRESULT CALLBACK OnD3D10SwapChainResized( ID3D10Device* pd3dDevice, IDXGISwapChain* pSwapChain, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ); void CALLBACK OnD3D10SwapChainReleasing( void* pUserContext ); void CALLBACK OnD3D10DestroyDevice( void* pUserContext ); void CALLBACK OnD3D10FrameRender( ID3D10Device* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext ); void InitApp(); void RenderText(); HRESULT CreateParticleBuffer( ID3D10Device* pd3dDevice ); HRESULT CreateRandomTexture( ID3D10Device* pd3dDevice ); HRESULT CreateVolumeTexture( ID3D10Device* pd3dDevice ); HRESULT CreatePositionTextures( ID3D10Device* pd3dDevice, MESH* pMesh ); HRESULT CreateMeshTexture( ID3D10Device* pd3dDevice, UINT width, UINT height, MESH* pMesh ); HRESULT CreateQuadVB( ID3D10Device* pd3dDevice ); void HandleKeys( float fElapsedTime ); //-------------------------------------------------------------------------------------- // Entry point to the program. Initializes everything and goes into a message processing // loop. Idle time is used to render the scene. //-------------------------------------------------------------------------------------- int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif // DXUT will create and use the best device (either D3D9 or D3D10) // that is available on the system depending on which D3D callbacks are set below // Set DXUT callbacks DXUTSetCallbackDeviceChanging( ModifyDeviceSettings ); DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackKeyboard( KeyboardProc ); DXUTSetCallbackFrameMove( OnFrameMove ); DXUTSetCallbackD3D10DeviceAcceptable( IsD3D10DeviceAcceptable ); DXUTSetCallbackD3D10DeviceCreated( OnD3D10CreateDevice ); DXUTSetCallbackD3D10SwapChainResized( OnD3D10SwapChainResized ); DXUTSetCallbackD3D10SwapChainReleasing( OnD3D10SwapChainReleasing ); DXUTSetCallbackD3D10DeviceDestroyed( OnD3D10DestroyDevice ); DXUTSetCallbackD3D10FrameRender( OnD3D10FrameRender ); InitApp(); DXUTInit( true, true, NULL ); // Parse the command line, show msgboxes on error, no extra command line params DXUTSetCursorSettings( true, true ); // Show the cursor and clip it when in full screen DXUTCreateWindow( L"AdvancedParticles" ); DXUTCreateDevice( true, 800, 600 ); DXUTMainLoop(); // Enter into the DXUT render loop } float RPercent() { float ret = ( float )( ( rand() % 20000 ) - 10000 ); return ret / 10000.0f; } //-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { g_iParticleStep = MAX_PARTICLES / g_OptimalParticlesPerShader; g_D3DSettingsDlg.Init( &g_DialogResourceManager ); g_HUD.Init( &g_DialogResourceManager ); g_SampleUI.Init( &g_DialogResourceManager ); g_HUD.SetCallback( OnGUIEvent ); int iY = 10; g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 35, iY, 125, 22 ); g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY += 24, 125, 22, VK_F2 ); g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 35, iY += 24, 125, 22, VK_F3 ); g_HUD.AddButton( IDC_TOGGLEWARP, L"Toggle WARP (F4)", 35, iY += 24, 125, 22, VK_F4 ); int iX = 35; iY = 0; g_SampleUI.SetCallback( OnGUIEvent ); iY = 10; g_SampleUI.AddButton( IDC_TOGGLEMESH, L"Toggle Active Mesh", iX, iY += 24, 125, 22 ); iY += 30; g_SampleUI.AddCheckBox( IDC_PAINTTOGGLE, L"Toggle Painting", iX, iY, 125, 22 ); g_SampleUI.AddButton( IDC_PARTICLECOLOR, L"Particle Color", iX, iY += 24, 125, 22 ); WCHAR str[MAX_PATH]; swprintf_s( str, MAX_PATH, L"Particle Opacity %.2f", g_fParticleOpacity ); g_SampleUI.AddStatic( IDC_PARTICLEOPACITY_STATIC, str, iX, iY += 24, 125, 22 ); g_SampleUI.AddSlider( IDC_PARTICLEOPACITY, iX - 20, iY += 24, 125, 22, 0, 100, ( int )( 100 * g_fParticleOpacity ) ); g_SampleUI.AddCheckBox( IDC_RANDOMIZECOLOR, L"Randomize Color", iX, iY += 24, 125, 22 ); } //-------------------------------------------------------------------------------------- // Called right before creating a D3D9 or D3D10 device, allowing the app to modify the device settings as needed //-------------------------------------------------------------------------------------- bool CALLBACK ModifyDeviceSettings( DXUTDeviceSettings* pDeviceSettings, void* pUserContext ) { pDeviceSettings->d3d10.SyncInterval = DXGI_SWAP_EFFECT_DISCARD; g_D3DSettingsDlg.GetDialogControl()->GetComboBox( DXUTSETTINGSDLG_PRESENT_INTERVAL )->SetEnabled( false ); // For the first device created if its a REF device, optionally display a warning dialog box static bool s_bFirstTime = true; if( s_bFirstTime ) { s_bFirstTime = false; if( ( DXUT_D3D9_DEVICE == pDeviceSettings->ver && pDeviceSettings->d3d9.DeviceType == D3DDEVTYPE_REF ) || ( DXUT_D3D10_DEVICE == pDeviceSettings->ver && pDeviceSettings->d3d10.DriverType == D3D10_DRIVER_TYPE_REFERENCE ) ) DXUTDisplaySwitchingToREFWarning( pDeviceSettings->ver ); } return true; } //-------------------------------------------------------------------------------------- // Handle updates to the scene. This is called regardless of which D3D API is used //-------------------------------------------------------------------------------------- static double fLastRandomize = 0.0; void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext ) { // Update the camera's position based on user input g_Camera.FrameMove( fElapsedTime ); if( g_bRandomizeColor ) { if( fTime - fLastRandomize > 2.0 ) { g_vParticleColor.x = fabs( RPercent() ); g_vParticleColor.y = fabs( RPercent() ); g_vParticleColor.z = fabs( RPercent() ); fLastRandomize = fTime; } } HandleKeys( fElapsedTime ); } //-------------------------------------------------------------------------------------- // Handle messages to the application //-------------------------------------------------------------------------------------- LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing, void* pUserContext ) { // Pass messages to dialog resource manager calls so GUI state is updated correctly *pbNoFurtherProcessing = g_DialogResourceManager.MsgProc( hWnd, uMsg, wParam, lParam ); if( *pbNoFurtherProcessing ) return 0; // Pass messages to settings dialog if its active if( g_D3DSettingsDlg.IsActive() ) { g_D3DSettingsDlg.MsgProc( hWnd, uMsg, wParam, lParam ); return 0; } // Give the dialogs a chance to handle the message first *pbNoFurtherProcessing = g_HUD.MsgProc( hWnd, uMsg, wParam, lParam ); if( *pbNoFurtherProcessing ) return 0; *pbNoFurtherProcessing = g_SampleUI.MsgProc( hWnd, uMsg, wParam, lParam ); if( *pbNoFurtherProcessing ) return 0; // Pass all remaining windows messages to camera so it can respond to user input g_Camera.HandleMessages( hWnd, uMsg, wParam, lParam ); return 0; } //-------------------------------------------------------------------------------------- // Handle key presses //-------------------------------------------------------------------------------------- void CALLBACK KeyboardProc( UINT nChar, bool bKeyDown, bool bAltDown, void* pUserContext ) { } //-------------------------------------------------------------------------------------- // Handles the GUI events //-------------------------------------------------------------------------------------- static COLORREF g_customColors[16] = {0}; void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext ) { switch( nControlID ) { case IDC_TOGGLEFULLSCREEN: DXUTToggleFullScreen(); break; case IDC_TOGGLEREF: DXUTToggleREF(); break; case IDC_CHANGEDEVICE: g_D3DSettingsDlg.SetActive( !g_D3DSettingsDlg.IsActive() ); break; case IDC_TOGGLEWARP: DXUTToggleWARP(); break; case IDC_TOGGLEMESH: { g_iControlMesh ++; if( g_iControlMesh >= NUM_MESHES ) g_iControlMesh = 0; } break; case IDC_PAINTTOGGLE: g_bPaint = !g_bPaint; break; case IDC_PARTICLECOLOR: { CHOOSECOLOR chcol; ZeroMemory( &chcol, sizeof( CHOOSECOLOR ) ); chcol.lStructSize = sizeof( CHOOSECOLOR ); chcol.rgbResult = RGB( ( BYTE )( g_vParticleColor.x * 255.0f ), ( BYTE )( g_vParticleColor.y * 255.0f ), ( BYTE )( g_vParticleColor.z * 255.0f ) ); chcol.Flags = CC_RGBINIT | CC_FULLOPEN; chcol.lpCustColors = g_customColors; DXUTPause( true, true ); if( ChooseColor( &chcol ) ) { g_vParticleColor.x = GetRValue( chcol.rgbResult ) / 255.0f; g_vParticleColor.y = GetGValue( chcol.rgbResult ) / 255.0f; g_vParticleColor.z = GetBValue( chcol.rgbResult ) / 255.0f; } DXUTPause( false, false ); } break; case IDC_PARTICLEOPACITY: { g_fParticleOpacity = g_SampleUI.GetSlider( IDC_PARTICLEOPACITY )->GetValue() / 100.0f; WCHAR str[MAX_PATH]; swprintf_s( str, MAX_PATH, L"Particle Opacity %.2f", g_fParticleOpacity ); g_SampleUI.GetStatic( IDC_PARTICLEOPACITY_STATIC )->SetText( str ); } break; case IDC_RANDOMIZECOLOR: g_bRandomizeColor = !g_bRandomizeColor; break; } } //-------------------------------------------------------------------------------------- // Reject any D3D10 devices that aren't acceptable by returning false //-------------------------------------------------------------------------------------- bool CALLBACK IsD3D10DeviceAcceptable( UINT Adapter, UINT Output, D3D10_DRIVER_TYPE DeviceType, DXGI_FORMAT BackBufferFormat, bool bWindowed, void* pUserContext ) { return true; } //-------------------------------------------------------------------------------------- // Create any D3D10 resources that aren't dependant on the back buffer //-------------------------------------------------------------------------------------- HRESULT CALLBACK OnD3D10CreateDevice( ID3D10Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ) { HRESULT hr; V_RETURN( g_DialogResourceManager.OnD3D10CreateDevice( pd3dDevice ) ); V_RETURN( g_D3DSettingsDlg.OnD3D10CreateDevice( pd3dDevice ) ); V_RETURN( D3DX10CreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial", &g_pFont10 ) ); V_RETURN( D3DX10CreateSprite( pd3dDevice, 512, &g_pSprite10 ) ); g_pTxtHelper = new CDXUTTextHelper( NULL, NULL, g_pFont10, g_pSprite10, 15 ); // Read the D3DX effect file WCHAR str[MAX_PATH]; UINT uFlags = D3D10_SHADER_ENABLE_STRICTNESS | D3D10_SHADER_DEBUG; V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"AdvancedParticles.fx" ) ); V_RETURN( D3DX10CreateEffectFromFile( str, NULL, NULL, "fx_4_0", uFlags, 0, pd3dDevice, NULL, NULL, &g_pParticleEffect10, NULL, NULL ) ); V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"Meshes.fx" ) ); V_RETURN( D3DX10CreateEffectFromFile( str, NULL, NULL, "fx_4_0", uFlags, 0, pd3dDevice, NULL, NULL, &g_pMeshEffect10, NULL, NULL ) ); V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"RenderToVolume.fx" ) ); V_RETURN( D3DX10CreateEffectFromFile( str, NULL, NULL, "fx_4_0", uFlags, 0, pd3dDevice, NULL, NULL, &g_pVolEffect10, NULL, NULL ) ); V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"Paint.fx" ) ); V_RETURN( D3DX10CreateEffectFromFile( str, NULL, NULL, "fx_4_0", uFlags, 0, pd3dDevice, NULL, NULL, &g_pPaintEffect10, NULL, NULL ) ); // Obtain the technique handles for particle fx g_pRenderParticles_Particle = g_pParticleEffect10->GetTechniqueByName( "RenderParticles" ); g_pAdvanceParticles_Particle = g_pParticleEffect10->GetTechniqueByName( "AdvanceParticles" ); // Obtain the parameter handles for particle fx g_pmWorldViewProj_Particle = g_pParticleEffect10->GetVariableByName( "g_mWorldViewProj" )->AsMatrix(); g_pmInvView_Particle = g_pParticleEffect10->GetVariableByName( "g_mInvView" )->AsMatrix(); g_pfGlobalTime_Particle = g_pParticleEffect10->GetVariableByName( "g_fGlobalTime" )->AsScalar(); g_pfElapsedTime_Particle = g_pParticleEffect10->GetVariableByName( "g_fElapsedTime" )->AsScalar(); g_pfVolumeSize_Particle = g_pParticleEffect10->GetVariableByName( "g_fVolumeSize" )->AsScalar(); g_pfEmitterSize_Particle = g_pParticleEffect10->GetVariableByName( "g_fEmitterSize" )->AsScalar(); g_pvVolumeOffsets_Particle = g_pParticleEffect10->GetVariableByName( "g_vVolumeOffsets" )->AsVector(); g_pvFrameGravity_Particle = g_pParticleEffect10->GetVariableByName( "g_vFrameGravity" )->AsVector(); g_pvParticleColor_Particle = g_pParticleEffect10->GetVariableByName( "g_vParticleColor" )->AsVector(); g_pvEmitterPos_Particle = g_pParticleEffect10->GetVariableByName( "g_vEmitterPos" )->AsVector(); g_ptxDiffuse_Particle = g_pParticleEffect10->GetVariableByName( "g_txDiffuse" )->AsShaderResource(); g_ptxRandom_Particle = g_pParticleEffect10->GetVariableByName( "g_txRandom" )->AsShaderResource(); g_ptxVolume_Particle = g_pParticleEffect10->GetVariableByName( "g_txVolume" )->AsShaderResource(); g_ptxVelocity_Particle = g_pParticleEffect10->GetVariableByName( "g_txVelocity" )->AsShaderResource(); // Obtain the technique handles for meshes fx g_pRenderScene_Mesh = g_pMeshEffect10->GetTechniqueByName( "RenderScene" ); g_pRenderAnimScene_Mesh = g_pMeshEffect10->GetTechniqueByName( "RenderAnimScene" ); // Obtain the parameter handles for meshes fx g_pmWorldViewProj_Mesh = g_pMeshEffect10->GetVariableByName( "g_mWorldViewProj" )->AsMatrix(); g_pmViewProj_Mesh = g_pMeshEffect10->GetVariableByName( "g_mViewProj" )->AsMatrix(); g_pmWorld_Mesh = g_pMeshEffect10->GetVariableByName( "g_mWorld" )->AsMatrix(); g_pmBoneWorld_Mesh = g_pMeshEffect10->GetVariableByName( "g_mBoneWorld" )->AsMatrix(); g_pmBonePrev_Mesh = g_pMeshEffect10->GetVariableByName( "g_mBonePrev" )->AsMatrix(); g_pvLightDir_Mesh = g_pMeshEffect10->GetVariableByName( "g_vLightDir" )->AsVector(); g_pvEyePt_Mesh = g_pMeshEffect10->GetVariableByName( "g_vEyePt" )->AsVector(); g_ptxDiffuse_Mesh = g_pMeshEffect10->GetVariableByName( "g_txDiffuse" )->AsShaderResource(); g_ptxNormal_Mesh = g_pMeshEffect10->GetVariableByName( "g_txNormal" )->AsShaderResource(); g_ptxSpecular_Mesh = g_pMeshEffect10->GetVariableByName( "g_txSpecular" )->AsShaderResource(); g_ptxPaint_Mesh = g_pMeshEffect10->GetVariableByName( "g_txPaint" )->AsShaderResource(); // Obtain the technique handles for volume fx g_pRenderScene_Vol = g_pVolEffect10->GetTechniqueByName( "RenderScene" ); g_pRenderAnimScene_Vol = g_pVolEffect10->GetTechniqueByName( "RenderAnimScene" ); g_pRenderVelocity_Vol = g_pVolEffect10->GetTechniqueByName( "RenderVelocity" ); g_pRenderAnimVelocity_Vol = g_pVolEffect10->GetTechniqueByName( "RenderAnimVelocity" ); // Obtain the parameter handles for volume fx g_pmWorldViewProj_Vol = g_pVolEffect10->GetVariableByName( "g_mWorldViewProj" )->AsMatrix(); g_pmViewProj_Vol = g_pVolEffect10->GetVariableByName( "g_mViewProj" )->AsMatrix(); g_pmWorld_Vol = g_pVolEffect10->GetVariableByName( "g_mWorld" )->AsMatrix(); g_pmWorldPrev_Vol = g_pVolEffect10->GetVariableByName( "g_mWorldPrev" )->AsMatrix(); g_pmBoneWorld_Vol = g_pVolEffect10->GetVariableByName( "g_mBoneWorld" )->AsMatrix(); g_pmBonePrev_Vol = g_pVolEffect10->GetVariableByName( "g_mBonePrev" )->AsMatrix(); g_pfElapsedTime_Vol = g_pVolEffect10->GetVariableByName( "g_fElapsedTime" )->AsScalar(); g_pfPlaneStart_Vol = g_pVolEffect10->GetVariableByName( "g_fPlaneStart" )->AsScalar(); g_pfPlaneStep_Vol = g_pVolEffect10->GetVariableByName( "g_fPlaneStep" )->AsScalar(); g_pvFarClipPlane_Vol = g_pVolEffect10->GetVariableByName( "g_vFarClipPlane" )->AsVector(); g_pvNearClipPlane_Vol = g_pVolEffect10->GetVariableByName( "g_vNearClipPlane" )->AsVector(); // Obtain the technique handles for paint fx g_pRenderToUV_Paint = g_pPaintEffect10->GetTechniqueByName( "RenderToUV" ); g_pRenderAnimToUV_Paint = g_pPaintEffect10->GetTechniqueByName( "RenderAnimToUV" ); g_pPaint_Paint = g_pPaintEffect10->GetTechniqueByName( "Paint" ); // Obtain the parameter handles for paint fx g_pmWorld_Paint = g_pPaintEffect10->GetVariableByName( "g_mWorld" )->AsMatrix(); g_pmBoneWorld_Paint = g_pPaintEffect10->GetVariableByName( "g_mBoneWorld" )->AsMatrix(); g_pNumParticles_Paint = g_pPaintEffect10->GetVariableByName( "g_NumParticles" )->AsScalar(); g_pParticleStart_Paint = g_pPaintEffect10->GetVariableByName( "g_ParticleStart" )->AsScalar(); g_pParticleStep_Paint = g_pPaintEffect10->GetVariableByName( "g_ParticleStep" )->AsScalar(); g_pfParticleRadiusSq_Paint = g_pPaintEffect10->GetVariableByName( "g_fParticleRadiusSq" )->AsScalar(); g_pvParticleColor_Paint = g_pPaintEffect10->GetVariableByName( "g_vParticleColor" )->AsVector(); g_ptxDiffuse_Paint = g_pPaintEffect10->GetVariableByName( "g_txDiffuse" )->AsShaderResource(); g_pParticleBuffer_Paint = g_pPaintEffect10->GetVariableByName( "g_ParticleBuffer" )->AsShaderResource(); // Create our vertex input layout for particles const D3D10_INPUT_ELEMENT_DESC particlelayout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "LASTPOSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 32, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "VELOCITY", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 48, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "ID", 0, DXGI_FORMAT_R32_UINT, 0, 60, D3D10_INPUT_PER_VERTEX_DATA, 0 }, }; D3D10_PASS_DESC PassDesc; g_pAdvanceParticles_Particle->GetPassByIndex( 0 )->GetDesc( &PassDesc ); V_RETURN( pd3dDevice->CreateInputLayout( particlelayout, sizeof( particlelayout ) / sizeof( particlelayout[0] ), PassDesc.pIAInputSignature, PassDesc.IAInputSignatureSize, &g_pParticleVertexLayout ) ); // Create our vertex input layout for meshes const D3D10_INPUT_ELEMENT_DESC meshlayout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0 }, }; g_pRenderScene_Mesh->GetPassByIndex( 0 )->GetDesc( &PassDesc ); V_RETURN( pd3dDevice->CreateInputLayout( meshlayout, sizeof( meshlayout ) / sizeof( meshlayout[0] ), PassDesc.pIAInputSignature, PassDesc.IAInputSignatureSize, &g_pMeshVertexLayout ) ); const D3D10_INPUT_ELEMENT_DESC skinnedlayout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "WEIGHTS", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "BONES", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 20, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 32, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 40, D3D10_INPUT_PER_VERTEX_DATA, 0 }, }; g_pRenderAnimScene_Mesh->GetPassByIndex( 0 )->GetDesc( &PassDesc ); V_RETURN( pd3dDevice->CreateInputLayout( skinnedlayout, sizeof( skinnedlayout ) / sizeof( skinnedlayout[0] ), PassDesc.pIAInputSignature, PassDesc.IAInputSignatureSize, &g_pAnimVertexLayout ) ); g_pRenderAnimToUV_Paint->GetPassByIndex( 0 )->GetDesc( &PassDesc ); V_RETURN( pd3dDevice->CreateInputLayout( skinnedlayout, sizeof( skinnedlayout ) / sizeof( skinnedlayout[0] ), PassDesc.pIAInputSignature, PassDesc.IAInputSignatureSize, &g_pPaintAnimVertexLayout ) ); // Create our vertex input layout for screen quads const D3D10_INPUT_ELEMENT_DESC quadlayout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 }, }; g_pPaint_Paint->GetPassByIndex( 0 )->GetDesc( &PassDesc ); V_RETURN( pd3dDevice->CreateInputLayout( quadlayout, sizeof( quadlayout ) / sizeof( quadlayout[0] ), PassDesc.pIAInputSignature, PassDesc.IAInputSignatureSize, &g_pQuadVertexLayout ) ); // Load meshes V_RETURN( g_WorldMesh[0].Mesh.Create( pd3dDevice, L"advancedparticles\\lizardSIG.sdkmesh" ) ); V_RETURN( g_WorldMesh[0].Mesh.LoadAnimation( L"advancedparticles\\lizardSIG.sdkmesh_anim" ) ); V_RETURN( CreateMeshTexture( pd3dDevice, 256, 256, &g_WorldMesh[0] ) ); D3DXMATRIX mIdentity; D3DXMatrixIdentity( &mIdentity ); g_WorldMesh[0].Mesh.TransformBindPose( &mIdentity ); V_RETURN( g_WorldMesh[1].Mesh.Create( pd3dDevice, L"advancedparticles\\blocktest.sdkmesh" ) ); V_RETURN( CreateMeshTexture( pd3dDevice, 256, 256, &g_WorldMesh[1] ) ); // Create the seeding particle V_RETURN( CreateParticleBuffer( pd3dDevice ) ); // Load the Particle Texture V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"misc\\Particle.dds" ) ); V_RETURN( D3DX10CreateShaderResourceViewFromFile( pd3dDevice, str, NULL, NULL, &g_pParticleTexRV, NULL ) ); // Create the random texture that fuels our random vector generator in the effect V_RETURN( CreateRandomTexture( pd3dDevice ) ); // Create the volume texture and render target views, etc V_RETURN( CreateVolumeTexture( pd3dDevice ) ); // Create position texture for the mesh for( UINT i = 0; i < NUM_MESHES; i++ ) V_RETURN( CreatePositionTextures( pd3dDevice, &g_WorldMesh[i] ) ); // Let the app know that this if the first time drawing particles g_bFirst = true; V_RETURN( CreateQuadVB( pd3dDevice ) ); // Setup the camera's view parameters D3DXVECTOR3 vecEye( 0.0f, 0.6f, -5.0f ); D3DXVECTOR3 vecAt ( 0.0f, 0.6f, 0.0f ); g_Camera.SetViewParams( &vecEye, &vecAt ); // Move the block into position g_WorldMesh[1].vRotation.x = 0; g_WorldMesh[1].vRotation.y = 0; g_WorldMesh[1].vRotation.z = -30.0f * ( 180.0f / 3.14159f ); g_WorldMesh[1].vPosition.x = 0.4f; g_WorldMesh[1].vPosition.y = 0.90f; return S_OK; } //-------------------------------------------------------------------------------------- // Create any D3D10 resources that depend on the back buffer //-------------------------------------------------------------------------------------- HRESULT CALLBACK OnD3D10SwapChainResized( ID3D10Device* pd3dDevice, IDXGISwapChain* pSwapChain, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ) { HRESULT hr = S_OK; V_RETURN( g_DialogResourceManager.OnD3D10ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) ); V_RETURN( g_D3DSettingsDlg.OnD3D10ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) ); // Setup the camera's projection parameters float fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT )pBackBufferSurfaceDesc->Height; g_Camera.SetProjParams( D3DX_PI / 4, fAspectRatio, 0.1f, 5000.0f ); g_Camera.SetWindow( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height ); g_Camera.SetButtonMasks( 0, MOUSE_WHEEL, MOUSE_LEFT_BUTTON | MOUSE_MIDDLE_BUTTON | MOUSE_RIGHT_BUTTON ); g_HUD.SetLocation( pBackBufferSurfaceDesc->Width - 170, 0 ); g_HUD.SetSize( 170, 170 ); g_SampleUI.SetLocation( pBackBufferSurfaceDesc->Width - 170, pBackBufferSurfaceDesc->Height - 300 ); g_SampleUI.SetSize( 170, 300 ); BOOL bFullscreen = FALSE; pSwapChain->GetFullscreenState( &bFullscreen, NULL ); g_SampleUI.GetButton( IDC_PARTICLECOLOR )->SetEnabled( !bFullscreen ); return hr; } //-------------------------------------------------------------------------------------- bool AdvanceParticles( ID3D10Device* pd3dDevice, float fGlobalTime, float fElapsedTime ) { // Set the Vertex Layout pd3dDevice->IASetInputLayout( g_pParticleVertexLayout ); // Set IA parameters ID3D10Buffer* pBuffers[1]; if( g_bFirst ) pBuffers[0] = g_pParticleStart; else pBuffers[0] = g_pParticleDrawFrom; UINT stride[1] = { sizeof( PARTICLE_VERTEX ) }; UINT offset[1] = { 0 }; pd3dDevice->IASetVertexBuffers( 0, 1, pBuffers, stride, offset ); pd3dDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_POINTLIST ); // Point to the correct output buffer pBuffers[0] = g_pParticleStreamTo; pd3dDevice->SOSetTargets( 1, pBuffers, offset ); D3DXVECTOR4 vColor; vColor.x = g_vParticleColor.x; vColor.y = g_vParticleColor.y; vColor.z = g_vParticleColor.z; vColor.w = g_fParticleOpacity; // Set Effects Parameters g_pfGlobalTime_Particle->SetFloat( fGlobalTime ); g_pfElapsedTime_Particle->SetFloat( fElapsedTime ); g_pvFrameGravity_Particle->SetFloatVector( ( float* )&g_vGravity ); g_pvParticleColor_Particle->SetFloatVector( ( float* )&vColor ); D3DXVECTOR4 vEmitterPos( g_vEmitterPos, 1 ); g_pvEmitterPos_Particle->SetFloatVector( ( float* )&vEmitterPos ); g_ptxRandom_Particle->SetResource( g_pRandomTexRV ); // set volume params g_ptxVolume_Particle->SetResource( g_pVolumeTexRV ); g_ptxVelocity_Particle->SetResource( g_pVelocityTexRV ); g_pfVolumeSize_Particle->SetFloat( g_VolumeSize ); g_pfEmitterSize_Particle->SetFloat( g_fEmitterSize ); D3DXVECTOR4 vOffsets( 0.5f / g_VolumeWidth, 0.5f / g_VolumeHeight, 0.5f / g_VolumeDepth, 0 ); g_pvVolumeOffsets_Particle->SetFloatVector( ( float* )vOffsets ); // Draw D3D10_TECHNIQUE_DESC techDesc; g_pAdvanceParticles_Particle->GetDesc( &techDesc ); for( UINT p = 0; p < techDesc.Passes; ++p ) { g_pAdvanceParticles_Particle->GetPassByIndex( p )->Apply( 0 ); if( g_bFirst ) pd3dDevice->Draw( MAX_PARTICLES, 0 ); else pd3dDevice->DrawAuto(); } // Get back to normal pBuffers[0] = NULL; pd3dDevice->SOSetTargets( 1, pBuffers, offset ); // Swap particle buffers ID3D10Buffer* pTemp = g_pParticleDrawFrom; g_pParticleDrawFrom = g_pParticleStreamTo; g_pParticleStreamTo = pTemp; ID3D10ShaderResourceView* pTempRV = g_pParticleDrawFromRV; g_pParticleDrawFromRV = g_pParticleStreamToRV; g_pParticleStreamToRV = pTempRV; g_bFirst = false; return true; } //-------------------------------------------------------------------------------------- bool RenderParticles( ID3D10Device* pd3dDevice, D3DXMATRIX& mView, D3DXMATRIX& mProj ) { D3DXMATRIX mWorldView; D3DXMATRIX mWorldViewProj; // Set the Vertex Layout pd3dDevice->IASetInputLayout( g_pParticleVertexLayout ); // Set IA parameters ID3D10Buffer* pBuffers[1] = { g_pParticleDrawFrom }; UINT stride[1] = { sizeof( PARTICLE_VERTEX ) }; UINT offset[1] = { 0 }; pd3dDevice->IASetVertexBuffers( 0, 1, pBuffers, stride, offset ); pd3dDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_POINTLIST ); // Set Effects Parameters D3DXMatrixMultiply( &mWorldViewProj, &mView, &mProj ); g_pmWorldViewProj_Particle->SetMatrix( ( float* )&mWorldViewProj ); g_ptxDiffuse_Particle->SetResource( g_pParticleTexRV ); D3DXMATRIX mInvView; D3DXMatrixInverse( &mInvView, NULL, &mView ); g_pmInvView_Particle->SetMatrix( ( float* )&mInvView ); // set volume params g_ptxVolume_Particle->SetResource( g_pVolumeTexRV ); g_ptxVelocity_Particle->SetResource( g_pVelocityTexRV ); g_pfVolumeSize_Particle->SetFloat( g_VolumeSize ); D3DXVECTOR4 vOffsets( 0.5f / g_VolumeWidth, 0.5f / g_VolumeHeight, 0.5f / g_VolumeDepth, 0 ); g_pvVolumeOffsets_Particle->SetFloatVector( ( float* )vOffsets ); // Draw D3D10_TECHNIQUE_DESC techDesc; g_pRenderParticles_Particle->GetDesc( &techDesc ); for( UINT p = 0; p < techDesc.Passes; ++p ) { g_pRenderParticles_Particle->GetPassByIndex( p )->Apply( 0 ); pd3dDevice->DrawAuto(); } return true; } //-------------------------------------------------------------------------------------- bool RenderAnimatedMeshes( ID3D10Device* pd3dDevice, D3DXMATRIX& mView, D3DXMATRIX& mProj, ID3D10EffectTechnique* pTechnique, double fTime, float fElapsedTime, bool bVolume ) { // Set the Vertex Layout pd3dDevice->IASetInputLayout( g_pAnimVertexLayout ); for( UINT i = 0; i < 1; i++ ) { D3DXMATRIX mWorldViewProj; D3DXMATRIX mViewProj; mWorldViewProj = g_WorldMesh[i].mWorld * mView * mProj; mViewProj = mView * mProj; CDXUTSDKMesh* pMesh = &g_WorldMesh[i].Mesh; // Set Effects Parameters if( bVolume ) { g_pmWorldViewProj_Vol->SetMatrix( ( float* )&mWorldViewProj ); g_pmViewProj_Vol->SetMatrix( ( float* )&mViewProj ); g_pmWorld_Vol->SetMatrix( ( float* )&g_WorldMesh[i].mWorld ); g_pmWorldPrev_Vol->SetMatrix( ( float* )&g_WorldMesh[i].mWorldPrev ); UINT NumInfluences = pMesh->GetNumInfluences( 0 ); if( NumInfluences > 0 ) { // Transform current position pMesh->TransformMesh( &g_WorldMesh[i].mWorld, fTime ); for( UINT g = 0; g < NumInfluences; g++ ) { const D3DXMATRIX* pMat = pMesh->GetMeshInfluenceMatrix( 0, g ); g_pmBoneWorld_Vol->SetMatrixArray( ( float* )pMat, g, 1 ); } // Transform previous position pMesh->TransformMesh( &g_WorldMesh[i].mWorldPrev, fTime - fElapsedTime ); for( UINT g = 0; g < NumInfluences; g++ ) { const D3DXMATRIX* pMat = pMesh->GetMeshInfluenceMatrix( 0, g ); g_pmBonePrev_Vol->SetMatrixArray( ( float* )pMat, g, 1 ); } } ID3D10Buffer* pBuffer = pMesh->GetVB10( 0, 0 ); UINT iStride = pMesh->GetVertexStride( 0, 0 ); UINT iOffset = 0; pd3dDevice->IASetVertexBuffers( 0, 1, &pBuffer, &iStride, &iOffset ); pd3dDevice->IASetIndexBuffer( pMesh->GetIB10( 0 ), pMesh->GetIBFormat10( 0 ), iOffset ); D3D10_TECHNIQUE_DESC techDesc; pTechnique->GetDesc( &techDesc ); SDKMESH_SUBSET* pSubset = NULL; D3D10_PRIMITIVE_TOPOLOGY PrimType; for( UINT p = 0; p < techDesc.Passes; ++p ) { for( UINT subset = 0; subset < pMesh->GetNumSubsets( 0 ); subset++ ) { pSubset = pMesh->GetSubset( 0, subset ); PrimType = pMesh->GetPrimitiveType10( ( SDKMESH_PRIMITIVE_TYPE )pSubset->PrimitiveType ); pd3dDevice->IASetPrimitiveTopology( PrimType ); pTechnique->GetPassByIndex( p )->Apply( 0 ); UINT IndexCount = ( UINT )pSubset->IndexCount; UINT IndexStart = ( UINT )pSubset->IndexStart; UINT VertexStart = ( UINT )pSubset->VertexStart; pd3dDevice->DrawIndexedInstanced( IndexCount, g_VolumeDepth, IndexStart, VertexStart, 0 ); } } } else { g_pmWorldViewProj_Mesh->SetMatrix( ( float* )&mWorldViewProj ); g_pmViewProj_Mesh->SetMatrix( ( float* )&mViewProj ); g_pmWorld_Mesh->SetMatrix( ( float* )&g_WorldMesh[i].mWorld ); D3DXVECTOR4 vLightDir( 0,1,0,0 ); g_pvLightDir_Mesh->SetFloatVector( ( float* )&vLightDir ); D3DXVECTOR4 vEye = D3DXVECTOR4( *g_Camera.GetEyePt(), 1 ); g_pvEyePt_Mesh->SetFloatVector( ( float* )&vEye ); UINT NumInfluences = pMesh->GetNumInfluences( 0 ); if( NumInfluences > 0 ) { // Transform current position pMesh->TransformMesh( &g_WorldMesh[i].mWorld, fTime ); for( UINT g = 0; g < NumInfluences; g++ ) { const D3DXMATRIX* pMat = pMesh->GetMeshInfluenceMatrix( 0, g ); g_pmBoneWorld_Mesh->SetMatrixArray( ( float* )pMat, g, 1 ); } // Transform previous position pMesh->TransformMesh( &g_WorldMesh[i].mWorldPrev, fTime - fElapsedTime ); for( UINT g = 0; g < NumInfluences; g++ ) { const D3DXMATRIX* pMat = pMesh->GetMeshInfluenceMatrix( 0, g ); g_pmBonePrev_Mesh->SetMatrixArray( ( float* )pMat, g, 1 ); } } g_ptxPaint_Mesh->SetResource( g_WorldMesh[i].pMeshRV ); pMesh->Render( pd3dDevice, pTechnique, g_ptxDiffuse_Mesh, g_ptxNormal_Mesh, g_ptxSpecular_Mesh ); } } return true; } //-------------------------------------------------------------------------------------- bool RenderMeshes( ID3D10Device* pd3dDevice, D3DXMATRIX& mView, D3DXMATRIX& mProj, ID3D10EffectTechnique* pTechnique, bool bVolume ) { // Set the Vertex Layout pd3dDevice->IASetInputLayout( g_pMeshVertexLayout ); for( UINT i = 1; i < NUM_MESHES; i++ ) { D3DXMATRIX mWorldViewProj; D3DXMATRIX mViewProj; mWorldViewProj = g_WorldMesh[i].mWorld * mView * mProj; mViewProj = mView * mProj; CDXUTSDKMesh* pMesh = &g_WorldMesh[i].Mesh; // Set Effects Parameters if( bVolume ) { g_pmWorldViewProj_Vol->SetMatrix( ( float* )&mWorldViewProj ); g_pmViewProj_Vol->SetMatrix( ( float* )&mViewProj ); g_pmWorld_Vol->SetMatrix( ( float* )&g_WorldMesh[i].mWorld ); g_pmWorldPrev_Vol->SetMatrix( ( float* )&g_WorldMesh[i].mWorldPrev ); ID3D10Buffer* pBuffer = pMesh->GetVB10( 0, 0 ); UINT iStride = pMesh->GetVertexStride( 0, 0 ); UINT iOffset = 0; pd3dDevice->IASetVertexBuffers( 0, 1, &pBuffer, &iStride, &iOffset ); pd3dDevice->IASetIndexBuffer( pMesh->GetIB10( 0 ), pMesh->GetIBFormat10( 0 ), iOffset ); D3D10_TECHNIQUE_DESC techDesc; pTechnique->GetDesc( &techDesc ); SDKMESH_SUBSET* pSubset = NULL; D3D10_PRIMITIVE_TOPOLOGY PrimType; for( UINT p = 0; p < techDesc.Passes; ++p ) { for( UINT subset = 0; subset < pMesh->GetNumSubsets( 0 ); subset++ ) { pSubset = pMesh->GetSubset( 0, subset ); PrimType = pMesh->GetPrimitiveType10( ( SDKMESH_PRIMITIVE_TYPE )pSubset->PrimitiveType ); pd3dDevice->IASetPrimitiveTopology( PrimType ); pTechnique->GetPassByIndex( p )->Apply( 0 ); UINT IndexCount = ( UINT )pSubset->IndexCount; UINT IndexStart = ( UINT )pSubset->IndexStart; UINT VertexStart = ( UINT )pSubset->VertexStart; pd3dDevice->DrawIndexedInstanced( IndexCount, g_VolumeDepth, IndexStart, VertexStart, 0 ); } } //pMesh->Render( pd3dDevice, pTechnique ); } else { g_pmWorldViewProj_Mesh->SetMatrix( ( float* )&mWorldViewProj ); g_pmViewProj_Mesh->SetMatrix( ( float* )&mViewProj ); g_pmWorld_Mesh->SetMatrix( ( float* )&g_WorldMesh[i].mWorld ); D3DXVECTOR4 vLightDir( 0,1,0,0 ); g_pvLightDir_Mesh->SetFloatVector( ( float* )&vLightDir ); g_ptxDiffuse_Mesh->SetResource( g_WorldMesh[i].pMeshRV ); pMesh->Render( pd3dDevice, pTechnique, NULL, g_ptxNormal_Mesh, g_ptxSpecular_Mesh ); } } return true; } //-------------------------------------------------------------------------------------- void ClearVolume( ID3D10Device* pd3dDevice ) { // clear the render target float ClearColor[4] = { 0.0f,0.0f,0.0f,0.0f }; pd3dDevice->ClearRenderTargetView( g_pVolumeTexTotalRTV, ClearColor ); pd3dDevice->ClearRenderTargetView( g_pVelocityTexTotalRTV, ClearColor ); } //-------------------------------------------------------------------------------------- bool RenderMeshesIntoVolume( ID3D10Device* pd3dDevice, ID3D10EffectTechnique* pTechnique, double fTime, float fElapsedTime, bool bAnimated ) { // store the old render target and DS ID3D10RenderTargetView* pOldRTV; ID3D10DepthStencilView* pOldDSV; pd3dDevice->OMGetRenderTargets( 1, &pOldRTV, &pOldDSV ); // store the old viewport D3D10_VIEWPORT oldViewport; UINT NumViewports = 1; pd3dDevice->RSGetViewports( &NumViewports, &oldViewport ); // set the new viewport D3D10_VIEWPORT newViewport; newViewport.TopLeftX = 0; newViewport.TopLeftY = 0; newViewport.Width = g_VolumeWidth; newViewport.Height = g_VolumeHeight; newViewport.MinDepth = 0.0f; newViewport.MaxDepth = 1.0f; pd3dDevice->RSSetViewports( 1, &newViewport ); // setup and orthogonal view from the top D3DXMATRIX mView; D3DXMATRIX mProj; D3DXVECTOR3 vEye( 0,100,0 ); D3DXVECTOR3 vAt( 0,0,0 ); D3DXVECTOR3 vUp( 0,0,1 ); D3DXMatrixLookAtLH( &mView, &vEye, &vAt, &vUp ); D3DXMatrixOrthoLH( &mProj, g_VolumeSize, g_VolumeSize, 0.1f, 1000.0f ); float fSliceSize = g_VolumeSize / ( float )( g_VolumeDepth + 1 ); float fSliceStart = 0.0f; // Set the render target pd3dDevice->OMSetRenderTargets( 1, &g_pVolumeTexTotalRTV, NULL ); // Set effect variables g_pfPlaneStart_Vol->SetFloat( fSliceStart ); g_pfPlaneStep_Vol->SetFloat( fSliceSize ); g_pfElapsedTime_Vol->SetFloat( fElapsedTime ); // render the scene if( bAnimated ) RenderAnimatedMeshes( pd3dDevice, mView, mProj, pTechnique, fTime, fElapsedTime, true ); else RenderMeshes( pd3dDevice, mView, mProj, pTechnique, true ); // restore the old viewport pd3dDevice->RSSetViewports( 1, &oldViewport ); // restore old render target and DS pd3dDevice->OMSetRenderTargets( 1, &pOldRTV, pOldDSV ); SAFE_RELEASE( pOldRTV ); SAFE_RELEASE( pOldDSV ); return true; } //-------------------------------------------------------------------------------------- bool RenderVelocitiesIntoVolume( ID3D10Device* pd3dDevice, ID3D10EffectTechnique* pTechnique, double fTime, float fElapsedTime, bool bAnimated ) { // store the old render target and DS ID3D10RenderTargetView* pOldRTV; ID3D10DepthStencilView* pOldDSV; pd3dDevice->OMGetRenderTargets( 1, &pOldRTV, &pOldDSV ); // store the old viewport D3D10_VIEWPORT oldViewport; UINT NumViewports = 1; pd3dDevice->RSGetViewports( &NumViewports, &oldViewport ); // set the new viewport D3D10_VIEWPORT newViewport; newViewport.TopLeftX = 0; newViewport.TopLeftY = 0; newViewport.Width = g_VolumeWidth; newViewport.Height = g_VolumeHeight; newViewport.MinDepth = 0.0f; newViewport.MaxDepth = 1.0f; pd3dDevice->RSSetViewports( 1, &newViewport ); // setup and orthogonal view from the top D3DXMATRIX mView; D3DXMATRIX mProj; D3DXVECTOR3 vEye( 0,100,0 ); D3DXVECTOR3 vAt( 0,0,0 ); D3DXVECTOR3 vUp( 0,0,1 ); D3DXMatrixLookAtLH( &mView, &vEye, &vAt, &vUp ); D3DXMatrixOrthoLH( &mProj, g_VolumeSize, g_VolumeSize, 0.1f, 1000.0f ); float fSliceSize = g_VolumeSize / ( float )( g_VolumeDepth + 1 ); float fSliceStart = 0.0f; // Set the render target pd3dDevice->OMSetRenderTargets( 1, &g_pVelocityTexTotalRTV, NULL ); // Calc clip planes D3DXVECTOR4 vFarClip( 0,1,0,0 ); D3DXVECTOR4 vNearClip( 0,-1,0,0 ); vFarClip.w = -fSliceStart; vNearClip.w = ( fSliceStart + fSliceSize ); // Set effect variables g_pfPlaneStart_Vol->SetFloat( 0.0f ); g_pfPlaneStep_Vol->SetFloat( fSliceSize ); g_pfElapsedTime_Vol->SetFloat( fElapsedTime ); // render the scene if( bAnimated ) RenderAnimatedMeshes( pd3dDevice, mView, mProj, pTechnique, fTime, fElapsedTime, true ); else RenderMeshes( pd3dDevice, mView, mProj, pTechnique, true ); // restore the old viewport pd3dDevice->RSSetViewports( 1, &oldViewport ); // restore old render target and DS pd3dDevice->OMSetRenderTargets( 1, &pOldRTV, pOldDSV ); SAFE_RELEASE( pOldRTV ); SAFE_RELEASE( pOldDSV ); return true; } //-------------------------------------------------------------------------------------- bool RenderPositionIntoTexture( ID3D10Device* pd3dDevice, MESH* pMesh, double fTime ) { // store the old render target and DS ID3D10RenderTargetView* pOldRTV; ID3D10DepthStencilView* pOldDSV; pd3dDevice->OMGetRenderTargets( 1, &pOldRTV, &pOldDSV ); // store the old viewport D3D10_VIEWPORT oldViewport; UINT NumViewports = 1; pd3dDevice->RSGetViewports( &NumViewports, &oldViewport ); // set the new viewport D3D10_VIEWPORT newViewport; newViewport.TopLeftX = 0; newViewport.TopLeftY = 0; newViewport.Width = g_PositionWidth; newViewport.Height = g_PositionHeight; newViewport.MinDepth = 0.0f; newViewport.MaxDepth = 1.0f; pd3dDevice->RSSetViewports( 1, &newViewport ); float ClearColor[4] = { 0,0,0,0 }; pd3dDevice->ClearRenderTargetView( pMesh->pMeshPositionRTV, ClearColor ); // Set the render target pd3dDevice->OMSetRenderTargets( 1, &pMesh->pMeshPositionRTV, NULL ); // Set effect variables g_pmWorld_Paint->SetMatrix( ( float* )&pMesh->mWorld ); ID3D10EffectTechnique* pTech = NULL; UINT NumInfluences = pMesh->Mesh.GetNumInfluences( 0 ); if( NumInfluences > 0 ) { pd3dDevice->IASetInputLayout( g_pPaintAnimVertexLayout ); pTech = g_pRenderAnimToUV_Paint; // Transform current position pMesh->Mesh.TransformMesh( &pMesh->mWorld, fTime ); for( UINT g = 0; g < NumInfluences; g++ ) { const D3DXMATRIX* pMat = pMesh->Mesh.GetMeshInfluenceMatrix( 0, g ); g_pmBoneWorld_Paint->SetMatrixArray( ( float* )pMat, g, 1 ); } } else { pd3dDevice->IASetInputLayout( g_pMeshVertexLayout ); pTech = g_pRenderToUV_Paint; } // render the mesh pMesh->Mesh.Render( pd3dDevice, pTech ); // restore the old viewport pd3dDevice->RSSetViewports( 1, &oldViewport ); // restore old render target and DS pd3dDevice->OMSetRenderTargets( 1, &pOldRTV, pOldDSV ); SAFE_RELEASE( pOldRTV ); SAFE_RELEASE( pOldDSV ); return true; } bool PaintWithParticles( ID3D10Device* pd3dDevice, MESH* pMesh ) { // store the old render target and DS ID3D10RenderTargetView* pOldRTV; ID3D10DepthStencilView* pOldDSV; pd3dDevice->OMGetRenderTargets( 1, &pOldRTV, &pOldDSV ); // store the old viewport D3D10_VIEWPORT oldViewport; UINT NumViewports = 1; pd3dDevice->RSGetViewports( &NumViewports, &oldViewport ); // set the new viewport D3D10_VIEWPORT newViewport; newViewport.TopLeftX = 0; newViewport.TopLeftY = 0; newViewport.Width = pMesh->MeshTextureWidth; newViewport.Height = pMesh->MeshTextureHeight; newViewport.MinDepth = 0.0f; newViewport.MaxDepth = 1.0f; pd3dDevice->RSSetViewports( 1, &newViewport ); // Set the render target pd3dDevice->OMSetRenderTargets( 1, &pMesh->pMeshRTV, NULL ); // Set effect variables g_pNumParticles_Paint->SetInt( MAX_PARTICLES ); g_pParticleStart_Paint->SetInt( g_iParticleStart ); g_pParticleStep_Paint->SetInt( g_iParticleStep ); g_pfParticleRadiusSq_Paint->SetFloat( g_fParticlePaintRadSq ); D3DXVECTOR4 vParticleColor( 0,1,0,1 ); g_pvParticleColor_Paint->SetFloatVector( ( float* )&vParticleColor ); g_ptxDiffuse_Paint->SetResource( pMesh->pMeshPositionRV ); g_pParticleBuffer_Paint->SetResource( g_pParticleDrawFromRV ); // Set the Vertex Layout pd3dDevice->IASetInputLayout( g_pQuadVertexLayout ); // Set IA params UINT offsets = 0; UINT strides = sizeof( QUAD_VERTEX ); pd3dDevice->IASetVertexBuffers( 0, 1, &g_pQuadVB, &strides, &offsets ); pd3dDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP ); // set the technique D3D10_TECHNIQUE_DESC techDesc; g_pPaint_Paint->GetDesc( &techDesc ); // render the quad for( UINT p = 0; p < techDesc.Passes; p++ ) { g_pPaint_Paint->GetPassByIndex( p )->Apply( 0 ); pd3dDevice->Draw( 4, 0 ); } // restore the old viewport pd3dDevice->RSSetViewports( 1, &oldViewport ); // restore old render target and DS pd3dDevice->OMSetRenderTargets( 1, &pOldRTV, pOldDSV ); SAFE_RELEASE( pOldRTV ); SAFE_RELEASE( pOldDSV ); return true; } //-------------------------------------------------------------------------------------- void ClearShaderResources( ID3D10Device* pd3dDevice ) { // unbind resources ID3D10ShaderResourceView* pNULLViews[8] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; pd3dDevice->VSSetShaderResources( 0, 8, pNULLViews ); pd3dDevice->GSSetShaderResources( 0, 8, pNULLViews ); pd3dDevice->PSSetShaderResources( 0, 8, pNULLViews ); } //-------------------------------------------------------------------------------------- void CALLBACK OnD3D10FrameRender( ID3D10Device* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext ) { float ClearColor[4] = { 0.0, 0.0, 0.0, 0.0 }; // If the settings dialog is being shown, then // render it instead of rendering the app's scene if( g_D3DSettingsDlg.IsActive() ) { g_D3DSettingsDlg.OnRender( fElapsedTime ); return; } // calc world matrix for dynamic object D3DXMATRIX mScale; D3DXMATRIX mRotX, mRotY, mRotZ; D3DXMATRIX mTrans; for( UINT i = 0; i < NUM_MESHES; i++ ) { D3DXMatrixScaling( &mScale, 0.2f, 0.2f, 0.2f ); D3DXMatrixRotationX( &mRotX, g_WorldMesh[i].vRotation.x ); D3DXMatrixRotationY( &mRotY, g_WorldMesh[i].vRotation.y ); D3DXMatrixRotationZ( &mRotZ, g_WorldMesh[i].vRotation.z ); D3DXMatrixTranslation( &mTrans, g_WorldMesh[i].vPosition.x, g_WorldMesh[i].vPosition.y, g_WorldMesh[i].vPosition.z ); g_WorldMesh[i].mWorld = mScale * mRotX * mRotY * mRotZ * mTrans; } ID3D10RenderTargetView* pRTV = DXUTGetD3D10RenderTargetView(); pd3dDevice->ClearRenderTargetView( pRTV, ClearColor ); ID3D10DepthStencilView* pDSV = DXUTGetD3D10DepthStencilView(); pd3dDevice->ClearDepthStencilView( pDSV, D3D10_CLEAR_DEPTH, 1.0, 0 ); // Rendet the mesh position into a texture if( g_bPaint ) { for( UINT i = 0; i < NUM_MESHES; i++ ) { RenderPositionIntoTexture( pd3dDevice, &g_WorldMesh[i], fTime ); } } // Clear the volume ClearVolume( pd3dDevice ); // Render meshes into the volume RenderMeshesIntoVolume( pd3dDevice, g_pRenderScene_Vol, fTime, fElapsedTime, false ); RenderVelocitiesIntoVolume( pd3dDevice, g_pRenderVelocity_Vol, fTime, fElapsedTime, false ); // Render animated meshes into the volume RenderMeshesIntoVolume( pd3dDevice, g_pRenderAnimScene_Vol, fTime, fElapsedTime, true ); RenderVelocitiesIntoVolume( pd3dDevice, g_pRenderAnimVelocity_Vol, fTime, fElapsedTime, true ); // Advance the Particles AdvanceParticles( pd3dDevice, ( float )fTime, fElapsedTime ); D3DXMATRIX mView; D3DXMATRIX mProj; // Get the projection & view matrix from the camera class mProj = *g_Camera.GetProjMatrix(); mView = *g_Camera.GetViewMatrix(); // Render scene meshes RenderMeshes( pd3dDevice, mView, mProj, g_pRenderScene_Mesh, false ); RenderAnimatedMeshes( pd3dDevice, mView, mProj, g_pRenderAnimScene_Mesh, fTime, fElapsedTime, false ); ClearShaderResources( pd3dDevice ); // Render the particles RenderParticles( pd3dDevice, mView, mProj ); if( g_bPaint ) { // Paint the scene meshes with the particles for( UINT i = 0; i < NUM_MESHES; i++ ) PaintWithParticles( pd3dDevice, &g_WorldMesh[i] ); // step up g_iParticleStart ++; if( g_iParticleStart >= g_iParticleStep ) g_iParticleStart = 0; } ClearShaderResources( pd3dDevice ); DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"HUD / Stats" ); RenderText(); g_HUD.OnRender( fElapsedTime ); g_SampleUI.OnRender( fElapsedTime ); DXUT_EndPerfEvent(); // store the previous world for( UINT i = 0; i < NUM_MESHES; i++ ) g_WorldMesh[i].mWorldPrev = g_WorldMesh[i].mWorld; } //-------------------------------------------------------------------------------------- // Render the help and statistics text //-------------------------------------------------------------------------------------- void RenderText() { g_pTxtHelper->Begin(); g_pTxtHelper->SetInsertionPos( 2, 0 ); g_pTxtHelper->SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) ); g_pTxtHelper->DrawTextLine( DXUTGetFrameStats( true ) ); g_pTxtHelper->DrawTextLine( DXUTGetDeviceStats() ); g_pTxtHelper->SetForegroundColor( D3DXCOLOR( 1.0f, 0.5f, 0.0f, 1.0f ) ); g_pTxtHelper->DrawTextLine( L"Use A,D,W,S,Q,E keys to move the active mesh" ); g_pTxtHelper->DrawTextLine( L"Use SHIFT + A,D,W,S,Q,E keys to rotate the active mesh" ); g_pTxtHelper->End(); } //-------------------------------------------------------------------------------------- // Release D3D10 resources created in OnD3D10ResizedSwapChain //-------------------------------------------------------------------------------------- void CALLBACK OnD3D10SwapChainReleasing( void* pUserContext ) { g_DialogResourceManager.OnD3D10ReleasingSwapChain(); } //-------------------------------------------------------------------------------------- // Release D3D10 resources created in OnD3D10CreateDevice //-------------------------------------------------------------------------------------- void CALLBACK OnD3D10DestroyDevice( void* pUserContext ) { g_DialogResourceManager.OnD3D10DestroyDevice(); g_D3DSettingsDlg.OnD3D10DestroyDevice(); DXUTGetGlobalResourceCache().OnDestroyDevice(); SAFE_RELEASE( g_pFont10 ); SAFE_RELEASE( g_pSprite10 ); SAFE_DELETE( g_pTxtHelper ); SAFE_RELEASE( g_pParticleEffect10 ); SAFE_RELEASE( g_pMeshEffect10 ); SAFE_RELEASE( g_pVolEffect10 ); SAFE_RELEASE( g_pPaintEffect10 ); SAFE_RELEASE( g_pQuadVB ); SAFE_RELEASE( g_pParticleVertexLayout ); SAFE_RELEASE( g_pMeshVertexLayout ); SAFE_RELEASE( g_pQuadVertexLayout ); SAFE_RELEASE( g_pAnimVertexLayout ); SAFE_RELEASE( g_pPaintAnimVertexLayout ); for( UINT i = 0; i < NUM_MESHES; i++ ) { SAFE_RELEASE( g_WorldMesh[i].pMeshPositionTexture ); SAFE_RELEASE( g_WorldMesh[i].pMeshPositionRV ); SAFE_RELEASE( g_WorldMesh[i].pMeshPositionRTV ); SAFE_RELEASE( g_WorldMesh[i].pMeshTexture ); SAFE_RELEASE( g_WorldMesh[i].pMeshRV ); SAFE_RELEASE( g_WorldMesh[i].pMeshRTV ); g_WorldMesh[i].Mesh.Destroy(); } // particles SAFE_RELEASE( g_pParticleStart ); SAFE_RELEASE( g_pParticleStreamTo ); SAFE_RELEASE( g_pParticleDrawFrom ); SAFE_RELEASE( g_pParticleStreamToRV ); SAFE_RELEASE( g_pParticleDrawFromRV ); SAFE_RELEASE( g_pParticleTexRV ); SAFE_RELEASE( g_pRandomTexture ); SAFE_RELEASE( g_pRandomTexRV ); // volume if( g_pVolumeTexRTVs ) { for( UINT i = 0; i < g_VolumeDepth; i++ ) { SAFE_RELEASE( g_pVolumeTexRTVs[i] ); } SAFE_DELETE_ARRAY( g_pVolumeTexRTVs ); } SAFE_RELEASE( g_pVolumeTexRV ); SAFE_RELEASE( g_pVolumeTexture ); SAFE_RELEASE( g_pVolumeTexTotalRTV ); if( g_pVelocityTexRTVs ) { for( UINT i = 0; i < g_VolumeDepth; i++ ) { SAFE_RELEASE( g_pVelocityTexRTVs[i] ); } SAFE_DELETE_ARRAY( g_pVelocityTexRTVs ); } SAFE_RELEASE( g_pVelocityTexRV ); SAFE_RELEASE( g_pVelocityTexture ); SAFE_RELEASE( g_pVelocityTexTotalRTV ); } //-------------------------------------------------------------------------------------- // This helper function creates 3 vertex buffers. The first is used to seed the // particle system. The second two are used as output and intput buffers alternatively // for the GS particle system. Since a buffer cannot be both an input to the GS and an // output of the GS, we must ping-pong between the two. //-------------------------------------------------------------------------------------- HRESULT CreateParticleBuffer( ID3D10Device* pd3dDevice ) { HRESULT hr = S_OK; D3D10_BUFFER_DESC vbdesc = { MAX_PARTICLES * sizeof( PARTICLE_VERTEX ), D3D10_USAGE_DEFAULT, D3D10_BIND_VERTEX_BUFFER, 0, 0 }; D3D10_SUBRESOURCE_DATA vbInitData; ZeroMemory( &vbInitData, sizeof( D3D10_SUBRESOURCE_DATA ) ); srand( 100 ); PARTICLE_VERTEX* pVertices = new PARTICLE_VERTEX[ MAX_PARTICLES ]; for( UINT i = 0; i < MAX_PARTICLES; i++ ) { pVertices[i].pos.x = g_vEmitterPos.x + RPercent() * g_fEmitterSize; pVertices[i].pos.y = g_vEmitterPos.y + RPercent() * g_fEmitterSize; pVertices[i].pos.z = g_vEmitterPos.z + RPercent() * g_fEmitterSize; pVertices[i].pos.w = 1.0f; pVertices[i].lastpos = pVertices[i].pos; pVertices[i].color = D3DXVECTOR4( 1, 0, 0, 1 ); pVertices[i].vel = D3DXVECTOR3( 0, 0, 0 ); pVertices[i].ID = i; } vbInitData.pSysMem = pVertices; V_RETURN( pd3dDevice->CreateBuffer( &vbdesc, &vbInitData, &g_pParticleStart ) ); SAFE_DELETE_ARRAY( vbInitData.pSysMem ); vbdesc.ByteWidth = MAX_PARTICLES * sizeof( PARTICLE_VERTEX ); vbdesc.BindFlags |= D3D10_BIND_STREAM_OUTPUT | D3D10_BIND_SHADER_RESOURCE; V_RETURN( pd3dDevice->CreateBuffer( &vbdesc, NULL, &g_pParticleDrawFrom ) ); V_RETURN( pd3dDevice->CreateBuffer( &vbdesc, NULL, &g_pParticleStreamTo ) ); // create resource views D3D10_SHADER_RESOURCE_VIEW_DESC SRVDesc; SRVDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; SRVDesc.ViewDimension = D3D10_SRV_DIMENSION_BUFFER; SRVDesc.Buffer.ElementOffset = 0; SRVDesc.Buffer.ElementWidth = MAX_PARTICLES * ( sizeof( PARTICLE_VERTEX ) / sizeof( D3DXVECTOR4 ) ); V_RETURN( pd3dDevice->CreateShaderResourceView( g_pParticleStreamTo, &SRVDesc, &g_pParticleDrawFromRV ) ); V_RETURN( pd3dDevice->CreateShaderResourceView( g_pParticleDrawFrom, &SRVDesc, &g_pParticleStreamToRV ) ); return hr; } //-------------------------------------------------------------------------------------- // This helper function creates a 1D texture full of random vectors. The shader uses // the current time value to index into this texture to get a random vector. //-------------------------------------------------------------------------------------- HRESULT CreateRandomTexture( ID3D10Device* pd3dDevice ) { HRESULT hr = S_OK; int iNumRandValues = 4096; srand( timeGetTime() ); //create the data D3D10_SUBRESOURCE_DATA InitData; InitData.pSysMem = new float[iNumRandValues * 4]; if( !InitData.pSysMem ) return E_OUTOFMEMORY; InitData.SysMemPitch = iNumRandValues * 4 * sizeof( float ); InitData.SysMemSlicePitch = iNumRandValues * 4 * sizeof( float ); for( int i = 0; i < iNumRandValues * 4; i++ ) { ( ( float* )InitData.pSysMem )[i] = float( ( rand() % 10000 ) - 5000 ); } // Create the texture D3D10_TEXTURE1D_DESC dstex; dstex.Width = iNumRandValues; dstex.MipLevels = 1; dstex.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; dstex.Usage = D3D10_USAGE_DEFAULT; dstex.BindFlags = D3D10_BIND_SHADER_RESOURCE; dstex.CPUAccessFlags = 0; dstex.MiscFlags = 0; dstex.ArraySize = 1; V_RETURN( pd3dDevice->CreateTexture1D( &dstex, &InitData, &g_pRandomTexture ) ); SAFE_DELETE_ARRAY( InitData.pSysMem ); // Create the resource view D3D10_SHADER_RESOURCE_VIEW_DESC SRVDesc; ZeroMemory( &SRVDesc, sizeof( SRVDesc ) ); SRVDesc.Format = dstex.Format; SRVDesc.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE1D; SRVDesc.Texture2D.MipLevels = dstex.MipLevels; V_RETURN( pd3dDevice->CreateShaderResourceView( g_pRandomTexture, &SRVDesc, &g_pRandomTexRV ) ); return hr; } HRESULT CreateVolumeTexture( ID3D10Device* pd3dDevice ) { HRESULT hr = S_OK; // Create the texture D3D10_TEXTURE3D_DESC dstex; dstex.Width = g_VolumeWidth; dstex.Height = g_VolumeHeight; dstex.Depth = g_VolumeDepth; dstex.MipLevels = 1; dstex.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; dstex.Usage = D3D10_USAGE_DEFAULT; dstex.BindFlags = D3D10_BIND_SHADER_RESOURCE | D3D10_BIND_RENDER_TARGET; dstex.CPUAccessFlags = 0; dstex.MiscFlags = 0; V_RETURN( pd3dDevice->CreateTexture3D( &dstex, NULL, &g_pVolumeTexture ) ); V_RETURN( pd3dDevice->CreateTexture3D( &dstex, NULL, &g_pVelocityTexture ) ); // Create the resource view D3D10_SHADER_RESOURCE_VIEW_DESC SRVDesc; ZeroMemory( &SRVDesc, sizeof( SRVDesc ) ); SRVDesc.Format = dstex.Format; SRVDesc.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE3D; SRVDesc.Texture3D.MostDetailedMip = 0; SRVDesc.Texture3D.MipLevels = 1; V_RETURN( pd3dDevice->CreateShaderResourceView( g_pVolumeTexture, &SRVDesc, &g_pVolumeTexRV ) ); V_RETURN( pd3dDevice->CreateShaderResourceView( g_pVelocityTexture, &SRVDesc, &g_pVelocityTexRV ) ); // Create the render target views D3D10_RENDER_TARGET_VIEW_DESC RTVDesc; RTVDesc.Format = dstex.Format; RTVDesc.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D; RTVDesc.Texture3D.MipSlice = 0; RTVDesc.Texture3D.FirstWSlice = 0; RTVDesc.Texture3D.WSize = 1; g_pVolumeTexRTVs = new ID3D10RenderTargetView*[g_VolumeDepth]; g_pVelocityTexRTVs = new ID3D10RenderTargetView*[g_VolumeDepth]; for( UINT i = 0; i < g_VolumeDepth; i++ ) { RTVDesc.Texture3D.FirstWSlice = i; V_RETURN( pd3dDevice->CreateRenderTargetView( g_pVolumeTexture, &RTVDesc, &g_pVolumeTexRTVs[i] ) ); V_RETURN( pd3dDevice->CreateRenderTargetView( g_pVelocityTexture, &RTVDesc, &g_pVelocityTexRTVs[i] ) ); } RTVDesc.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D; RTVDesc.Texture3D.MipSlice = 0; RTVDesc.Texture3D.FirstWSlice = 0; RTVDesc.Texture3D.WSize = g_VolumeDepth; V_RETURN( pd3dDevice->CreateRenderTargetView( g_pVolumeTexture, &RTVDesc, &g_pVolumeTexTotalRTV ) ); V_RETURN( pd3dDevice->CreateRenderTargetView( g_pVelocityTexture, &RTVDesc, &g_pVelocityTexTotalRTV ) ); return hr; } HRESULT CreatePositionTextures( ID3D10Device* pd3dDevice, MESH* pMesh ) { HRESULT hr = S_OK; // Create the texture D3D10_TEXTURE2D_DESC dstex; dstex.Width = g_PositionWidth; dstex.Height = g_PositionHeight; dstex.MipLevels = 1; dstex.ArraySize = 1; dstex.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; dstex.SampleDesc.Count = 1; dstex.SampleDesc.Quality = 0; dstex.Usage = D3D10_USAGE_DEFAULT; dstex.BindFlags = D3D10_BIND_SHADER_RESOURCE | D3D10_BIND_RENDER_TARGET; dstex.CPUAccessFlags = 0; dstex.MiscFlags = 0; V_RETURN( pd3dDevice->CreateTexture2D( &dstex, NULL, &pMesh->pMeshPositionTexture ) ); // Create the resource view D3D10_SHADER_RESOURCE_VIEW_DESC SRVDesc; ZeroMemory( &SRVDesc, sizeof( SRVDesc ) ); SRVDesc.Format = dstex.Format; SRVDesc.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE2D; SRVDesc.Texture2D.MostDetailedMip = 0; SRVDesc.Texture2D.MipLevels = 1; V_RETURN( pd3dDevice->CreateShaderResourceView( pMesh->pMeshPositionTexture, &SRVDesc, &pMesh->pMeshPositionRV ) ); // Create the render target view D3D10_RENDER_TARGET_VIEW_DESC RTVDesc; RTVDesc.Format = dstex.Format; RTVDesc.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D; RTVDesc.Texture2D.MipSlice = 0; V_RETURN( pd3dDevice->CreateRenderTargetView( pMesh->pMeshPositionTexture, &RTVDesc, &pMesh->pMeshPositionRTV ) ); return hr; } HRESULT CreateMeshTexture( ID3D10Device* pd3dDevice, UINT width, UINT height, MESH* pMesh ) { HRESULT hr = S_OK; D3D10_TEXTURE2D_DESC dstex; pMesh->MeshTextureWidth = width; pMesh->MeshTextureHeight = height; // Create the texture dstex.Width = width; dstex.Height = height; dstex.ArraySize = 1; dstex.MipLevels = 1; dstex.CPUAccessFlags = 0; dstex.MiscFlags = 0; dstex.SampleDesc.Count = 1; dstex.SampleDesc.Quality = 0; dstex.Format = DXGI_FORMAT_R8G8B8A8_UNORM; dstex.Usage = D3D10_USAGE_DEFAULT; dstex.BindFlags = D3D10_BIND_SHADER_RESOURCE | D3D10_BIND_RENDER_TARGET; V_RETURN( pd3dDevice->CreateTexture2D( &dstex, NULL, &pMesh->pMeshTexture ) ); // Create the resource view D3D10_SHADER_RESOURCE_VIEW_DESC SRVDesc; ZeroMemory( &SRVDesc, sizeof( SRVDesc ) ); SRVDesc.Format = dstex.Format; SRVDesc.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE2D; SRVDesc.Texture2D.MostDetailedMip = 0; SRVDesc.Texture2D.MipLevels = 1; V_RETURN( pd3dDevice->CreateShaderResourceView( pMesh->pMeshTexture, &SRVDesc, &pMesh->pMeshRV ) ); // Create the render target view D3D10_RENDER_TARGET_VIEW_DESC RTVDesc; RTVDesc.Format = dstex.Format; RTVDesc.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D; RTVDesc.Texture2D.MipSlice = 0; V_RETURN( pd3dDevice->CreateRenderTargetView( pMesh->pMeshTexture, &RTVDesc, &pMesh->pMeshRTV ) ); float ClearColor[4] = {1,1,1,0}; pd3dDevice->ClearRenderTargetView( pMesh->pMeshRTV, ClearColor ); return hr; } HRESULT CreateQuadVB( ID3D10Device* pd3dDevice ) { HRESULT hr = S_OK; QUAD_VERTEX Verts[4]; Verts[0].Pos = D3DXVECTOR3( -1, -1, 0 ); Verts[0].Tex = D3DXVECTOR2( 0, 0 ); Verts[1].Pos = D3DXVECTOR3( -1, 1, 0 ); Verts[1].Tex = D3DXVECTOR2( 0, 1 ); Verts[2].Pos = D3DXVECTOR3( 1, -1, 0 ); Verts[2].Tex = D3DXVECTOR2( 1, 0 ); Verts[3].Pos = D3DXVECTOR3( 1, 1, 0 ); Verts[3].Tex = D3DXVECTOR2( 1, 1 ); D3D10_BUFFER_DESC vbdesc = { 4 * sizeof( QUAD_VERTEX ), D3D10_USAGE_IMMUTABLE, D3D10_BIND_VERTEX_BUFFER, 0, 0 }; D3D10_SUBRESOURCE_DATA InitData; InitData.pSysMem = Verts; InitData.SysMemPitch = 0; InitData.SysMemSlicePitch = 0; V_RETURN( pd3dDevice->CreateBuffer( &vbdesc, &InitData, &g_pQuadVB ) ); return hr; } void HandleKeys( float fElapsedTime ) { float fMoveAmt = 1.0f * fElapsedTime; float fRotateAmt = D3DX_PI * fElapsedTime; if( GetAsyncKeyState( VK_SHIFT ) & 0x8000 ) { if( GetAsyncKeyState( 'W' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vRotation.x += fRotateAmt; } if( GetAsyncKeyState( 'S' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vRotation.x -= fRotateAmt; } if( GetAsyncKeyState( 'D' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vRotation.y += fRotateAmt; } if( GetAsyncKeyState( 'A' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vRotation.y -= fRotateAmt; } if( GetAsyncKeyState( 'E' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vRotation.z += fRotateAmt; } if( GetAsyncKeyState( 'Q' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vRotation.z -= fRotateAmt; } } else { if( GetAsyncKeyState( 'W' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vPosition.z += fMoveAmt; } if( GetAsyncKeyState( 'S' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vPosition.z -= fMoveAmt; } if( GetAsyncKeyState( 'D' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vPosition.x += fMoveAmt; } if( GetAsyncKeyState( 'A' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vPosition.x -= fMoveAmt; } if( GetAsyncKeyState( 'E' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vPosition.y += fMoveAmt; } if( GetAsyncKeyState( 'Q' ) & 0x8000 ) { g_WorldMesh[g_iControlMesh].vPosition.y -= fMoveAmt; } } }
41.653261
119
0.635317
billionare
b0b9194ff681cc3b74fd6134acd7dda99ed56769
1,392
cpp
C++
BOJ_solve/17678.cpp
biyotte/Code_of_gunwookim
b8b679ea56b8684ec44a7911211edee1fb558a96
[ "MIT" ]
4
2021-01-27T11:51:30.000Z
2021-01-30T17:02:55.000Z
BOJ_solve/17678.cpp
biyotte/Code_of_gunwookim
b8b679ea56b8684ec44a7911211edee1fb558a96
[ "MIT" ]
null
null
null
BOJ_solve/17678.cpp
biyotte/Code_of_gunwookim
b8b679ea56b8684ec44a7911211edee1fb558a96
[ "MIT" ]
5
2021-01-27T11:46:12.000Z
2021-05-06T05:37:47.000Z
#include <bits/stdc++.h> #define x first #define y second #define pb push_back #define all(v) v.begin(),v.end() #pragma gcc optimize("O3") #pragma gcc optimize("Ofast") #pragma gcc optimize("unroll-loops") using namespace std; const int INF = 1e9; const int TMX = 1 << 18; const long long llINF = 1e16; const long long mod = 998244353; const long long hashmod = 100003; const int MAXN = 100000; const int MAXM = 1000000; typedef long long ll; typedef long double ld; typedef pair <int,int> pi; typedef pair <ll,ll> pl; typedef vector <int> vec; typedef vector <pi> vecpi; typedef long long ll; map <int,int> sz[500005]; int idx[500005],ans; int n,k,co[500005],mx[500005]; vec v[500005]; int dfs(int x,int pr) { int sum = 0; idx[x] = x; if(++sz[x][co[x]] == mx[co[x]]) sz[x].erase(co[x]); for(int i : v[x]) { if(i == pr) continue; sum += dfs(i,x); if(sz[idx[x]].size() < sz[idx[i]].size()) swap(idx[x],idx[i]); for(auto i : sz[idx[i]]) { sz[idx[x]][i.x] += i.y; if(sz[idx[x]][i.x] == mx[i.x]) sz[idx[x]].erase(i.x); } } if(!sz[idx[x]].empty()) return sum; sum += (x != 1), ans += (sum == 1); return (sum > 0); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> k; for(int i = 1;i < n;i++) { int x,y; cin >> x >> y; v[x].pb(y), v[y].pb(x); } for(int i = 1;i <= n;i++) { cin >> co[i]; mx[co[i]]++; } dfs(1,-1); cout << (ans+1)/2; }
23.59322
64
0.586925
biyotte
b0bdf8782d63bbc53d457dfc9bf3839c02f1bbe5
7,473
cpp
C++
src/chaincontrol/viewmanager.cpp
bille18/SuperBitcoin
f0145d53ec99decbcb571165b926f283c17e32bd
[ "MIT" ]
null
null
null
src/chaincontrol/viewmanager.cpp
bille18/SuperBitcoin
f0145d53ec99decbcb571165b926f283c17e32bd
[ "MIT" ]
null
null
null
src/chaincontrol/viewmanager.cpp
bille18/SuperBitcoin
f0145d53ec99decbcb571165b926f283c17e32bd
[ "MIT" ]
null
null
null
/////////////////////////////////////////////////////////// // CViewManger.cpp // Implementation of the Class CViewManger // Created on: 2-2-2018 16:40:58 // Original author: ranger /////////////////////////////////////////////////////////// #include <interface/ichaincomponent.h> #include "sbtcd/baseimpl.hpp" #include "viewmanager.h" #include "config/argmanager.h" #include "sbtccore/block/undo.h" SET_CPP_SCOPED_LOG_CATEGORY(CID_BLOCK_CHAIN); CViewManager &CViewManager::Instance() { static CViewManager viewManager; return viewManager; } CViewManager::CViewManager() { } CViewManager::~CViewManager() { } int CViewManager::InitCoinsDB(int64_t iCoinDBCacheSize, bool bReset) { NLogFormat("initialize view manager"); delete pCoinsTip; delete pCoinsViewDB; delete pCoinsCatcher; pCoinsViewDB = new CCoinsViewDB(iCoinDBCacheSize, false, bReset); if (!pCoinsViewDB->Upgrade()) { return false; } return true; } void CViewManager::InitCoinsCache() { pCoinsCatcher = new CCoinsViewErrorCatcher(pCoinsViewDB); pCoinsTip = new CCoinsViewCache(pCoinsCatcher); } /** Undo the effects of this block (with given index) on the UTXO set represented by coins. * When FAILED is returned, view is left in an indeterminate state. */ DisconnectResult CViewManager::DisconnectBlock(const CBlock &block, const CBlockIndex *pindex, CCoinsViewCache &view, bool *pfClean) { if (pfClean) *pfClean = false; bool fClean = true; CBlockUndo blockUndo; CDiskBlockPos pos = pindex->GetUndoPos(); if (pos.IsNull()) { ELogFormat("no undo data available"); return DISCONNECT_FAILED; } if (!UndoReadFromDisk(blockUndo, pos, pindex->pprev->GetBlockHash())) { ELogFormat("failure reading undo data"); return DISCONNECT_FAILED; } if (blockUndo.vtxundo.size() + 1 != block.vtx.size()) { ELogFormat("block and undo data inconsistent"); return DISCONNECT_FAILED; } // undo transactions in reverse order for (int i = block.vtx.size() - 1; i >= 0; i--) { const CTransaction &tx = *(block.vtx[i]); uint256 hash = tx.GetHash(); bool is_coinbase = tx.IsCoinBase(); // Check that all outputs are available and match the outputs in the block itself // exactly. for (size_t o = 0; o < tx.vout.size(); o++) { if (!tx.vout[o].scriptPubKey.IsUnspendable()) { COutPoint out(hash, o); Coin coin; bool is_spent = view.SpendCoin(out, &coin); if (!is_spent || tx.vout[o] != coin.out || pindex->nHeight != coin.nHeight || is_coinbase != coin.fCoinBase) { fClean = false; // transaction output mismatch } } } // restore inputs if (i > 0) { // not coinbases CTxUndo &txundo = blockUndo.vtxundo[i - 1]; if (txundo.vprevout.size() != tx.vin.size()) { ELogFormat("transaction and undo data inconsistent"); return DISCONNECT_FAILED; } for (unsigned int j = tx.vin.size(); j-- > 0;) { const COutPoint &out = tx.vin[j].prevout; int res = ApplyTxInUndo(std::move(txundo.vprevout[j]), view, out); if (res == DISCONNECT_FAILED) return DISCONNECT_FAILED; fClean = fClean && res != DISCONNECT_UNCLEAN; } // At this point, all of txundo.vprevout should have been moved out. } } // move best block pointer to prevout block view.SetBestBlock(pindex->pprev->GetBlockHash()); //sbtc-vm GET_CONTRACT_INTERFACE(ifContractObj); ifContractObj->UpdateState(pindex->pprev->hashStateRoot, pindex->pprev->hashUTXORoot); GET_CHAIN_INTERFACE(ifChainObj); if (pfClean == NULL && ifChainObj->IsLogEvents()) { ifContractObj->DeleteResults(block.vtx); ifChainObj->GetBlockTreeDB()->EraseHeightIndex(pindex->nHeight); } return fClean ? DISCONNECT_OK : DISCONNECT_UNCLEAN; } /** Apply the effects of a block on the utxo cache, ignoring that it may already have been applied. */ bool CViewManager::ConnectBlock(const CBlock &block, const CBlockIndex *pIndex, CCoinsViewCache &viewCache) { for (const CTransactionRef &tx : block.vtx) { if (!tx->IsCoinBase()) { for (const CTxIn &txin : tx->vin) { viewCache.SpendCoin(txin.prevout); } } // Pass check = true as every addition may be an overwrite. AddCoins(viewCache, *tx, pIndex->nHeight, true); } return true; } CCoinsView *CViewManager::GetCoinViewDB() { return pCoinsViewDB; } CCoinsViewCache *CViewManager::GetCoinsTip() { return pCoinsTip; } std::vector<uint256> CViewManager::getHeads() { assert(pCoinsViewDB); return pCoinsViewDB->GetHeadBlocks(); }; bool CViewManager::Flush() { pCoinsTip->Flush(); return true; } void CViewManager::UpdateCoins(const CTransaction &tx, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight) { // mark inputs spent if (!tx.IsCoinBase()) { txundo.vprevout.reserve(tx.vin.size()); for (const CTxIn &txin : tx.vin) { txundo.vprevout.emplace_back(); bool is_spent = inputs.SpendCoin(txin.prevout, &txundo.vprevout.back()); assert(is_spent); } } // add outputs AddCoins(inputs, tx, nHeight); } void CViewManager::UpdateCoins(const CTransaction &tx, CCoinsViewCache &inputs, int nHeight) { CTxUndo txundo; UpdateCoins(tx, inputs, txundo, nHeight); } void CViewManager::RequestShutdown() { if (pCoinsViewDB) { pCoinsViewDB->RequestShutdown(); } } /** * Restore the UTXO in a Coin at a given COutPoint * @param undo The Coin to be restored. * @param view The coins view to which to apply the changes. * @param out The out point that corresponds to the tx input. * @return A DisconnectResult as an int */ int CViewManager::ApplyTxInUndo(Coin &&undo, CCoinsViewCache &view, const COutPoint &out) { bool fClean = true; if (view.HaveCoin(out)) fClean = false; // overwriting transaction output if (undo.nHeight == 0) { // Missing undo metadata (height and coinbase). Older versions included this // information only in undo records for the last spend of a transactions' // outputs. This implies that it must be present for some other output of the same tx. const Coin &alternate = AccessByTxid(view, out.hash); if (!alternate.IsSpent()) { undo.nHeight = alternate.nHeight; undo.fCoinBase = alternate.fCoinBase; } else { return DISCONNECT_FAILED; // adding output for transaction without known metadata } } // The potential_overwrite parameter to AddCoin is only allowed to be false if we know for // sure that the coin did not already exist in the cache. As we have queried for that above // using HaveCoin, we don't need to guess. When fClean is false, a coin already existed and // it is an overwrite. view.AddCoin(out, std::move(undo), !fClean); return fClean ? DISCONNECT_OK : DISCONNECT_UNCLEAN; }
29.305882
115
0.617824
bille18
b0c60a92576ffb67eda375efc157b70405f09a4a
517
hh
C++
ACAP_linux/3rd/CoMISo/Config/GmmTypes.hh
shubhMaheshwari/Automatic-Unpaired-Shape-Deformation-Transfer
8c9afe017769f9554706bcd267b6861c4c144999
[ "MIT" ]
216
2018-09-09T11:53:56.000Z
2022-03-19T13:41:35.000Z
ACAP_linux/3rd/CoMISo/Config/GmmTypes.hh
gaolinorange/Automatic-Unpaired-Shape-Deformation-Transfer
8c9afe017769f9554706bcd267b6861c4c144999
[ "MIT" ]
13
2018-10-23T08:29:09.000Z
2021-09-08T06:45:34.000Z
ACAP_linux/3rd/CoMISo/Config/GmmTypes.hh
shubhMaheshwari/Automatic-Unpaired-Shape-Deformation-Transfer
8c9afe017769f9554706bcd267b6861c4c144999
[ "MIT" ]
41
2018-09-13T08:50:41.000Z
2022-02-23T00:33:54.000Z
// (C) Copyright 2014 by Autodesk, Inc. #ifndef GMMTYPES_HH_INCLUDED #define GMMTYPES_HH_INCLUDED #include <gmm/gmm_matrix.h> namespace COMISO_GMM { // Matrix Types typedef gmm::col_matrix< gmm::wsvector<double> > WSColMatrix; typedef gmm::row_matrix< gmm::wsvector<double> > WSRowMatrix; typedef gmm::col_matrix< gmm::rsvector<double> > RSColMatrix; typedef gmm::row_matrix< gmm::rsvector<double> > RSRowMatrix; typedef gmm::csc_matrix<double> CSCMatrix; }//namespace COMISO_GMM #endif//GMMTYPES_HH_INCLUDED
24.619048
61
0.775629
shubhMaheshwari
b0c660c512a6f2da10b75c3025468a19d9e1952e
4,461
cpp
C++
library/src/blas2/rocblas_syr.cpp
zjunweihit/rocBLAS
c8bda2d15a7772d810810492ebed616eec0959a5
[ "MIT" ]
null
null
null
library/src/blas2/rocblas_syr.cpp
zjunweihit/rocBLAS
c8bda2d15a7772d810810492ebed616eec0959a5
[ "MIT" ]
null
null
null
library/src/blas2/rocblas_syr.cpp
zjunweihit/rocBLAS
c8bda2d15a7772d810810492ebed616eec0959a5
[ "MIT" ]
null
null
null
/* ************************************************************************ * Copyright 2016-2019 Advanced Micro Devices, Inc. * ************************************************************************ */ #include "rocblas_syr.hpp" #include "logging.h" #include "utility.h" namespace { template <typename> constexpr char rocblas_syr_name[] = "unknown"; template <> constexpr char rocblas_syr_name<float>[] = "rocblas_ssyr"; template <> constexpr char rocblas_syr_name<double>[] = "rocblas_dsyr"; template <typename T> rocblas_status rocblas_syr_impl(rocblas_handle handle, rocblas_fill uplo, rocblas_int n, const T* alpha, const T* x, rocblas_int incx, T* A, rocblas_int lda) { if(!handle) return rocblas_status_invalid_handle; RETURN_ZERO_DEVICE_MEMORY_SIZE_IF_QUERIED(handle); if(!alpha) return rocblas_status_invalid_pointer; auto layer_mode = handle->layer_mode; if(layer_mode & (rocblas_layer_mode_log_trace | rocblas_layer_mode_log_bench | rocblas_layer_mode_log_profile)) { auto uplo_letter = rocblas_fill_letter(uplo); if(handle->pointer_mode == rocblas_pointer_mode_host) { if(layer_mode & rocblas_layer_mode_log_trace) log_trace(handle, rocblas_syr_name<T>, uplo, n, *alpha, x, incx, A, lda); if(layer_mode & rocblas_layer_mode_log_bench) log_bench(handle, "./rocblas-bench -f syr -r", rocblas_precision_string<T>, "--uplo", uplo_letter, "-n", n, "--alpha", *alpha, "--incx", incx, "--lda", lda); } else { if(layer_mode & rocblas_layer_mode_log_trace) log_trace(handle, rocblas_syr_name<T>, uplo, n, alpha, x, incx, A, lda); } if(layer_mode & rocblas_layer_mode_log_profile) log_profile(handle, rocblas_syr_name<T>, "uplo", uplo_letter, "N", n, "incx", incx, "lda", lda); } if(uplo != rocblas_fill_lower && uplo != rocblas_fill_upper) return rocblas_status_not_implemented; if(!x || !A) return rocblas_status_invalid_pointer; if(n < 0 || !incx || lda < n || lda < 1) return rocblas_status_invalid_size; return rocblas_syr_template(handle, uplo, n, alpha, x, incx, A, lda); } } /* * =========================================================================== * C wrapper * =========================================================================== */ extern "C" { rocblas_status rocblas_ssyr(rocblas_handle handle, rocblas_fill uplo, rocblas_int n, const float* alpha, const float* x, rocblas_int incx, float* A, rocblas_int lda) { return rocblas_syr_impl(handle, uplo, n, alpha, x, incx, A, lda); } rocblas_status rocblas_dsyr(rocblas_handle handle, rocblas_fill uplo, rocblas_int n, const double* alpha, const double* x, rocblas_int incx, double* A, rocblas_int lda) { return rocblas_syr_impl(handle, uplo, n, alpha, x, incx, A, lda); } } // extern "C"
36.565574
93
0.401479
zjunweihit
37d0898a0b90fa8fa52aec17ed16dc1e2ccb95dc
19,831
cpp
C++
trace_server/mainwindow.cpp
mojmir-svoboda/DbgToolkit
590887987d0856032be906068a3103b6ce31d21c
[ "MIT" ]
null
null
null
trace_server/mainwindow.cpp
mojmir-svoboda/DbgToolkit
590887987d0856032be906068a3103b6ce31d21c
[ "MIT" ]
null
null
null
trace_server/mainwindow.cpp
mojmir-svoboda/DbgToolkit
590887987d0856032be906068a3103b6ce31d21c
[ "MIT" ]
null
null
null
#include "mainwindow.h" #include "ui_mainwindow.h" #include "ui_settings.h" #include "ui_mixer.h" #include "ui_help.h" #include <server/server.h> #include "connection.h" #include <QTime> #include <QShortcut> #include <QFileDialog> #include <QMessageBox> #include <QTimer> #include <QLabel> #include <QDropEvent> #include <QMimeData> #include <QStatusBar> #include <widgets/help.h> #include <widgets/mixer.h> #include <trace_version/trace_version.h> #include "constants.h" #include <dock/dockwidget.h> #include <widgets/setupdialogcsv.h> #include <widgets/controlbar/controlbardockmanager.h> #include <widgets/quickstringwidget.h> #include <widgets/findwidget.h> #include <ui_controlbardockmanager.h> #include "ui_setupdialogcsv.h" #include <ui_controlbarcommon.h> #include <utils/utils.h> #include <utils/utils_qstandarditem.h> #include <utils/utils_qsettings.h> #include <utils/utils_history.h> #include "qt_plugins.h" #include "platform.h" MainWindow::MainWindow (QWidget * parent, QString const & iface, unsigned short port, bool no_quit_msg_box, bool dump_mode, QString const & log_name, int level) : QMainWindow(parent) , ui(new Ui::MainWindow) , m_help(new Ui::HelpDialog) , m_timer(new QTimer(this)) , m_dock_mgr(this, QStringList(QString(g_traceServerName))) , m_docked_name(g_traceServerName) , m_log_name(log_name) , m_appdir(QDir::homePath() + "/" + g_traceServerDirName) , m_start_level(level) , m_no_quit_msg_box(no_quit_msg_box) { qDebug("================================================================================"); qDebug("%s this=0x%08x", __FUNCTION__, this); setWindowTitle(g_traceServerName); setObjectName(g_traceServerName); ui->setupUi(this); setStyleSheet( "QMainWindow::separator { background: rgb(150, 150, 150); width: 1px; height: 1px; }"); qApp->setStyleSheet("QToolTip { color: #efc090; background-color: #000066; border: 1px solid #efc090; }"); m_settings_dialog = new QDialog(this); m_settings_dialog->setWindowFlags(Qt::Sheet); m_settings_ui = new Ui::SettingsDialog(); m_settings_ui->setupUi(m_settings_dialog); m_setup_dialog_csv = new SetupDialogCSV(this); m_setup_dialog_csv->ui->preView->setModel(new QStandardItemModel()); m_setup_dialog_csv->ui->columnList->setModel(new QStandardItemModel()); //m_mixer = new Mixer(nullptr, m_dock_mgr.controlUI()->mixerButton, sizeof(context_t) * CHAR_BIT, sizeof(level_t) * CHAR_BIT); //Ui::Mixer * ui_mixer = new Ui::Mixer(); //m_mixer->setupMixer(m_config.m_mixer); m_config.m_appdir = m_appdir; m_config.m_dump_mode = dump_mode; m_config.m_trace_addr = iface; m_config.m_trace_port = port; loadConfig(); // only host:port really needed from config right now. the rest is loaded from loadState // tray stuff createTrayActions(); createTrayIcon(); QIcon icon(":images/Icon.ico"); setWindowIcon(icon); m_tray_icon->setVisible(true); m_tray_icon->show(); setAcceptDrops(true); setDockNestingEnabled(true); setAnimated(false); bool const on_top = m_config.m_on_top; if (on_top) { onOnTop(on_top); } startServer(); m_timer->setInterval(5000); connect(m_timer, SIGNAL(timeout()) , this, SLOT(onTimerHit())); m_timer->start(); /// status widget m_status_widget = new QLabel(m_server->getRunningStatus()); m_status_widget->setAlignment(Qt::AlignRight); m_status_widget->setMinimumWidth(256); if (statusBar()) statusBar()->hide(); m_find_widget = new FindWidget(this, this); m_find_widget->setActionAbleWidget(&m_dock_mgr); m_find_widget->setBroadcasting(); m_find_widget->setParent(this); m_quick_string_widget = new QuickStringWidget(this, this); m_quick_string_widget->setActionAbleWidget(&m_dock_mgr); m_quick_string_widget->setBroadcasting(); m_quick_string_widget->setParent(this); setupMenuBar(); //connect(m_dock_mgr.controlUI()->levelSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onLevelValueChanged(int))); connect(m_dock_mgr.controlUI()->buffCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onBufferingStateChanged(int))); connect(m_dock_mgr.controlUI()->clrDataButton, SIGNAL(clicked()), this, SLOT(onClearAllData())); connect(m_dock_mgr.controlUI()->presetComboBox, SIGNAL(activated(int)), this, SLOT(onPresetChanged(int))); connect(m_dock_mgr.controlUI()->presetComboBox->lineEdit(), SIGNAL(returnPressed()), this, SLOT(onPresetAdd())); connect(m_dock_mgr.controlUI()->activatePresetButton, SIGNAL(clicked()), this, SLOT(onPresetApply())); connect(m_dock_mgr.controlUI()->presetSaveButton, SIGNAL(clicked()), this, SLOT(onPresetSave())); connect(m_dock_mgr.controlUI()->presetAddButton, SIGNAL(clicked()), this, SLOT(onPresetAdd())); connect(m_dock_mgr.controlUI()->presetRmButton, SIGNAL(clicked()), this, SLOT(onPresetRm())); //connect(m_dock_mgr.controlUI()->presetResetButton, SIGNAL(clicked()), this, SLOT(onPresetReset())); loadState(); } MainWindow::~MainWindow() { qDebug("%s this=0x%08x", __FUNCTION__, this); #ifdef WIN32 UnregisterHotKey(getHWNDForWidget(this), 0); #endif m_server->setParent(0); delete m_server; delete m_tray_icon; delete m_tray_menu; delete m_help; delete ui; delete m_settings_ui; } void MainWindow::startServer () { qDebug("%s this=0x%08x addr=%s port=%i", __FUNCTION__, this, m_config.m_trace_addr.toLatin1().data(), m_config.m_trace_port); m_server = new Server(m_config.m_trace_addr, m_config.m_trace_port, this, m_no_quit_msg_box); connect(m_server, SIGNAL(newConnection(Connection *)), this, SLOT(newConnection(Connection *))); connect(m_server, SIGNAL(statusChanged(QString const &)), this, SLOT(onStatusChanged(QString const &))); } void MainWindow::stopServer() { qDebug("%s this=0x%08x addr=%s port=%i", __FUNCTION__, this, m_config.m_trace_addr.toLatin1().data(), m_config.m_trace_port); m_server->stop(); disconnect(m_server, SIGNAL(newConnection(Connection *)), this, SLOT(newConnection(Connection *))); disconnect(m_server, SIGNAL(statusChanged(QString const &)), this, SLOT(onStatusChanged(QString const &))); delete m_server; m_server = nullptr; } void MainWindow::hide () { qDebug("%s", __FUNCTION__); m_config.m_hidden = true; QMainWindow::hide(); } void MainWindow::showNormal () { qDebug("%s", __FUNCTION__); m_config.m_hidden = false; QMainWindow::showNormal(); } void MainWindow::showMaximized () { qDebug("%s", __FUNCTION__); m_config.m_hidden = false; QMainWindow::showMaximized(); } void MainWindow::createTrayActions () { m_minimize_action = new QAction(tr("Mi&nimize"), this); connect(m_minimize_action, SIGNAL(triggered()), this, SLOT(hide())); m_maximize_action = new QAction(tr("Ma&ximize"), this); connect(m_maximize_action, SIGNAL(triggered()), this, SLOT(showMaximized())); m_restore_action = new QAction(tr("&Restore"), this); connect(m_restore_action, SIGNAL(triggered()), this, SLOT(showNormal())); m_quit_action = new QAction(tr("&Quit"), this); connect(m_quit_action, SIGNAL(triggered()), this, SLOT(onQuit())); } void MainWindow::createTrayIcon () { m_tray_menu = new QMenu(this); m_tray_menu->addAction(m_minimize_action); m_tray_menu->addAction(m_maximize_action); m_tray_menu->addAction(m_restore_action); m_tray_menu->addSeparator(); m_tray_menu->addAction(m_quit_action); QIcon icon(":/images/Icon.ico"); m_tray_icon = new QSystemTrayIcon(icon, this); m_tray_icon->setContextMenu(m_tray_menu); //connect(m_tray_icon, SIGNAL(messageClicked()), this, SLOT(messageClicked())); connect(m_tray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); } void MainWindow::registerHotKey () { #ifdef WIN32 DWORD const hotkey = m_config.m_hotkey; int mod = 0; UnregisterHotKey(getHWNDForWidget(this), 0); RegisterHotKey(getHWNDForWidget(this), 0, mod, LOBYTE(hotkey)); #endif } void MainWindow::dropEvent (QDropEvent * event) { QMimeData const * mimeData = event->mimeData(); if (mimeData->hasUrls()) { QStringList pathList; QList<QUrl> urlList = mimeData->urls(); for (int i = 0; i < urlList.size() && i < 32; ++i) pathList.append(urlList.at(i).toLocalFile()); openFiles(pathList); } event->acceptProposedAction(); } void MainWindow::dragEnterEvent (QDragEnterEvent *event) { event->acceptProposedAction(); } void MainWindow::onStatusChanged (QString const & status) { m_status_widget->setText(status); m_timer->start(5000); } void MainWindow::showServerStatus () { m_status_widget->setText(m_server->getRunningStatus()); } void MainWindow::onTimerHit () { showServerStatus(); } void MainWindow::onQuit () { qDebug("onQuit: hide systray, store state, qApp->quit"); m_server->stop(); m_tray_icon->setVisible(false); m_tray_icon->hide(); while (!m_connections.empty()) { Connection * c = m_connections.back(); m_connections.pop_back(); delete c; } QTimer::singleShot(0, this, SLOT(onQuitReally())); // trigger lazy quit } void MainWindow::onQuitReally () { qDebug("%s", __FUNCTION__); qApp->quit(); } void MainWindow::onDockManagerButton () { if (m_dock_mgr_button->isChecked()) { m_dock_mgr.show(); m_dock_mgr.m_dockwidget->show(); m_dock_mgr.m_config.m_show = true; restoreDockWidget(m_dock_mgr.m_dockwidget); } else { m_dock_mgr.hide(); m_dock_mgr.m_dockwidget->hide(); m_dock_mgr.m_config.m_show = false; } } void MainWindow::onDockManagerClosed () { m_dock_mgr_button->setChecked(false); } void MainWindow::onReloadFile () { for (size_t i = 0, ie = m_reload_fnames.size(); i < ie; ++i) { QString const fname = m_reload_fnames[i]; if (!fname.isEmpty()) createTailDataStream(fname); } m_reload_fnames.clear(); } void MainWindow::tailFiles (QStringList const & files) { for (int i = 0, ie = files.size(); i < ie; ++i) { QString const fname = files.at(i); if (!fname.isEmpty()) createTailDataStream(fname); } } void MainWindow::onFileTail () { QString fname = QFileDialog::getOpenFileName(this, tr("Open File"), "", tr("*.*")); QStringList files; files << fname; tailFiles(files); } void MainWindow::onFileLoadCSV () { QString fname = QFileDialog::getOpenFileName(this, tr("Open File"), "", tr("CSV File(s) (*.%1)").arg(g_traceFileExtCSV)); QStringList files; files << fname; tailFiles(files); // spunt, @TODO } void MainWindow::onLogTail () { createTailLogStream(m_log_name, "|"); } void MainWindow::openFiles (QStringList const & files) { for (int i = 0, ie = files.size(); i < ie; ++i) { QString fname = files.at(i); if (fname != "") { importDataStream(fname); } } } void MainWindow::onFileLoad () { // @TODO: multi-selection? QString fname = QFileDialog::getOpenFileName(this, tr("Open File"), "", tr("Trace File(s) (*.%1)").arg(g_traceFileExtTLV)); QStringList files; files << fname; openFiles(files); } void MainWindow::onSaveData () { QString const dir = QFileDialog::getExistingDirectory(this, tr("Save data to directory"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dir.isEmpty()) return; if (mkPath(dir)) { for (connections_t::iterator it = m_connections.begin(), ite = m_connections.end(); it != ite; ++it) (*it)->onSaveData(dir); } } void MainWindow::onExportDataToCSV () { QString const dir = QFileDialog::getExistingDirectory(this, tr("Export csv to directory"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dir.isEmpty()) return; if (mkPath(dir)) { for (connections_t::iterator it = m_connections.begin(), ite = m_connections.end(); it != ite; ++it) (*it)->onExportDataToCSV(dir); } } void MainWindow::onOnTop (int const state) { if (state == 0) { Qt::WindowFlags const old = windowFlags(); Qt::WindowFlags const newflags = Qt::Window | (old & ~(Qt::WindowStaysOnTopHint)); setWindowFlags(newflags); show(); } else { //setWindowFlags(Qt::WindowStaysOnTopHint); //@NOTE: win users lacks the min and max buttons. sigh. setWindowFlags(Qt::WindowStaysOnTopHint); show(); } } void MainWindow::onHotkeyShowOrHide () { bool const not_on_top = !isActiveWindow(); qDebug("onHotkeyShowOrHide() isActive=%u", not_on_top); m_config.m_hidden = !m_config.m_hidden; if (m_config.m_hidden) { m_config.m_was_maximized = isMaximized(); hide(); } else { if (m_config.m_was_maximized) showMaximized(); else showNormal(); raise(); activateWindow(); } } void MainWindow::onShowHelp () { QDialog dialog(this); dialog.setWindowFlags(Qt::Sheet); m_help->setupUi(&dialog); m_help->helpTextEdit->clear(); m_help->helpTextEdit->setHtml(QString(html_help)); m_help->helpTextEdit->setReadOnly(true); dialog.exec(); } void MainWindow::onOptionsAction() { setConfigValuesToUI(m_config); // set signal and slot for "Buttons" connect(m_settings_ui->okSaveButton, SIGNAL(clicked()), m_settings_dialog, SLOT(accept())); connect(m_settings_ui->cancelButton, SIGNAL(clicked()), m_settings_dialog, SLOT(reject())); int const retval = m_settings_dialog->exec(); if (retval == QDialog::Rejected) return; setUIValuesToConfig(m_config); saveConfig(); } void MainWindow::applyCachedLayout () { qDebug("%s", __FUNCTION__); if (m_geo_data.size()) restoreGeometry(m_geo_data); if (m_layout_data.size()) restoreState(m_layout_data); } void MainWindow::onRecentFile () { QAction * action = qobject_cast<QAction *>(sender()); if (action) { QString const fname = action->data().toString(); QString const ext = QFileInfo(fname).suffix(); bool const is_tlv = (0 == QString::compare(ext, g_traceFileExtTLV, Qt::CaseInsensitive)); bool const is_csv = (0 == QString::compare(ext, g_traceFileExtCSV, Qt::CaseInsensitive)); if (is_tlv) importDataStream(fname); else if (is_csv) createTailDataStream(fname); else createTailDataStream(fname); } } void MainWindow::setupMenuBar () { qDebug("%s", __FUNCTION__); m_dock_mgr_button = new QToolButton(0); m_dock_mgr_button->setObjectName(QStringLiteral("dockManagerButton")); m_dock_mgr_button->setMinimumSize(QSize(0, 0)); //m_dock_mgr_button->setFont(font); m_dock_mgr_button->setCheckable(true); m_dock_mgr_button->setChecked(false); m_dock_mgr_button->setToolTip(QApplication::translate("MainWindow", "Central management of docked data widgets", 0)); m_dock_mgr_button->setText(QApplication::translate("MainWindow", "Widget Manager", 0)); menuBar()->setCornerWidget(m_dock_mgr_button, Qt::TopLeftCorner); connect(m_dock_mgr_button, SIGNAL(clicked()), this, SLOT(onDockManagerButton())); m_dock_mgr_button->setStyleSheet("\ QToolButton { border: 1px solid #8f8f91; border-radius: 4px; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e6e7fa, stop: 1 #dadbff); } \ QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbdd, stop: 1 #d6d7da); }"); menuBar()->setCornerWidget(m_status_widget, Qt::TopRightCorner); connect(m_status_widget, SIGNAL(clicked()), this, SLOT(onDockManagerButton())); // File m_file_menu = menuBar()->addMenu(tr("&File")); m_file_menu->addAction(tr("Data file &Load..."), this, SLOT(onFileLoad()), QKeySequence(Qt::ControlModifier + Qt::Key_O)); m_file_menu->addAction(tr("&Save raw client data as..."), this, SLOT(onSaveData())); m_file_menu->addAction(tr("&Export data as CSV format..."), this, SLOT(onExportDataToCSV())); m_file_menu->addSeparator(); m_file_menu->addAction(tr("Load &CSV file..."), this, SLOT(onFileLoadCSV())); m_file_menu->addAction(tr("&Follow text file..."), this, SLOT(onFileTail()), QKeySequence(Qt::ControlModifier + Qt::Key_T)); m_file_menu->addSeparator(); syncHistoryToRecent(m_config.m_recent_history); m_before_action = m_file_menu->addSeparator(); m_file_menu->addAction(tr("Quit program"), this, SLOT(onQuit())); // View QMenu * viewMenu = menuBar()->addMenu(tr("&View")); viewMenu->addAction(tr("&Save preset"), this, SLOT(onSave()), Qt::Key_F5); viewMenu->addAction(tr("&Apply preset"), this, SLOT(onApply()), Qt::Key_F9); viewMenu->addAction(tr("Save preset &as..."), this, SLOT(onSaveAs()), QKeySequence(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_F5)); viewMenu->addSeparator(); // View QMenu * actionMenu = menuBar()->addMenu(tr("Actions")); QKeySequence all_undo(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_Z); actionMenu->addAction(tr("All widgets - Undo action (if lucky)"), this, SLOT(onAllPopAction()), all_undo); QKeySequence all_deldata(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_D); actionMenu->addAction(tr("All widgets - Clear Data"), this, SLOT(onClearAllData()), all_deldata); QKeySequence all_colorlast(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_E); actionMenu->addAction(tr("All widgets - Color last line "), this, SLOT(onColorAllLastLine()), all_colorlast); QKeySequence all_scrolllast(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_S); actionMenu->addAction(tr("All widgets - Scroll to last "), this, SLOT(onAllScrollToLast()), all_scrolllast); QKeySequence quick_string(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_Q); actionMenu->addAction(tr("All widgets - Quick String filter"), this, SLOT(onAllQuickString()), quick_string); QKeySequence all_find(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_F); actionMenu->addAction(tr("All widgets - All Find"), this, SLOT(onAllFind()), all_find); // widget's tool dockable widgets. m_windows_menu = menuBar()->addMenu(tr("&Windows")); // Tools QMenu * tools = menuBar()->addMenu(tr("&Tools")); tools->addAction(tr("&Options"), this, SLOT(onOptionsAction())); // Help QMenu * helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addSeparator(); helpMenu->addAction(tr("&Remove configuration files"), this, SLOT(onRemoveConfigurationFiles())); helpMenu->addAction(tr("Show server log"), this, SLOT(onLogTail()), QKeySequence(Qt::ControlModifier + Qt::AltModifier + Qt::Key_L)); QAction * ver = helpMenu->addAction(tr("Version %1").arg(g_Version)); ver->setEnabled(false); // Help //QMenu * helpMenu = menuBar()->addMenu(tr("&Help")); //helpMenu->addAction(tr("Help"), this, SLOT(onShowHelp())); } void MainWindow::addWindowAction (QAction * action) { m_windows_menu->addAction(action); } void MainWindow::rmWindowAction (QAction * action) { m_windows_menu->removeAction(action); } void MainWindow::iconActivated (QSystemTrayIcon::ActivationReason reason) { switch (reason) { case QSystemTrayIcon::Trigger: break; case QSystemTrayIcon::DoubleClick: onHotkeyShowOrHide(); break; case QSystemTrayIcon::MiddleClick: break; default: break; } } void MainWindow::closeEvent (QCloseEvent * event) { m_config.m_hidden = true; saveConfig(); hide(); event->ignore(); } void MainWindow::changeEvent (QEvent * e) { QMainWindow::changeEvent(e); } bool MainWindow::eventFilter (QObject * target, QEvent * e) { /*if (e->type() == QEvent::Shortcut) { QShortcutEvent * se = static_cast<QShortcutEvent *>(e); if (se->key() == QKeySequence(Qt::ControlModifier + Qt::Key_Insert)) { //onCopyToClipboard(); return true; } }*/ return false; } void MainWindow::keyPressEvent (QKeyEvent * e) { if (e->type() == QKeyEvent::KeyPress) { /*if (e->matches(QKeySequence::Copy)) e->accept(); else if (e->key() == Qt::Key_Escape) if (m_find_widget && m_find_widget->isVisible()) { m_find_widget->onCancel(); e->accept(); }*/ } QMainWindow::keyPressEvent(e); } void MainWindow::onRemoveConfigurationFiles () { //QString const path = m_appdir; // @NOTE: rather not.. will not risk deletion of other files than mine QString const path = QDir::homePath() + "/" + g_traceServerDirName; if (path.isEmpty()) return; QMessageBox msg_box; QPushButton * b_del = msg_box.addButton(tr("Yes, Delete"), QMessageBox::ActionRole); QPushButton * b_abort = msg_box.addButton(QMessageBox::Abort); msg_box.exec(); if (msg_box.clickedButton() == b_abort) return; QDir d_out(path); d_out.removeRecursively(); QDir d_new; d_new.mkpath(path); }
30.415644
164
0.719984
mojmir-svoboda
37d8580822150dd4c9d38b6fd0e9dfe833bd5f81
347
cpp
C++
Cpp_Programs/races/20180828T/rectangle.cpp
xiazeyu/OI_Resource
1de0ab9a84ee22ae4edb612ddeddc712c3c38e56
[ "Apache-2.0" ]
2
2018-10-01T09:03:35.000Z
2019-05-24T08:53:06.000Z
Cpp_Programs/races/20180828T/rectangle.cpp
xiazeyu/OI_Resource
1de0ab9a84ee22ae4edb612ddeddc712c3c38e56
[ "Apache-2.0" ]
null
null
null
Cpp_Programs/races/20180828T/rectangle.cpp
xiazeyu/OI_Resource
1de0ab9a84ee22ae4edb612ddeddc712c3c38e56
[ "Apache-2.0" ]
null
null
null
#include <bits/stdc++.h> using namespace std; long dp[50][50][2500], n, m, k; int main(){ // freopen("rectangle.in", "r", stdin); // freopen("rectangle.out", "w", stdout); scanf("%ld%ld%ld", &n, &m, &k); dp[2][2][4] = 1; for(long i = 3; i <= n; i++) for(long j = 3; j <= m; j++) for(long l = 4; l <= k, l++) return 0; }
18.263158
43
0.489914
xiazeyu
37da12953d7e3f15254dea73a9fd24e120b5be98
516
cpp
C++
Ejercicios/Ejercicio_40 Punto-De-Venta-Parte 1/Menu.cpp
Olioliver98/C-
f47db3c3aab37387b9e4f227c910e9cc8359729e
[ "MIT" ]
null
null
null
Ejercicios/Ejercicio_40 Punto-De-Venta-Parte 1/Menu.cpp
Olioliver98/C-
f47db3c3aab37387b9e4f227c910e9cc8359729e
[ "MIT" ]
null
null
null
Ejercicios/Ejercicio_40 Punto-De-Venta-Parte 1/Menu.cpp
Olioliver98/C-
f47db3c3aab37387b9e4f227c910e9cc8359729e
[ "MIT" ]
null
null
null
#include <iostream> using namespace std; void menu() { int opciones = 0; while (true) { system("cls"); cout<<"********"; cout<<" MENU "; cout<<"********"; cout<<"\n"; cout<<"1 - Bebidas calientes "<< endl; cout<<"2 - Bebidas frias"<< endl; cout<<"3 - Reposteria"<< endl; cout<<"0 - Salir "<< endl; cin>> opciones; if (opciones == 0) { break; } } }
15.176471
46
0.381783
Olioliver98
37e34ac82766584c4a6e24d9d06ce78a71321a68
1,571
cpp
C++
Source/FactoryGame/FGCrashSiteDebris.cpp
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
Source/FactoryGame/FGCrashSiteDebris.cpp
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
Source/FactoryGame/FGCrashSiteDebris.cpp
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
// This file has been automatically generated by the Unreal Header Implementation tool #include "FGCrashSiteDebris.h" FDebrisMesh::FDebrisMesh(){ } FDebrisActor::FDebrisActor(){ } FDebrisItemDrop::FDebrisItemDrop(){ } TSubclassOf< class UFGItemDescriptor > FDebrisItemDrop::GetItemClass() const{ return TSubclassOf<class UFGItemDescriptor>(); } bool FDebrisItemDrop::IsValid() const{ return bool(); } FSimulatedMeshTransform::FSimulatedMeshTransform(){ } FSimulatedMeshTransform::FSimulatedMeshTransform( UStaticMesh* mesh, const FTransform& transform){ } FSimulatedActorTransform::FSimulatedActorTransform(){ } FSimulatedActorTransform::FSimulatedActorTransform( TSubclassOf< AFGCrashSiteDebrisActor > actor, const FTransform& transform){ } FSimulatedItemDropTransform::FSimulatedItemDropTransform(){ } #if WITH_EDITOR void AFGCrashSiteDebris::OnConstruction( const FTransform& transform){ } void AFGCrashSiteDebris::BeginPlay(){ } void AFGCrashSiteDebris::Tick( float dt){ } void AFGCrashSiteDebris::PostEditChangeChainProperty( FPropertyChangedChainEvent& PropertyChangedEvent){ } #endif #if WITH_EDITOR void AFGCrashSiteDebris::OnPreBeginPIE( bool isSimulating){ } void AFGCrashSiteDebris::OnEndPIE( bool wasSimulatingInEditor){ } void AFGCrashSiteDebris::SpawnSimulation(){ } void AFGCrashSiteDebris::ResetSavedSimulation(){ } void AFGCrashSiteDebris::DestroySavedSimulation(){ } void AFGCrashSiteDebris::SpawnSavedSimulation(){ } #endif #if WITH_EDITORONLY_DATA #endif AFGCrashSiteDebris::AFGCrashSiteDebris(){ } AFGCrashSiteDebris::~AFGCrashSiteDebris(){ }
47.606061
129
0.819223
iam-Legend
37e61a50af20180e06b1d1104cf6b94ecbcdc8a0
1,130
cc
C++
iridium/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
behemoth3663/ports_local
ad57042ae62c907f9340ee696f468fdfeb562a8b
[ "BSD-3-Clause" ]
1
2022-02-08T02:24:08.000Z
2022-02-08T02:24:08.000Z
iridium/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
behemoth3663/ports_local
ad57042ae62c907f9340ee696f468fdfeb562a8b
[ "BSD-3-Clause" ]
null
null
null
iridium/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
behemoth3663/ports_local
ad57042ae62c907f9340ee696f468fdfeb562a8b
[ "BSD-3-Clause" ]
null
null
null
--- content/utility/utility_blink_platform_with_sandbox_support_impl.cc.orig 2019-12-16 21:50:48 UTC +++ content/utility/utility_blink_platform_with_sandbox_support_impl.cc @@ -9,7 +9,7 @@ #if defined(OS_MACOSX) #include "content/child/child_process_sandbox_support_impl_mac.h" -#elif defined(OS_LINUX) +#elif defined(OS_LINUX) || defined(OS_BSD) #include "content/child/child_process_sandbox_support_impl_linux.h" #endif @@ -17,7 +17,7 @@ namespace content { UtilityBlinkPlatformWithSandboxSupportImpl:: UtilityBlinkPlatformWithSandboxSupportImpl() { -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_BSD) mojo::PendingRemote<font_service::mojom::FontService> font_service; UtilityThread::Get()->BindHostReceiver( font_service.InitWithNewPipeAndPassReceiver()); @@ -34,7 +34,7 @@ UtilityBlinkPlatformWithSandboxSupportImpl:: blink::WebSandboxSupport* UtilityBlinkPlatformWithSandboxSupportImpl::GetSandboxSupport() { -#if defined(OS_LINUX) || defined(OS_MACOSX) +#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) return sandbox_support_.get(); #else return nullptr;
37.666667
100
0.777876
behemoth3663
37f2405b71af9bcbca1a80d1a58f2ae5e2bdd00e
585
cpp
C++
node_modules/lzz-gyp/lzz-source/smtc_TmplFuncDefnEntity.cpp
SuperDizor/dizornator
9f57dbb3f6af80283b4d977612c95190a3d47900
[ "ISC" ]
3
2019-09-18T16:44:33.000Z
2021-03-29T13:45:27.000Z
node_modules/lzz-gyp/lzz-source/smtc_TmplFuncDefnEntity.cpp
SuperDizor/dizornator
9f57dbb3f6af80283b4d977612c95190a3d47900
[ "ISC" ]
null
null
null
node_modules/lzz-gyp/lzz-source/smtc_TmplFuncDefnEntity.cpp
SuperDizor/dizornator
9f57dbb3f6af80283b4d977612c95190a3d47900
[ "ISC" ]
2
2019-03-29T01:06:38.000Z
2019-09-18T16:44:34.000Z
// smtc_TmplFuncDefnEntity.cpp // #include "smtc_TmplFuncDefnEntity.h" #ifndef LZZ_ENABLE_INLINE #include "smtc_TmplFuncDefnEntity.inl" #endif // semantic #include "smtc_EntityVisitor.h" #define LZZ_INLINE inline namespace smtc { TmplFuncDefnEntity::TmplFuncDefnEntity (TmplFuncDefnPtr const & tmpl_func_defn) : m_tmpl_func_defn (tmpl_func_defn) {} } namespace smtc { TmplFuncDefnEntity::~ TmplFuncDefnEntity () {} } namespace smtc { void TmplFuncDefnEntity::accept (EntityVisitor const & visitor) const { visitor.visit (* this); } } #undef LZZ_INLINE
19.5
81
0.748718
SuperDizor
37f3093cb79be3be8dd4fc11c307eb79889b347e
1,870
cpp
C++
tools/qiangbao.cpp
WatorVapor/wai.native.wator
e048df159e2952c143f8832264b20da20dcd88fa
[ "MIT" ]
null
null
null
tools/qiangbao.cpp
WatorVapor/wai.native.wator
e048df159e2952c143f8832264b20da20dcd88fa
[ "MIT" ]
null
null
null
tools/qiangbao.cpp
WatorVapor/wai.native.wator
e048df159e2952c143f8832264b20da20dcd88fa
[ "MIT" ]
null
null
null
#include <algorithm> #include <iostream> #include <list> #include <map> #include <string> #include <thread> #include <vector> using namespace std; #include "ctrlclaw.hpp" #include "log.hpp" #include "qiangbaoword.hpp" #include "textpump.hpp" vector<string> parseUTF8(const string &words); void parseBytes(const vector<string> &Bytes, const string &text); static string longTxt( u8"它是由从地方到全球范围内几百万个私人的、学术界的、" u8"企业的和政府的网络所构成,通过电子," u8"无线和光纤网络技术等等一系列广泛的技术联系在一起。" u8"这种将计算机网络互相联接在一起的方法可称作“网络互联”," u8"在这基础上发展出覆盖全世界的全球性互联网络称互联网," u8"即是互相连接一起的网络。"); static string shortTxt( u8"人造卫星能够成功执行预定任务,单凭卫星本身是不行的," u8"而需要完整的卫星工程系统"); static string oneTxt(u8"它就要背负着积累于人世间的所有不快和仇恨恩怨"); static string bugTxt( u8",影片讲述了江湖三大高手之一的笑三少遭人陷害亡命天涯并" u8"追查事情真相的故事。"); int main(int ac, char *av[]) { QiangbaoWord qiangbao("./db/baidu.baike"); if (qiangbao.loadMaster(false) == false) { return 0; } auto learnQiangbao = [&](string wordStr, vector<string> word) { qiangbao.learn(word, wordStr); }; CtrlClaw claw; claw.claw(longTxt); claw.eachSentence(learnQiangbao); claw.claw(shortTxt); claw.eachSentence(learnQiangbao); claw.claw(oneTxt); claw.eachSentence(learnQiangbao); claw.claw(bugTxt); claw.eachSentence(learnQiangbao); qiangbao.unloadMaster(); return 0; } /* int main(int ac,char*av[]) { PhoenixWord phoenix("./db/baidu.baike"); if(phoenix.loadMaster()==false) { return 0; } auto learnPhoenix = [&](string wordStr, vector<string> word) { phoenix.learn(word,wordStr); }; CtrlClaw claw; auto clawText = [&](string &path,string &content) { DUMP_VAR(path); //DUMP_VAR(content); claw.claw(content); claw.eachSentence(learnPhoenix); }; TextPump txtPump; txtPump.eachTextFile("./url_crawl/textout/baike.baidu",clawText); phoenix.unloadMaster(); return 0; } */
22.261905
67
0.700535
WatorVapor
37f314c12b2a3eb0087b242bd4ce857c312b0939
668
cpp
C++
Fluid Render/Fluid Render/BilateralNormalFBO.cpp
freehyan/Graphics
a7b0f111c1012ae56a64e592489583a718eb5cfe
[ "MIT" ]
47
2017-07-05T04:03:16.000Z
2021-01-22T07:06:05.000Z
Fluid Render/Fluid Render/BilateralNormalFBO.cpp
freehyan/Graphics
a7b0f111c1012ae56a64e592489583a718eb5cfe
[ "MIT" ]
null
null
null
Fluid Render/Fluid Render/BilateralNormalFBO.cpp
freehyan/Graphics
a7b0f111c1012ae56a64e592489583a718eb5cfe
[ "MIT" ]
3
2017-08-23T12:52:16.000Z
2021-11-15T08:47:57.000Z
#include "BilateralNormalFBO.h" #include <Cooler/ProductFactory.h> Cooler::CProductFactory<CBilateralNormalFBO> theCreater("BILATERAL_NORMAL_FBO"); CBilateralNormalFBO::CBilateralNormalFBO() { } CBilateralNormalFBO::~CBilateralNormalFBO() { } //*********************************************************** //FUNCTION: void CBilateralNormalFBO::addTextureV(const std::string& vTexName, GLint vInternalFormat /* = GL_RGBA32F */, GLenum vFormat /* = GL_RGBA */) { if (vTexName == "tex_bilateral_normal") _generateTexture(m_BilateralNormalTex, vInternalFormat, vFormat); else std::cout << vTexName + " is not defined in the resource config file." << std::endl; }
29.043478
140
0.693114
freehyan
37fc886bd3676bcf3af3a843d249e7f6e442dda0
23,799
cpp
C++
cppbwh_test.cpp
ntllct/CPPBWH
abae472ca70a5d75b0caf838a32f7c995a30e3c8
[ "MIT" ]
null
null
null
cppbwh_test.cpp
ntllct/CPPBWH
abae472ca70a5d75b0caf838a32f7c995a30e3c8
[ "MIT" ]
null
null
null
cppbwh_test.cpp
ntllct/CPPBWH
abae472ca70a5d75b0caf838a32f7c995a30e3c8
[ "MIT" ]
null
null
null
// Copyright (c) 2018 Alexander Alexeev [ntllct@protonmail.com] // g++ -std=c++14 -m64 -O2 -mavx cppbwh_test.cpp -o cppbwh_test #include <iostream> #include <cstddef> #include <iomanip> #include <cstring> #include <algorithm> #include <random> #include <chrono> #include "cppbwh.hpp" std::mt19937_64 random64; using namespace ntllct; void TEST( bool compare_result, const char* prefix ) { std::cout << prefix << ": " << "\033[1m"; if( compare_result ) std::cout << "\033[32m" << "OK!" << "\033[0m" << std::endl; else std::cout << "\033[31m" << "Failed!" << "\033[0m" << std::endl; } void test_xorswap() { size_t val1 = random64() >> 2; size_t val2 = random64() >> 2; size_t val3 = val1; size_t val4 = val2; unsigned long ul_val1 = val1; unsigned long ul_val2 = val2; unsigned long ul_val3 = val3; unsigned long ul_val4 = val4; unsigned int ui_val1 = val1; unsigned int ui_val2 = val2; unsigned int ui_val3 = val3; unsigned int ui_val4 = val4; unsigned short us_val1 = val1; unsigned short us_val2 = val2; unsigned short us_val3 = val3; unsigned short us_val4 = val4; unsigned char uc_val1 = val1; unsigned char uc_val2 = val2; unsigned char uc_val3 = val3; unsigned char uc_val4 = val4; long l_val1 = -val1; long l_val2 = val2; long l_val3 = -val3; long l_val4 = val4; int i_val1 = -val1; int i_val2 = val2; int i_val3 = -val3; int i_val4 = val4; short s_val1 = -val1; short s_val2 = val2; short s_val3 = -val3; short s_val4 = val4; char c_val1 = -val1; char c_val2 = val2; char c_val3 = -val3; char c_val4 = val4; cppbwh::xorswap( val1, val2 ); TEST( val1 == val4 && val2 == val3, "xorswap (size_t)" ); cppbwh::xorswap( ul_val1, ul_val2 ); TEST( ul_val1 == ul_val4 && ul_val2 == ul_val3, "xorswap (unsigned long)" ); cppbwh::xorswap( ui_val1, ui_val2 ); TEST( ui_val1 == ui_val4 && ui_val2 == ui_val3, "xorswap (unsigned int)" ); cppbwh::xorswap( us_val1, us_val2 ); TEST( us_val1 == us_val4 && us_val2 == us_val3, "xorswap (unsigned short)" ); cppbwh::xorswap( uc_val1, uc_val2 ); TEST( uc_val1 == uc_val4 && uc_val2 == uc_val3, "xorswap (unsigned char)" ); cppbwh::xorswap( l_val1, l_val2 ); TEST( l_val1 == l_val4 && l_val2 == l_val3, "xorswap (long)" ); cppbwh::xorswap( i_val1, i_val2 ); TEST( i_val1 == i_val4 && i_val2 == i_val3, "xorswap (int)" ); cppbwh::xorswap( s_val1, s_val2 ); TEST( s_val1 == s_val4 && s_val2 == s_val3, "xorswap (short)" ); cppbwh::xorswap( c_val1, c_val2 ); TEST( c_val1 == c_val4 && c_val2 == c_val3, "xorswap (char)" ); std::cout << std::endl; } void test_bit_reverse() { size_t val1 = random64(); unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; std::string bit_str1_; std::string bit_str2_; bit_str1_.clear(); bit_str2_.clear(); cppbwh::tobin( val1, bit_str1_ ); std::reverse( bit_str1_.begin(), bit_str1_.end() ); cppbwh::reverse( val1 ); cppbwh::tobin( val1, bit_str2_ ); TEST( bit_str1_.compare( bit_str2_ ) == 0, "reverse (size_t)" ); bit_str1_.clear(); bit_str2_.clear(); cppbwh::tobin( ul_val1, bit_str1_ ); std::reverse( bit_str1_.begin(), bit_str1_.end() ); cppbwh::reverse( ul_val1 ); cppbwh::tobin( ul_val1, bit_str2_ ); TEST( bit_str1_.compare( bit_str2_ ) == 0, "reverse (unsigned long)" ); bit_str1_.clear(); bit_str2_.clear(); cppbwh::tobin( ui_val1, bit_str1_ ); std::reverse( bit_str1_.begin(), bit_str1_.end() ); cppbwh::reverse( ui_val1 ); cppbwh::tobin( ui_val1, bit_str2_ ); TEST( bit_str1_.compare( bit_str2_ ) == 0, "reverse (unsigned int)" ); bit_str1_.clear(); bit_str2_.clear(); cppbwh::tobin( us_val1, bit_str1_ ); std::reverse( bit_str1_.begin(), bit_str1_.end() ); cppbwh::reverse( us_val1 ); cppbwh::tobin( us_val1, bit_str2_ ); TEST( bit_str1_.compare( bit_str2_ ) == 0, "reverse (unsigned short)" ); bit_str1_.clear(); bit_str2_.clear(); cppbwh::tobin( uc_val1, bit_str1_ ); std::reverse( bit_str1_.begin(), bit_str1_.end() ); cppbwh::reverse( uc_val1 ); cppbwh::tobin( uc_val1, bit_str2_ ); TEST( bit_str1_.compare( bit_str2_ ) == 0, "reverse (unsigned char)" ); std::cout << std::endl; } void test_lsb() { size_t val1 = random64(); val1 |= 1UL; val1 <<= 5; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; TEST( cppbwh::lsb( val1 ) == 1UL << 5, "lsb (size_t)" ); TEST( cppbwh::lsb( ul_val1 ) == 1UL << 5, "lsb (unsigned long)" ); TEST( cppbwh::lsb( ui_val1 ) == 1UL << 5, "lsb (unsigned int)" ); TEST( cppbwh::lsb( us_val1 ) == 1UL << 5, "lsb (unsigned short)" ); TEST( cppbwh::lsb( uc_val1 ) == 1UL << 5, "lsb (unsigned char)" ); std::cout << std::endl; } void test_tobin() { size_t val1 = 0b00000100'00000000'00000000'00001000'00000000'00000100'10000000'10010001; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; char buf_[65]{0}; cppbwh::tobin( val1, buf_, false ); TEST( strcmp( "00000100000000000000000000001000" "00000000000001001000000010010001", buf_ ) == 0, "tobin (size_t)" ); memset( buf_, 0, 65 ); cppbwh::tobin( ul_val1, buf_, false ); TEST( strcmp( "00000100000000000000000000001000" "00000000000001001000000010010001", buf_ ) == 0, "tobin (unsigned long)" ); memset( buf_, 0, 65 ); cppbwh::tobin( ui_val1, buf_, false ); TEST( strcmp( "00000000000001001000000010010001", buf_ ) == 0, "tobin (unsigned int)" ); memset( buf_, 0, 65 ); cppbwh::tobin( us_val1, buf_, false ); TEST( strcmp( "1000000010010001", buf_ ) == 0, "tobin (unsigned short)" ); memset( buf_, 0, 65 ); cppbwh::tobin( uc_val1, buf_, false ); TEST( strcmp( "10010001", buf_ ) == 0, "tobin (unsigned char)" ); memset( buf_, 0, 65 ); cppbwh::tobin( val1, buf_, true ); TEST( strcmp( "100000000000000000000001000" "00000000000001001000000010010001", buf_ ) == 0, "tobin (size_t)" ); memset( buf_, 0, 65 ); cppbwh::tobin( ul_val1, buf_, true ); TEST( strcmp( "100000000000000000000001000" "00000000000001001000000010010001", buf_ ) == 0, "tobin (unsigned long)" ); memset( buf_, 0, 65 ); cppbwh::tobin( ui_val1, buf_, true ); TEST( strcmp( "1001000000010010001", buf_ ) == 0, "tobin (unsigned int)" ); std::string bin_val_; cppbwh::tobin( val1, bin_val_, false ); TEST( strcmp( "00000100000000000000000000001000" "00000000000001001000000010010001", bin_val_.c_str() ) == 0, "tobin (size_t)" ); bin_val_.clear(); cppbwh::tobin( ul_val1, bin_val_, false ); TEST( strcmp( "00000100000000000000000000001000" "00000000000001001000000010010001", bin_val_.c_str() ) == 0, "tobin (unsigned long)" ); bin_val_.clear(); cppbwh::tobin( ui_val1, bin_val_, false ); TEST( strcmp( "00000000000001001000000010010001", bin_val_.c_str() ) == 0, "tobin (unsigned int)" ); bin_val_.clear(); cppbwh::tobin( us_val1, bin_val_, false ); TEST( strcmp( "1000000010010001", bin_val_.c_str() ) == 0, "tobin (unsigned short)" ); bin_val_.clear(); cppbwh::tobin( uc_val1, bin_val_, false ); TEST( strcmp( "10010001", bin_val_.c_str() ) == 0, "tobin (unsigned char)" ); bin_val_.clear(); cppbwh::tobin( val1, bin_val_, true ); TEST( strcmp( "100000000000000000000001000" "00000000000001001000000010010001", bin_val_.c_str() ) == 0, "tobin (size_t)" ); bin_val_.clear(); cppbwh::tobin( ul_val1, bin_val_, true ); TEST( strcmp( "100000000000000000000001000" "00000000000001001000000010010001", bin_val_.c_str() ) == 0, "tobin (unsigned long)" ); bin_val_.clear(); cppbwh::tobin( ui_val1, bin_val_, true ); TEST( strcmp( "1001000000010010001", bin_val_.c_str() ) == 0, "tobin (unsigned int)" ); std::cout << std::endl; } void test_swapn() { size_t val1 = 0b10101010'10101010'10101010'10101010'10101010'10101010'10101010'10101010; size_t val2 = 0b01010101'01010101'01010101'01010101'01010101'01010101'01010101'01010101; unsigned long ul_val1 = val1; unsigned long ul_val2 = val2; unsigned int ui_val1 = val1; unsigned int ui_val2 = val2; unsigned short us_val1 = val1; unsigned short us_val2 = val2; unsigned char uc_val1 = val1; unsigned char uc_val2 = val2; cppbwh::swapn( val1 ); TEST( val1 == val2, "swapn (size_t)" ); cppbwh::swapn( ul_val1 ); TEST( ul_val1 == ul_val2, "swapn (unsigned long)" ); cppbwh::swapn( ui_val1 ); TEST( ui_val1 == ui_val2, "swapn (unsigned int)" ); cppbwh::swapn( us_val1 ); TEST( us_val1 == us_val2, "swapn (unsigned short)" ); cppbwh::swapn( uc_val1 ); TEST( uc_val1 == uc_val2, "swapn (unsigned char)" ); val1 = 0b10101010'10101010'10101010'10101010'10101010'10101010'10101010'10011001; val2 = 0b01010101'01010101'01010101'01010101'01010101'01010101'01010101'01100110; ul_val1 = val1; ul_val2 = val2; ui_val1 = val1; ui_val2 = val2; us_val1 = val1; us_val2 = val2; uc_val1 = val1; uc_val2 = val2; cppbwh::swapn( val1 ); TEST( val1 == val2, "swapn (size_t)" ); cppbwh::swapn( ul_val1 ); TEST( ul_val1 == ul_val2, "swapn (unsigned long)" ); cppbwh::swapn( ui_val1 ); TEST( ui_val1 == ui_val2, "swapn (unsigned int)" ); cppbwh::swapn( us_val1 ); TEST( us_val1 == us_val2, "swapn (unsigned short)" ); cppbwh::swapn( uc_val1 ); TEST( uc_val1 == uc_val2, "swapn (unsigned char)" ); std::cout << std::endl; } void test_floor_log2() { for( unsigned int i = 0; i < 5; ++i ) { size_t val1 = random64(); unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; TEST( cppbwh::floor_log2( val1 ) == static_cast<size_t>( std::floor( std::log2( val1 ) ) ), "floor_log2 (size_t)" ); TEST( cppbwh::floor_log2( ul_val1 ) == static_cast<unsigned long>( std::floor( std::log2( ul_val1 ) ) ), "floor_log2 (unsigned long)" ); TEST( cppbwh::floor_log2( ui_val1 ) == static_cast<unsigned int>( std::floor( std::log2( ui_val1 ) ) ), "floor_log2 (unsigned int)" ); TEST( cppbwh::floor_log2( us_val1 ) == static_cast<unsigned short>( std::floor( std::log2( us_val1 ) ) ), "floor_log2 (unsigned short)" ); TEST( cppbwh::floor_log2( uc_val1 ) == static_cast<unsigned char>( std::floor( std::log2( uc_val1 ) ) ), "floor_log2 (unsigned char)" ); } std::cout << std::endl; } void test_mul_3_5() { for( unsigned int i = 0; i < 5; ++i ) { size_t val1 = random64() >> 2; val1 >>= 2; unsigned long ul_val1 = val1; //ul_val1 >>= 2; unsigned int ui_val1 = val1; ui_val1 >>= 2; unsigned short us_val1 = val1; us_val1 >>= 2; unsigned char uc_val1 = val1; uc_val1 >>= 2; std::cout << "Can be errors! (Round errors)" << std::endl; TEST( cppbwh::mul_3_5( val1 ) == static_cast<size_t>( std::floor( static_cast<long double>( val1 ) * 3.5 ) ), "test_mul_3_5 (size_t)" ); std::cout << cppbwh::mul_3_5( val1 ) << ", " << static_cast<size_t>( std::floor( static_cast<long double>( val1 ) * 3.5 ) ) << std::endl; TEST( cppbwh::mul_3_5( ul_val1 ) == static_cast<unsigned long>( std::floor( static_cast<long double>( ul_val1 ) * 3.5 ) ), "test_mul_3_5 (unsigned long)" ); TEST( cppbwh::mul_3_5( ui_val1 ) == static_cast<unsigned int>( std::floor( static_cast<long double>( ui_val1 ) * 3.5 ) ), "test_mul_3_5 (unsigned int)" ); TEST( cppbwh::mul_3_5( us_val1 ) == static_cast<unsigned short>( std::floor( static_cast<long double>( us_val1 ) * 3.5 ) ), "test_mul_3_5 (unsigned short)" ); TEST( cppbwh::mul_3_5( uc_val1 ) == static_cast<unsigned char>( std::floor( static_cast<long double>( uc_val1 ) * 3.5 ) ), "test_mul_3_5 (unsigned char)" ); } std::cout << std::endl; } void test_nlpo2() { size_t val1 = random64(); val1 |= 0x8000000000000000; val1 >>= 2; unsigned long ul_val1 = val1; ul_val1 |= 0x8000000000000000; ul_val1 >>= 2; unsigned int ui_val1 = val1; ui_val1 |= 0x80000000; ui_val1 >>= 2; unsigned short us_val1 = val1; us_val1 |= 0x8000; us_val1 >>= 2; unsigned char uc_val1 = val1; uc_val1 |= 0x80; uc_val1 >>= 2; TEST( cppbwh::nlpo2( val1 ) == 0x4000000000000000, "nlpo2 (size_t)" ); TEST( cppbwh::nlpo2( ul_val1 ) == 0x4000000000000000, "nlpo2 (unsigned long)" ); TEST( cppbwh::nlpo2( ui_val1 ) == 0x40000000, "nlpo2 (unsigned int)" ); TEST( cppbwh::nlpo2( us_val1 ) == 0x4000, "nlpo2 (unsigned short)" ); TEST( cppbwh::nlpo2( uc_val1 ) == 0x40, "nlpo2 (unsigned char)" ); std::cout << std::endl; } void test_msb() { size_t val1 = random64(); val1 |= 0x8000000000000000; val1 >>= 5; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; ui_val1 |= 0x80000000; ui_val1 >>= 5; unsigned short us_val1 = val1; us_val1 |= 0x8000; us_val1 >>= 5; unsigned char uc_val1 = val1; uc_val1 |= 0x80; uc_val1 >>= 5; TEST( cppbwh::msb( val1 ) == 0x8000000000000000 >> 5, "msb (size_t)" ); TEST( cppbwh::msb( ul_val1 ) == 0x8000000000000000 >> 5, "msb (unsigned long)" ); TEST( cppbwh::msb( ui_val1 ) == 0x80000000 >> 5, "msb (unsigned int)" ); TEST( cppbwh::msb( us_val1 ) == 0x8000 >> 5, "msb (unsigned short)" ); TEST( cppbwh::msb( uc_val1 ) == 0x80 >> 5, "msb (unsigned char)" ); std::cout << std::endl; } void test_rotate_left() { size_t val1 = 1UL << 6; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; std::cout << static_cast<unsigned int>( cppbwh::rotate_left( uc_val1, 7 ) ) << std::endl; TEST( cppbwh::rotate_left( val1, 7 ) == 1UL << 13, "rotate_left (size_t)" ); TEST( cppbwh::rotate_left( ul_val1, 7 ) == 1UL << 13, "rotate_left (unsigned long)" ); TEST( cppbwh::rotate_left( ui_val1, 7 ) == 1UL << 13, "rotate_left (unsigned int)" ); TEST( cppbwh::rotate_left( us_val1, 7 ) == 1UL << 13, "rotate_left (unsigned short)" ); TEST( cppbwh::rotate_left( uc_val1, 7 ) == 1UL << 5, "rotate_left (unsigned char)" ); val1 = 0b01010101'01010101'01010101'01010101'01010101'01010101'01010101'01100110; ul_val1 = val1; ui_val1 = val1; us_val1 = val1; uc_val1 = val1; std::cout << static_cast<unsigned int>( cppbwh::rotate_left( uc_val1, 7 ) ) << std::endl; TEST( cppbwh::rotate_left( val1, 7 ) == 0b1'01010101'01010101'01010101'01010101'01010101'01010101'01100110'0101010, "rotate_left (size_t)" ); TEST( cppbwh::rotate_left( ul_val1, 7 ) == 0b1'01010101'01010101'01010101'01010101'01010101'01010101'01100110'0101010, "rotate_left (unsigned long)" ); TEST( cppbwh::rotate_left( ui_val1, 7 ) == 0b1'01010101'01010101'01100110'0101010, "rotate_left (unsigned int)" ); TEST( cppbwh::rotate_left( us_val1, 7 ) == 0b1'01100110'0101010, "rotate_left (unsigned short)" ); TEST( cppbwh::rotate_left( uc_val1, 7 ) == 0b00110011, "rotate_left (unsigned char)" ); std::cout << std::endl; } void test_rotate_right() { size_t val1 = 1UL << 7; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; std::cout << static_cast<unsigned int>( cppbwh::rotate_right( uc_val1, 5 ) ) << std::endl; TEST( cppbwh::rotate_right( val1, 5 ) == 1UL << 2, "rotate_right (size_t)" ); TEST( cppbwh::rotate_right( ul_val1, 5 ) == 1UL << 2, "rotate_right (unsigned long)" ); TEST( cppbwh::rotate_right( ui_val1, 5 ) == 1UL << 2, "rotate_right (unsigned int)" ); TEST( cppbwh::rotate_right( us_val1, 5 ) == 1UL << 2, "rotate_right (unsigned short)" ); TEST( cppbwh::rotate_right( uc_val1, 5 ) == 1UL << 2, "rotate_right (unsigned char)" ); val1 = 0b01010101'01010101'01010101'01010101'01010101'01010101'01010101'01100110; ul_val1 = val1; ui_val1 = val1; us_val1 = val1; uc_val1 = val1; std::cout << static_cast<unsigned int>( cppbwh::rotate_right( uc_val1, 7 ) ) << std::endl; TEST( cppbwh::rotate_right( val1, 7 ) == 0b1100110'01010101'01010101'01010101'01010101'01010101'01010101'01010101'0, "rotate_right (size_t)" ); TEST( cppbwh::rotate_right( ul_val1, 7 ) == 0b1100110'01010101'01010101'01010101'01010101'01010101'01010101'01010101'0, "rotate_right (unsigned long)" ); TEST( cppbwh::rotate_right( ui_val1, 7 ) == 0b1100110'01010101'01010101'01010101'0, "rotate_right (unsigned int)" ); TEST( cppbwh::rotate_right( us_val1, 7 ) == 0b1100110'01010101'0, "rotate_right (unsigned short)" ); TEST( cppbwh::rotate_right( uc_val1, 7 ) == 0b11001100, "rotate_right (unsigned char)" ); std::cout << std::endl; } void test_hex_unhex() { size_t val1 = random64(); size_t val2 = 0; char buff1_[17]{0}; char buff2_[9]{0}; unsigned long ul_val1 = val1; unsigned long ul_val2 = 0; unsigned int ui_val1 = val1; unsigned int ui_val2 = 0; unsigned short us_val1 = val1; unsigned short us_val2 = 0; unsigned char uc_val1 = val1; unsigned char uc_val2 = 0; memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); const char str1_[] = "Test"; const char str2_[] = "Test!"; cppbwh::hex( str1_, strlen( str1_ ), buff1_ ); cppbwh::unhex( buff1_, strlen( buff1_ ), buff2_ ); TEST( strcmp( buff2_, str1_ ) == 0, "test_hex_unhex (str1_)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( str2_, strlen( str2_ ), buff1_ ); cppbwh::unhex( buff1_, strlen( buff1_ ), buff2_ ); TEST( strcmp( buff2_, str2_ ) == 0, "test_hex_unhex (str2_)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( val1, buff1_ ); cppbwh::unhex( buff1_, val2 ); TEST( val1 == val2, "test_hex_unhex (size_t)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( ul_val1, buff1_ ); cppbwh::unhex( buff1_, ul_val2 ); TEST( ul_val1 == ul_val2, "test_hex_unhex (unsigned long)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( ui_val1, buff1_ ); cppbwh::unhex( buff1_, ui_val2 ); TEST( ui_val1 == ui_val2, "test_hex_unhex (unsigned int)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( us_val1, buff1_ ); cppbwh::unhex( buff1_, us_val2 ); TEST( us_val1 == us_val2, "test_hex_unhex (unsigned short)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( uc_val1, buff1_ ); cppbwh::unhex( buff1_, uc_val2 ); TEST( uc_val1 == uc_val2, "test_hex_unhex (unsigned char)" ); std::string out_; memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( str1_, strlen( str1_ ), out_ ); cppbwh::unhex( out_.c_str(), out_.size(), buff2_ ); TEST( strcmp( buff2_, str1_ ) == 0, "test_hex_unhex (str1_)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( str2_, strlen( str2_ ), out_ ); cppbwh::unhex( out_.c_str(), out_.size(), buff2_ ); TEST( strcmp( buff2_, str2_ ) == 0, "test_hex_unhex (str2_)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( val1, out_ ); cppbwh::unhex( out_.c_str(), val2 ); TEST( val1 == val2, "test_hex_unhex (size_t)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( ul_val1, out_ ); cppbwh::unhex( out_.c_str(), ul_val2 ); TEST( ul_val1 == ul_val2, "test_hex_unhex (unsigned long)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( ui_val1, out_ ); cppbwh::unhex( out_.c_str(), ui_val2 ); TEST( ui_val1 == ui_val2, "test_hex_unhex (unsigned int)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( us_val1, out_ ); cppbwh::unhex( out_.c_str(), us_val2 ); TEST( us_val1 == us_val2, "test_hex_unhex (unsigned short)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( uc_val1, out_ ); cppbwh::unhex( out_.c_str(), uc_val2 ); TEST( uc_val1 == uc_val2, "test_hex_unhex (unsigned char)" ); std::cout << std::endl; } void test_bit_set_clear_check() { size_t val1 = 0; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; size_t bpos_ = 0; for( unsigned int i = 0; i < 10; ++i ) { bpos_ = random64() % ( sizeof( size_t ) * 8 ); cppbwh::setbit( val1, bpos_ ); TEST( cppbwh::checkbit( val1, bpos_ ), "set and check bit (size_t)" ); cppbwh::clearbit( val1, bpos_ ); TEST( !cppbwh::checkbit( val1, bpos_ ), "clear and check bit (size_t)" ); bpos_ = random64() % ( sizeof( unsigned long ) * 8 ); cppbwh::setbit( ul_val1, bpos_ ); TEST( cppbwh::checkbit( ul_val1, bpos_ ), "set and check bit (unsigned long)" ); cppbwh::clearbit( ul_val1, bpos_ ); TEST( !cppbwh::checkbit( ul_val1, bpos_ ), "clear and check bit (unsigned long)" ); bpos_ = random64() % ( sizeof( unsigned int ) * 8 ); cppbwh::setbit( ui_val1, bpos_ ); TEST( cppbwh::checkbit( ui_val1, bpos_ ), "set and check bit (unsigned int)" ); cppbwh::clearbit( ui_val1, bpos_ ); TEST( !cppbwh::checkbit( ui_val1, bpos_ ), "clear and check bit (unsigned int)" ); bpos_ = random64() % ( sizeof( unsigned short ) * 8 ); cppbwh::setbit( us_val1, bpos_ ); TEST( cppbwh::checkbit( us_val1, bpos_ ), "set and check bit (unsigned short)" ); cppbwh::clearbit( us_val1, bpos_ ); TEST( !cppbwh::checkbit( us_val1, bpos_ ), "clear and check bit (unsigned short)" ); bpos_ = random64() % ( sizeof( unsigned char ) * 8 ); cppbwh::setbit( uc_val1, bpos_ ); TEST( cppbwh::checkbit( uc_val1, bpos_ ), "set and check bit (unsigned char)" ); cppbwh::clearbit( uc_val1, bpos_ ); TEST( !cppbwh::checkbit( uc_val1, bpos_ ), "clear and check bit (unsigned char)" ); } val1 = 0b00100010'00100100'10010000'0010000'00100100'00100001'00010000'01000000; size_t val2 = 0b00100010'00100100'10010000'0010000'00100100'00100001'00010000'01000000; ul_val1 = val1; unsigned long ul_val2 = val1; ui_val1 = val1; unsigned int ui_val2 = val1; us_val1 = val1; unsigned short us_val2 = val1; uc_val1 = val1; unsigned char uc_val2 = val1; cppbwh::setbit( val1, 62 ); TEST( cppbwh::checkbit( val1, 62 ), "set and check bit (size_t)" ); cppbwh::clearbit( val1, 62 ); TEST( val1 == val2, "clear and check bit (size_t)" ); cppbwh::setbit( ul_val1, 59 ); TEST( cppbwh::checkbit( ul_val1, 59 ), "set and check bit (unsigned long)" ); cppbwh::clearbit( ul_val1, 59 ); TEST( ul_val1 == ul_val2, "clear and check bit (unsigned long)" ); cppbwh::setbit( ui_val1, 30 ); TEST( cppbwh::checkbit( ui_val1, 30 ), "set and check bit (unsigned int)" ); cppbwh::clearbit( ui_val1, 30 ); TEST( ui_val1 == ui_val2, "clear and check bit (unsigned int)" ); cppbwh::setbit( us_val1, 13 ); TEST( cppbwh::checkbit( us_val1, 13 ), "set and check bit (unsigned short)" ); cppbwh::clearbit( us_val1, 13 ); TEST( us_val1 == us_val2, "clear and check bit (unsigned short)" ); cppbwh::setbit( uc_val1, 4 ); TEST( cppbwh::checkbit( uc_val1, 4 ), "set and check bit (unsigned char)" ); cppbwh::clearbit( uc_val1, 4 ); TEST( uc_val1 == uc_val2, "clear and check bit (unsigned char)" ); } int main() { std::chrono::high_resolution_clock::time_point d_ = std::chrono::high_resolution_clock::now(); unsigned seed_ = d_.time_since_epoch().count(); random64.seed( seed_ ); test_xorswap(); test_bit_reverse(); test_lsb(); test_tobin(); test_swapn(); test_floor_log2(); test_mul_3_5(); test_nlpo2(); test_msb(); test_rotate_left(); test_rotate_right(); test_hex_unhex(); test_bit_set_clear_check(); return( EXIT_SUCCESS ); }
32.962604
155
0.650447
ntllct
37fde8a751c3cdff49d8ef0ff9b6e84bb32c1d1f
242
hpp
C++
include/Pomdog/Math/PlaneIntersectionType.hpp
ValtoForks/pomdog
73798ae5f4a4c3b9b1e1e96239187c4b842c93b2
[ "MIT" ]
null
null
null
include/Pomdog/Math/PlaneIntersectionType.hpp
ValtoForks/pomdog
73798ae5f4a4c3b9b1e1e96239187c4b842c93b2
[ "MIT" ]
null
null
null
include/Pomdog/Math/PlaneIntersectionType.hpp
ValtoForks/pomdog
73798ae5f4a4c3b9b1e1e96239187c4b842c93b2
[ "MIT" ]
null
null
null
// Copyright (c) 2013-2018 mogemimi. Distributed under the MIT license. #pragma once #include <cstdint> namespace Pomdog { enum class PlaneIntersectionType : std::uint8_t { Front, Back, Intersecting, }; } // namespace Pomdog
15.125
71
0.702479
ValtoForks
53000f9a0ce22b21078b06f1b9ab11e95d0a820f
299
cpp
C++
C-Plus-Plus/Cstring/strcpy.cpp
19-1-skku-oss/2019-1-OSS-L2
40cef694a9442b983da080d23913f34641b2fa4d
[ "MIT" ]
null
null
null
C-Plus-Plus/Cstring/strcpy.cpp
19-1-skku-oss/2019-1-OSS-L2
40cef694a9442b983da080d23913f34641b2fa4d
[ "MIT" ]
25
2019-05-28T09:49:06.000Z
2019-06-07T14:27:53.000Z
C-Plus-Plus/Cstring/strcpy.cpp
19-1-skku-oss/2019-1-OSS-L2
40cef694a9442b983da080d23913f34641b2fa4d
[ "MIT" ]
1
2019-12-08T11:00:31.000Z
2019-12-08T11:00:31.000Z
#include <iostream> using namespace std; char *strcpy(char *dest, char *source) { int i; for ( i = 0; source[i]; i++) dest[i] = source[i]; dest[i] = NULL; return dest; } int main() { char input[100]; cin >> input; char dest[100]; strcpy(dest, input); cout << dest << endl; return 0; }
13.590909
38
0.602007
19-1-skku-oss
530167d404dee6c84a3bb28d489f71c1f73ad6f5
934
cpp
C++
kernel/hw/pc/idt/idt.cpp
MTGos/mtgos
270f4932565eb3fe074cacc8c55c41103fa0a371
[ "BSD-2-Clause" ]
2
2018-01-04T18:11:39.000Z
2020-03-12T17:54:13.000Z
kernel/hw/pc/idt/idt.cpp
MTGos/kernel
270f4932565eb3fe074cacc8c55c41103fa0a371
[ "BSD-2-Clause" ]
10
2017-02-05T11:09:45.000Z
2017-02-08T13:42:14.000Z
kernel/hw/pc/idt/idt.cpp
MTGos/kernel
270f4932565eb3fe074cacc8c55c41103fa0a371
[ "BSD-2-Clause" ]
null
null
null
#include "idt.hpp" extern "C" void intr_stub_0(); IDT_entry entries[256]; void setIDTEntry(int i, void *entry) { uintptr_t p = (uintptr_t)entry; entries[i].offset0 = (uint16_t)p; p >>= 16; #ifndef __x86_64__ entries[i].selector = 0x8; #else entries[i].selector = 0x28; #endif entries[i].zero = 0; entries[i].type = 0b1110; entries[i].storageSeg = false; entries[i].dpl = 3; entries[i].used = true; entries[i].offset1 = (uint16_t)p; p >>= 16; #ifdef __x86_64__ entries[i].offset2 = (uint32_t)p; entries[i].zero2 = 0; #endif } void initIDT() { char *start_vectors = (char *)&intr_stub_0; for (int i = 0; i < 256; i++) setIDTEntry(i, start_vectors + 16 * i); struct { uint16_t size; IDT_entry *off; } __attribute__((packed)) idtr; idtr.size = sizeof(entries); idtr.off = (IDT_entry *)(&entries); asm volatile("lidt %0" : : "m"(idtr)); }
25.944444
73
0.605996
MTGos
530c3b4f77632b37fa7654385cfc3256f7262f22
1,963
hh
C++
block/sorted_array.hh
duynguyen-ori75/learning
903a6d9f59b2d08a237b45487ac12052123a0bd5
[ "MIT" ]
2
2021-03-27T17:11:37.000Z
2021-04-14T17:24:32.000Z
block/sorted_array.hh
duynguyen-ori75/learning
903a6d9f59b2d08a237b45487ac12052123a0bd5
[ "MIT" ]
null
null
null
block/sorted_array.hh
duynguyen-ori75/learning
903a6d9f59b2d08a237b45487ac12052123a0bd5
[ "MIT" ]
1
2021-03-27T17:11:43.000Z
2021-03-27T17:11:43.000Z
#include <algorithm> #include <vector> class SortedArray { private: std::vector<int> data_; int maxSize_, currentSize_; std::pair<int, int> cellPayload(int index) { return std::make_pair(this->data_[index * 2], this->data_[index * 2 + 1]); } int lookUp(int key) { int low = 0; int high = currentSize_ - 1; while (low <= high) { auto mid = (low + high) / 2; auto cell = cellPayload(mid); if (cell.first < key) low = mid + 1; else high = mid - 1; } return low; } public: SortedArray(int size) : maxSize_(size), currentSize_(0) { data_.resize(size * 2); } std::pair<bool, int> Search(int key) { auto index = this->lookUp(key); if (index >= this->currentSize_ || cellPayload(index).first != key) return std::make_pair(false, -1); return std::make_pair(true, cellPayload(index).second); } bool Insert(int key, int value) { auto index = this->lookUp(key); if (index < this->currentSize_ && cellPayload(index).first == key) { this->data_[index * 2 + 1] = value; return true; } if (this->currentSize_ >= this->maxSize_) return false; for (int idx = this->currentSize_; idx > index; idx--) { this->data_[idx * 2] = this->data_[(idx - 1) * 2]; this->data_[idx * 2 + 1] = this->data_[(idx - 1) * 2 + 1]; } this->data_[index * 2] = key; this->data_[index * 2 + 1] = value; this->currentSize_++; return true; } bool Remove(int key) { auto index = this->lookUp(key); if (index >= this->currentSize_ || cellPayload(index).first != key) return false; for (int idx = index; idx < this->currentSize_ - 1; idx++) { this->data_[idx * 2] = this->data_[(idx + 1) * 2]; this->data_[idx * 2 + 1] = this->data_[(idx + 1) * 2]; } this->currentSize_--; this->data_[this->currentSize_ * 2] = 0; this->data_[this->currentSize_ * 2 + 1] = 0; return true; } };
29.742424
78
0.573102
duynguyen-ori75
53135981d29773a1ed9030c17764f8eba518ec6c
185
hpp
C++
engine/core/include/debug.hpp
redstrate/prism
acb6c5306c6f60088744191f3d3d8713fc6950bd
[ "MIT" ]
18
2020-08-11T18:13:49.000Z
2022-03-08T21:42:54.000Z
engine/core/include/debug.hpp
redstrate/prism
acb6c5306c6f60088744191f3d3d8713fc6950bd
[ "MIT" ]
11
2020-08-27T12:37:48.000Z
2022-02-21T05:17:03.000Z
engine/core/include/debug.hpp
redstrate/prism
acb6c5306c6f60088744191f3d3d8713fc6950bd
[ "MIT" ]
1
2020-12-08T14:01:48.000Z
2020-12-08T14:01:48.000Z
#pragma once #include <string_view> void draw_console(); void draw_debug_ui(); void load_debug_options(); void save_debug_options(); std::string_view get_shader_source_directory();
15.416667
47
0.789189
redstrate
53162e76b695dcac0abafade96d28c6c5785ca7d
1,529
cpp
C++
lib/generator/object/trees/defaults/MegaRedwoodTree.cpp
NetherGamesMC/noiselib
56fc48ea1367e1d08b228dfa580b513fbec8ca31
[ "MIT" ]
14
2021-08-16T18:58:30.000Z
2022-02-13T01:12:31.000Z
lib/generator/object/trees/defaults/MegaRedwoodTree.cpp
NetherGamesMC/ext-vanillagenerator
56fc48ea1367e1d08b228dfa580b513fbec8ca31
[ "MIT" ]
2
2021-06-21T15:10:01.000Z
2021-07-19T01:48:00.000Z
lib/generator/object/trees/defaults/MegaRedwoodTree.cpp
NetherGamesMC/ext-vanillagenerator
56fc48ea1367e1d08b228dfa580b513fbec8ca31
[ "MIT" ]
3
2021-06-21T02:10:39.000Z
2021-08-04T01:36:08.000Z
#include "MegaRedwoodTree.h" void MegaRedwoodTree::Initialize(Random &random, BlockTransaction &txn) { MegaJungleTree::Initialize(random, txn); SetHeight(static_cast<int_fast32_t>(random.NextInt(15) + random.NextInt(3)) + 13); SetType(MAGIC_NUMBER_SPRUCE); SetLeavesHeight(static_cast<int_fast32_t>(random.NextInt(5)) + (random.NextBoolean() ? 3 : 13)); } void MegaRedwoodTree::SetLeavesHeight(int_fast32_t iLeavesHeight) { this->leavesHeight = iLeavesHeight; } bool MegaRedwoodTree::Generate(ChunkManager &world, Random &random, int_fast32_t sourceX, int_fast32_t sourceY, int_fast32_t sourceZ) { if (CannotGenerateAt(sourceX, sourceY, sourceZ, world)) { return false; } // generates the leaves int_fast32_t previousRadius = 0; for (int_fast32_t y = sourceY + height - leavesHeight; y <= sourceY + height; y++) { int_fast32_t n = sourceY + height - y; int_fast32_t radius = (int) std::floor((double) n / leavesHeight * 3.5); if (radius == previousRadius && n > 0 && y % 2 == 0) { radius++; } GenerateLeaves(sourceX, y, sourceZ, radius, false, world); previousRadius = radius; } // generates the trunk GenerateTrunk(world, sourceX, sourceY, sourceZ); // blocks below trunk are always dirt GenerateDirtBelowTrunk(sourceX, sourceY, sourceZ); return true; } void MegaRedwoodTree::GenerateDirtBelowTrunk(int_fast32_t blockX, int_fast32_t blockY, int_fast32_t blockZ) { // NOOP: MegaRedwoodTree does not replace blocks below (surely to preserves podzol) }
33.977778
135
0.725311
NetherGamesMC
53175fef90dc2da0612ef58649995f659c16ace9
1,638
cpp
C++
TransimsNet/Write_Turn.cpp
kravitz/transims4
ea0848bf3dc71440d54724bb3ecba3947b982215
[ "NASA-1.3" ]
2
2018-04-27T11:07:02.000Z
2020-04-24T06:53:21.000Z
TransimsNet/Write_Turn.cpp
idkravitz/transims4
ea0848bf3dc71440d54724bb3ecba3947b982215
[ "NASA-1.3" ]
null
null
null
TransimsNet/Write_Turn.cpp
idkravitz/transims4
ea0848bf3dc71440d54724bb3ecba3947b982215
[ "NASA-1.3" ]
null
null
null
//********************************************************* // Write_Turn.cpp - Write the Turn Prohibition File //********************************************************* #include "TransimsNet.hpp" #include "Turn_File.hpp" //--------------------------------------------------------- // Write_Turn //--------------------------------------------------------- void TransimsNet::Write_Turn (void) { int node; Turn_Data *turn_ptr; Link_Data *link_ptr; Time_Step time_step (1, "24_HOUR_CLOCK"); Turn_File *turn_file = (Turn_File *) Network_Db_Base (NEW_TURN_PROHIBITION); Show_Message ("Writing %s - Record", turn_file->File_Type ()); Set_Progress (); for (turn_ptr = turn_data.First (); turn_ptr; turn_ptr = turn_data.Next ()) { Show_Progress (); //---- get the approach link ---- link_ptr = link_data.Get (turn_ptr->In_Link ()); if (link_ptr == NULL) { Write (1, "link=%d was not found (out=%d)", turn_ptr->In_Link (), turn_ptr->Out_Link ()); continue; } node = (turn_ptr->In_Dir () == 1) ? link_ptr->Anode () : link_ptr->Bnode (); //---- write the turn record ---- turn_file->Node (node); turn_file->In_Link (turn_ptr->In_Link ()); turn_file->Out_Link (turn_ptr->Out_Link ()); turn_file->Start (time_step.Format_Step (Resolve (turn_ptr->Start ()))); turn_file->End (time_step.Format_Step (Resolve (turn_ptr->End ()))); turn_file->Use (Use_Code (turn_ptr->Use ())); turn_file->Penalty (turn_ptr->Penalty ()); turn_file->Notes ("Turn Prohibition"); if (!turn_file->Write ()) { Error ("Writing Turn Prohibition"); } nturn++; } End_Progress (); turn_file->Close (); }
26.419355
92
0.562882
kravitz
53184101cce46c77f942e454fb9b899f11155216
3,137
hpp
C++
boost/numeric/mtl/utility/make_copy_or_reference.hpp
lit-uriy/mtl4-mirror
37cf7c2847165d3537cbc3400cb5fde6f80e3d8b
[ "MTLL" ]
24
2019-03-26T15:25:45.000Z
2022-03-26T10:00:45.000Z
lib/mtl4/boost/numeric/mtl/utility/make_copy_or_reference.hpp
spraetor/amdis2
53c45c81a65752a8fafbb54f9ae6724a86639dcd
[ "MIT" ]
2
2020-04-17T12:35:32.000Z
2021-03-03T15:46:25.000Z
lib/mtl4/boost/numeric/mtl/utility/make_copy_or_reference.hpp
spraetor/amdis2
53c45c81a65752a8fafbb54f9ae6724a86639dcd
[ "MIT" ]
10
2019-12-01T13:40:30.000Z
2022-01-14T08:39:54.000Z
// Software License for MTL // // Copyright (c) 2007 The Trustees of Indiana University. // 2008 Dresden University of Technology and the Trustees of Indiana University. // 2010 SimuNova UG (haftungsbeschränkt), www.simunova.com. // All rights reserved. // Authors: Peter Gottschling and Andrew Lumsdaine // // This file is part of the Matrix Template Library // // See also license.mtl.txt in the distribution. #ifndef MTL_MAKE_COPY_OR_REFERENCE_INCLUDE #define MTL_MAKE_COPY_OR_REFERENCE_INCLUDE namespace mtl { /// Helper class to avoid avoidable copies for input parameters /** Container is referred if it has already target type, otherwise copied. Create an object of this type and pass the value member variable to the function, e.g. make_in_copy_or_reference<Tgt, Src> copy_or_ref(v); f(copy_or_ref.value); where Src is the type of v and Tgt the type of f's argument. **/ template <typename Target, typename Source> struct make_in_copy_or_reference { typedef Target type; explicit make_in_copy_or_reference(const Source& src) : value(src) {} Target value; }; template <typename Target> struct make_in_copy_or_reference<Target, Target> { typedef const Target& type; explicit make_in_copy_or_reference(const Target& src) : value(src) {} const Target& value; }; /// Helper class to avoid avoidable copies for output parameters. /** Container is referred if it has already target type, otherwise copied at destruction. Create an object of this type and pass the value member variable to the function, e.g. make_in_copy_or_reference<Tgt, Src> copy_or_ref(v); f(copy_or_ref.value); where Src is the type of v and Tgt the type of f's argument. Target must be DefaultConstructible. **/ template <typename Target, typename Source> struct make_out_copy_or_reference { explicit make_out_copy_or_reference(Source& src) : src(src) {} ~make_out_copy_or_reference() { src= value; } Target value; private: Source& src; }; template <typename Target> struct make_out_copy_or_reference<Target, Target> { explicit make_out_copy_or_reference(Target& src) : value(src) {} Target& value; }; /// Helper class to avoid avoidable copies for input-output parameters. /** Container is referred if it has already target type, otherwise copied construction and destruction. Create an object of this type and pass the value member variable to the function, e.g. make_in_copy_or_reference<Tgt, Src> copy_or_ref(v); f(copy_or_ref.value); where Src is the type of v and Tgt the type of f's argument. **/ template <typename Target, typename Source> struct make_in_out_copy_or_reference { explicit make_in_out_copy_or_reference(Source& src) : value(src), src(src) {} ~make_in_out_copy_or_reference() { src= value; } Target value; private: Source& src; }; template <typename Target> struct make_in_out_copy_or_reference<Target, Target> { explicit make_in_out_copy_or_reference(Target& src) : value(src) {} Target& value; }; } // namespace mtl #endif // MTL_MAKE_COPY_OR_REFERENCE_INCLUDE
33.021053
103
0.740198
lit-uriy
5320a449b99a0b9b72e6eea6794928401694a678
232
cpp
C++
modules/math/source/blub/math/log/global.cpp
qwertzui11/voxelTerrain
05038fb261893dd044ae82fab96b7708ea5ed623
[ "MIT" ]
96
2015-02-02T20:01:24.000Z
2021-11-14T20:33:29.000Z
modules/math/source/blub/math/log/global.cpp
qwertzui11/voxelTerrain
05038fb261893dd044ae82fab96b7708ea5ed623
[ "MIT" ]
12
2016-06-04T15:45:30.000Z
2020-02-04T11:10:51.000Z
modules/math/source/blub/math/log/global.cpp
qwertzui11/voxelTerrain
05038fb261893dd044ae82fab96b7708ea5ed623
[ "MIT" ]
19
2015-09-22T01:21:45.000Z
2020-09-30T09:52:27.000Z
#include "global.hpp" #include "blub/core/string.hpp" using namespace blub::math::log; using namespace blub; BLUB_LOG_GLOBAL_LOGGER_INIT(global, blub::log::logger) { blub::log::logger result("math"); return result; }
13.647059
54
0.706897
qwertzui11
53231c25a00b5bd467b4a61051c9304900ecb9fa
19,304
cpp
C++
source/mclib/packet.cpp
mechasource/mechcommander2
b2c7cecf001cec1f535aa8d29c31bdc30d9aa983
[ "BSD-2-Clause" ]
38
2015-04-10T13:31:03.000Z
2021-09-03T22:34:05.000Z
source/mclib/packet.cpp
mechasource/mechcommander2
b2c7cecf001cec1f535aa8d29c31bdc30d9aa983
[ "BSD-2-Clause" ]
1
2020-07-09T09:48:44.000Z
2020-07-12T12:41:43.000Z
source/mclib/packet.cpp
mechasource/mechcommander2
b2c7cecf001cec1f535aa8d29c31bdc30d9aa983
[ "BSD-2-Clause" ]
12
2015-06-29T08:06:57.000Z
2021-10-13T13:11:41.000Z
//--------------------------------------------------------------------------- // // Packet.cpp -- File contains the actual code for the Packet File class // //---------------------------------------------------------------------------// // Copyright (C) Microsoft Corporation. All rights reserved. // //===========================================================================// //--------------------------------------------------------------------------- // Include Files #ifndef PACKET_H #include "packet.h" #endif #ifndef HEAP_H #include "heap.h" #endif #ifndef LZ_H #include "lz.h" #endif #include "zlib.h" #ifndef _MBCS //#include "gameos.hpp" #else #include <_ASSERT.h> #define gosASSERT _ASSERT #define gos_Malloc malloc #define gos_Free free #endif #include <string.h> //--------------------------------------------------------------------------- extern uint8_t* LZPacketBuffer; extern uint32_t LZPacketBufferSize; //--------------------------------------------------------------------------- // class PacketFile void PacketFile::clear(void) { currentPacket = -1; packetSize = packetBase = numPackets = 0; if (seekTable) systemHeap->Free(seekTable); seekTable = nullptr; } //--------------------------------------------------------------------------- void PacketFile::atClose(void) { if (isOpen() && fileMode != READ) // update filesize { int32_t endPtr = getLength(); // seek(sizeof(int32_t)); //Move Past Version // Marker writeLong(endPtr); //Write File // length int32_t tableEntry; currentPacket = numPackets; if (!seekTable) { while (--currentPacket >= 0) { seek(TABLE_ENTRY(currentPacket)); tableEntry = readLong(); if (GetPacketType(tableEntry) == STORAGE_TYPE_NUL) { seek(TABLE_ENTRY(currentPacket)); writeLong(SetPacketType(endPtr, STORAGE_TYPE_NUL)); } else { endPtr = GetPacketOffset(tableEntry); } } } else { while (--currentPacket >= 0) { tableEntry = seekTable[currentPacket]; if (GetPacketType(tableEntry) == STORAGE_TYPE_NUL) { seekTable[currentPacket] = SetPacketType(endPtr, STORAGE_TYPE_NUL); } else { endPtr = GetPacketOffset(tableEntry); } } } //----------------------------------------------------- // If seekTable was being used, write it back to file if (seekTable) { seek(sizeof(int32_t) * 2); // File Version & File Length write(uint8_t*(seekTable), (numPackets * sizeof(int32_t))); } //------------------------------------------------------ // Is we were using a checkSum, calc it and write it to // the beginning of the file. if (usesCheckSum) { int32_t checkSum = checkSumFile(); seek(0); writeLong(checkSum); } } clear(); } //--------------------------------------------------------------------------- int32_t PacketFile::checkSumFile(void) { //----------------------------------------- int32_t currentPosition = logicalPosition; seek(4); uint8_t* fileMap = (uint8_t*)malloc(fileSize()); read(fileMap, fileSize()); int32_t sum = 0; uint8_t* curFileByte = fileMap; for (uint32_t i = 4; i < fileSize(); i++, curFileByte++) { sum += *curFileByte; } free(fileMap); seek(currentPosition); return sum; } //--------------------------------------------------------------------------- int32_t PacketFile::afterOpen(void) { if (!numPackets && getLength() >= 12) { int32_t firstPacketOffset; int32_t firstCheck = readLong(); if (firstCheck == PACKET_FILE_VERSION && !usesCheckSum) { } else { //--------------------------------------- // This is probably a checksum. Check it int32_t checkSum = checkSumFile(); if (checkSum != firstCheck) return PACKET_OUT_OF_RANGE; } firstPacketOffset = readLong(); numPackets = (firstPacketOffset / sizeof(int32_t)) - 2; } currentPacket = -1; if (fileMode == READ || fileMode == RDWRITE) { if (numPackets && !seekTable) { seekTable = (int32_t*)systemHeap->Malloc(numPackets * sizeof(int32_t)); gosASSERT(seekTable != nullptr); seek(sizeof(int32_t) * 2); // File Version & File Length read(uint8_t*(seekTable), (numPackets * sizeof(int32_t))); } } return (NO_ERROR); } //--------------------------------------------------------------------------- PacketFile::PacketFile(void) { seekTable = nullptr; usesCheckSum = FALSE; clear(); } //--------------------------------------------------------------------------- PacketFile::~PacketFile(void) { close(); } //--------------------------------------------------------------------------- int32_t PacketFile::open(const std::wstring_view& filename, FileMode _mode, int32_t numChild) { int32_t openResult = MechFile::open(filename, _mode, numChild); if (openResult != NO_ERROR) { return (openResult); } openResult = afterOpen(); return (openResult); } //--------------------------------------------------------------------------- int32_t PacketFile::open(std::unique_ptr<File> _parent, uint32_t fileSize, int32_t numChild) { int32_t result = MechFile::open(_parent, fileSize, numChild); if (result != NO_ERROR) return (result); result = afterOpen(); return (result); } //--------------------------------------------------------------------------- int32_t PacketFile::create(const std::wstring_view& filename) { int32_t openResult = MechFile::create(filename); if (openResult != NO_ERROR) { return (openResult); } openResult = afterOpen(); return (openResult); } int32_t PacketFile::createWithCase(const std::wstring_view& filename) { int32_t openResult = MechFile::createWithCase(filename); if (openResult != NO_ERROR) { return (openResult); } openResult = afterOpen(); return (openResult); } //--------------------------------------------------------------------------- void PacketFile::close(void) { atClose(); MechFile::close(); } //--------------------------------------------------------------------------- int32_t PacketFile::readPacketOffset(int32_t packet, int32_t* lastType) { int32_t offset = -1; if (packet < numPackets) { if (seekTable) offset = seekTable[packet]; if (lastType) *lastType = GetPacketType(offset); offset = GetPacketOffset(offset); } return offset; } //--------------------------------------------------------------------------- int32_t PacketFile::readPacket(int32_t packet, uint8_t* buffer) { int32_t result = 0; if ((packet == -1) || (packet == currentPacket) || (seekPacket(packet) == NO_ERROR)) { if ((getStorageType() == STORAGE_TYPE_RAW) || (getStorageType() == STORAGE_TYPE_FWF)) { seek(packetBase); result = read(buffer, packetSize); } else { switch (getStorageType()) { case STORAGE_TYPE_LZD: { seek(packetBase + sizeof(int32_t)); if (!LZPacketBuffer) { LZPacketBuffer = (uint8_t*)malloc(LZPacketBufferSize); gosASSERT(LZPacketBuffer); } if ((int32_t)LZPacketBufferSize < packetSize) { LZPacketBufferSize = packetSize; free(LZPacketBuffer); LZPacketBuffer = (uint8_t*)malloc(LZPacketBufferSize); gosASSERT(LZPacketBuffer); } if (LZPacketBuffer) { read(LZPacketBuffer, (packetSize - sizeof(int32_t))); int32_t decompLength = LZDecomp(buffer, LZPacketBuffer, packetSize - sizeof(int32_t)); if (decompLength != packetUnpackedSize) result = 0; else result = decompLength; } } break; case STORAGE_TYPE_ZLIB: { seek(packetBase + sizeof(int32_t)); if (!LZPacketBuffer) { LZPacketBuffer = (uint8_t*)malloc(LZPacketBufferSize); gosASSERT(LZPacketBuffer); } if ((int32_t)LZPacketBufferSize < packetSize) { LZPacketBufferSize = packetSize; free(LZPacketBuffer); LZPacketBuffer = (uint8_t*)malloc(LZPacketBufferSize); gosASSERT(LZPacketBuffer); } if (LZPacketBuffer) { read(LZPacketBuffer, (packetSize - sizeof(int32_t))); uint32_t decompLength = LZPacketBufferSize; int32_t decompResult = uncompress( buffer, &decompLength, LZPacketBuffer, packetSize - sizeof(int32_t)); if ((decompResult != Z_OK) || ((int32_t)decompLength != packetUnpackedSize)) result = 0; else result = decompLength; } } break; case STORAGE_TYPE_HF: STOP(("Tried to read a Huffman Compressed Packet. No Longer " "Supported!!")); break; } } } return result; } //--------------------------------------------------------------------------- int32_t PacketFile::readPackedPacket(int32_t packet, uint8_t* buffer) { int32_t result = 0; if ((packet == -1) || (packet == currentPacket) || (seekPacket(packet) == NO_ERROR)) { if ((getStorageType() == STORAGE_TYPE_RAW) || (getStorageType() == STORAGE_TYPE_FWF)) { seek(packetBase); result = read(buffer, packetSize); } else { switch (getStorageType()) { case STORAGE_TYPE_LZD: { seek(packetBase + sizeof(int32_t)); read(buffer, packetSize); } break; case STORAGE_TYPE_ZLIB: { seek(packetBase + sizeof(int32_t)); read(buffer, packetSize); } break; } } } return result; } //--------------------------------------------------------------------------- int32_t PacketFile::seekPacket(int32_t packet) { int32_t offset, next; if (packet < 0) { return (PACKET_OUT_OF_RANGE); } offset = readPacketOffset(packet, &packetType); currentPacket = packet++; if (packet == numPackets) next = getLength(); else next = readPacketOffset(packet); packetSize = next - offset; packetBase = offset; // seek to beginning of packet seek(packetBase); switch (getStorageType()) { case STORAGE_TYPE_LZD: // the first uint32_t of a compressed packet is the unpacked length packetUnpackedSize = readLong(); break; case STORAGE_TYPE_ZLIB: // the first uint32_t of a compressed packet is the unpacked length packetUnpackedSize = readLong(); break; case STORAGE_TYPE_RAW: packetUnpackedSize = packetSize; break; case STORAGE_TYPE_NUL: packetUnpackedSize = 0; break; default: return (BAD_PACKET_VERSION); } if (offset > 0) return (NO_ERROR); return (PACKET_OUT_OF_RANGE); } //--------------------------------------------------------------------------- void PacketFile::operator++(void) { if (++currentPacket >= numPackets) { currentPacket = numPackets - 1; } seekPacket(currentPacket); } //--------------------------------------------------------------------------- void PacketFile::operator--(void) { if (currentPacket-- <= 0) { currentPacket = 0; } seekPacket(currentPacket); } //--------------------------------------------------------------------------- int32_t PacketFile::getNumPackets(void) { return numPackets; } //--------------------------------------------------------------------------- int32_t PacketFile::getCurrentPacket(void) { return currentPacket; } //--------------------------------------------------------------------------- inline int32_t PacketFile::getPacketOffset(void) { return packetBase; } //--------------------------------------------------------------------------- int32_t PacketFile::getPackedPacketSize(void) { return packetSize; } //--------------------------------------------------------------------------- int32_t PacketFile::getStorageType(void) { return packetType; } //--------------------------------------------------------------------------- void PacketFile::reserve(int32_t count, bool useCheckSum) { //--------------------------------------------------- // If we already have packets, reserve does nothing. // Otherwise, reserve sets up the file. Must be // called before any writing to a newly created file. if (numPackets) { return; } usesCheckSum = useCheckSum; numPackets = count; int32_t firstPacketOffset = TABLE_ENTRY(numPackets); writeLong(PACKET_FILE_VERSION); writeLong(firstPacketOffset); //---------------------------- // initialize the seek table while (count-- > 0) writeLong(SetPacketType(firstPacketOffset, STORAGE_TYPE_NUL)); //------------------------------------------------------------- // If we called this, chances are we are writing a packet file // from start to finish. It is MUCH faster if this table is // updated in memory and flushed when the file is closed. if (!seekTable) { seekTable = (int32_t*)systemHeap->Malloc(numPackets * sizeof(int32_t)); if (seekTable != nullptr) { seek(sizeof(int32_t) * 2); // File Version & File Length read(uint8_t*(seekTable), (numPackets * sizeof(int32_t))); } } } //--------------------------------------------------------------------------- int32_t PacketFile::writePacket(int32_t packet, uint8_t* buffer, int32_t nbytes, uint8_t pType) { //-------------------------------------------------------- // This function writes the packet to the current end // of file and stores the packet address in the seek // table. NOTE that this cannot be used to replace // a packet. That function is writePacket which takes // a packet number and a buffer. The size cannot change // and, as such, is irrelevant. You must write the // same sized packet each time, if the packet already // exists. In theory, it could be smaller but the check // right now doesn't allow anything but same size. int32_t result = 0; uint8_t* workBuffer = nullptr; if (pType == ANY_PACKET_TYPE || pType == STORAGE_TYPE_LZD || pType == STORAGE_TYPE_ZLIB) { if ((nbytes << 1) < 4096) workBuffer = (uint8_t*)malloc(4096); else workBuffer = (uint8_t*)malloc(nbytes << 1); gosASSERT(workBuffer != nullptr); } gosASSERT((packet > 0) || (packet < numPackets)); packetBase = getLength(); currentPacket = packet; packetSize = packetUnpackedSize = nbytes; //----------------------------------------------- // Code goes in here to pick the best compressed // version of the packet. Otherwise, default // to RAW. if ((pType == ANY_PACKET_TYPE) || (pType == STORAGE_TYPE_LZD) || (pType == STORAGE_TYPE_ZLIB)) { if (pType == ANY_PACKET_TYPE) pType = STORAGE_TYPE_RAW; //----------------------------- // Find best compression here. // This USED to use LZ. Use ZLib from now on. // Game will ALWAYS be able to READ LZ Packets!! uint32_t actualSize = nbytes << 1; if (actualSize < 4096) actualSize = 4096; uint32_t workBufferSize = actualSize; uint32_t oldBufferSize = nbytes; int32_t compressedResult = compress2(workBuffer, &workBufferSize, buffer, nbytes, Z_DEFAULT_COMPRESSION); if (compressedResult != Z_OK) STOP(("Unable to write packet %d to file %s. Error %d", packet, m_fileName, compressedResult)); compressedResult = uncompress(buffer, &oldBufferSize, workBuffer, nbytes); if ((int32_t)oldBufferSize != nbytes) STOP(( "Packet size changed after compression. Was %d is now %d", nbytes, oldBufferSize)); if ((pType == STORAGE_TYPE_LZD) || (pType == STORAGE_TYPE_ZLIB) || ((int32_t)workBufferSize < nbytes)) { pType = STORAGE_TYPE_ZLIB; packetSize = workBufferSize; } } packetType = pType; seek(packetBase); if (packetType == STORAGE_TYPE_ZLIB) { writeLong(packetUnpackedSize); result = write(workBuffer, packetSize); } else { result = write(buffer, packetSize); } if (!seekTable) { seek(TABLE_ENTRY(packet)); writeLong(SetPacketType(packetBase, packetType)); } else { seekTable[packet] = SetPacketType(packetBase, packetType); } int32_t* currentEntry = nullptr; if (seekTable) { packet++; currentEntry = &(seekTable[packet]); } int32_t tableData = SetPacketType(getLength(), STORAGE_TYPE_NUL); while (packet < (numPackets - 1)) { if (!seekTable) { writeLong(tableData); } else { *currentEntry = tableData; currentEntry++; } packet++; } if (workBuffer) free(workBuffer); return result; } #define DEFAULT_MAX_PACKET 65535 //--------------------------------------------------------------------------- int32_t PacketFile::insertPacket(int32_t packet, uint8_t* buffer, int32_t nbytes, uint8_t pType) { //-------------------------------------------------------- // This function writes the packet to the current end // of file and stores the packet address in the seek // table. Originally, replace was a NONO. No, we check // for the size and, if it is different, insert the new // packet into a new file and basically spend many timeparts doing it. // Necessary for the teditor. // I Love it. int32_t result = 0; if (packet < 0) { return result; } //--------------------------------------------------------------- // Only used here, so OK if regular WINDOWS(tm) malloc! uint8_t* workBuffer = (uint8_t*)malloc(DEFAULT_MAX_PACKET); //------------------------------------------------------------- // All new code here. Basically, open a new packet file, // write each of the old packets and this new one. Close all // and copy the new one over the old one. Open the new one and // set pointers accordingly. PacketFile tmpFile; result = tmpFile.create("AF3456AF.788"); if (packet >= numPackets) { numPackets++; } tmpFile.reserve(numPackets); for (size_t i = 0; i < numPackets; i++) { if (i == packet) { if (nbytes >= DEFAULT_MAX_PACKET) { //---------------------------------------------------- // Not sure what to do here. We'll try reallocating ::free(workBuffer); workBuffer = (uint8_t*)malloc(packetSize); } tmpFile.writePacket(i, buffer, nbytes, pType); } else { seekPacket(i); int32_t storageType = getStorageType(); int32_t packetSize = getPacketSize(); if (packetSize >= DEFAULT_MAX_PACKET) { //---------------------------------------------------- // Not sure what to do here. We'll try reallocating ::free(workBuffer); workBuffer = (uint8_t*)malloc(packetSize); } readPacket(i, workBuffer); tmpFile.writePacket(i, workBuffer, packetSize, storageType); } } //------------------------------------ // Now close and reassign everything. wchar_t ourFileName[250]; int32_t ourFileMode = 0; strcpy(ourFileName, m_fileName); ourFileMode = fileMode; tmpFile.close(); close(); remove(ourFileName); rename("AF3456AF.788", ourFileName); remove("AF3456AF.788"); open(ourFileName, (FileMode)ourFileMode); seekPacket(packet); return result; } //--------------------------------------------------------------------------- int32_t PacketFile::writePacket(int32_t packet, uint8_t* buffer) { //-------------------------------------------------------- // This function replaces the packet with the contents // of buffer. There are two restrictions. The first is // that the packet must be the same length as the existing // packet. If not, buffer over/under run will occur. // The second is that the packet cannot be compressed since // there is no gaurantee that the new data will compress // to exactly the same length. Returns NO_ERROR if packet // written successfully. Otherwise returns error. int32_t result = 0; if ((packet < 0) || (packet >= numPackets)) { return 0; } seekPacket(packet); if (packetType == STORAGE_TYPE_LZD || packetType == STORAGE_TYPE_HF || packetType == STORAGE_TYPE_ZLIB) { return (PACKET_WRONG_SIZE); } else { result = write(buffer, packetSize); } if (result == packetUnpackedSize) { return (NO_ERROR); } return BAD_WRITE_ERR; }
26.699862
104
0.573249
mechasource
532ca3c95bed76e5f1dd034d35ae7dc6cc562e24
1,469
cpp
C++
Sorting/quick-sort.cpp
divyanshu013/algorithm-journey
8dc32daa732f16099da148bb8669778d4ef3172a
[ "MIT" ]
null
null
null
Sorting/quick-sort.cpp
divyanshu013/algorithm-journey
8dc32daa732f16099da148bb8669778d4ef3172a
[ "MIT" ]
null
null
null
Sorting/quick-sort.cpp
divyanshu013/algorithm-journey
8dc32daa732f16099da148bb8669778d4ef3172a
[ "MIT" ]
null
null
null
/******************************************************************************* Quick sort ========== Ref - http://quiz.geeksforgeeks.org/quick-sort/ -------------------------------------------------------------------------------- Problem ======= Classic old quick sort. -------------------------------------------------------------------------------- Time Complexity =============== O(nlogn) -------------------------------------------------------------------------------- Output ====== Array is initially: 64 34 25 12 22 11 90 After quick sort, array is: 11 12 22 25 34 64 90 *******************************************************************************/ #include <stdio.h> void printArray(int arr[], int n) { for(int i = 0; i < n; ++i) printf("%d ", arr[i]); printf("\n"); } void swap(int *p, int *q) { int temp = *p; *p = *q; *q = temp; } int partition(int arr[], int l, int r) { int pivot = arr[r]; int i = l; for (int j = l; j < r; j++) { if (arr[j] <= pivot) { swap(&arr[i++], &arr[j]); } } swap(&arr[i], &arr[r]); return i; } void quickSort(int arr[], int l, int r) { if (l < r) { int p = partition(arr, l, r); quickSort(arr, l, p - 1); quickSort(arr, p + 1, r); } } int main() { int arr[] = {64, 34, 25, 12, 22, 11, 90}; printf("Array is initially:\n"); printArray(arr, 7); printf("After quick sort, array is:\n"); quickSort(arr, 0, 6); printArray(arr, 7); return 0; }
19.586667
80
0.381892
divyanshu013
5331499b9235c169f20b8d531761c180854084f5
8,705
cpp
C++
src/libgeo/si.cpp
transpixel/TPQZcam
b44a97d44b49e9aa76c36efb6e4102091ff36c67
[ "MIT" ]
1
2017-06-01T00:21:16.000Z
2017-06-01T00:21:16.000Z
src/libgeo/si.cpp
transpixel/TPQZcam
b44a97d44b49e9aa76c36efb6e4102091ff36c67
[ "MIT" ]
3
2017-06-01T00:26:16.000Z
2020-05-09T21:06:27.000Z
libgeo/si.cpp
transpixel/tpqz
2d8400b1be03292d0c5ab74710b87e798ae6c52c
[ "MIT" ]
null
null
null
// // // MIT License // // Copyright (c) 2020 Stellacore Corporation. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject // to the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY // KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // /*! \file \brief Definitions for geo::si */ #include "libgeo/si.h" #include "libdat/info.h" #include "libla/eigen.h" #include "libmath/math.h" #include <algorithm> #include <sstream> namespace geo { namespace si { ga::Vector SemiAxis :: asVector () const { return { theMag * theDir }; } std::string SemiAxis :: infoString ( std::string const & title ) const { std::ostringstream oss; if (! title.empty()) { oss << title << " "; } oss << "Mag: " << dat::infoString(theMag); oss << " "; oss << "Dir: " << dat::infoString(theDir); return oss.str(); } SemiAxis PointSoln :: kthLargestSemiAxis ( size_t const & ndx ) const { SemiAxis axis{}; if (ndx < theSemiAxes.size()) { size_t const last{ theSemiAxes.size() - 1u }; size_t const kthNdx{ last - ndx }; axis = theSemiAxes[kthNdx]; } return axis; } double PointSoln :: rmsAxisMagnitude () const { double rms{ dat::nullValue<double>() }; double sumSqs{ 0. }; double count{ 0. }; for (size_t kk{0u} ; kk < 3u ; ++kk) { double const & mag = theSemiAxes[kk].theMag; if (dat::isValid(mag)) { sumSqs += math::sq(mag); count += 1.; } } if (0. < count) { rms = std::sqrt(sumSqs / count); } return rms; } std::vector<ga::Vector> PointSoln :: ellipsoidTips () const { ga::Vector const & mid = theLoc; return std::vector<ga::Vector> { mid + theSemiAxes[0].asVector() , mid - theSemiAxes[0].asVector() , mid + theSemiAxes[1].asVector() , mid - theSemiAxes[1].asVector() , mid + theSemiAxes[2].asVector() , mid - theSemiAxes[2].asVector() }; } std::string PointSoln :: infoString ( std::string const & title ) const { std::ostringstream oss; if (! title.empty()) { oss << title << std::endl; } oss << dat::infoString(theLoc, "theLoc"); oss << std::endl; oss << dat::infoString(theSemiAxes[0], "EllipA"); oss << std::endl; oss << dat::infoString(theSemiAxes[1], "EllipB"); oss << std::endl; oss << dat::infoString(theSemiAxes[2], "EllipC"); return oss.str(); } PointSystem :: PointSystem () : theNormCo{} , theNormRhs{} , theNumRays{ 0u } , theNumPlanes{ 0u } { std::fill(std::begin(theNormCo), std::end(theNormCo), 0.); std::fill(std::begin(theNormRhs), std::end(theNormRhs), 0.); } void PointSystem :: addWeightedRays ( std::vector<WRay> const & wrays ) { for (WRay const & wray : wrays) { addWeightedRay(wray); /* double const weightSq{ math::sq(wray.first) }; geo::Ray const & ray = wray.second; Dyadic const obsDyadic{ rayDyadicFor(ray.theDir) }; addWeightedDyadic(weightSq, obsDyadic); addWeightedRhs(weightSq, obsDyadic, ray.theStart); ++theNumRays; */ } } void PointSystem :: addWeightedPlanes ( std::vector<WPlane> const & wplanes ) { for (WPlane const & wplane : wplanes) { addWeightedPlane(wplane); /* double const weightSq{ math::sq(wplane.first) }; geo::Plane const & plane = wplane.second; Dyadic const obsDyadic{ planeDyadicFor(plane.unitNormal()) }; addWeightedDyadic(weightSq, obsDyadic); addWeightedRhs(weightSq, obsDyadic, plane.origin()); ++theNumPlanes; */ } } namespace { //! Extract ellipsoid axes from SVD decomposition of normal matrix inline std::array<SemiAxis, 3u> inverseEllipsoidFrom ( Eigen::BDCSVD<la::eigen::Matrix_t<double> > const & svd ) { // NOTE: Eigen return sVals sorted in decreasing order la::eigen::Matrix_t<double> const vecS{ svd.singularValues() }; la::eigen::Matrix_t<double> const matV{ svd.matrixU() }; // weights are eigenValues which are sqrt(SingularValues) std::array<double, 3u> const wVals { std::sqrt(vecS(0, 0)) , std::sqrt(vecS(1, 0)) , std::sqrt(vecS(2, 0)) }; /* io::out() << "======" << '\n'; io::out() << "matU:\n" << svd.matrixU() << '\n'; io::out() << "vecS:\n" << vecS << '\n'; io::out() << "wVal:" << dat::infoString(wVals) << '\n'; io::out() << "matV:\n" << svd.matrixV() << '\n'; io::out() << "======" << '\n'; */ // eigen vectors are columns of 'V' matrix ga::Vector const eVec0{ matV(0, 0), matV(1, 0), matV(2, 0) }; ga::Vector const eVec1{ matV(0, 1), matV(1, 1), matV(2, 1) }; ga::Vector const eVec2{ matV(0, 2), matV(1, 2), matV(2, 2) }; // return as inverse ellipsoid return { SemiAxis{ wVals[0], eVec0 } , SemiAxis{ wVals[1], eVec1 } , SemiAxis{ wVals[2], eVec2 } }; } //! Inverse of each axis std::array<SemiAxis, 3u> standardEllipsoid ( Eigen::BDCSVD<la::eigen::Matrix_t<double> > const & svd ) { std::array<SemiAxis, 3u> invAxes; std::array<SemiAxis, 3u> const fwdAxes{ inverseEllipsoidFrom(svd) }; size_t const numAxes{ fwdAxes.size() }; for (size_t kk{0u} ; kk < numAxes ; ++kk) { SemiAxis const & fwdAxis = fwdAxes[kk]; double const & wSqMag = fwdAxis.theMag; ga::Vector const & dir = fwdAxis.theDir; double invSqMag{ dat::nullValue<double>() }; if (math::eps < wSqMag) { invSqMag = 1. / wSqMag; } invAxes[kk] = SemiAxis{ invSqMag, dir }; } return invAxes; } //! Solve point location and uncertainty ellipsoid using SVD PointSoln pointSolnSVD ( Dyadic const & normCo , RhsVec const & normRhs ) { // Interpret input structures as Eigen data la::eigen::ConstMap<double> const coMat (normCo.begin(), 3u, 3u); la::eigen::ConstMap<double> const rhsMat (normRhs.begin(), normRhs.size(), 1u); // allocate output solution space std::array<double, 3u> soln{ dat::nullValue<double>() }; la::eigen::WriteMap<double> solnOut(soln.begin(), soln.size(), 1u); // construct SVD auto const eFlags{ Eigen::ComputeThinU + Eigen::ComputeThinV }; Eigen::BDCSVD<la::eigen::Matrix_t<double> > const svd(coMat, eFlags); // use SVD to solve system solnOut = svd.solve(rhsMat); // extract uncertainties std::array<SemiAxis, 3u> const covarAxes{ standardEllipsoid(svd) }; // pack results into PointSoln ga::Vector const pntLoc{ soln[0], soln[1], soln[2] }; return PointSoln{ pntLoc, covarAxes }; } } // [annon] PointSoln PointSystem :: pointSolution () const { PointSoln const tmp{ pointSolnSVD(theNormCo, theNormRhs) }; // adjust for statistical degrees of freedom (on average) // unclear if required constexpr double scale{ 1. }; /* double const domPlanes{ 1. * (double)theNumPlanes }; double const domRays{ 2. * (double)theNumRays }; double const dofPoint{ 3. }; double const redundancy{ domRays + domPlanes - dofPoint }; double scale{ dat::nullValue<double>() }; if (0. < redundancy) { scale = 1. / redundancy; } if (0. == redundancy) { scale = 1.; } io::out() << dat::infoString(domPlanes, "domPlanes") << '\n'; io::out() << dat::infoString(domRays, "domRays") << '\n'; io::out() << dat::infoString(dofPoint, "dofPoint") << '\n'; io::out() << dat::infoString(redundancy, "redundancy") << '\n'; io::out() << dat::infoString(scale, "scale") << '\n'; */ // adjust axes magnitudes for return values std::array<SemiAxis, 3u> const & tmpAxes = tmp.theSemiAxes; std::array<SemiAxis, 3u> const stdEllipAxes { SemiAxis{ scale*tmpAxes[0].theMag, tmpAxes[0].theDir } , SemiAxis{ scale*tmpAxes[1].theMag, tmpAxes[1].theDir } , SemiAxis{ scale*tmpAxes[2].theMag, tmpAxes[2].theDir } }; return PointSoln{ tmp.theLoc, stdEllipAxes }; } std::string PointSystem :: infoString ( std::string const & title ) const { std::ostringstream oss; if (! title.empty()) { oss << title << std::endl; } oss << priv::infoMatrix(theNormCo.begin(), "theNormCo", 3u); oss << std::endl; oss << priv::infoMatrix(theNormRhs.begin(), "theNormRhs", 1u); return oss.str(); } } // si } // geo
24.383754
72
0.653418
transpixel
533701c4844948c192103c881ae49b407fc972ec
2,805
cpp
C++
src/nietacka/event/GameEvent.cpp
PiotrJander/sik-achtung-die-kurve
a44af3b20e5baccd18d388a0a29f412a2c5e5902
[ "MIT" ]
null
null
null
src/nietacka/event/GameEvent.cpp
PiotrJander/sik-achtung-die-kurve
a44af3b20e5baccd18d388a0a29f412a2c5e5902
[ "MIT" ]
null
null
null
src/nietacka/event/GameEvent.cpp
PiotrJander/sik-achtung-die-kurve
a44af3b20e5baccd18d388a0a29f412a2c5e5902
[ "MIT" ]
null
null
null
// // Created by Piotr Jander on 22/08/2017. // #include <sstream> #include "GameEvent.h" #include "../crc32c.h" #include "PixelEvent.h" #include "PlayerEliminatedEvent.h" #include "GameOverEvent.h" #include "NewGameEvent.h" #include "../Exceptions.h" std::unique_ptr<GameEvent> GameEvent::read(ReadBuffer &readBuffer) { try { uint32_t length, expectedChecksum; readBuffer >> length; length = ntohl(length); const char *startOfEvent = readBuffer.peek(); auto event = readSelf(readBuffer, length); if (length != event->selfLength()) { throw ParseException("Event length mismatch"); } readBuffer >> expectedChecksum; expectedChecksum = ntohl(expectedChecksum); uint32_t actualChecksum = crc32c(0, reinterpret_cast<const unsigned char *>(startOfEvent), length); // if (expectedChecksum != actualChecksum) { // throw ParseException("Bad checksum"); // } return event; } catch (ReadBufferException &e) { throw ParseException("Trying to read past the buffer"); } } std::unique_ptr<GameEvent> GameEvent::readSelf(ReadBuffer &readBuffer, int length) { const HeaderPacked *header = reinterpret_cast<const HeaderPacked *>(readBuffer.peek()); switch (header->type) { case Type::NEW_GAME: { auto packedNoPlayerNames = readBuffer.castAndAdvance<NewGameEvent::SelfPackedNoPlayerNames>(); std::vector<std::string> names; int len = length - sizeof(NewGameEvent::SelfPackedNoPlayerNames); while (len) { std::string name = readBuffer.readString(len); len -= name.size() + 1; names.emplace_back(move(name)); } return std::make_unique<NewGameEvent>(*packedNoPlayerNames, names); } case Type::PIXEL: { return std::make_unique<PixelEvent>(*readBuffer.castAndAdvance<PixelEvent::SelfPacked>()); } case Type::PLAYER_ELIMINATED: { return std::make_unique<PlayerEliminatedEvent>(*readBuffer.castAndAdvance<PlayerEliminatedEvent::SelfPacked>()); } case Type::GAME_OVER: { return std::make_unique<GameOverEvent>(*readBuffer.castAndAdvance<HeaderPacked>()); } } } bool GameEvent::operator==(const GameEvent &other) const { return other.getEventNo() == getEventNo() && other.getType() == getType(); } void GameEvent::write(DynamicBuffer &buffer) { uint32_t length = selfLength(); buffer << htonl(length); const char *start = buffer.currentLocation(); writeSelf(buffer); uint32_t checksum = crc32c(0, (const unsigned char *) start, length); buffer << htonl(checksum); }
31.875
124
0.630303
PiotrJander
53376b589d20ca7205de812d1662d4199954e404
3,758
cpp
C++
src/atlas_fusion/src/algorithms/pointcloud/PointCloudExtrapolator.cpp
Robotics-BUT/Atlas-Fusion
3237f65d84a2686c5a20b89def4b706d89744ffb
[ "MIT" ]
15
2020-10-27T01:38:05.000Z
2021-09-21T07:27:01.000Z
src/atlas_fusion/src/algorithms/pointcloud/PointCloudExtrapolator.cpp
Robotics-BUT/Atlas-Fusion
3237f65d84a2686c5a20b89def4b706d89744ffb
[ "MIT" ]
2
2021-06-02T11:54:38.000Z
2021-10-05T13:05:29.000Z
src/atlas_fusion/src/algorithms/pointcloud/PointCloudExtrapolator.cpp
Robotics-BUT/Atlas-Fusion
3237f65d84a2686c5a20b89def4b706d89744ffb
[ "MIT" ]
4
2021-04-10T09:12:47.000Z
2021-04-27T15:33:27.000Z
/* * Copyright 2020 Brno University of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "algorithms/pointcloud/PointCloudExtrapolator.h" #include "local_map/Frames.h" namespace AtlasFusion::Algorithms { std::vector<std::shared_ptr<DataModels::PointCloudBatch>> PointCloudExtrapolator::splitPointCloudToBatches( std::shared_ptr<pcl::PointCloud<pcl::PointXYZ>> scan, DataModels::LocalPosition startPose, DataModels::LocalPosition poseDiff, rtl::RigidTf3D<double> sensorOffsetTf) { std::vector<std::shared_ptr<DataModels::PointCloudBatch>> output; auto singleBatchSize = static_cast<size_t>(std::ceil(static_cast<float>(scan->width) / noOfBatches_)); auto timeOffset = startPose.getTimestamp(); auto duration = poseDiff.getTimestamp(); DataModels::LocalPosition endPose {startPose.getPosition() + poseDiff.getPosition(), startPose.getOrientation() * poseDiff.getOrientation(), startPose.getTimestamp() + poseDiff.getTimestamp()}; size_t pointCnt = 0; for(size_t i = 0 ; i < noOfBatches_ ; i++) { double ratio = static_cast<double>(i) / noOfBatches_; auto pose = AtlasFusion::DataModels::LocalPosition { {poseDiff.getPosition().x() * (ratio), poseDiff.getPosition().y() * (ratio), poseDiff.getPosition().z() * (ratio)}, {poseDiff.getOrientation().slerp(rtl::Quaternion<double>::identity(), (float)(1-ratio))}, uint64_t(duration * (ratio)) }; rtl::RigidTf3D<double> movementCompensationTF{pose.getOrientation(), pose.getPosition()}; uint64_t ts = timeOffset + static_cast<uint64_t>(ratio * duration); pcl::PointCloud<pcl::PointXYZ> points; points.reserve(singleBatchSize); // TODO: Avoid point copying for(size_t j = 0 ; j < singleBatchSize ; j++) { if(pointCnt < scan->width) { points.push_back(scan->at(pointCnt++)); } } rtl::RigidTf3D<double> toGlobelFrameTf{endPose.getOrientation(), endPose.getPosition()}; rtl::RigidTf3D<double> startToEndTf{poseDiff.getOrientation(), poseDiff.getPosition()}; auto finalTF = toGlobelFrameTf(startToEndTf.inverted()(movementCompensationTF(sensorOffsetTf))); // TODO: Avoid point copying auto batch = std::make_shared<DataModels::PointCloudBatch>(ts, points, LocalMap::Frames::kOrigin, finalTF); output.push_back(batch); } return output; } }
47.56962
135
0.659393
Robotics-BUT
5338331888132a1f22692026f400c0bfa1f21d34
7,298
cpp
C++
lower_app/source/ApplicationThread.cpp
Imx6ull-app/remote_manage
509afcb900f485b809f1008393cdc0cbafcda441
[ "Apache-2.0" ]
5
2020-08-06T16:35:22.000Z
2021-07-06T13:33:15.000Z
lower_app/source/ApplicationThread.cpp
Imx6ull-app/remote_manage
509afcb900f485b809f1008393cdc0cbafcda441
[ "Apache-2.0" ]
null
null
null
lower_app/source/ApplicationThread.cpp
Imx6ull-app/remote_manage
509afcb900f485b809f1008393cdc0cbafcda441
[ "Apache-2.0" ]
6
2020-08-25T04:59:30.000Z
2022-03-04T08:56:49.000Z
/* * File : app_task.cpp * appliction task * COPYRIGHT (C) 2020, zc * * Change Logs: * Date Author Notes * 2020-5-12 zc the first version * 2020-5-20 zc Code standardization */ /** * @addtogroup IMX6ULL */ /*@{*/ #include "../driver/Led.h" #include "../driver/Beep.h" #include "../include/ApplicationThread.h" /************************************************************************** * Local Macro Definition ***************************************************************************/ /************************************************************************** * Local Type Definition ***************************************************************************/ /************************************************************************** * Local static Variable Declaration ***************************************************************************/ /************************************************************************** * Global Variable Declaration ***************************************************************************/ CApplicationReg *pApplicationReg; /************************************************************************** * Function ***************************************************************************/ void *ApplicationLoopTask(void *arg); /** * 内部数据构造函数 * * @param NULL * * @return NULL */ CApplicationReg::CApplicationReg(void) { /*清除内部寄存状态*/ memset((char *)m_RegVal, 0, REG_NUM); if(pthread_mutex_init(&m_RegMutex, NULL) != 0) { printf("mutex init failed\n"); } } /** * 内部数据析构函数 * * @param NULL * * @return NULL */ CApplicationReg::~CApplicationReg() { pthread_mutex_destroy(&m_RegMutex); } /** * 获取内部寄存器变量的值 * * @param nRegIndex 待读取寄存器的起始地址 * @param nRegSize 读取的寄存器的数量 * @param pDataStart 放置读取数据的首地址 * * @return 读取寄存器的数量 */ uint16_t CApplicationReg::GetMultipleReg(uint16_t nRegIndex, uint16_t nRegSize, uint8_t *pDataStart) { uint16_t nIndex; if(nRegSize > REG_NUM) nRegSize = REG_NUM; pthread_mutex_lock(&m_RegMutex); for(nIndex=0; nIndex<nRegSize; nIndex++) { *(pDataStart+nIndex) = m_RegVal[nRegIndex+nIndex]; } pthread_mutex_unlock(&m_RegMutex); #if __SYSTEM_DEBUG printf("get array:"); SystemLogArray(m_RegVal, nRegSize); #endif return nRegSize; } /** * 设置数据到内部寄存器 * * @param nRegIndex 设置寄存器的起始地址 * @param nRegSize 设置的寄存器的数量 * @param pDataStart 放置设置数据的首地址 * * @return NULL */ void CApplicationReg::SetMultipleReg(uint16_t nRegIndex, uint16_t nRegSize, uint8_t *pDataStart) { uint16_t nIndex, nEndIndex; nEndIndex = nRegIndex+nRegSize; if(nEndIndex>REG_NUM) nEndIndex = REG_NUM; pthread_mutex_lock(&m_RegMutex); for(nIndex=nRegIndex; nIndex<nEndIndex; nIndex++) { m_RegVal[nIndex] = *(pDataStart+nIndex); } pthread_mutex_unlock(&m_RegMutex); #if __SYSTEM_DEBUG printf("set array:"); SystemLogArray(m_RegVal, nRegSize); #endif } /** * 判断数据是否变化后修改数据,变化了表明了其它线程修改了指令 * * @param nRegIndex 寄存器的起始地址 * @param nRegSize 读取的寄存器的数量 * @param pDataStart 设置数据的地址 * @param psrc 缓存的原始寄存器数据 * * @return NULL */ int CApplicationReg::DiffSetMultipleReg(uint16_t nRegIndex, uint16_t nRegSize, uint8_t *pDataStart, uint8_t *pDataCompare) { uint16_t nIndex, nEndRegIndex; nEndRegIndex = nRegIndex+nRegSize; if(nEndRegIndex>REG_NUM) nEndRegIndex = REG_NUM; pthread_mutex_lock(&m_RegMutex); if(memcmp((char *)&m_RegVal[nRegIndex], pDataCompare, nRegSize) != 0) { pthread_mutex_unlock(&m_RegMutex); return RT_FAIL; } for(nIndex=nRegIndex; nIndex<nEndRegIndex; nIndex++) { m_RegVal[nIndex] = *(pDataStart+nIndex); } pthread_mutex_unlock(&m_RegMutex); #if __SYSTEM_DEBUG printf("diff array:"); SystemLogArray(m_RegVal, nRegSize); #endif return RT_OK; } /** * 根据寄存器更新内部硬件参数 * * @param NULL * * @return NULL */ int CApplicationReg::RefreshAllDevice(void) { uint8_t *pRegVal; uint8_t *pRegCacheVal; uint8_t nRegModifyFlag; //Reg修改状态 uint16_t nRegConfigStatus; //Reg配置状态 pRegVal = (uint8_t *)malloc(REG_CONFIG_NUM); pRegCacheVal = (uint8_t *)malloc(REG_CONFIG_NUM); nRegModifyFlag = 0; if(pRegVal != NULL && pRegCacheVal != NULL) { /*读取所有的寄存值并复制到缓存中*/ GetMultipleReg(0, REG_CONFIG_NUM, pRegVal); memcpy(pRegCacheVal, pRegVal, REG_CONFIG_NUM); /*有设置消息*/ nRegConfigStatus = pRegVal[1] <<8 | pRegVal[0]; if(nRegConfigStatus&0x01) { /*LED设置处理*/ for(uint8_t nIndex = 1; nIndex<16; nIndex++) { uint16_t device_cmd = nRegConfigStatus>>nIndex; if(device_cmd == 0) { break; } else if((device_cmd&0x01) != 0) { switch(nIndex) { case DEVICE_LED0: LedStatusConvert(pRegVal[2]&0x01); break; case DEVICE_BEEP: BeepStatusConvert((pRegVal[2]>>1)&0x01); break; case DEVICE_REBOOT: system("reboot"); while(1){ USR_DEBUG("wait for reboot\r\n"); sleep(1); } break; default: break; } } } pRegVal[0] = 0; pRegVal[1] = 0; nRegModifyFlag = 1; } /*更新寄存器状态*/ if(nRegModifyFlag == 1){ if(DiffSetMultipleReg(0, REG_CONFIG_NUM, pRegVal, pRegCacheVal) == RT_OK){ nRegModifyFlag = 0; } else { free(pRegVal); free(pRegCacheVal); USR_DEBUG("modify by other interface\n"); return RT_FAIL; } } free(pRegVal); free(pRegCacheVal); } else{ USR_DEBUG("malloc error\n"); } return RT_OK; } /** * 获取寄存器数据结构体指针 * * @param NULL * * @return 返回寄存器的信息 */ CApplicationReg *GetApplicationReg(void) { return pApplicationReg; } /** * 设置寄存器结构体指针 * * @param NULL * * @return 返回寄存器的信息 */ void SetApplicationReg(CApplicationReg *pAppReg) { pApplicationReg = pAppReg; } /** * app模块任务初始化 * * @param NULL * * @return NULL */ void ApplicationThreadInit(void) { pthread_t tid1; int nErr; pApplicationReg = new CApplicationReg(); nErr = pthread_create(&tid1, NULL, ApplicationLoopTask, NULL); if(nErr != 0){ USR_DEBUG("app task thread create nErr, %d\n", nErr); } } /** * app模块初始化 * * @param arg 线程传递的参数 * * @return NULL */ void *ApplicationLoopTask(void *arg) { USR_DEBUG("app Task Start\n"); for(;;){ if(pApplicationReg->RefreshAllDevice() == RT_OK){ usleep(800); //指令处理完休眠,非RT_OK表示仍有指令需要处理 } } }
23.391026
122
0.503837
Imx6ull-app
533c6c1de3ba67d0a7fae0c73bcef8affb5a48fe
499
cpp
C++
74_Meta/src/Main.cpp
jonixis/CPP18
0dfe165f22a3cbef9e8cda102196d53d3e120e57
[ "MIT" ]
null
null
null
74_Meta/src/Main.cpp
jonixis/CPP18
0dfe165f22a3cbef9e8cda102196d53d3e120e57
[ "MIT" ]
null
null
null
74_Meta/src/Main.cpp
jonixis/CPP18
0dfe165f22a3cbef9e8cda102196d53d3e120e57
[ "MIT" ]
null
null
null
#include "Fibonacci.h" #include "Euclid.h" #include <iostream> int main(int argc, char const *argv[]) { int resFib = fibonacci<10>::res; int resGCD = euclid<1071, 462>::res; int resFibConst = fibonacciConst(10); int resGCDConst = euclidConst(1071, 462); std::cout << "Fibonacci: " << resFib << std::endl; std::cout << "Euclid: " << resGCD << std::endl; std::cout << "FibonacciConst: " << resFibConst << std::endl; std::cout << "EuclidConst: " << resGCDConst << std::endl; return 0; }
23.761905
61
0.641283
jonixis
53407e87f88b3041243c068815a24f8ea9304667
35,426
cpp
C++
attacker/SSL/MeituanPatch.cpp
satadriver/attacker
24e4434d8a836e040e48df195f2ca8919ab52609
[ "Apache-2.0" ]
null
null
null
attacker/SSL/MeituanPatch.cpp
satadriver/attacker
24e4434d8a836e040e48df195f2ca8919ab52609
[ "Apache-2.0" ]
null
null
null
attacker/SSL/MeituanPatch.cpp
satadriver/attacker
24e4434d8a836e040e48df195f2ca8919ab52609
[ "Apache-2.0" ]
1
2022-03-20T03:21:00.000Z
2022-03-20T03:21:00.000Z
#include "MeituanPatch.h" #include "letvPlugin.h" #include "../HttpUtils.h" #include "../cipher/CryptoUtils.h" #include "../Public.h" #include "sslPublic.h" int MeiTuanPatch::isMeiTuan(string url, string host) { if (host.find("api.meituan.com") != -1 && url.find("/appupdate/patch/list?") != -1) { return TRUE; } return FALSE; } int MeiTuanPatch::replyMeiTuan(char * dstbuf, int buflen, int buflimit, string username) { char * szHttpFormat = "HTTP/1.1 200 OK\r\n" "Content-Type: application/json;charset=utf-8\r\n" "Content-Length: %u\r\n" "Connection: keep-alive\r\n\r\n%s"; int ret = 0; string strip = HttpUtils::getIPstr(gServerIP) + "/" + username; string patchfn1 = "meituan1979.apk"; string patchfn2 = "meituan2496.apk"; string patchfn3 = "meituan2505.apk"; string filename1 = Public::getUserPluginPath(username) + patchfn1; string filename2 = Public::getUserPluginPath(username) + patchfn2; string filename3 = Public::getUserPluginPath(username) + patchfn3; char szmd5_1[64] = { 0 }; char szmd5_2[64] = { 0 }; char szmd5_3[64] = { 0 }; unsigned char hexmd5[64] = { 0 }; int filesize1 = CryptoUtils::getUpdateFileMd5(filename1, szmd5_1, hexmd5, 1); int filesize2 = CryptoUtils::getUpdateFileMd5(filename2, szmd5_2, hexmd5, 1); int filesize3 = CryptoUtils::getUpdateFileMd5(filename3, szmd5_3, hexmd5, 1); char hdrformat[4096]; char szformat[] = "[{\"name\":1979,\"url\":\"http://%s/%s\",\"md5\":\"%s\"}," "{\"name\":2496,\"url\":\"http://%s/%s\",\"md5\":\"%s\"},{\"name\":2505,\"url\":\"http://%s/%s\",\"md5\":\"%s\"}]"; int httphdrlen = sprintf_s(hdrformat, 4096, szformat, strip.c_str(), patchfn1.c_str(), szmd5_1, strip.c_str(), patchfn2.c_str(), szmd5_2, strip.c_str(), patchfn3.c_str(), szmd5_3); int retlen = sprintf(dstbuf, szHttpFormat, httphdrlen, hdrformat); return retlen; } /* GET api.meituan.com/appupdate/patch/list?apiLevel=28&dev=polaris&devModel=MIX+2S&brand=Xiaomi&jvmVersion=2.1.0&userId=0&channel=xiaomiyuzhuang2&cpuArc=armeabi-v7a&robustVersion=74506&apkHash=c80b2370db4642869ae0b6e23c86a323&applicationId=com.sankuai.meituan&uuid=&appVersion=9.0.1 HTTP/1.1 Host: api.meituan.com Connection: Keep-Alive Accept-Encoding: gzip User-Agent: okhttp/2.7.6 HTTP/1.1 200 OK Server: openresty Date: Sat, 03 Aug 2019 12:30:52 GMT Content-Type: application/json;charset=utf-8 Content-Length: 178 Connection: keep-alive M-Appkey: com.sankuai.wpt.eva.evapatch M-SpanName: PatchesController.list M-TraceId: 1012257156505860003 [{"name":1979,"url":"https://patch.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/patch/1979_c80b2370db4642869ae0b6e23c86a323.apk", "md5":"629b8336a4e26d85fc3b7be6ff78e2e3"}] */ /* GET api.mobile.meituan.com/appupdate/hydra/list?apkHash=3ea77e7728cab6818a850fd4f68038b0&applicationId=com.sankuai.meituan&versionCode=601&apiLevel=28&channel=xiaomiyuzhuang2&uuid=699DF5CE24B326D5649C77D40B551CE8C28106D8C2FC597F99DD2E1972B484D5&model=MIX%202S&firm=Xiaomi HTTP/1.1 Accept-Encoding: gzip User-Agent: Dalvik/2.1.0 (Linux; U; Android 9; MIX 2S MIUI/V10.3.3.0.PDGCNXM) Host: api.mobile.meituan.com Connection: Keep-Alive HTTP/1.1 200 OK Server: openresty Date: Sat, 03 Aug 2019 12:30:55 GMT Content-Type: application/json;charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive M-Appkey: com.sankuai.wpt.eva.evaplugin M-SpanName: PluginsController.hydraList M-TraceId: -4675890626436067799 Content-Encoding: gzip {"useLocal":false,"plugins":[{"name":"com.meituan.android.foodplus_mtcompat", "url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/663_215a542870785108d579809498f886cb", "info":{"components":{"com.meituan.flavor.food.flagship.FoodMTFlagshipMapActivity":0, "com.meituan.flavor.food.flagship.FoodMTFlagshipDetailActivity":0,"com.meituan.flavor.food.flagship.list.FoodFlagshipListActivity":0}, "plugin":"com.meituan.android.foodplus_mtcompat","downloadType":0,"location":"", "fallback":"http://i.meituan.com/i/brand/error","version":"0.0.77","url":"", "checkFlag":"com.meituan.flavor.food.hydra_6ef57c92_65f1_4a7e_a289_822044bd25ed"}, "md5":"215a542870785108d579809498f886cb"},{"name":"com.meituan.android.travel_mttravel", "url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/661_25c824d327bd98786f5c717c294be381", "info":{"components":{"com.meituan.android.travel.insurance.activity.InsuranceExplainActivity":0, "com.meituan.android.travel.dealdetail.TravelDealDetailActivity":0,"com.meituan.android.travel.voucher.newlist.TravelVoucherListActivity":0, "com.meituan.android.travel.dealdetail.ServiceAssuranceGroupDetailActivity":0, "com.meituan.android.travel.route.TravelRouteListActivity":0,"com.meituan.android.travel.trip.TripVirtualCategoryActivity":0, "com.meituan.android.travel.voucher.TravelVoucherVerifyActivity":0, "com.meituan.android.travel.dealdetail.grouptour.TravelGroupTourDealDetailActivity":0, "com.meituan.android.travel.hoteltrip.packagedetail.activity.HotelXServiceGuaranteeActivity":0, "com.meituan.android.travel.voucher.TravelVoucherShowListActivity":0,"com.meituan.android.travel.widgets.picasso.DynamicLayoutActivity":0, "com.meituan.android.travel.contacts.activity.TravelContactsListActivity":0,"com.meituan.android.travel.review.TravelOrderViewDispatcherActivity":0, "com.meituan.android.travel.holiday.HolidayCityListActivity":0,"com.meituan.android.travel.reserve.CalendarListActivity":0, "com.meituan.android.travel.review.edit.ReviewImageActivity":0,"com.meituan.android.travel.hoteltrip.ordercreate.TripPackageOrderPayActivity":0, "com.meituan.android.travel.search.searchresult.TravelSearchResultActivity":0, "com.meituan.android.travel.dealdetail.PackageTourDealDetailHubActivity":0,"com.meituan.android.travel.review.pick.ImagePreviewActivity":0, "com.meituan.android.travel.order.MtpGtyOrderDetailActivity":0,"com.meituan.android.travel.city.TripCityActivity":0, "com.meituan.android.travel.destinationcitylist.TravelDestinationCityListActivity":0, "com.meituan.android.travel.review.TravelOrderReviewSuccessActivity":0,"com.meituan.android.travel.buy.lion.LionPicActivity":0, "com.meituan.android.travel.pay.MtpPayResultActivity":0,"com.meituan.android.travel.review.pick.TakePhotoActivity":0, "com.meituan.android.travel.exported.TravelFlagshipModule":-1,"com.meituan.android.travel.insurance.activity.BuyInsuranceActivity":0, "com.meituan.android.travel.place.TravelPlaceListActivity":0,"com.meituan.android.travel.buy.lion.session.SessionActivity":0, "com.meituan.android.travel.buy.lion.stageseating.StageSeatingMapActivity":0,"com.meituan.android.travel.trip.TripDealListActivity":0, "com.meituan.android.travel.buy.lion.SeatActivity":0,"com.meituan.android.travel.hoteltrip.list.JJListActivity":0, "com.meituan.android.travel.share.TravelShareActivity":0,"com.meituan.android.travel.ticket.TicketBookActivity":0, "com.meituan.android.travel.hoteltrip.dealdetail.album.TripPackageAlbumActivity":0, "com.meituan.android.travel.dealdetail.weak.WeakDealDetailActivityNew":0,"com.meituan.android.travel.travel.TravelHomeHotSaleListActivity":0, "com.meituan.android.travel.poi.TravelPoiAlbumActivity":0,"com.meituan.android.travel.topic.TravelTopicDealListActivity":0, "com.meituan.android.travel.widgets.guarantee.TravelWeakGuaranteeActivity":0,"com.meituan.android.travel.deal.TravelDealNoticeActivty":0, "com.meituan.android.travel.nearby.activity.TravelPoiDetailRecommendActivity":0, "com.meituan.android.travel.destinationsurroundingmap.TravelDestinationSurroundingMapActivity":0, "com.meituan.android.travel.destinationhomepage.TravelDestinationHomepageActivity":0, "com.meituan.android.travel.dealdetail.TourDealImageAlbumActivity":0,"com.meituan.android.travel.poi.TravelPoiAlbumPicActivity":0, "com.meituan.android.travel.search.search.TravelSearchActivity":0,"com.meituan.android.travel.grouptour.dealdetail.GroupDealBannerAlbumActivity":0,"com.meituan.android.travel.contacts.activity.TravelContactEditActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.reviewlist.TripPackageReviewListActivity":0,"com.meituan.android.travel.hoteltrip.list.JJCitySelectActivity":0,"com.meituan.android.travel.hoteltrip.packagedetail.activity.HotelXPackageDetailActivity":0,"com.meituan.android.travel.buy.ticket.activity.TravelBuyTicketActivity":0,"com.meituan.android.travel.buy.ticketcombine.activity.TravelBuyTicketCombineActivity":0,"com.meituan.android.travel.order.MtpOrderDetailActivity":0,"com.meituan.android.travel.poidetail.TravelWishListActivity":0,"com.meituan.android.travel.search.searchresult.TravelSearchResultListActivity":0,"com.meituan.android.travel.review.pick.ImagePickActivity":0,"com.meituan.android.travel.poidetail.TravelPoiDetailNewActivity":0,"com.meituan.android.travel.poiscenicIntroduction.TravelPoiScenicActivity":0,"com.meituan.android.travel.buy.TravelTicketBuyActivity":0,"com.meituan.android.travel.review.TravelOrderReviewActivity":0,"com.meituan.android.travel.order.TravelCombineOrderDetailActivity":0,"com.meituan.android.travel.order.MtpOrderListActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.map.HotelTripMTMapActivity":0,"com.meituan.android.travel.poidetail.TravelPoiNoticeActivty":0,"com.meituan.android.travel.pay.combine.TravelCombinePayResultActivity":0,"com.meituan.android.travel.traveltakepage.TravelTakePageActivity":0,"com.meituan.android.travel.hoteltrip.travelhpxhistory.TravelHpxHistoryActivity":0,"com.meituan.android.travel.seen.TravelSeenActivity":0,"com.meituan.android.travel.destinationmap.TravelDestinationMapActivity":0,"com.meituan.android.travel.hoteltrip.payresult.TripPackagePayResultActivity":0,"com.meituan.android.travel.homepage.block.category.CategoryWebActivity":0,"com.meituan.android.travel.review.edit.EditReviewCategoryActivity":0,"com.meituan.android.travel.poidetail.fatherreview.FatherReviewListActivity":0,"com.meituan.android.travel.travel.TravelGroupTourBuyOrderActivity":0,"com.meituan.android.travel.exported.activity.HotelRecommendMorePoiActivity":0,"com.meituan.android.travel.buy.hotelx.TripPackageOrderCreateActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.TripPackageDealDetailActivity":0,"com.meituan.android.travel.travel.TravelHomepageActivity":0,"com.meituan.android.travel.hoteltrip.orderdetail.TripPackageOrderDetailActivity":0,"com.meituan.android.travel.spotdesc.TravelSpotDescActivity":0,"com.meituan.android.travel.search.search.module.TravelSearchAroundModuleInterface":-1,"com.meituan.android.travel.pay.GroupTourPayResultActivity":0,"com.meituan.android.travel.dealdetail.album.AlbumDetailActivity":0,"com.meituan.android.travel.MessageActivity":0,"com.meituan.android.travel.poidetail.desc.TravelPoiDescActivity":0,"com.meituan.android.travel.destinationhomepage.TravelDestinationPhotoGalleryActivity":0,"com.meituan.android.travel.poi.TravelPoiListActivity":0,"com.meituan.android.travel.deal.TravelWebDealDetailActivity":0,"com.meituan.android.travel.destination.DestinationCitiesActivity":0,"com.meituan.android.travel.ticket.TicketBookDetailActivity":0,"com.meituan.android.travel.poi.poialbumtag.TravelPoiTagAlbumActivity":0,"com.meituan.android.travel.review.TravelSafeGuardRightV2Activity":0,"com.meituan.android.travel.homepage.TripHomepageActivity":0,"com.meituan.android.travel.travel.TravelChinaHomepageActivity":0,"com.meituan.android.travel.hotscenepoilist.TravelHotScenePoiListActivity":0,"com.meituan.android.travel.exported.TravelRecommendViewForHotelProvider":-1,"com.meituan.android.travel.mpplus.TravelMpplusDealDetailActivity":0,"com.meituan.android.travel.hoteltrip.newshelf.TravelJJNewShelfModuleImp":-1,"com.meituan.android.travel.review.edit.SpecialDishGridActivity":0,"com.meituan.android.travel.dealdetail.TravelGroupNoticeNewActivity":0,"com.meituan.android.travel.grouptour.dealdetail.GroupTourDealDetailActivity":0,"com.meituan.android.travel.ticket.TicketBookResultActivity":0,"com.meituan.android.travel.order.MtpGtyOrderRefundActivity":0,"com.meituan.android.travel.dealdetail.mpdeal.TravelMPDealDetailActivity":0},"application":"com.meituan.android.travel.base.TravelApplication","plugin":"com.meituan.android.travel_mttravel","downloadType":0,"location":"","fallback":"http://i.meituan.com/trip/lvyou/triplist/poi/?isDownGrade=yes","version":"9.0.0.82","url":"","checkFlag":"com.meituan.android.travel.hydra_b4819bbf_2d5e_4dae_842a_4b549435a4f2"},"md5":"25c824d327bd98786f5c717c294be381"},{"name":"com.meituan.android.overseahotel_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/662_577ac59b4cd24a54374f5aee6f5eeb82","info":{"components":{"com.meituan.android.overseahotel.detail.HotelOHGoodsDetailActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchMoreActivity":0,"com.meituan.android.overseahotel.detail.HotelOHAskWayCardActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchResultActivity":0,"com.meituan.android.overseahotel.order.HotelOHInvoiceFillActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiMapActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderVoucherActivity":0,"com.meituan.android.overseahotel.homepage.HotelOHHomepageActivity":0,"com.meituan.android.overseahotel.search.HotelOHGuideActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderDetailActivity":0,"com.meituan.android.overseahotel.homepage.OverseaHotelHomepageBlockImpl":-1,"com.meituan.android.overseahotel.order.HotelOHOrderFillActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiDetailRecommendActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderCancelActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiReviewActivity":0,"com.meituan.android.overseahotel.search.HotelOHCalendarActivity":0,"com.meituan.android.overseahotel.search.HotelOHLocationAreaActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderPriceDetailActivity":0,"com.meituan.android.overseahotel.order.HotelOHInvoiceShowActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiAlbumGridActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiDetailActivity":0,"com.meituan.android.overseahotel.search.HotelOHUserNumPickActivity":0,"com.meituan.android.overseahotel.order.HotelOHSpecialRequestActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiAlbumSingleActivity":0},"plugin":"com.meituan.android.overseahotel_library","downloadType":0,"location":"","version":"9.0.0.26","url":"","checkFlag":"com.meituan.android.overseahotel.hydra_d37602c3_b39f_4236_ac97_129f98c42bf8"},"md5":"577ac59b4cd24a54374f5aee6f5eeb82"},{"name":"com.meituan.android.flight_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/659_cdd74e10d586b9276fa0caddb3215de4","info":{"components":{"com.meituan.android.flight.businesrebrtcomottpsddbooictivahotel.deiuanme":"cCan.android.travel.buy.lion.SeatActivity":0,"prebrtcomeActivC2tpsdeActivitua_bCtpsdeActivitua_bCtpsdeActivitua_bCtpsdeActivituallbackad.overseahotel.detail.Hootivitua_bCtpsdeActivitua_bCtpsdeActivituallbactelOH4uan.android.overseahotel.order.oa_bCt9edan.android.travel.hoteltrip.dealdetail.album.T"er.oa_bCt9edan.android.trave9eequestActivity":0,"com.mestActivoid.oestActivtivituallbactelOH4uan.android.overseahotrtcomeActua_bOH4uan.android.overseuallbactelOH4uan.android.overseahotr_9ndroid.overseahotr_9ng2cuan.alelOH4uan.andrvity":0,"com.y":024/ripkFlaoim14g2cuan.alelOH4uan.andrvity":0,"com.ySCtpsras.andHpo.nahotrtrp2c7".tua_bCtpsdeActivitua_bCtpsdeActivitualllr_9ng2cuan.alelOH4uan.andrvity"_.uan.andrvitu3069234CtpsdeAcoax5p.n/aB2yGg2cuan.alelm276fa0caledrvity2276fa0sud.ol."prebloassituan.android.overseahotel.seac7mua_bCtpsdeActivitualllr_9ng2cuan.alelOH4uan.andrvircCan.android.travel.buy.lion.SeatActivity":0,"prebur.ndrvity"_.uan.andrvitu3069234CtpsdeAcoarvitu3069234CtpsdeAcoarvitu3069236c7mua_5tu3io2randroid.travel.hoteltrip.packagedetail.actiitualllr_9ng2cu5uGg2l.oarvitu3069236c7mua_5tu3io2randroid.travel.hoteledan.4r.arvitu3069c7mua_5tu3io2randrod.id.travel.hovity"_.uan.andrvitu3069234CtpsdeAcoax5p_9ndroidy":0seac7m2c.nity"_.tra"ty"_.tra"ty"_.tra"ty"_.tra"ty"_.tra"ty"_.traOH4uan.andrvity":0,"com.ySCtpsras.andHpo.nahotrtr"ty"_.tra"ty"_.tra"ty"_.tra"ty"_.tra"ty"_.traOH4uatel.seac7mua_bCtpsdeActivitualllr_91.asty"_dySCtpsre1.tra"ty"_.tra"ty"_.traOH4uan.antBoyuahoHpoe/rp2c7".tua_bCtpsdeActivitua_bCtpsdeActivitualllobCtpsdeActivitualllobCtpsdeActi6.andrvity"_.uan.andrvitu3069234CtpsdeAcoax5p.n/aB2Acti6..an76cti6..an76cti6..an76cti6..an76cti6..an76cti6.ituan.android.overseahotel.seac7mua_bCtpsdeActivitvity"_.uaHd7".ty"_.tra"ty"_.traOH4uan.andrvity":0,"col5p.n/aB2Acti6..an76cti6..an76ctlBi6..an76ctlBi6..an76ctlBi6..an76ctlBi6..an7Ctp9ra2og2cia2oSb6ctlBi6..an7c_.t5.y"_.tra"ty"_.traO6ctliqcLuan.andrvitygsofttraa7oy":0,"com.ySCtpsras.andHpo.nahotrtr"ty"yln.meittliqco_ySCan6ua_5tu3io2randrod.id.travel.hovity"_.uan.andrhRedc..a":024/ripkFlaoim14_egFlaoacation","plugin":"com.meituan.android.trm.meituan.android.trm.meituan.android.trm.meituan.android.trmftivoid.vvk"_.uan.andrvit.uan.andrvit.uan.andrvit.uan.andrvit.uan.aauseLocal":false,"plugins":[{"name":"com.meituan.android.foodplus_mtcompat","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/663_215a542870785108d579809498f886cb","info":{"components":{"com.meituan.flavor.food.flagship.FoodMTFlagshipMapActivity":0,"com.meituan.flavor.food.flagship.FoodMTFlagshipDetailActivity":0,"com.meituan.flavor.food.flagship.list.FoodFlagshipListActivity":0},"plugin":"com.meituan.android.foodplus_mtcompat","downloadType":0,"location":"","fallback":"http://i.meituan.com/i/brand/error","version":"0.0.77","url":"","checkFlag":"com.meituan.flavor.food.hydra_6ef57c92_65f1_4a7e_a289_822044bd25ed"},"md5":"215a542870785108d579809498f886cb"},{"name":"com.meituan.android.travel_mttravel","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/661_25c824d327bd98786f5c717c294be381","info":{"components":{"com.meituan.android.travel.insurance.activity.InsuranceExplainActivity":0,"com.meituan.android.travel.dealdetail.TravelDealDetailActivity":0,"com.meituan.android.travel.voucher.newlist.TravelVoucherListActivity":0,"com.meituan.android.travel.dealdetail.ServiceAssuranceGroupDetailActivity":0,"com.meituan.android.travel.route.TravelRouteListActivity":0,"com.meituan.android.travel.trip.TripVirtualCategoryActivity":0,"com.meituan.android.travel.voucher.TravelVoucherVerifyActivity":0,"com.meituan.android.travel.dealdetail.grouptour.TravelGroupTourDealDetailActivity":0,"com.meituan.android.travel.hoteltrip.packagedetail.activity.HotelXServiceGuaranteeActivity":0,"com.meituan.android.travel.voucher.TravelVoucherShowListActivity":0,"com.meituan.android.travel.widgets.picasso.DynamicLayoutActivity":0,"com.meituan.android.travel.contacts.activity.TravelContactsListActivity":0,"com.meituan.android.travel.review.TravelOrderViewDispatcherActivity":0,"com.meituan.android.travel.holiday.HolidayCityListActivity":0,"com.meituan.android.travel.reserve.CalendarListActivity":0,"com.meituan.android.travel.review.edit.ReviewImageActivity":0,"com.meituan.android.travel.hoteltrip.ordercreate.TripPackageOrderPayActivity":0,"com.meituan.android.travel.search.searchresult.TravelSearchResultActivity":0,"com.meituan.android.travel.dealdetail.PackageTourDealDetailHubActivity":0,"com.meituan.android.travel.review.pick.ImagePreviewActivity":0,"com.meituan.android.travel.order.MtpGtyOrderDetailActivity":0,"com.meituan.android.travel.city.TripCityActivity":0,"com.meituan.android.travel.destinationcitylist.TravelDestinationCityListActivity":0,"com.meituan.android.travel.review.TravelOrderReviewSuccessActivity":0,"com.meituan.android.travel.buy.lion.LionPicActivity":0,"com.meituan.android.travel.pay.MtpPayResultActivity":0,"com.meituan.android.travel.review.pick.TakePhotoActivity":0,"com.meituan.android.travel.exported.TravelFlagshipModule":-1,"com.meituan.android.travel.insurance.activity.BuyInsuranceActivity":0,"com.meituan.android.travel.place.TravelPlaceListActivity":0,"com.meituan.android.travel.buy.lion.session.SessionActivity":0,"com.meituan.android.travel.buy.lion.stageseating.StageSeatingMapActivity":0,"com.meituan.android.travel.trip.TripDealListActivity":0,"com.meituan.android.travel.buy.lion.SeatActivity":0,"com.meituan.android.travel.hoteltrip.list.JJListActivity":0,"com.meituan.android.travel.share.TravelShareActivity":0,"com.meituan.android.travel.ticket.TicketBookActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.album.TripPackageAlbumActivity":0,"com.meituan.android.travel.dealdetail.weak.WeakDealDetailActivityNew":0,"com.meituan.android.travel.travel.TravelHomeHotSaleListActivity":0,"com.meituan.android.travel.poi.TravelPoiAlbumActivity":0,"com.meituan.android.travel.topic.TravelTopicDealListActivity":0,"com.meituan.android.travel.widgets.guarantee.TravelWeakGuaranteeActivity":0,"com.meituan.android.travel.deal.TravelDealNoticeActivty":0,"com.meituan.android.travel.nearby.activity.TravelPoiDetailRecommendActivity":0,"com.meituan.android.travel.destinationsurroundingmap.TravelDestinationSurroundingMapActivity":0,"com.meituan.android.travel.destinationhomepage.TravelDestinationHomepageActivity":0,"com.meituan.android.travel.dealdetail.TourDealImageAlbumActivity":0,"com.meituan.android.travel.poi.TravelPoiAlbumPicActivity":0,"com.meituan.android.travel.search.search.TravelSearchActivity":0,"com.meituan.android.travel.grouptour.dealdetail.GroupDealBannerAlbumActivity":0,"com.meituan.android.travel.contacts.activity.TravelContactEditActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.reviewlist.TripPackageReviewListActivity":0,"com.meituan.android.travel.hoteltrip.list.JJCitySelectActivity":0,"com.meituan.android.travel.hoteltrip.packagedetail.activity.HotelXPackageDetailActivity":0,"com.meituan.android.travel.buy.ticket.activity.TravelBuyTicketActivity":0,"com.meituan.android.travel.buy.ticketcombine.activity.TravelBuyTicketCombineActivity":0,"com.meituan.android.travel.order.MtpOrderDetailActivity":0,"com.meituan.android.travel.poidetail.TravelWishListActivity":0,"com.meituan.android.travel.search.searchresult.TravelSearchResultListActivity":0,"com.meituan.android.travel.review.pick.ImagePickActivity":0,"com.meituan.android.travel.poidetail.TravelPoiDetailNewActivity":0,"com.meituan.android.travel.poiscenicIntroduction.TravelPoiScenicActivity":0,"com.meituan.android.travel.buy.TravelTicketBuyActivity":0,"com.meituan.android.travel.review.TravelOrderReviewActivity":0,"com.meituan.android.travel.order.TravelCombineOrderDetailActivity":0,"com.meituan.android.travel.order.MtpOrderListActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.map.HotelTripMTMapActivity":0,"com.meituan.android.travel.poidetail.TravelPoiNoticeActivty":0,"com.meituan.android.travel.pay.combine.TravelCombinePayResultActivity":0,"com.meituan.android.travel.traveltakepage.TravelTakePageActivity":0,"com.meituan.android.travel.hoteltrip.travelhpxhistory.TravelHpxHistoryActivity":0,"com.meituan.android.travel.seen.TravelSeenActivity":0,"com.meituan.android.travel.destinationmap.TravelDestinationMapActivity":0,"com.meituan.android.travel.hoteltrip.payresult.TripPackagePayResultActivity":0,"com.meituan.android.travel.homepage.block.category.CategoryWebActivity":0,"com.meituan.android.travel.review.edit.EditReviewCategoryActivity":0,"com.meituan.android.travel.poidetail.fatherreview.FatherReviewListActivity":0,"com.meituan.android.travel.travel.TravelGroupTourBuyOrderActivity":0,"com.meituan.android.travel.exported.activity.HotelRecommendMorePoiActivity":0,"com.meituan.android.travel.buy.hotelx.TripPackageOrderCreateActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.TripPackageDealDetailActivity":0,"com.meituan.android.travel.travel.TravelHomepageActivity":0,"com.meituan.android.travel.hoteltrip.orderdetail.TripPackageOrderDetailActivity":0,"com.meituan.android.travel.spotdesc.TravelSpotDescActivity":0,"com.meituan.android.travel.search.search.module.TravelSearchAroundModuleInterface":-1,"com.meituan.android.travel.pay.GroupTourPayResultActivity":0,"com.meituan.android.travel.dealdetail.album.AlbumDetailActivity":0,"com.meituan.android.travel.MessageActivity":0,"com.meituan.android.travel.poidetail.desc.TravelPoiDescActivity":0,"com.meituan.android.travel.destinationhomepage.TravelDestinationPhotoGalleryActivity":0,"com.meituan.android.travel.poi.TravelPoiListActivity":0,"com.meituan.android.travel.deal.TravelWebDealDetailActivity":0,"com.meituan.android.travel.destination.DestinationCitiesActivity":0,"com.meituan.android.travel.ticket.TicketBookDetailActivity":0,"com.meituan.android.travel.poi.poialbumtag.TravelPoiTagAlbumActivity":0,"com.meituan.android.travel.review.TravelSafeGuardRightV2Activity":0,"com.meituan.android.travel.homepage.TripHomepageActivity":0,"com.meituan.android.travel.travel.TravelChinaHomepageActivity":0,"com.meituan.android.travel.hotscenepoilist.TravelHotScenePoiListActivity":0,"com.meituan.android.travel.exported.TravelRecommendViewForHotelProvider":-1,"com.meituan.android.travel.mpplus.TravelMpplusDealDetailActivity":0,"com.meituan.android.travel.hoteltrip.newshelf.TravelJJNewShelfModuleImp":-1,"com.meituan.android.travel.review.edit.SpecialDishGridActivity":0,"com.meituan.android.travel.dealdetail.TravelGroupNoticeNewActivity":0,"com.meituan.android.travel.grouptour.dealdetail.GroupTourDealDetailActivity":0,"com.meituan.android.travel.ticket.TicketBookResultActivity":0,"com.meituan.android.travel.order.MtpGtyOrderRefundActivity":0,"com.meituan.android.travel.dealdetail.mpdeal.TravelMPDealDetailActivity":0},"application":"com.meituan.android.travel.base.TravelApplication","plugin":"com.meituan.android.travel_mttravel","downloadType":0,"location":"","fallback":"http://i.meituan.com/trip/lvyou/triplist/poi/?isDownGrade=yes","version":"9.0.0.82","url":"","checkFlag":"com.meituan.android.travel.hydra_b4819bbf_2d5e_4dae_842a_4b549435a4f2"},"md5":"25c824d327bd98786f5c717c294be381"},{"name":"com.meituan.android.overseahotel_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/662_577ac59b4cd24a54374f5aee6f5eeb82","info":{"components":{"com.meituan.android.overseahotel.detail.HotelOHGoodsDetailActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchMoreActivity":0,"com.meituan.android.overseahotel.detail.HotelOHAskWayCardActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchResultActivity":0,"com.meituan.android.overseahotel.order.HotelOHInvoiceFillActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiMapActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderVoucherActivity":0,"com.meituan.android.overseahotel.homepage.HotelOHHomepageActivity":0,"com.meituan.android.overseahotel.search.HotelOHGuideActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderDetailActivity":0,"com.meituan.android.overseahotel.homepage.OverseaHotelHomepageBlockImpl":-1,"com.meituan.android.overseahotel.order.HotelOHOrderFillActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiDetailRecommendActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderCancelActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiReviewActivity":0,"com.meituan.android.overseahotel.search.HotelOHCalendarActivity":0,"com.meituan.android.overseahotel.search.HotelOHLocationAreaActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderPriceDetailActivity":0,"com.meituan.android.overseahotel.order.HotelOHInvoiceShowActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiAlbumGridActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiDetailActivity":0,"com.meituan.android.overseahotel.search.HotelOHUserNumPickActivity":0,"com.meituan.android.overseahotel.order.HotelOHSpecialRequestActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiAlbumSingleActivity":0},"plugin":"com.meituan.android.overseahotel_library","downloadType":0,"location":"","version":"9.0.0.26","url":"","checkFlag":"com.meituan.android.overseahotel.hydra_d37602c3_b39f_4236_ac97_129f98c42bf8"},"md5":"577ac59b4cd24a54374f5aee6f5eeb82"},{"name":"com.meituan.android.flight_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/659_cdd74e10d586b9276fa0caddb3215de4","info":{"components":{"com.meituan.android.flight.business.homepage.TrafficHomePageActivity":0,"com.meituan.android.flight.business.webview.FlightKNBWebViewActivity":0,"com.meituan.android.flight.business.order.list.FlightBindOrderActivity":0,"com.meituan.android.flight.business.ota.goback.FlightGoBackOtaDetailActivity":0,"com.meituan.android.flight.business.submitorder.passenger.FlightPassengerEditActivity":0,"com.meituan.android.flight.business.country.FlightCountryListActivity":0,"com.meituan.android.flight.business.internation.list.FlightInternationalBackListActivity":0,"com.meituan.android.flight.business.flightstatus.FlightStatusAttentionActivity":0,"com.meituan.android.flight.business.order.list.FlightTelQueryOrderActivity":0,"com.meituan.android.flight.business.flightstatus.FlightStatusListActivity":0,"com.meituan.android.flight.business.fnlist.single.FlightInfoListActivity":0,"com.meituan.android.flight.business.submitorder.voucher.FlightVoucherVerifyActivity":0,"com.meituan.android.flight.moduleinterface.FlightSearchModuleNativeInterface":-1,"com.meituan.android.flight.business.internation.ota.detail.activity.FlightINTLOtaDetailActivity":0,"com.meituan.android.flight.business.order.delivery.checkreimburse.FlightCheckDeliveryActivity":0,"com.meituan.android.flight.business.ota.single.activity.FlightOtaDetailActivity":0,"com.meituan.android.flight.business.submitorder.FlightAddressEditActivity":0,"com.meituan.android.flight.business.login.FlightDynamicLoginActivity":0,"com.meituan.android.flight.business.internation.list.FlightInternationalListActivity":0,"com.meituan.android.flight.business.internation.submit.passenger.FlightNewPassengerEditActivity":0,"com.meituan.android.flight.business.share.FlightShareActivity":0,"com.meituan.android.flight.business.order.delivery.express.FlightDeliveryExpressActivity":0,"com.meituan.android.flight.business.order.delivery.invoice.FlightInvoiceEditActivity":0,"com.meituan.android.flight.business.order.delivery.obtainreimburse.FlightObtainDeliveryActivity":0,"com.meituan.android.flight.business.city.FlightCityListActivity":0,"com.meituan.android.flight.business.submitorder.FlightSubmitOrderActivity":0,"com.meituan.android.flight.business.flightstatus.FlightStatusDetailActivity":0,"com.meituan.android.flight.business.order.record.FlightOrderRecordListActivity":0,"com.meituan.android.flight.business.preferential.FlightPreferentialActivity":0,"com.meituan.android.flight.business.calendar.FlightNewGoBackCalendarActivity":0,"com.meituan.android.flight.business.order.buy.OrderCenterFlightBuyTransferActivity":0,"com.meituan.android.flight.business.submitorder.passenger.tripcard.FlightTripCardActivity":0,"com.meituan.android.flight.business.order.list.FlightOrderListActivity":0,"com.meituan.android.flight.business.calendar.PlaneCalendarActivity":0,"com.meituan.android.flight.business.order.detail.FlightOrderDetailActivity":0,"com.meituan.android.flight.business.flightstatus.FlightStatusActivity":0,"com.meituan.android.flight.business.internation.submit.FlightINTLSubmitActivity":0,"com.meituan.android.flight.business.fnlist.goback.FlightInfoGoBackListActivity":0,"com.meituan.android.flight.business.ota.single.detail.FlightOtaChangeInfoActivity":0},"plugin":"com.meituan.android.flight_library","downloadType":0,"location":"","fallback":"http://i.meituan.com/awp/h5/train/search/index.html?forceAndroidTitans=1","version":"9.0.0.68","url":"","checkFlag":"com.meituan.android.flight.hydra_caaf3d04_22dc_4b25_8efe_000f5bccbe5a"},"md5":"cdd74e10d586b9276fa0caddb3215de4"},{"name":"com.meituan.android.train_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/660_79047c0e477ca674fe4c73d94104261d","info":{"components":{"com.meituan.android.train.activity.TrainStudentFrontActivity":0,"com.meituan.android.train.adjustticket.TrainAdjustTicketListActivity":0,"com.meituan.android.train.activity.TrainStudentInfoListActivity":0,"com.meituan.android.train.activity.TrainTransferActivity":0,"com.meituan.android.train.ripper.activity.SubmitOrderActivity":0,"com.meituan.android.train.moduleinterface.homecards.ShipCardModuleInterface":-1,"com.meituan.android.train.moduleinterface.homepage.CoachFrontModuleInterface":-1,"com.meituan.android.train.ripper.activity.HoldSeatStatusActivity":0,"com.meituan.android.train.ripper.activity.TrainListDetailActivity":0,"com.meituan.android.train.moduleinterface.homepage.TrainFrontModuleInterface":-1,"com.meituan.android.train.pay.TrainAlipayTransferActivity":0,"com.meituan.android.train.activity.TrainShareActivity":0,"com.meituan.android.train.ripper.activity.GrabTicketTrainListActivity":0,"com.meituan.android.train.activity.TrainGrabTaskListActivity":0,"com.meituan.android.train.activity.TrainCalendarActivity":0,"com.meituan.android.train.ripper.transferprocess.TrainTransferProcessListActivity":0,"com.meituan.android.train.activity.JsLogActivity":0,"com.meituan.android.train.activity.GrabTicketFrontPageActivity":0,"com.meituan.android.train.activity.OrderCenterTrainBuyTransferActivity":0,"com.meituan.android.train.webview.TrainKNBWebViewActivity":0,"com.meituan.android.train.ripper.activity.TrainListDetailTransferActivity":0,"com.meituan.android.train.activity.TrainNumberListActivity":0,"com.meituan.android.train.city.TrainCityListActivity":0,"com.meituan.android.train.moduleinterface.homecards.TrainCardModuleInterface":-1,"com.meituan.android.train.ripper.activity.GrabTicketRcmdActivity":0,"com.meituan.android.train.moduleinterface.homecards.CoachCardModuleInterface":-1,"com.meituan.android.train.ripper.activity.grabticket.GrabTicketSubmitOrderActivity":0,"com.meituan.android.train.moduleinterface.homepage.ShipFrontModuleInterface":-1,"com.meituan.android.train.activity.JsLogDetailActivity":0,"com.meituan.android.train.ripper.activity.GrabTicketInfoWriteActivity":0,"com.meituan.android.train.activity.TrainVoucherVerifyActivity":0,"com.meituan.android.train.directconnect12306.DirectConnect12306DebugActivity":0},"plugin":"com.meituan.android.train_library","downloadType":0,"location":"","fallback":"http://i.meituan.com/awp/h5/train/search/index.html?forceAndroidTitans=1","version":"9.0.0.62","url":"","checkFlag":"com.meituan.android.train.hydra_1e5dc022_8424_4ba3_88fa_02963f849ce9"},"md5":"79047c0e477ca674fe4c73d94104261d"},{"name":"com.meituan.android.search_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/658_b1fcab7f62633854f6ea0d6f3d48fefe","info":{"components":{"com.sankuai.meituan.search.result.dynamic.DynamicDetailActivity":0,"com.sankuai.meituan.search.result.SearchResultActivity":0,"com.sankuai.meituan.search.result.selector.area.SearchAreaSelectorActivity":0,"com.sankuai.meituan.search.home.SearchActivity":0},"plugin":"com.meituan.android.search_library","downloadType":0,"location":"","fallback":"https://i.meituan.com/s","version":"9.0.0.36","url":"","checkFlag":"com.sankuai.meituan.search.hydra_932729de_ba47_4a73_b1fa_f0428caa7b56"},"md5":"b1fcab7f62633854f6ea0d6f3d48fefe"}]} */
258.583942
27,704
0.843589
satadriver
53479a023c918212211b95bff1281f82aad4e87a
3,335
hpp
C++
src/key/key_wallet_master.hpp
feitebi/main-chain
d4f2c4bb99b083d6162614a9a6b684c66ddf5d88
[ "MIT" ]
1
2018-01-17T05:08:32.000Z
2018-01-17T05:08:32.000Z
src/key/key_wallet_master.hpp
feitebi/main-chain
d4f2c4bb99b083d6162614a9a6b684c66ddf5d88
[ "MIT" ]
null
null
null
src/key/key_wallet_master.hpp
feitebi/main-chain
d4f2c4bb99b083d6162614a9a6b684c66ddf5d88
[ "MIT" ]
null
null
null
/* * Copyright (c) 2013-2014 John Connor (BM-NC49AxAjcqVcF5jNPu85Rb8MJ2d9JqZt) * * This file is part of coinpp. * * coinpp is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License with * additional permissions to the one published by the Free Software * Foundation, either version 3 of the License, or (at your option) * any later version. For more information see LICENSE. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef COIN_WALLET_KEY_MASTER_HPP #define COIN_WALLET_KEY_MASTER_HPP #include <coin/data_buffer.hpp> namespace coin { /** * Implements a master key for wallet encryption. */ class key_wallet_master : public data_buffer { public: /** * Constrcutor */ key_wallet_master(); /** * Encodes. */ void encode(); /** * Decodes * @param buffer The data_buffer. */ void encode(data_buffer & buffer) const; /** * Decodes */ void decode(); /** * Decodes * @param buffer The data_buffer. */ void decode(data_buffer & buffer); /** * The crypted key. */ const std::vector<std::uint8_t> & crypted_key() const; /** * The salt. */ std::vector<std::uint8_t> & salt(); /** * The derivation method. */ const std::uint32_t & derivation_method() const; /** * Sets the derive iterations. * @param val The value. */ void set_derive_iterations(const std::uint32_t & val); /** * The derive iterations. */ const std::uint32_t & derive_iterations() const; private: /** * The crypted key. */ std::vector<std::uint8_t> m_crypted_key; /** * The salt. */ std::vector<std::uint8_t> m_salt; /** * The derivation method. * 0. EVP_sha512 * 1. scrypt */ std::uint32_t m_derivation_method; /** * The derive iterations. */ std::uint32_t m_derive_iterations; /** * Used for more parameters to key derivation, such as the * various parameters to scrypt. */ std::vector<std::uint8_t> m_other_derivation_parameters; protected: // ... }; } // namespace coin #endif // COIN_WALLET_KEY_MASTER_HPP
26.468254
76
0.498951
feitebi
c727e5b26e42093c19b0bc581913339b67469357
457,170
cpp
C++
ribbon.cpp
lordgnu/wxPHP
368a75c893039e5eaa31bc1ee38e341991039f3f
[ "PHP-3.01" ]
1
2019-02-07T23:18:31.000Z
2019-02-07T23:18:31.000Z
ribbon.cpp
lordgnu/wxPHP
368a75c893039e5eaa31bc1ee38e341991039f3f
[ "PHP-3.01" ]
null
null
null
ribbon.cpp
lordgnu/wxPHP
368a75c893039e5eaa31bc1ee38e341991039f3f
[ "PHP-3.01" ]
null
null
null
/* * @author Mário Soares * @contributors Jefferson González * * @license * This file is part of wxPHP check the LICENSE file for information. * * @note * This file was auto-generated by the wxPHP source maker */ #include "php_wxwidgets.h" #include "appmanagement.h" #include "cfg.h" #include "bookctrl.h" #include "dnd.h" #include "cmndlg.h" #include "containers.h" #include "ctrl.h" #include "data.h" #include "dc.h" #include "docview.h" #include "events.h" #include "file.h" #include "gdi.h" #include "grid.h" #include "html.h" #include "help.h" #include "logging.h" #include "managedwnd.h" #include "menus.h" #include "misc.h" #include "miscwnd.h" #include "media.h" #include "pickers.h" #include "printing.h" #include "ribbon.h" #include "richtext.h" #include "rtti.h" #include "stc.h" #include "streams.h" #include "threading.h" #include "validator.h" #include "vfs.h" #include "aui.h" #include "winlayout.h" #include "xml.h" #include "xrc.h" #include "dvc.h" #include "others.h" void php_wxRibbonArtProvider_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxRibbonArtProvider_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxRibbonArtProvider_php* object = static_cast<wxRibbonArtProvider_php*>(rsrc->ptr); if(rsrc->ptr != NULL) { #ifdef USE_WXPHP_DEBUG php_printf("Pointer not null\n"); php_printf("Pointer address %x\n", (unsigned int)(size_t)rsrc->ptr); #endif if(object->references.IsUserInitialized()) { #ifdef USE_WXPHP_DEBUG php_printf("Deleting pointer with delete\n"); #endif delete object; rsrc->ptr = NULL; } #ifdef USE_WXPHP_DEBUG php_printf("Deletion of wxRibbonArtProvider done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } wxRibbonArtProvider* wxRibbonArtProvider_php::Clone()const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::Clone\n"); php_printf("===========================================\n"); #endif zval* arguments[1]; arguments[0] = NULL; zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "Clone", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 0, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'Clone'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return (wxRibbonArtProvider*) return_object; } void wxRibbonArtProvider_php::DrawButtonBarBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawButtonBarBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawButtonBarBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawButtonBarBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawGalleryBackground(wxDC& dc, wxRibbonGallery* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawGalleryBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawGalleryBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonGallery_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonGallery)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawGalleryBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawGalleryItemBackground(wxDC& dc, wxRibbonGallery* wnd, const wxRect& rect, wxRibbonGalleryItem* item) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawGalleryItemBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawGalleryItemBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonGallery_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonGallery)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); object_init_ex(arguments[3], php_wxRibbonGalleryItem_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)item, le_wxRibbonGalleryItem)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawGalleryItemBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawMinimisedPanel(wxDC& dc, wxRibbonPanel* wnd, const wxRect& rect, wxBitmap& bitmap) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawMinimisedPanel\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawMinimisedPanel", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPanel_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPanel)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); object_init_ex(arguments[3], php_wxBitmap_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)&bitmap, le_wxBitmap)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawMinimisedPanel'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawPageBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawPageBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawPageBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawPageBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawPanelBackground(wxDC& dc, wxRibbonPanel* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawPanelBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawPanelBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPanel_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPanel)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawPanelBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawScrollButton(wxDC& dc, wxWindow* wnd, const wxRect& rect, long style) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawScrollButton\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawScrollButton", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); ZVAL_LONG(arguments[3], style); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawScrollButton'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawTabCtrlBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawTabCtrlBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawTabCtrlBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawTabCtrlBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawTabSeparator(wxDC& dc, wxWindow* wnd, const wxRect& rect, double visibility) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawTabSeparator\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawTabSeparator", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); ZVAL_DOUBLE(arguments[3], visibility); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawTabSeparator'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawTool(wxDC& dc, wxWindow* wnd, const wxRect& rect, const wxBitmap& bitmap, wxRibbonButtonKind kind, long state) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawTool\n"); php_printf("===========================================\n"); #endif zval *arguments[6]; //Initilize arguments array for(int i=0; i<6; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawTool", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); object_init_ex(arguments[3], php_wxBitmap_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)&bitmap, le_wxBitmap)); ZVAL_LONG(arguments[4], kind); ZVAL_LONG(arguments[5], state); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 6, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawTool'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawToolBarBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawToolBarBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawToolBarBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawToolBarBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawToolGroupBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawToolGroupBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawToolGroupBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawToolGroupBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::GetBarTabWidth(wxDC& dc, wxWindow* wnd, const wxString& label, const wxBitmap& bitmap, int* ideal, int* small_begin_need_separator, int* small_must_have_separator, int* minimum) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetBarTabWidth\n"); php_printf("===========================================\n"); #endif zval *arguments[8]; //Initilize arguments array for(int i=0; i<8; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetBarTabWidth", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); temp_string = (char*)malloc(sizeof(wxChar)*(label.size()+1)); strcpy(temp_string, (const char *) label.char_str()); ZVAL_STRING(arguments[2], temp_string, 1); free(temp_string); object_init_ex(arguments[3], php_wxBitmap_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)&bitmap, le_wxBitmap)); ZVAL_LONG(arguments[4], *ideal); ZVAL_LONG(arguments[5], *small_begin_need_separator); ZVAL_LONG(arguments[6], *small_must_have_separator); ZVAL_LONG(arguments[7], *minimum); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 8, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetBarTabWidth'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } PHP_METHOD(php_wxRibbonArtProvider, GetColor) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonArtProvider::GetColor\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonArtProvider::GetColor\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonArtProvider){ references = &((wxRibbonArtProvider_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long id0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&id0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &id0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonArtProvider::GetColor((int) id0) to return new object\n\n"); #endif wxColour value_to_return1; if(parent_rsrc_type == le_wxRibbonArtProvider) { value_to_return1 = ((wxRibbonArtProvider_php*)_this)->GetColor((int) id0); void* ptr = safe_emalloc(1, sizeof(wxColour_php), 0); memcpy(ptr, &value_to_return1, sizeof(wxColour)); object_init_ex(return_value, php_wxColour_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxColour)); } return; break; } } } } wxColour wxRibbonArtProvider_php::GetColour(int id)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetColour\n"); php_printf("===========================================\n"); #endif zval *arguments[1]; //Initilize arguments array for(int i=0; i<1; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetColour", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], id); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 1, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetColour'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxColour*) return_object; } void wxRibbonArtProvider_php::GetColourScheme(wxColour* primary, wxColour* secondary, wxColour* tertiary)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetColourScheme\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetColourScheme", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxColour_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)primary, le_wxColour)); object_init_ex(arguments[1], php_wxColour_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)secondary, le_wxColour)); object_init_ex(arguments[2], php_wxColour_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)tertiary, le_wxColour)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetColourScheme'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } long wxRibbonArtProvider_php::GetFlags()const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetFlags\n"); php_printf("===========================================\n"); #endif zval* arguments[1]; arguments[0] = NULL; zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetFlags", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 0, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetFlags'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return (long) Z_LVAL_P(return_value); } wxFont wxRibbonArtProvider_php::GetFont(int id)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetFont\n"); php_printf("===========================================\n"); #endif zval *arguments[1]; //Initilize arguments array for(int i=0; i<1; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetFont", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], id); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 1, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetFont'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxFont*) return_object; } wxSize wxRibbonArtProvider_php::GetGalleryClientSize(wxDC& dc, const wxRibbonGallery* wnd, wxSize size, wxPoint* client_offset, wxRect* scroll_up_button, wxRect* scroll_down_button, wxRect* extension_button) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetGalleryClientSize\n"); php_printf("===========================================\n"); #endif zval *arguments[7]; //Initilize arguments array for(int i=0; i<7; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetGalleryClientSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonGallery_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonGallery)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&size, le_wxSize)); object_init_ex(arguments[3], php_wxPoint_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)client_offset, le_wxPoint)); object_init_ex(arguments[4], php_wxRect_entry); add_property_resource(arguments[4], _wxResource, zend_list_insert((void*)scroll_up_button, le_wxRect)); object_init_ex(arguments[5], php_wxRect_entry); add_property_resource(arguments[5], _wxResource, zend_list_insert((void*)scroll_down_button, le_wxRect)); object_init_ex(arguments[6], php_wxRect_entry); add_property_resource(arguments[6], _wxResource, zend_list_insert((void*)extension_button, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 7, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetGalleryClientSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } wxSize wxRibbonArtProvider_php::GetGallerySize(wxDC& dc, const wxRibbonGallery* wnd, wxSize client_size) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetGallerySize\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetGallerySize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonGallery_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonGallery)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&client_size, le_wxSize)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetGallerySize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } int wxRibbonArtProvider_php::GetMetric(int id)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetMetric\n"); php_printf("===========================================\n"); #endif zval *arguments[1]; //Initilize arguments array for(int i=0; i<1; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetMetric", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], id); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 1, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetMetric'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return (int) Z_LVAL_P(return_value); } wxSize wxRibbonArtProvider_php::GetMinimisedPanelMinimumSize(wxDC& dc, const wxRibbonPanel* wnd, wxSize* desired_bitmap_size, wxDirection* expanded_panel_direction) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetMinimisedPanelMinimumSize\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetMinimisedPanelMinimumSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPanel_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPanel)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)desired_bitmap_size, le_wxSize)); ZVAL_LONG(arguments[3], *expanded_panel_direction); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetMinimisedPanelMinimumSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } wxRect wxRibbonArtProvider_php::GetPageBackgroundRedrawArea(wxDC& dc, const wxRibbonPage* wnd, wxSize page_old_size, wxSize page_new_size) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetPageBackgroundRedrawArea\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetPageBackgroundRedrawArea", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPage_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPage)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&page_old_size, le_wxSize)); object_init_ex(arguments[3], php_wxSize_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)&page_new_size, le_wxSize)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetPageBackgroundRedrawArea'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxRect*) return_object; } wxSize wxRibbonArtProvider_php::GetPanelClientSize(wxDC& dc, const wxRibbonPanel* wnd, wxSize size, wxPoint* client_offset) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetPanelClientSize\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetPanelClientSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPanel_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPanel)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&size, le_wxSize)); object_init_ex(arguments[3], php_wxPoint_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)client_offset, le_wxPoint)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetPanelClientSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } wxSize wxRibbonArtProvider_php::GetPanelSize(wxDC& dc, const wxRibbonPanel* wnd, wxSize client_size, wxPoint* client_offset) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetPanelSize\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetPanelSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPanel_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPanel)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&client_size, le_wxSize)); object_init_ex(arguments[3], php_wxPoint_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)client_offset, le_wxPoint)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetPanelSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } wxSize wxRibbonArtProvider_php::GetScrollButtonMinimumSize(wxDC& dc, wxWindow* wnd, long style) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetScrollButtonMinimumSize\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetScrollButtonMinimumSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); ZVAL_LONG(arguments[2], style); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetScrollButtonMinimumSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } wxSize wxRibbonArtProvider_php::GetToolSize(wxDC& dc, wxWindow* wnd, wxSize bitmap_size, wxRibbonButtonKind kind, bool is_first, bool is_last, wxRect* dropdown_region) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetToolSize\n"); php_printf("===========================================\n"); #endif zval *arguments[7]; //Initilize arguments array for(int i=0; i<7; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetToolSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&bitmap_size, le_wxSize)); ZVAL_LONG(arguments[3], kind); ZVAL_BOOL(arguments[4], is_first); ZVAL_BOOL(arguments[5], is_last); object_init_ex(arguments[6], php_wxRect_entry); add_property_resource(arguments[6], _wxResource, zend_list_insert((void*)dropdown_region, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 7, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetToolSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } PHP_METHOD(php_wxRibbonArtProvider, SetColor) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonArtProvider::SetColor\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonArtProvider::SetColor\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonArtProvider){ references = &((wxRibbonArtProvider_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long id0; zval* color0 = 0; void* object_pointer0_1 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO' (&id0, &color0, php_wxColour_entry)\n"); #endif char parse_parameters_string[] = "lO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &id0, &color0, php_wxColour_entry ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(color0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(color0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(color0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonArtProvider::SetColor((int) id0, *(wxColour*) object_pointer0_1)\n\n"); #endif if(parent_rsrc_type == le_wxRibbonArtProvider) { ((wxRibbonArtProvider_php*)_this)->SetColor((int) id0, *(wxColour*) object_pointer0_1); } references->AddReference(color0); return; break; } } } } void wxRibbonArtProvider_php::SetColourScheme(const wxColour& primary, const wxColour& secondary, const wxColour& tertiary) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::SetColourScheme\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "SetColourScheme", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxColour_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&primary, le_wxColour)); object_init_ex(arguments[1], php_wxColour_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&secondary, le_wxColour)); object_init_ex(arguments[2], php_wxColour_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&tertiary, le_wxColour)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'SetColourScheme'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::SetFlags(long flags) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::SetFlags\n"); php_printf("===========================================\n"); #endif zval *arguments[1]; //Initilize arguments array for(int i=0; i<1; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "SetFlags", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], flags); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 1, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'SetFlags'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::SetFont(int id, const wxFont& font) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::SetFont\n"); php_printf("===========================================\n"); #endif zval *arguments[2]; //Initilize arguments array for(int i=0; i<2; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "SetFont", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], id); object_init_ex(arguments[1], php_wxFont_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&font, le_wxFont)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 2, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'SetFont'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::SetMetric(int id, int new_val) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::SetMetric\n"); php_printf("===========================================\n"); #endif zval *arguments[2]; //Initilize arguments array for(int i=0; i<2; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "SetMetric", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], id); ZVAL_LONG(arguments[1], new_val); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 2, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'SetMetric'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawButtonBarButton(wxDC& dc, wxWindow* wnd, const wxRect& rect, wxRibbonButtonKind kind, long state, const wxString& label, const wxBitmap& bitmap_large, const wxBitmap& bitmap_small) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawButtonBarButton\n"); php_printf("===========================================\n"); #endif zval *arguments[8]; //Initilize arguments array for(int i=0; i<8; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawButtonBarButton", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); ZVAL_LONG(arguments[3], kind); ZVAL_LONG(arguments[4], state); temp_string = (char*)malloc(sizeof(wxChar)*(label.size()+1)); strcpy(temp_string, (const char *) label.char_str()); ZVAL_STRING(arguments[5], temp_string, 1); free(temp_string); object_init_ex(arguments[6], php_wxBitmap_entry); add_property_resource(arguments[6], _wxResource, zend_list_insert((void*)&bitmap_large, le_wxBitmap)); object_init_ex(arguments[7], php_wxBitmap_entry); add_property_resource(arguments[7], _wxResource, zend_list_insert((void*)&bitmap_small, le_wxBitmap)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 8, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawButtonBarButton'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } bool wxRibbonArtProvider_php::GetButtonBarButtonSize(wxDC& dc, wxWindow* wnd, wxRibbonButtonKind kind, wxRibbonButtonBarButtonState size, const wxString& label, wxSize bitmap_size_large, wxSize bitmap_size_small, wxSize* button_size, wxRect* normal_region, wxRect* dropdown_region) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetButtonBarButtonSize\n"); php_printf("===========================================\n"); #endif zval *arguments[10]; //Initilize arguments array for(int i=0; i<10; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetButtonBarButtonSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); ZVAL_LONG(arguments[2], kind); ZVAL_LONG(arguments[3], size); temp_string = (char*)malloc(sizeof(wxChar)*(label.size()+1)); strcpy(temp_string, (const char *) label.char_str()); ZVAL_STRING(arguments[4], temp_string, 1); free(temp_string); object_init_ex(arguments[5], php_wxSize_entry); add_property_resource(arguments[5], _wxResource, zend_list_insert((void*)&bitmap_size_large, le_wxSize)); object_init_ex(arguments[6], php_wxSize_entry); add_property_resource(arguments[6], _wxResource, zend_list_insert((void*)&bitmap_size_small, le_wxSize)); object_init_ex(arguments[7], php_wxSize_entry); add_property_resource(arguments[7], _wxResource, zend_list_insert((void*)button_size, le_wxSize)); object_init_ex(arguments[8], php_wxRect_entry); add_property_resource(arguments[8], _wxResource, zend_list_insert((void*)normal_region, le_wxRect)); object_init_ex(arguments[9], php_wxRect_entry); add_property_resource(arguments[9], _wxResource, zend_list_insert((void*)dropdown_region, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 10, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetButtonBarButtonSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } void php_wxRibbonBar_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonBar_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonBar, ArePanelsShown) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::ArePanelsShown\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::ArePanelsShown\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::ArePanelsShown())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->ArePanelsShown()); return; break; } } } } PHP_METHOD(php_wxRibbonBar, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; zval* pos0 = 0; void* object_pointer0_2 = 0; zval* size0 = 0; void* object_pointer0_3 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Create((wxWindow*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Create((wxWindow*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2)); references->AddReference(parent0); references->AddReference(pos0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } } } } PHP_METHOD(php_wxRibbonBar, DismissExpandedPanel) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::DismissExpandedPanel\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::DismissExpandedPanel\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::DismissExpandedPanel())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->DismissExpandedPanel()); return; break; } } } } PHP_METHOD(php_wxRibbonBar, GetActivePage) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::GetActivePage\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::GetActivePage\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonBar::GetActivePage())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonBar_php*)_this)->GetActivePage()); return; break; } } } } PHP_METHOD(php_wxRibbonBar, GetPage) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::GetPage\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::GetPage\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long n0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&n0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &n0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::GetPage((int) n0) to return object pointer\n\n"); #endif wxRibbonPage_php* value_to_return1; value_to_return1 = (wxRibbonPage_php*) ((wxRibbonBar_php*)_this)->GetPage((int) n0); if(value_to_return1 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return1->references.IsUserInitialized()){ if(value_to_return1->phpObj != NULL){ *return_value = *value_to_return1->phpObj; zval_add_ref(&value_to_return1->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonPage_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return1, le_wxRibbonPage)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return1 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonBar, HidePanels) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::HidePanels\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::HidePanels\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::HidePanels()\n\n"); #endif ((wxRibbonBar_php*)_this)->HidePanels(); return; break; } } } } PHP_METHOD(php_wxRibbonBar, Realize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::Realize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::Realize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Realize())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Realize()); return; break; } } } } PHP_METHOD(php_wxRibbonBar, SetActivePage) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::SetActivePage\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::SetActivePage\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long page0; bool overload0_called = false; //Parameters for overload 1 zval* page1 = 0; void* object_pointer1_0 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&page0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &page0 ) == SUCCESS) { overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&page1)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &page1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(page1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(page1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(page1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::SetActivePage((size_t) page0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->SetActivePage((size_t) page0)); return; break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::SetActivePage((wxRibbonPage*) object_pointer1_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->SetActivePage((wxRibbonPage*) object_pointer1_0)); references->AddReference(page1); return; break; } } } } PHP_METHOD(php_wxRibbonBar, SetArtProvider) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::SetArtProvider\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::SetArtProvider\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* art0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&art0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &art0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(art0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(art0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(art0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::SetArtProvider((wxRibbonArtProvider*) object_pointer0_0)\n\n"); #endif ((wxRibbonBar_php*)_this)->SetArtProvider((wxRibbonArtProvider*) object_pointer0_0); references->AddReference(art0); return; break; } } } } PHP_METHOD(php_wxRibbonBar, SetTabCtrlMargins) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::SetTabCtrlMargins\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::SetTabCtrlMargins\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long left0; long right0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'll' (&left0, &right0)\n"); #endif char parse_parameters_string[] = "ll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &left0, &right0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::SetTabCtrlMargins((int) left0, (int) right0)\n\n"); #endif ((wxRibbonBar_php*)_this)->SetTabCtrlMargins((int) left0, (int) right0); return; break; } } } } PHP_METHOD(php_wxRibbonBar, ShowPanels) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::ShowPanels\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::ShowPanels\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool show0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 0 && arguments_received <= 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '|b' (&show0)\n"); #endif char parse_parameters_string[] = "|b"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &show0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::ShowPanels()\n\n"); #endif ((wxRibbonBar_php*)_this)->ShowPanels(); return; break; } case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::ShowPanels(show0)\n\n"); #endif ((wxRibbonBar_php*)_this)->ShowPanels(show0); return; break; } } } } PHP_METHOD(php_wxRibbonBar, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; zval* pos1 = 0; void* object_pointer1_2 = 0; zval* size1 = 0; void* object_pointer1_3 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonBar_php(); ((wxRibbonBar_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0)\n"); #endif _this = new wxRibbonBar_php((wxWindow*) object_pointer1_0); ((wxRibbonBar_php*) _this)->references.Initialize(); ((wxRibbonBar_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonBar_php*) _this)->references.Initialize(); ((wxRibbonBar_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2)\n"); #endif _this = new wxRibbonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2); ((wxRibbonBar_php*) _this)->references.Initialize(); ((wxRibbonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonBar_php*) _this)->references.AddReference(pos1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3)\n"); #endif _this = new wxRibbonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3); ((wxRibbonBar_php*) _this)->references.Initialize(); ((wxRibbonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonBar_php*) _this)->references.AddReference(pos1); ((wxRibbonBar_php*) _this)->references.AddReference(size1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1); ((wxRibbonBar_php*) _this)->references.Initialize(); ((wxRibbonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonBar_php*) _this)->references.AddReference(pos1); ((wxRibbonBar_php*) _this)->references.AddReference(size1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonBar); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonBar_php*) _this)->evnArray); array_init(((wxRibbonBar_php*) _this)->evnArray); ((wxRibbonBar_php*) _this)->phpObj = getThis(); ((wxRibbonBar_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonBar_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } void php_wxRibbonButtonBar_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonButtonBar_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonButtonBar, AddDropdownButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::AddDropdownButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::AddDropdownButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; char* label0; long label_len0; zval* bitmap0 = 0; void* object_pointer0_2 = 0; char* help_string0; long help_string_len0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 3 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lsO|s' (&button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0)\n"); #endif char parse_parameters_string[] = "lsO|s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0 ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddDropdownButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return3; value_to_return3 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddDropdownButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddDropdownButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return4; value_to_return4 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddDropdownButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, AddHybridButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::AddHybridButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::AddHybridButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; char* label0; long label_len0; zval* bitmap0 = 0; void* object_pointer0_2 = 0; char* help_string0; long help_string_len0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 3 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lsO|s' (&button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0)\n"); #endif char parse_parameters_string[] = "lsO|s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0 ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddHybridButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return3; value_to_return3 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddHybridButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddHybridButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return4; value_to_return4 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddHybridButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, AddToggleButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::AddToggleButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::AddToggleButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; char* label0; long label_len0; zval* bitmap0 = 0; void* object_pointer0_2 = 0; char* help_string0; long help_string_len0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 3 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lsO|s' (&button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0)\n"); #endif char parse_parameters_string[] = "lsO|s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0 ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddToggleButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return3; value_to_return3 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddToggleButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddToggleButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return4; value_to_return4 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddToggleButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, ClearButtons) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::ClearButtons\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::ClearButtons\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::ClearButtons()\n\n"); #endif ((wxRibbonButtonBar_php*)_this)->ClearButtons(); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; zval* pos0 = 0; void* object_pointer0_2 = 0; zval* size0 = 0; void* object_pointer0_3 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Create((wxWindow*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Create((wxWindow*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2)); references->AddReference(parent0); references->AddReference(pos0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, DeleteButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::DeleteButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::DeleteButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&button_id0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::DeleteButton((int) button_id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->DeleteButton((int) button_id0)); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, EnableButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::EnableButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::EnableButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; bool enable0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l|b' (&button_id0, &enable0)\n"); #endif char parse_parameters_string[] = "l|b"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &enable0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::EnableButton((int) button_id0)\n\n"); #endif ((wxRibbonButtonBar_php*)_this)->EnableButton((int) button_id0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::EnableButton((int) button_id0, enable0)\n\n"); #endif ((wxRibbonButtonBar_php*)_this)->EnableButton((int) button_id0, enable0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, Realize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::Realize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::Realize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Realize())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Realize()); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, ToggleButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::ToggleButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::ToggleButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; bool checked0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lb' (&button_id0, &checked0)\n"); #endif char parse_parameters_string[] = "lb"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &checked0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::ToggleButton((int) button_id0, checked0)\n\n"); #endif ((wxRibbonButtonBar_php*)_this)->ToggleButton((int) button_id0, checked0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; zval* pos1 = 0; void* object_pointer1_2 = 0; zval* size1 = 0; void* object_pointer1_3 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonButtonBar_php(); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0)\n"); #endif _this = new wxRibbonButtonBar_php((wxWindow*) object_pointer1_0); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); ((wxRibbonButtonBar_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonButtonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); ((wxRibbonButtonBar_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2)\n"); #endif _this = new wxRibbonButtonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); ((wxRibbonButtonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonButtonBar_php*) _this)->references.AddReference(pos1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3)\n"); #endif _this = new wxRibbonButtonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); ((wxRibbonButtonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonButtonBar_php*) _this)->references.AddReference(pos1); ((wxRibbonButtonBar_php*) _this)->references.AddReference(size1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonButtonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); ((wxRibbonButtonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonButtonBar_php*) _this)->references.AddReference(pos1); ((wxRibbonButtonBar_php*) _this)->references.AddReference(size1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonButtonBar); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonButtonBar_php*) _this)->evnArray); array_init(((wxRibbonButtonBar_php*) _this)->evnArray); ((wxRibbonButtonBar_php*) _this)->phpObj = getThis(); ((wxRibbonButtonBar_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonButtonBar_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonButtonBar, AddButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::AddButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::AddButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; char* label0; long label_len0; zval* bitmap0 = 0; void* object_pointer0_2 = 0; char* help_string0; long help_string_len0; long kind0; bool overload0_called = false; //Parameters for overload 1 long button_id1; char* label1; long label_len1; zval* bitmap1 = 0; void* object_pointer1_2 = 0; zval* bitmap_small1 = 0; void* object_pointer1_3 = 0; zval* bitmap_disabled1 = 0; void* object_pointer1_4 = 0; zval* bitmap_small_disabled1 = 0; void* object_pointer1_5 = 0; long kind1; char* help_string1; long help_string_len1; zval* client_data1 = 0; void* object_pointer1_8 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 4 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lsOs|l' (&button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0, &kind0)\n"); #endif char parse_parameters_string[] = "lsOs|l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0, &kind0 ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { goto overload1; } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { goto overload1; } } overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received >= 3 && arguments_received <= 9) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lsO|OOOlsz' (&button_id1, &label1, &label_len1, &bitmap1, php_wxBitmap_entry, &bitmap_small1, php_wxBitmap_entry, &bitmap_disabled1, php_wxBitmap_entry, &bitmap_small_disabled1, php_wxBitmap_entry, &kind1, &help_string1, &help_string_len1, &client_data1)\n"); #endif char parse_parameters_string[] = "lsO|OOOlsz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id1, &label1, &label_len1, &bitmap1, php_wxBitmap_entry, &bitmap_small1, php_wxBitmap_entry, &bitmap_disabled1, php_wxBitmap_entry, &bitmap_small_disabled1, php_wxBitmap_entry, &kind1, &help_string1, &help_string_len1, &client_data1 ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(bitmap1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(bitmap_small1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap_small1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap_small1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 5){ if(Z_TYPE_P(bitmap_disabled1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap_disabled1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_4 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_4 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap_disabled1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 6){ if(Z_TYPE_P(bitmap_small_disabled1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap_small_disabled1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_5 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_5 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap_small_disabled1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 9){ if(Z_TYPE_P(client_data1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(client_data1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_8 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_8 || (rsrc_type != le_wxEvtHandler && rsrc_type != le_wxWindow && rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow && rsrc_type != le_wxValidator && rsrc_type != le_wxTextValidator && rsrc_type != le_wxGenericValidator && rsrc_type != le_wxMenu && rsrc_type != le_wxAuiManager && rsrc_type != le_wxMouseEventsManager && rsrc_type != le_wxTimer && rsrc_type != le_wxEventBlocker && rsrc_type != le_wxProcess && rsrc_type != le_wxFileSystemWatcher && rsrc_type != le_wxTaskBarIcon && rsrc_type != le_wxNotificationMessage && rsrc_type != le_wxBitmapHandler && rsrc_type != le_wxImage && rsrc_type != le_wxSizer && rsrc_type != le_wxBoxSizer && rsrc_type != le_wxStaticBoxSizer && rsrc_type != le_wxWrapSizer && rsrc_type != le_wxStdDialogButtonSizer && rsrc_type != le_wxGridSizer && rsrc_type != le_wxFlexGridSizer && rsrc_type != le_wxGridBagSizer && rsrc_type != le_wxSizerItem && rsrc_type != le_wxGBSizerItem && rsrc_type != le_wxImageList && rsrc_type != le_wxDC && rsrc_type != le_wxWindowDC && rsrc_type != le_wxClientDC && rsrc_type != le_wxPaintDC && rsrc_type != le_wxScreenDC && rsrc_type != le_wxPostScriptDC && rsrc_type != le_wxPrinterDC && rsrc_type != le_wxMemoryDC && rsrc_type != le_wxBufferedDC && rsrc_type != le_wxBufferedPaintDC && rsrc_type != le_wxAutoBufferedPaintDC && rsrc_type != le_wxMirrorDC && rsrc_type != le_wxColour && rsrc_type != le_wxMenuItem && rsrc_type != le_wxEvent && rsrc_type != le_wxMenuEvent && rsrc_type != le_wxKeyEvent && rsrc_type != le_wxCommandEvent && rsrc_type != le_wxNotifyEvent && rsrc_type != le_wxTreeEvent && rsrc_type != le_wxBookCtrlEvent && rsrc_type != le_wxAuiNotebookEvent && rsrc_type != le_wxAuiToolBarEvent && rsrc_type != le_wxListEvent && rsrc_type != le_wxSpinEvent && rsrc_type != le_wxSplitterEvent && rsrc_type != le_wxSpinDoubleEvent && rsrc_type != le_wxGridSizeEvent && rsrc_type != le_wxWizardEvent && rsrc_type != le_wxGridEvent && rsrc_type != le_wxGridRangeSelectEvent && rsrc_type != le_wxDataViewEvent && rsrc_type != le_wxHeaderCtrlEvent && rsrc_type != le_wxRibbonBarEvent && rsrc_type != le_wxStyledTextEvent && rsrc_type != le_wxChildFocusEvent && rsrc_type != le_wxHtmlCellEvent && rsrc_type != le_wxHtmlLinkEvent && rsrc_type != le_wxHyperlinkEvent && rsrc_type != le_wxColourPickerEvent && rsrc_type != le_wxFontPickerEvent && rsrc_type != le_wxScrollEvent && rsrc_type != le_wxWindowModalDialogEvent && rsrc_type != le_wxDateEvent && rsrc_type != le_wxCalendarEvent && rsrc_type != le_wxWindowCreateEvent && rsrc_type != le_wxWindowDestroyEvent && rsrc_type != le_wxUpdateUIEvent && rsrc_type != le_wxHelpEvent && rsrc_type != le_wxGridEditorCreatedEvent && rsrc_type != le_wxCollapsiblePaneEvent && rsrc_type != le_wxClipboardTextEvent && rsrc_type != le_wxFileCtrlEvent && rsrc_type != le_wxSashEvent && rsrc_type != le_wxFileDirPickerEvent && rsrc_type != le_wxContextMenuEvent && rsrc_type != le_wxRibbonButtonBarEvent && rsrc_type != le_wxRibbonGalleryEvent && rsrc_type != le_wxCloseEvent && rsrc_type != le_wxActivateEvent && rsrc_type != le_wxAuiManagerEvent && rsrc_type != le_wxSizeEvent && rsrc_type != le_wxMouseEvent && rsrc_type != le_wxMoveEvent && rsrc_type != le_wxTimerEvent && rsrc_type != le_wxThreadEvent && rsrc_type != le_wxScrollWinEvent && rsrc_type != le_wxSysColourChangedEvent && rsrc_type != le_wxProcessEvent && rsrc_type != le_wxEraseEvent && rsrc_type != le_wxSetCursorEvent && rsrc_type != le_wxIdleEvent && rsrc_type != le_wxPaintEvent && rsrc_type != le_wxPaletteChangedEvent && rsrc_type != le_wxInitDialogEvent && rsrc_type != le_wxMaximizeEvent && rsrc_type != le_wxNavigationKeyEvent && rsrc_type != le_wxFocusEvent && rsrc_type != le_wxFileSystemWatcherEvent && rsrc_type != le_wxDisplayChangedEvent && rsrc_type != le_wxCalculateLayoutEvent && rsrc_type != le_wxQueryLayoutInfoEvent && rsrc_type != le_wxTaskBarIconEvent && rsrc_type != le_wxAcceleratorTable && rsrc_type != le_wxGDIObject && rsrc_type != le_wxBitmap && rsrc_type != le_wxPalette && rsrc_type != le_wxIcon && rsrc_type != le_wxFont && rsrc_type != le_wxAnimation && rsrc_type != le_wxIconBundle && rsrc_type != le_wxCursor && rsrc_type != le_wxRegion && rsrc_type != le_wxPen && rsrc_type != le_wxBrush && rsrc_type != le_wxArtProvider && rsrc_type != le_wxHtmlCell && rsrc_type != le_wxHtmlContainerCell && rsrc_type != le_wxHtmlColourCell && rsrc_type != le_wxHtmlWidgetCell && rsrc_type != le_wxHtmlEasyPrinting && rsrc_type != le_wxHtmlLinkInfo && rsrc_type != le_wxFindReplaceData && rsrc_type != le_wxSound && rsrc_type != le_wxFileSystem && rsrc_type != le_wxFileSystemHandler && rsrc_type != le_wxMask && rsrc_type != le_wxToolTip && rsrc_type != le_wxGraphicsRenderer && rsrc_type != le_wxLayoutConstraints && rsrc_type != le_wxFSFile && rsrc_type != le_wxColourData && rsrc_type != le_wxFontData && rsrc_type != le_wxGridTableBase && rsrc_type != le_wxDataViewRenderer && rsrc_type != le_wxDataViewBitmapRenderer && rsrc_type != le_wxDataViewChoiceRenderer && rsrc_type != le_wxDataViewCustomRenderer && rsrc_type != le_wxDataViewSpinRenderer && rsrc_type != le_wxDataViewDateRenderer && rsrc_type != le_wxDataViewIconTextRenderer && rsrc_type != le_wxDataViewProgressRenderer && rsrc_type != le_wxDataViewTextRenderer && rsrc_type != le_wxDataViewToggleRenderer && rsrc_type != le_wxDataViewIconText && rsrc_type != le_wxVariant && rsrc_type != le_wxClipboard && rsrc_type != le_wxConfigBase && rsrc_type != le_wxFileConfig && rsrc_type != le_wxXmlResource && rsrc_type != le_wxPageSetupDialogData && rsrc_type != le_wxPrintDialogData && rsrc_type != le_wxPrintData && rsrc_type != le_wxPrintPreview && rsrc_type != le_wxPrinter && rsrc_type != le_wxPrintout && rsrc_type != le_wxHtmlPrintout && rsrc_type != le_wxHtmlDCRenderer && rsrc_type != le_wxHtmlFilter && rsrc_type != le_wxHtmlHelpData && rsrc_type != le_wxHtmlTagHandler && rsrc_type != le_wxHtmlWinTagHandler && rsrc_type != le_wxModule && rsrc_type != le_wxHtmlTagsModule && rsrc_type != le_wxImageHandler && rsrc_type != le_wxXmlResourceHandler && rsrc_type != le_wxXmlDocument && rsrc_type != le_wxLayoutAlgorithm && rsrc_type != le_wxFileHistory && rsrc_type != le_wxToolBarToolBase)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(client_data1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return4; value_to_return4 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8), (wxRibbonButtonKind) kind0) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return5; value_to_return5 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8), (wxRibbonButtonKind) kind0); if(value_to_return5 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return5->references.IsUserInitialized()){ if(value_to_return5->phpObj != NULL){ *return_value = *value_to_return5->phpObj; zval_add_ref(&value_to_return5->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return5, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return5 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } if(overload1_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return3; value_to_return3 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return4; value_to_return4 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return5; value_to_return5 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4); if(value_to_return5 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return5->references.IsUserInitialized()){ if(value_to_return5->phpObj != NULL){ *return_value = *value_to_return5->phpObj; zval_add_ref(&value_to_return5->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return5, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return5 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); references->AddReference(bitmap_disabled1); return; break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return6; value_to_return6 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5); if(value_to_return6 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return6->references.IsUserInitialized()){ if(value_to_return6->phpObj != NULL){ *return_value = *value_to_return6->phpObj; zval_add_ref(&value_to_return6->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return6, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return6 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); references->AddReference(bitmap_disabled1); references->AddReference(bitmap_small_disabled1); return; break; } case 7: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return7; value_to_return7 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1); if(value_to_return7 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return7->references.IsUserInitialized()){ if(value_to_return7->phpObj != NULL){ *return_value = *value_to_return7->phpObj; zval_add_ref(&value_to_return7->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return7, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return7 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); references->AddReference(bitmap_disabled1); references->AddReference(bitmap_small_disabled1); return; break; } case 8: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1, wxString(help_string1, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return8; value_to_return8 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1, wxString(help_string1, wxConvUTF8)); if(value_to_return8 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return8->references.IsUserInitialized()){ if(value_to_return8->phpObj != NULL){ *return_value = *value_to_return8->phpObj; zval_add_ref(&value_to_return8->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return8, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return8 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); references->AddReference(bitmap_disabled1); references->AddReference(bitmap_small_disabled1); return; break; } case 9: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1, wxString(help_string1, wxConvUTF8), (wxObject*) object_pointer1_8) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return9; value_to_return9 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1, wxString(help_string1, wxConvUTF8), (wxObject*) object_pointer1_8); if(value_to_return9 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return9->references.IsUserInitialized()){ if(value_to_return9->phpObj != NULL){ *return_value = *value_to_return9->phpObj; zval_add_ref(&value_to_return9->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return9, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return9 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); references->AddReference(bitmap_disabled1); references->AddReference(bitmap_small_disabled1); references->AddReference(client_data1); return; break; } } } } void php_wxRibbonControl_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonControl_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } wxSize wxRibbonControl_php::DoGetNextLargerSize(wxOrientation direction, wxSize relative_to)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonControl::DoGetNextLargerSize\n"); php_printf("===========================================\n"); #endif zval *arguments[2]; //Initilize arguments array for(int i=0; i<2; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DoGetNextLargerSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], direction); object_init_ex(arguments[1], php_wxSize_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&relative_to, le_wxSize)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 2, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } #ifdef USE_WXPHP_DEBUG php_printf("Calling original method\n"); php_printf("===========================================\n\n"); #endif //Call original method return wxRibbonControl::DoGetNextLargerSize(direction, relative_to); } wxSize wxRibbonControl_php::DoGetNextSmallerSize(wxOrientation direction, wxSize relative_to)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonControl::DoGetNextSmallerSize\n"); php_printf("===========================================\n"); #endif zval *arguments[2]; //Initilize arguments array for(int i=0; i<2; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DoGetNextSmallerSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], direction); object_init_ex(arguments[1], php_wxSize_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&relative_to, le_wxSize)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 2, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } #ifdef USE_WXPHP_DEBUG php_printf("Calling original method\n"); php_printf("===========================================\n\n"); #endif //Call original method return wxRibbonControl::DoGetNextSmallerSize(direction, relative_to); } PHP_METHOD(php_wxRibbonControl, GetArtProvider) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::GetArtProvider\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::GetArtProvider\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::GetArtProvider() to return object pointer\n\n"); #endif wxRibbonArtProvider_php* value_to_return0; value_to_return0 = (wxRibbonArtProvider_php*) ((wxRibbonControl_php*)_this)->GetArtProvider(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonArtProvider_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonArtProvider)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonControl, GetNextLargerSize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::GetNextLargerSize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::GetNextLargerSize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long direction0; bool overload0_called = false; //Parameters for overload 1 long direction1; zval* relative_to1 = 0; void* object_pointer1_1 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&direction0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &direction0 ) == SUCCESS) { overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO' (&direction1, &relative_to1, php_wxSize_entry)\n"); #endif char parse_parameters_string[] = "lO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &direction1, &relative_to1, php_wxSize_entry ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(relative_to1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(relative_to1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(relative_to1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::GetNextLargerSize((wxOrientation) direction0) to return new object\n\n"); #endif wxSize value_to_return1; value_to_return1 = ((wxRibbonControl_php*)_this)->GetNextLargerSize((wxOrientation) direction0); void* ptr = safe_emalloc(1, sizeof(wxSize_php), 0); memcpy(ptr, &value_to_return1, sizeof(wxSize)); object_init_ex(return_value, php_wxSize_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxSize)); return; break; } } } if(overload1_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::GetNextLargerSize((wxOrientation) direction1, *(wxSize*) object_pointer1_1) to return new object\n\n"); #endif wxSize value_to_return2; value_to_return2 = ((wxRibbonControl_php*)_this)->GetNextLargerSize((wxOrientation) direction1, *(wxSize*) object_pointer1_1); void* ptr = safe_emalloc(1, sizeof(wxSize_php), 0); memcpy(ptr, &value_to_return2, sizeof(wxSize)); object_init_ex(return_value, php_wxSize_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxSize)); return; break; } } } } PHP_METHOD(php_wxRibbonControl, GetNextSmallerSize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::GetNextSmallerSize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::GetNextSmallerSize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long direction0; bool overload0_called = false; //Parameters for overload 1 long direction1; zval* relative_to1 = 0; void* object_pointer1_1 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&direction0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &direction0 ) == SUCCESS) { overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO' (&direction1, &relative_to1, php_wxSize_entry)\n"); #endif char parse_parameters_string[] = "lO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &direction1, &relative_to1, php_wxSize_entry ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(relative_to1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(relative_to1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(relative_to1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::GetNextSmallerSize((wxOrientation) direction0) to return new object\n\n"); #endif wxSize value_to_return1; value_to_return1 = ((wxRibbonControl_php*)_this)->GetNextSmallerSize((wxOrientation) direction0); void* ptr = safe_emalloc(1, sizeof(wxSize_php), 0); memcpy(ptr, &value_to_return1, sizeof(wxSize)); object_init_ex(return_value, php_wxSize_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxSize)); return; break; } } } if(overload1_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::GetNextSmallerSize((wxOrientation) direction1, *(wxSize*) object_pointer1_1) to return new object\n\n"); #endif wxSize value_to_return2; value_to_return2 = ((wxRibbonControl_php*)_this)->GetNextSmallerSize((wxOrientation) direction1, *(wxSize*) object_pointer1_1); void* ptr = safe_emalloc(1, sizeof(wxSize_php), 0); memcpy(ptr, &value_to_return2, sizeof(wxSize)); object_init_ex(return_value, php_wxSize_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxSize)); return; break; } } } } PHP_METHOD(php_wxRibbonControl, IsSizingContinuous) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::IsSizingContinuous\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::IsSizingContinuous\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonControl::IsSizingContinuous())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonControl_php*)_this)->IsSizingContinuous()); return; break; } } } } PHP_METHOD(php_wxRibbonControl, Realise) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::Realise\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::Realise\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonControl::Realise())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonControl_php*)_this)->Realise()); return; break; } } } } PHP_METHOD(php_wxRibbonControl, Realize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::Realize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::Realize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonControl::Realize())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonControl_php*)_this)->Realize()); return; break; } } } } PHP_METHOD(php_wxRibbonControl, SetArtProvider) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::SetArtProvider\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::SetArtProvider\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* art0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&art0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &art0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(art0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(art0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(art0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::SetArtProvider((wxRibbonArtProvider*) object_pointer0_0)\n\n"); #endif ((wxRibbonControl_php*)_this)->SetArtProvider((wxRibbonArtProvider*) object_pointer0_0); references->AddReference(art0); return; break; } } } } PHP_METHOD(php_wxRibbonControl, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; zval* pos1 = 0; void* object_pointer1_2 = 0; zval* size1 = 0; void* object_pointer1_3 = 0; long style1; zval* validator1 = 0; void* object_pointer1_5 = 0; char* name1; long name_len1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 2 && arguments_received <= 7) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'zl|OOlOs' (&parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1, &validator1, php_wxValidator_entry, &name1, &name_len1)\n"); #endif char parse_parameters_string[] = "zl|OOlOs"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1, &validator1, php_wxValidator_entry, &name1, &name_len1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 6){ if(Z_TYPE_P(validator1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(validator1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_5 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_5 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(validator1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonControl_php(); ((wxRibbonControl_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2)\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); ((wxRibbonControl_php*) _this)->references.AddReference(pos1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3)\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); ((wxRibbonControl_php*) _this)->references.AddReference(pos1); ((wxRibbonControl_php*) _this)->references.AddReference(size1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); ((wxRibbonControl_php*) _this)->references.AddReference(pos1); ((wxRibbonControl_php*) _this)->references.AddReference(size1); break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1, *(wxValidator*) object_pointer1_5)\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1, *(wxValidator*) object_pointer1_5); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); ((wxRibbonControl_php*) _this)->references.AddReference(pos1); ((wxRibbonControl_php*) _this)->references.AddReference(size1); ((wxRibbonControl_php*) _this)->references.AddReference(validator1); break; } case 7: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1, *(wxValidator*) object_pointer1_5, wxString(name1, wxConvUTF8))\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1, *(wxValidator*) object_pointer1_5, wxString(name1, wxConvUTF8)); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); ((wxRibbonControl_php*) _this)->references.AddReference(pos1); ((wxRibbonControl_php*) _this)->references.AddReference(size1); ((wxRibbonControl_php*) _this)->references.AddReference(validator1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonControl); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonControl_php*) _this)->evnArray); array_init(((wxRibbonControl_php*) _this)->evnArray); ((wxRibbonControl_php*) _this)->phpObj = getThis(); ((wxRibbonControl_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonControl_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } void php_wxRibbonGallery_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonGallery_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonGallery, Append) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::Append\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::Append\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* bitmap0 = 0; void* object_pointer0_0 = 0; long id0; bool overload0_called = false; //Parameters for overload 1 zval* bitmap1 = 0; void* object_pointer1_0 = 0; long id1; char* clientData1; long clientData_len1; zval* clientData1_ref; bool overload1_called = false; //Parameters for overload 2 zval* bitmap2 = 0; void* object_pointer2_0 = 0; long id2; zval* clientData2 = 0; void* object_pointer2_2 = 0; bool overload2_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Ol' (&bitmap0, php_wxBitmap_entry, &id0)\n"); #endif char parse_parameters_string[] = "Ol"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &bitmap0, php_wxBitmap_entry, &id0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { goto overload1; } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { goto overload1; } } overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received == 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Ols' (&bitmap1, php_wxBitmap_entry, &id1, &clientData1, &clientData_len1)\n"); #endif char parse_parameters_string[] = "Ols"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &bitmap1, php_wxBitmap_entry, &id1, &clientData1, &clientData_len1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(bitmap1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 ) { goto overload2; } } else if(Z_TYPE_P(bitmap1) != IS_NULL) { goto overload2; } } overload1_called = true; already_called = true; char parse_references_string[] = "zzz"; zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_references_string, &dummy, &dummy, &clientData1_ref ); } } //Overload 2 overload2: if(!already_called && arguments_received == 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Olz' (&bitmap2, php_wxBitmap_entry, &id2, &clientData2)\n"); #endif char parse_parameters_string[] = "Olz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &bitmap2, php_wxBitmap_entry, &id2, &clientData2 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(bitmap2) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap2), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer2_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer2_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap2) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(clientData2) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(clientData2), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer2_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer2_2 || (rsrc_type != le_wxTreeItemData)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(clientData2) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload2_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::Append(*(wxBitmap*) object_pointer0_0, (int) id0) to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return2; value_to_return2 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->Append(*(wxBitmap*) object_pointer0_0, (int) id0); if(value_to_return2 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return2->references.IsUserInitialized()){ if(value_to_return2->phpObj != NULL){ *return_value = *value_to_return2->phpObj; zval_add_ref(&value_to_return2->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return2, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return2 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } if(overload1_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::Append(*(wxBitmap*) object_pointer1_0, (int) id1, (void*) clientData1) to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return3; value_to_return3 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->Append(*(wxBitmap*) object_pointer1_0, (int) id1, (void*) clientData1); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); ZVAL_STRING(clientData1_ref, (char*) clientData1, 1); return; break; } } } if(overload2_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::Append(*(wxBitmap*) object_pointer2_0, (int) id2, (wxClientData*) object_pointer2_2) to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return3; value_to_return3 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->Append(*(wxBitmap*) object_pointer2_0, (int) id2, (wxClientData*) object_pointer2_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap2); references->AddReference(clientData2); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, Clear) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::Clear\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::Clear\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::Clear()\n\n"); #endif ((wxRibbonGallery_php*)_this)->Clear(); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; zval* pos0 = 0; void* object_pointer0_2 = 0; zval* size0 = 0; void* object_pointer0_3 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::Create((wxWindow*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->Create((wxWindow*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2)); references->AddReference(parent0); references->AddReference(pos0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, EnsureVisible) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::EnsureVisible\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::EnsureVisible\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&item0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::EnsureVisible((const wxRibbonGalleryItem*) object_pointer0_0)\n\n"); #endif ((wxRibbonGallery_php*)_this)->EnsureVisible((const wxRibbonGalleryItem*) object_pointer0_0); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetActiveItem) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetActiveItem\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetActiveItem\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetActiveItem() to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return0; value_to_return0 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->GetActiveItem(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetCount) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetCount\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetCount\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonGallery::GetCount())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonGallery_php*)_this)->GetCount()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetDownButtonState) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetDownButtonState\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetDownButtonState\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonGallery::GetDownButtonState())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonGallery_php*)_this)->GetDownButtonState()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetExtensionButtonState) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetExtensionButtonState\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetExtensionButtonState\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonGallery::GetExtensionButtonState())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonGallery_php*)_this)->GetExtensionButtonState()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetHoveredItem) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetHoveredItem\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetHoveredItem\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetHoveredItem() to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return0; value_to_return0 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->GetHoveredItem(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetItem) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetItem\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetItem\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long n0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&n0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &n0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetItem((unsigned int) n0) to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return1; value_to_return1 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->GetItem((unsigned int) n0); if(value_to_return1 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return1->references.IsUserInitialized()){ if(value_to_return1->phpObj != NULL){ *return_value = *value_to_return1->phpObj; zval_add_ref(&value_to_return1->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return1, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return1 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetItemClientData) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetItemClientData\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetItemClientData\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&item0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetItemClientData((const wxRibbonGalleryItem*) object_pointer0_0)\n\n"); #endif ZVAL_STRING(return_value, (char*) ((wxRibbonGallery_php*)_this)->GetItemClientData((const wxRibbonGalleryItem*) object_pointer0_0), 1); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetItemClientObject) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetItemClientObject\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetItemClientObject\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&item0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetItemClientObject((const wxRibbonGalleryItem*) object_pointer0_0) to return object pointer\n\n"); #endif wxClientData_php* value_to_return1; value_to_return1 = (wxClientData_php*) ((wxRibbonGallery_php*)_this)->GetItemClientObject((const wxRibbonGalleryItem*) object_pointer0_0); if(value_to_return1 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return1->references.IsUserInitialized()){ if(value_to_return1->phpObj != NULL){ *return_value = *value_to_return1->phpObj; zval_add_ref(&value_to_return1->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxClientData_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return1, le_wxClientData)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return1 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetSelection) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetSelection\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetSelection\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetSelection() to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return0; value_to_return0 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->GetSelection(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetUpButtonState) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetUpButtonState\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetUpButtonState\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonGallery::GetUpButtonState())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonGallery_php*)_this)->GetUpButtonState()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, IsEmpty) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::IsEmpty\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::IsEmpty\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::IsEmpty())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->IsEmpty()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, IsHovered) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::IsHovered\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::IsHovered\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::IsHovered())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->IsHovered()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, ScrollLines) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::ScrollLines\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::ScrollLines\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long lines0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&lines0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &lines0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::ScrollLines((int) lines0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->ScrollLines((int) lines0)); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, ScrollPixels) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::ScrollPixels\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::ScrollPixels\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long pixels0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&pixels0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &pixels0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::ScrollPixels((int) pixels0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->ScrollPixels((int) pixels0)); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, SetItemClientData) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::SetItemClientData\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::SetItemClientData\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; char* data0; long data_len0; zval* data0_ref; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'zs' (&item0, &data0, &data_len0)\n"); #endif char parse_parameters_string[] = "zs"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, &data0, &data_len0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; char parse_references_string[] = "zz"; zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_references_string, &dummy, &data0_ref ); } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::SetItemClientData((wxRibbonGalleryItem*) object_pointer0_0, (void*) data0)\n\n"); #endif ((wxRibbonGallery_php*)_this)->SetItemClientData((wxRibbonGalleryItem*) object_pointer0_0, (void*) data0); references->AddReference(item0); ZVAL_STRING(data0_ref, (char*) data0, 1); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, SetItemClientObject) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::SetItemClientObject\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::SetItemClientObject\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; zval* data0 = 0; void* object_pointer0_1 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'zz' (&item0, &data0)\n"); #endif char parse_parameters_string[] = "zz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, &data0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 2){ if(Z_TYPE_P(data0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(data0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_1 || (rsrc_type != le_wxTreeItemData)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(data0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::SetItemClientObject((wxRibbonGalleryItem*) object_pointer0_0, (wxClientData*) object_pointer0_1)\n\n"); #endif ((wxRibbonGallery_php*)_this)->SetItemClientObject((wxRibbonGalleryItem*) object_pointer0_0, (wxClientData*) object_pointer0_1); references->AddReference(item0); references->AddReference(data0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, SetSelection) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::SetSelection\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::SetSelection\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&item0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::SetSelection((wxRibbonGalleryItem*) object_pointer0_0)\n\n"); #endif ((wxRibbonGallery_php*)_this)->SetSelection((wxRibbonGalleryItem*) object_pointer0_0); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; zval* pos1 = 0; void* object_pointer1_2 = 0; zval* size1 = 0; void* object_pointer1_3 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonGallery_php(); ((wxRibbonGallery_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0)\n"); #endif _this = new wxRibbonGallery_php((wxWindow*) object_pointer1_0); ((wxRibbonGallery_php*) _this)->references.Initialize(); ((wxRibbonGallery_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonGallery_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonGallery_php*) _this)->references.Initialize(); ((wxRibbonGallery_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2)\n"); #endif _this = new wxRibbonGallery_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2); ((wxRibbonGallery_php*) _this)->references.Initialize(); ((wxRibbonGallery_php*) _this)->references.AddReference(parent1); ((wxRibbonGallery_php*) _this)->references.AddReference(pos1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3)\n"); #endif _this = new wxRibbonGallery_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3); ((wxRibbonGallery_php*) _this)->references.Initialize(); ((wxRibbonGallery_php*) _this)->references.AddReference(parent1); ((wxRibbonGallery_php*) _this)->references.AddReference(pos1); ((wxRibbonGallery_php*) _this)->references.AddReference(size1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonGallery_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1); ((wxRibbonGallery_php*) _this)->references.Initialize(); ((wxRibbonGallery_php*) _this)->references.AddReference(parent1); ((wxRibbonGallery_php*) _this)->references.AddReference(pos1); ((wxRibbonGallery_php*) _this)->references.AddReference(size1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonGallery); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonGallery_php*) _this)->evnArray); array_init(((wxRibbonGallery_php*) _this)->evnArray); ((wxRibbonGallery_php*) _this)->phpObj = getThis(); ((wxRibbonGallery_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonGallery_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } void php_wxRibbonPage_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonPage_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonPage, AdjustRectToIncludeScrollButtons) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::AdjustRectToIncludeScrollButtons\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::AdjustRectToIncludeScrollButtons\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* rect0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&rect0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &rect0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(rect0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(rect0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(rect0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPage::AdjustRectToIncludeScrollButtons((wxRect*) object_pointer0_0)\n\n"); #endif ((wxRibbonPage_php*)_this)->AdjustRectToIncludeScrollButtons((wxRect*) object_pointer0_0); references->AddReference(rect0); return; break; } } } } PHP_METHOD(php_wxRibbonPage, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; char* label0; long label_len0; zval* icon0 = 0; void* object_pointer0_3 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lsOl' (&parent0, &id0, &label0, &label_len0, &icon0, php_wxBitmap_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lsOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &label0, &label_len0, &icon0, php_wxBitmap_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(icon0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(icon0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(icon0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Create((wxRibbonBar*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Create((wxRibbonBar*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8)))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8))); references->AddReference(parent0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(icon0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, (long) style0)); references->AddReference(parent0); references->AddReference(icon0); return; break; } } } } PHP_METHOD(php_wxRibbonPage, DismissExpandedPanel) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::DismissExpandedPanel\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::DismissExpandedPanel\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::DismissExpandedPanel())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->DismissExpandedPanel()); return; break; } } } } PHP_METHOD(php_wxRibbonPage, GetIcon) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::GetIcon\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::GetIcon\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPage::GetIcon() to return object reference\n\n"); #endif wxBitmap_php* value_to_return0; value_to_return0 = (wxBitmap_php*) &((wxRibbonPage_php*)_this)->GetIcon(); if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxBitmap_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxBitmap)); } if(value_to_return0 != _this && return_is_user_initialized){ //Prevent adding references to it self references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonPage, GetMajorAxis) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::GetMajorAxis\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::GetMajorAxis\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonPage::GetMajorAxis())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonPage_php*)_this)->GetMajorAxis()); return; break; } } } } PHP_METHOD(php_wxRibbonPage, Realize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::Realize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::Realize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Realize())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Realize()); return; break; } } } } PHP_METHOD(php_wxRibbonPage, ScrollLines) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::ScrollLines\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::ScrollLines\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long lines0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&lines0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &lines0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::ScrollLines((int) lines0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->ScrollLines((int) lines0)); return; break; } } } } PHP_METHOD(php_wxRibbonPage, ScrollPixels) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::ScrollPixels\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::ScrollPixels\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long pixels0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&pixels0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &pixels0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::ScrollPixels((int) pixels0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->ScrollPixels((int) pixels0)); return; break; } } } } PHP_METHOD(php_wxRibbonPage, SetArtProvider) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::SetArtProvider\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::SetArtProvider\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* art0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&art0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &art0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(art0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(art0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(art0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPage::SetArtProvider((wxRibbonArtProvider*) object_pointer0_0)\n\n"); #endif ((wxRibbonPage_php*)_this)->SetArtProvider((wxRibbonArtProvider*) object_pointer0_0); references->AddReference(art0); return; break; } } } } PHP_METHOD(php_wxRibbonPage, SetSizeWithScrollButtonAdjustment) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::SetSizeWithScrollButtonAdjustment\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::SetSizeWithScrollButtonAdjustment\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long x0; long y0; long width0; long height0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'llll' (&x0, &y0, &width0, &height0)\n"); #endif char parse_parameters_string[] = "llll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &x0, &y0, &width0, &height0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPage::SetSizeWithScrollButtonAdjustment((int) x0, (int) y0, (int) width0, (int) height0)\n\n"); #endif ((wxRibbonPage_php*)_this)->SetSizeWithScrollButtonAdjustment((int) x0, (int) y0, (int) width0, (int) height0); return; break; } } } } PHP_METHOD(php_wxRibbonPage, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; char* label1; long label_len1; zval* icon1 = 0; void* object_pointer1_3 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lsOl' (&parent1, &id1, &label1, &label_len1, &icon1, php_wxBitmap_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lsOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &label1, &label_len1, &icon1, php_wxBitmap_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(icon1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(icon1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(icon1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonPage_php(); ((wxRibbonPage_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxRibbonBar*) object_pointer1_0)\n"); #endif _this = new wxRibbonPage_php((wxRibbonBar*) object_pointer1_0); ((wxRibbonPage_php*) _this)->references.Initialize(); ((wxRibbonPage_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonPage_php((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonPage_php*) _this)->references.Initialize(); ((wxRibbonPage_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8))\n"); #endif _this = new wxRibbonPage_php((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8)); ((wxRibbonPage_php*) _this)->references.Initialize(); ((wxRibbonPage_php*) _this)->references.AddReference(parent1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3)\n"); #endif _this = new wxRibbonPage_php((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3); ((wxRibbonPage_php*) _this)->references.Initialize(); ((wxRibbonPage_php*) _this)->references.AddReference(parent1); ((wxRibbonPage_php*) _this)->references.AddReference(icon1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonPage_php((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, (long) style1); ((wxRibbonPage_php*) _this)->references.Initialize(); ((wxRibbonPage_php*) _this)->references.AddReference(parent1); ((wxRibbonPage_php*) _this)->references.AddReference(icon1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonPage); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonPage_php*) _this)->evnArray); array_init(((wxRibbonPage_php*) _this)->evnArray); ((wxRibbonPage_php*) _this)->phpObj = getThis(); ((wxRibbonPage_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonPage_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } void php_wxRibbonPanel_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonPanel_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonPanel, CanAutoMinimise) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::CanAutoMinimise\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::CanAutoMinimise\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::CanAutoMinimise())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->CanAutoMinimise()); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; char* label0; long label_len0; zval* icon0 = 0; void* object_pointer0_3 = 0; zval* pos0 = 0; void* object_pointer0_4 = 0; zval* size0 = 0; void* object_pointer0_5 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 7) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lsOOOl' (&parent0, &id0, &label0, &label_len0, &icon0, php_wxBitmap_entry, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lsOOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &label0, &label_len0, &icon0, php_wxBitmap_entry, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(icon0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(icon0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(icon0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 5){ if(Z_TYPE_P(pos0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_4 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_4 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 6){ if(Z_TYPE_P(size0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_5 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_5 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8)))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8))); references->AddReference(parent0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(icon0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(pos0); return; break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4, *(wxSize*) object_pointer0_5))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4, *(wxSize*) object_pointer0_5)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(pos0); references->AddReference(size0); return; break; } case 7: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4, *(wxSize*) object_pointer0_5, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4, *(wxSize*) object_pointer0_5, (long) style0)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(pos0); references->AddReference(size0); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, GetExpandedDummy) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::GetExpandedDummy\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::GetExpandedDummy\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPanel::GetExpandedDummy() to return object pointer\n\n"); #endif wxRibbonPanel_php* value_to_return0; value_to_return0 = (wxRibbonPanel_php*) ((wxRibbonPanel_php*)_this)->GetExpandedDummy(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonPanel_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonPanel)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonPanel, GetExpandedPanel) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::GetExpandedPanel\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::GetExpandedPanel\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPanel::GetExpandedPanel() to return object pointer\n\n"); #endif wxRibbonPanel_php* value_to_return0; value_to_return0 = (wxRibbonPanel_php*) ((wxRibbonPanel_php*)_this)->GetExpandedPanel(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonPanel_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonPanel)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonPanel, GetMinimisedIcon) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::GetMinimisedIcon\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::GetMinimisedIcon\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload1_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPanel::GetMinimisedIcon() to return object reference\n\n"); #endif wxBitmap_php* value_to_return0; value_to_return0 = (wxBitmap_php*) &((wxRibbonPanel_php*)_this)->GetMinimisedIcon(); if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxBitmap_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxBitmap)); } if(value_to_return0 != _this && return_is_user_initialized){ //Prevent adding references to it self references->AddReference(return_value); } return; break; } } } if(overload1_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPanel::GetMinimisedIcon() to return object reference\n\n"); #endif wxBitmap_php* value_to_return0; value_to_return0 = (wxBitmap_php*) &((wxRibbonPanel_php*)_this)->GetMinimisedIcon(); if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxBitmap_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxBitmap)); } if(value_to_return0 != _this && return_is_user_initialized){ //Prevent adding references to it self references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonPanel, HideExpanded) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::HideExpanded\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::HideExpanded\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::HideExpanded())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->HideExpanded()); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, IsHovered) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::IsHovered\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::IsHovered\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::IsHovered())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->IsHovered()); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, IsMinimised) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::IsMinimised\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::IsMinimised\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* at_size1 = 0; void* object_pointer1_0 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'O' (&at_size1, php_wxSize_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &at_size1, php_wxSize_entry ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(at_size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(at_size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(at_size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::IsMinimised())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->IsMinimised()); return; break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::IsMinimised(*(wxSize*) object_pointer1_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->IsMinimised(*(wxSize*) object_pointer1_0)); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, Realize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::Realize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::Realize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Realize())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Realize()); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, SetArtProvider) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::SetArtProvider\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::SetArtProvider\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* art0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&art0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &art0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(art0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(art0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(art0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPanel::SetArtProvider((wxRibbonArtProvider*) object_pointer0_0)\n\n"); #endif ((wxRibbonPanel_php*)_this)->SetArtProvider((wxRibbonArtProvider*) object_pointer0_0); references->AddReference(art0); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, ShowExpanded) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::ShowExpanded\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::ShowExpanded\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::ShowExpanded())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->ShowExpanded()); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; char* label1; long label_len1; zval* minimised_icon1 = 0; void* object_pointer1_3 = 0; zval* pos1 = 0; void* object_pointer1_4 = 0; zval* size1 = 0; void* object_pointer1_5 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 7) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lsOOOl' (&parent1, &id1, &label1, &label_len1, &minimised_icon1, php_wxBitmap_entry, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lsOOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &label1, &label_len1, &minimised_icon1, php_wxBitmap_entry, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(minimised_icon1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(minimised_icon1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(minimised_icon1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 5){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_4 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_4 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 6){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_5 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_5 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonPanel_php(); ((wxRibbonPanel_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8))\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8)); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); ((wxRibbonPanel_php*) _this)->references.AddReference(minimised_icon1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); ((wxRibbonPanel_php*) _this)->references.AddReference(minimised_icon1); ((wxRibbonPanel_php*) _this)->references.AddReference(pos1); break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4, *(wxSize*) object_pointer1_5)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4, *(wxSize*) object_pointer1_5); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); ((wxRibbonPanel_php*) _this)->references.AddReference(minimised_icon1); ((wxRibbonPanel_php*) _this)->references.AddReference(pos1); ((wxRibbonPanel_php*) _this)->references.AddReference(size1); break; } case 7: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4, *(wxSize*) object_pointer1_5, (long) style1)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4, *(wxSize*) object_pointer1_5, (long) style1); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); ((wxRibbonPanel_php*) _this)->references.AddReference(minimised_icon1); ((wxRibbonPanel_php*) _this)->references.AddReference(pos1); ((wxRibbonPanel_php*) _this)->references.AddReference(size1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonPanel); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonPanel_php*) _this)->evnArray); array_init(((wxRibbonPanel_php*) _this)->evnArray); ((wxRibbonPanel_php*) _this)->phpObj = getThis(); ((wxRibbonPanel_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonPanel_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } void php_wxRibbonToolBar_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonToolBar_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonToolBar, AddDropdownTool) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::AddDropdownTool\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::AddDropdownTool\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long tool_id0; zval* bitmap0 = 0; void* object_pointer0_1 = 0; char* help_string0; long help_string_len0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 2 && arguments_received <= 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO|s' (&tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0)\n"); #endif char parse_parameters_string[] = "lO|s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0 ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddDropdownTool((int) tool_id0, *(wxBitmap*) object_pointer0_1) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return2; value_to_return2 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddDropdownTool((int) tool_id0, *(wxBitmap*) object_pointer0_1); if(value_to_return2 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return2->references.IsUserInitialized()){ if(value_to_return2->phpObj != NULL){ *return_value = *value_to_return2->phpObj; zval_add_ref(&value_to_return2->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return2, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return2 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddDropdownTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return3; value_to_return3 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddDropdownTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, AddHybridTool) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::AddHybridTool\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::AddHybridTool\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long tool_id0; zval* bitmap0 = 0; void* object_pointer0_1 = 0; char* help_string0; long help_string_len0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 2 && arguments_received <= 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO|s' (&tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0)\n"); #endif char parse_parameters_string[] = "lO|s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0 ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddHybridTool((int) tool_id0, *(wxBitmap*) object_pointer0_1) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return2; value_to_return2 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddHybridTool((int) tool_id0, *(wxBitmap*) object_pointer0_1); if(value_to_return2 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return2->references.IsUserInitialized()){ if(value_to_return2->phpObj != NULL){ *return_value = *value_to_return2->phpObj; zval_add_ref(&value_to_return2->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return2, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return2 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddHybridTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return3; value_to_return3 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddHybridTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, AddSeparator) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::AddSeparator\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::AddSeparator\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddSeparator() to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return0; value_to_return0 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddSeparator(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, AddTool) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::AddTool\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::AddTool\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long tool_id0; zval* bitmap0 = 0; void* object_pointer0_1 = 0; char* help_string0; long help_string_len0; long kind0; bool overload0_called = false; //Parameters for overload 1 long tool_id1; zval* bitmap1 = 0; void* object_pointer1_1 = 0; zval* bitmap_disabled1 = 0; void* object_pointer1_2 = 0; char* help_string1; long help_string_len1; long kind1; zval* client_data1 = 0; void* object_pointer1_5 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 3 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lOs|l' (&tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0, &kind0)\n"); #endif char parse_parameters_string[] = "lOs|l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0, &kind0 ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_1 ) { goto overload1; } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { goto overload1; } } overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received >= 2 && arguments_received <= 6) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO|Oslz' (&tool_id1, &bitmap1, php_wxBitmap_entry, &bitmap_disabled1, php_wxBitmap_entry, &help_string1, &help_string_len1, &kind1, &client_data1)\n"); #endif char parse_parameters_string[] = "lO|Oslz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &tool_id1, &bitmap1, php_wxBitmap_entry, &bitmap_disabled1, php_wxBitmap_entry, &help_string1, &help_string_len1, &kind1, &client_data1 ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(bitmap1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(bitmap_disabled1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap_disabled1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap_disabled1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 6){ if(Z_TYPE_P(client_data1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(client_data1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_5 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_5 || (rsrc_type != le_wxEvtHandler && rsrc_type != le_wxWindow && rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow && rsrc_type != le_wxValidator && rsrc_type != le_wxTextValidator && rsrc_type != le_wxGenericValidator && rsrc_type != le_wxMenu && rsrc_type != le_wxAuiManager && rsrc_type != le_wxMouseEventsManager && rsrc_type != le_wxTimer && rsrc_type != le_wxEventBlocker && rsrc_type != le_wxProcess && rsrc_type != le_wxFileSystemWatcher && rsrc_type != le_wxTaskBarIcon && rsrc_type != le_wxNotificationMessage && rsrc_type != le_wxBitmapHandler && rsrc_type != le_wxImage && rsrc_type != le_wxSizer && rsrc_type != le_wxBoxSizer && rsrc_type != le_wxStaticBoxSizer && rsrc_type != le_wxWrapSizer && rsrc_type != le_wxStdDialogButtonSizer && rsrc_type != le_wxGridSizer && rsrc_type != le_wxFlexGridSizer && rsrc_type != le_wxGridBagSizer && rsrc_type != le_wxSizerItem && rsrc_type != le_wxGBSizerItem && rsrc_type != le_wxImageList && rsrc_type != le_wxDC && rsrc_type != le_wxWindowDC && rsrc_type != le_wxClientDC && rsrc_type != le_wxPaintDC && rsrc_type != le_wxScreenDC && rsrc_type != le_wxPostScriptDC && rsrc_type != le_wxPrinterDC && rsrc_type != le_wxMemoryDC && rsrc_type != le_wxBufferedDC && rsrc_type != le_wxBufferedPaintDC && rsrc_type != le_wxAutoBufferedPaintDC && rsrc_type != le_wxMirrorDC && rsrc_type != le_wxColour && rsrc_type != le_wxMenuItem && rsrc_type != le_wxEvent && rsrc_type != le_wxMenuEvent && rsrc_type != le_wxKeyEvent && rsrc_type != le_wxCommandEvent && rsrc_type != le_wxNotifyEvent && rsrc_type != le_wxTreeEvent && rsrc_type != le_wxBookCtrlEvent && rsrc_type != le_wxAuiNotebookEvent && rsrc_type != le_wxAuiToolBarEvent && rsrc_type != le_wxListEvent && rsrc_type != le_wxSpinEvent && rsrc_type != le_wxSplitterEvent && rsrc_type != le_wxSpinDoubleEvent && rsrc_type != le_wxGridSizeEvent && rsrc_type != le_wxWizardEvent && rsrc_type != le_wxGridEvent && rsrc_type != le_wxGridRangeSelectEvent && rsrc_type != le_wxDataViewEvent && rsrc_type != le_wxHeaderCtrlEvent && rsrc_type != le_wxRibbonBarEvent && rsrc_type != le_wxStyledTextEvent && rsrc_type != le_wxChildFocusEvent && rsrc_type != le_wxHtmlCellEvent && rsrc_type != le_wxHtmlLinkEvent && rsrc_type != le_wxHyperlinkEvent && rsrc_type != le_wxColourPickerEvent && rsrc_type != le_wxFontPickerEvent && rsrc_type != le_wxScrollEvent && rsrc_type != le_wxWindowModalDialogEvent && rsrc_type != le_wxDateEvent && rsrc_type != le_wxCalendarEvent && rsrc_type != le_wxWindowCreateEvent && rsrc_type != le_wxWindowDestroyEvent && rsrc_type != le_wxUpdateUIEvent && rsrc_type != le_wxHelpEvent && rsrc_type != le_wxGridEditorCreatedEvent && rsrc_type != le_wxCollapsiblePaneEvent && rsrc_type != le_wxClipboardTextEvent && rsrc_type != le_wxFileCtrlEvent && rsrc_type != le_wxSashEvent && rsrc_type != le_wxFileDirPickerEvent && rsrc_type != le_wxContextMenuEvent && rsrc_type != le_wxRibbonButtonBarEvent && rsrc_type != le_wxRibbonGalleryEvent && rsrc_type != le_wxCloseEvent && rsrc_type != le_wxActivateEvent && rsrc_type != le_wxAuiManagerEvent && rsrc_type != le_wxSizeEvent && rsrc_type != le_wxMouseEvent && rsrc_type != le_wxMoveEvent && rsrc_type != le_wxTimerEvent && rsrc_type != le_wxThreadEvent && rsrc_type != le_wxScrollWinEvent && rsrc_type != le_wxSysColourChangedEvent && rsrc_type != le_wxProcessEvent && rsrc_type != le_wxEraseEvent && rsrc_type != le_wxSetCursorEvent && rsrc_type != le_wxIdleEvent && rsrc_type != le_wxPaintEvent && rsrc_type != le_wxPaletteChangedEvent && rsrc_type != le_wxInitDialogEvent && rsrc_type != le_wxMaximizeEvent && rsrc_type != le_wxNavigationKeyEvent && rsrc_type != le_wxFocusEvent && rsrc_type != le_wxFileSystemWatcherEvent && rsrc_type != le_wxDisplayChangedEvent && rsrc_type != le_wxCalculateLayoutEvent && rsrc_type != le_wxQueryLayoutInfoEvent && rsrc_type != le_wxTaskBarIconEvent && rsrc_type != le_wxAcceleratorTable && rsrc_type != le_wxGDIObject && rsrc_type != le_wxBitmap && rsrc_type != le_wxPalette && rsrc_type != le_wxIcon && rsrc_type != le_wxFont && rsrc_type != le_wxAnimation && rsrc_type != le_wxIconBundle && rsrc_type != le_wxCursor && rsrc_type != le_wxRegion && rsrc_type != le_wxPen && rsrc_type != le_wxBrush && rsrc_type != le_wxArtProvider && rsrc_type != le_wxHtmlCell && rsrc_type != le_wxHtmlContainerCell && rsrc_type != le_wxHtmlColourCell && rsrc_type != le_wxHtmlWidgetCell && rsrc_type != le_wxHtmlEasyPrinting && rsrc_type != le_wxHtmlLinkInfo && rsrc_type != le_wxFindReplaceData && rsrc_type != le_wxSound && rsrc_type != le_wxFileSystem && rsrc_type != le_wxFileSystemHandler && rsrc_type != le_wxMask && rsrc_type != le_wxToolTip && rsrc_type != le_wxGraphicsRenderer && rsrc_type != le_wxLayoutConstraints && rsrc_type != le_wxFSFile && rsrc_type != le_wxColourData && rsrc_type != le_wxFontData && rsrc_type != le_wxGridTableBase && rsrc_type != le_wxDataViewRenderer && rsrc_type != le_wxDataViewBitmapRenderer && rsrc_type != le_wxDataViewChoiceRenderer && rsrc_type != le_wxDataViewCustomRenderer && rsrc_type != le_wxDataViewSpinRenderer && rsrc_type != le_wxDataViewDateRenderer && rsrc_type != le_wxDataViewIconTextRenderer && rsrc_type != le_wxDataViewProgressRenderer && rsrc_type != le_wxDataViewTextRenderer && rsrc_type != le_wxDataViewToggleRenderer && rsrc_type != le_wxDataViewIconText && rsrc_type != le_wxVariant && rsrc_type != le_wxClipboard && rsrc_type != le_wxConfigBase && rsrc_type != le_wxFileConfig && rsrc_type != le_wxXmlResource && rsrc_type != le_wxPageSetupDialogData && rsrc_type != le_wxPrintDialogData && rsrc_type != le_wxPrintData && rsrc_type != le_wxPrintPreview && rsrc_type != le_wxPrinter && rsrc_type != le_wxPrintout && rsrc_type != le_wxHtmlPrintout && rsrc_type != le_wxHtmlDCRenderer && rsrc_type != le_wxHtmlFilter && rsrc_type != le_wxHtmlHelpData && rsrc_type != le_wxHtmlTagHandler && rsrc_type != le_wxHtmlWinTagHandler && rsrc_type != le_wxModule && rsrc_type != le_wxHtmlTagsModule && rsrc_type != le_wxImageHandler && rsrc_type != le_wxXmlResourceHandler && rsrc_type != le_wxXmlDocument && rsrc_type != le_wxLayoutAlgorithm && rsrc_type != le_wxFileHistory && rsrc_type != le_wxToolBarToolBase)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(client_data1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return3; value_to_return3 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8), (wxRibbonButtonKind) kind0) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return4; value_to_return4 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8), (wxRibbonButtonKind) kind0); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } if(overload1_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return2; value_to_return2 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1); if(value_to_return2 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return2->references.IsUserInitialized()){ if(value_to_return2->phpObj != NULL){ *return_value = *value_to_return2->phpObj; zval_add_ref(&value_to_return2->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return2, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return2 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return3; value_to_return3 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_disabled1); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return4; value_to_return4 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8)); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_disabled1); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8), (wxRibbonButtonKind) kind1) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return5; value_to_return5 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8), (wxRibbonButtonKind) kind1); if(value_to_return5 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return5->references.IsUserInitialized()){ if(value_to_return5->phpObj != NULL){ *return_value = *value_to_return5->phpObj; zval_add_ref(&value_to_return5->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return5, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return5 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_disabled1); return; break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8), (wxRibbonButtonKind) kind1, (wxObject*) object_pointer1_5) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return6; value_to_return6 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8), (wxRibbonButtonKind) kind1, (wxObject*) object_pointer1_5); if(value_to_return6 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return6->references.IsUserInitialized()){ if(value_to_return6->phpObj != NULL){ *return_value = *value_to_return6->phpObj; zval_add_ref(&value_to_return6->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return6, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return6 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_disabled1); references->AddReference(client_data1); return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; zval* pos0 = 0; void* object_pointer0_2 = 0; zval* size0 = 0; void* object_pointer0_3 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonToolBar::Create((wxWindow*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonToolBar_php*)_this)->Create((wxWindow*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonToolBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonToolBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonToolBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonToolBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2)); references->AddReference(parent0); references->AddReference(pos0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonToolBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonToolBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonToolBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonToolBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, SetRows) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::SetRows\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::SetRows\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long nMin0; long nMax0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l|l' (&nMin0, &nMax0)\n"); #endif char parse_parameters_string[] = "l|l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &nMin0, &nMax0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::SetRows((int) nMin0)\n\n"); #endif ((wxRibbonToolBar_php*)_this)->SetRows((int) nMin0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::SetRows((int) nMin0, (int) nMax0)\n\n"); #endif ((wxRibbonToolBar_php*)_this)->SetRows((int) nMin0, (int) nMax0); return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; zval* pos1 = 0; void* object_pointer1_2 = 0; zval* size1 = 0; void* object_pointer1_3 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonToolBar_php(); ((wxRibbonToolBar_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0)\n"); #endif _this = new wxRibbonToolBar_php((wxWindow*) object_pointer1_0); ((wxRibbonToolBar_php*) _this)->references.Initialize(); ((wxRibbonToolBar_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonToolBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonToolBar_php*) _this)->references.Initialize(); ((wxRibbonToolBar_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2)\n"); #endif _this = new wxRibbonToolBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2); ((wxRibbonToolBar_php*) _this)->references.Initialize(); ((wxRibbonToolBar_php*) _this)->references.AddReference(parent1); ((wxRibbonToolBar_php*) _this)->references.AddReference(pos1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3)\n"); #endif _this = new wxRibbonToolBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3); ((wxRibbonToolBar_php*) _this)->references.Initialize(); ((wxRibbonToolBar_php*) _this)->references.AddReference(parent1); ((wxRibbonToolBar_php*) _this)->references.AddReference(pos1); ((wxRibbonToolBar_php*) _this)->references.AddReference(size1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonToolBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1); ((wxRibbonToolBar_php*) _this)->references.Initialize(); ((wxRibbonToolBar_php*) _this)->references.AddReference(parent1); ((wxRibbonToolBar_php*) _this)->references.AddReference(pos1); ((wxRibbonToolBar_php*) _this)->references.AddReference(size1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonToolBar); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonToolBar_php*) _this)->evnArray); array_init(((wxRibbonToolBar_php*) _this)->evnArray); ((wxRibbonToolBar_php*) _this)->phpObj = getThis(); ((wxRibbonToolBar_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonToolBar_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif }
32.953939
10,035
0.710565
lordgnu
c734444850ca0b3531b782fabf1f063300503178
477
cpp
C++
_site/Competitive Programming/UVa/UVa10943.cpp
anujkyadav07/anuj-k-yadav.github.io
ac5cccc8cdada000ba559538cd84921437b3c5e6
[ "MIT" ]
1
2019-06-10T04:39:49.000Z
2019-06-10T04:39:49.000Z
_site/Competitive Programming/UVa/UVa10943.cpp
anujkyadav07/anuj-k-yadav.github.io
ac5cccc8cdada000ba559538cd84921437b3c5e6
[ "MIT" ]
2
2021-09-27T23:34:07.000Z
2022-02-26T05:54:27.000Z
_site/Competitive Programming/UVa/UVa10943.cpp
anujkyadav07/anuj-k-yadav.github.io
ac5cccc8cdada000ba559538cd84921437b3c5e6
[ "MIT" ]
3
2019-06-23T14:15:08.000Z
2019-07-09T20:40:58.000Z
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll N, K; ll dp[105][105]; ll cal(ll sum, ll len){ if(sum == N && len == K){ return 1; } else if(sum > N){ return 0; } if(len > K){ return 0; } if(dp[sum][len] != -1){ return dp[sum][len]; } ll ans = 0; for(ll i = sum; i <= N; i++){ ans += cal(sum+i,len+1); } return dp[sum][len] = ans; } int main(){ while(cin>>N>>K && N+K){ memset(dp, -1, sizeof dp); cout<<cal(0,0)<<"\n"; } }
14.029412
30
0.515723
anujkyadav07
c7393cbc0f655951a5d5dc6573f7d2cd915b2bee
8,955
cpp
C++
jni/love/src/modules/keyboard/sdl/Keyboard.cpp
ultimateprogramer/love2d-admob-android
5f6fa8c2b5cb7743c2df4c2c04ea91540a2b0a13
[ "Xnet", "X11" ]
1
2021-02-26T02:29:31.000Z
2021-02-26T02:29:31.000Z
jni/love/src/modules/keyboard/sdl/Keyboard.cpp
ultimateprogramer/love2d-admob-android
5f6fa8c2b5cb7743c2df4c2c04ea91540a2b0a13
[ "Xnet", "X11" ]
null
null
null
jni/love/src/modules/keyboard/sdl/Keyboard.cpp
ultimateprogramer/love2d-admob-android
5f6fa8c2b5cb7743c2df4c2c04ea91540a2b0a13
[ "Xnet", "X11" ]
1
2021-06-22T10:59:48.000Z
2021-06-22T10:59:48.000Z
/** * Copyright (c) 2006-2014 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. **/ #include "common/config.h" #include "Keyboard.h" namespace love { namespace keyboard { namespace sdl { Keyboard::Keyboard() : key_repeat(false) { } const char *Keyboard::getName() const { return "love.keyboard.sdl"; } void Keyboard::setKeyRepeat(bool enable) { key_repeat = enable; } bool Keyboard::hasKeyRepeat() const { return key_repeat; } bool Keyboard::isDown(Key *keylist) const { const Uint8 *keystate = SDL_GetKeyboardState(0); std::map<Key, SDL_Keycode>::const_iterator it; for (Key key = *keylist; key != KEY_MAX_ENUM; key = *(++keylist)) { it = keys.find(key); if (it != keys.end() && keystate[SDL_GetScancodeFromKey(it->second)]) return true; } return false; } void Keyboard::setTextInput(bool enable) { if (enable) SDL_StartTextInput(); else SDL_StopTextInput(); } bool Keyboard::hasTextInput() const { return SDL_IsTextInputActive(); } std::map<Keyboard::Key, SDL_Keycode> Keyboard::createKeyMap() { std::map<Keyboard::Key, SDL_Keycode> k; k[Keyboard::KEY_UNKNOWN] = SDLK_UNKNOWN; k[Keyboard::KEY_RETURN] = SDLK_RETURN; k[Keyboard::KEY_ESCAPE] = SDLK_ESCAPE; k[Keyboard::KEY_BACKSPACE] = SDLK_BACKSPACE; k[Keyboard::KEY_TAB] = SDLK_TAB; k[Keyboard::KEY_SPACE] = SDLK_SPACE; k[Keyboard::KEY_EXCLAIM] = SDLK_EXCLAIM; k[Keyboard::KEY_QUOTEDBL] = SDLK_QUOTEDBL; k[Keyboard::KEY_HASH] = SDLK_HASH; k[Keyboard::KEY_DOLLAR] = SDLK_DOLLAR; k[Keyboard::KEY_AMPERSAND] = SDLK_AMPERSAND; k[Keyboard::KEY_QUOTE] = SDLK_QUOTE; k[Keyboard::KEY_LEFTPAREN] = SDLK_LEFTPAREN; k[Keyboard::KEY_RIGHTPAREN] = SDLK_RIGHTPAREN; k[Keyboard::KEY_ASTERISK] = SDLK_ASTERISK; k[Keyboard::KEY_PLUS] = SDLK_PLUS; k[Keyboard::KEY_COMMA] = SDLK_COMMA; k[Keyboard::KEY_MINUS] = SDLK_MINUS; k[Keyboard::KEY_PERIOD] = SDLK_PERIOD; k[Keyboard::KEY_SLASH] = SDLK_SLASH; k[Keyboard::KEY_0] = SDLK_0; k[Keyboard::KEY_1] = SDLK_1; k[Keyboard::KEY_2] = SDLK_2; k[Keyboard::KEY_3] = SDLK_3; k[Keyboard::KEY_4] = SDLK_4; k[Keyboard::KEY_5] = SDLK_5; k[Keyboard::KEY_6] = SDLK_6; k[Keyboard::KEY_7] = SDLK_7; k[Keyboard::KEY_8] = SDLK_8; k[Keyboard::KEY_9] = SDLK_9; k[Keyboard::KEY_COLON] = SDLK_COLON; k[Keyboard::KEY_SEMICOLON] = SDLK_SEMICOLON; k[Keyboard::KEY_LESS] = SDLK_LESS; k[Keyboard::KEY_EQUALS] = SDLK_EQUALS; k[Keyboard::KEY_GREATER] = SDLK_GREATER; k[Keyboard::KEY_QUESTION] = SDLK_QUESTION; k[Keyboard::KEY_AT] = SDLK_AT; k[Keyboard::KEY_LEFTBRACKET] = SDLK_LEFTBRACKET; k[Keyboard::KEY_BACKSLASH] = SDLK_BACKSLASH; k[Keyboard::KEY_RIGHTBRACKET] = SDLK_RIGHTBRACKET; k[Keyboard::KEY_CARET] = SDLK_CARET; k[Keyboard::KEY_UNDERSCORE] = SDLK_UNDERSCORE; k[Keyboard::KEY_BACKQUOTE] = SDLK_BACKQUOTE; k[Keyboard::KEY_A] = SDLK_a; k[Keyboard::KEY_B] = SDLK_b; k[Keyboard::KEY_C] = SDLK_c; k[Keyboard::KEY_D] = SDLK_d; k[Keyboard::KEY_E] = SDLK_e; k[Keyboard::KEY_F] = SDLK_f; k[Keyboard::KEY_G] = SDLK_g; k[Keyboard::KEY_H] = SDLK_h; k[Keyboard::KEY_I] = SDLK_i; k[Keyboard::KEY_J] = SDLK_j; k[Keyboard::KEY_K] = SDLK_k; k[Keyboard::KEY_L] = SDLK_l; k[Keyboard::KEY_M] = SDLK_m; k[Keyboard::KEY_N] = SDLK_n; k[Keyboard::KEY_O] = SDLK_o; k[Keyboard::KEY_P] = SDLK_p; k[Keyboard::KEY_Q] = SDLK_q; k[Keyboard::KEY_R] = SDLK_r; k[Keyboard::KEY_S] = SDLK_s; k[Keyboard::KEY_T] = SDLK_t; k[Keyboard::KEY_U] = SDLK_u; k[Keyboard::KEY_V] = SDLK_v; k[Keyboard::KEY_W] = SDLK_w; k[Keyboard::KEY_X] = SDLK_x; k[Keyboard::KEY_Y] = SDLK_y; k[Keyboard::KEY_Z] = SDLK_z; k[Keyboard::KEY_CAPSLOCK] = SDLK_CAPSLOCK; k[Keyboard::KEY_F1] = SDLK_F1; k[Keyboard::KEY_F2] = SDLK_F2; k[Keyboard::KEY_F3] = SDLK_F3; k[Keyboard::KEY_F4] = SDLK_F4; k[Keyboard::KEY_F5] = SDLK_F5; k[Keyboard::KEY_F6] = SDLK_F6; k[Keyboard::KEY_F7] = SDLK_F7; k[Keyboard::KEY_F8] = SDLK_F8; k[Keyboard::KEY_F9] = SDLK_F9; k[Keyboard::KEY_F10] = SDLK_F10; k[Keyboard::KEY_F11] = SDLK_F11; k[Keyboard::KEY_F12] = SDLK_F12; k[Keyboard::KEY_PRINTSCREEN] = SDLK_PRINTSCREEN; k[Keyboard::KEY_SCROLLLOCK] = SDLK_SCROLLLOCK; k[Keyboard::KEY_PAUSE] = SDLK_PAUSE; k[Keyboard::KEY_INSERT] = SDLK_INSERT; k[Keyboard::KEY_HOME] = SDLK_HOME; k[Keyboard::KEY_PAGEUP] = SDLK_PAGEUP; k[Keyboard::KEY_DELETE] = SDLK_DELETE; k[Keyboard::KEY_END] = SDLK_END; k[Keyboard::KEY_PAGEDOWN] = SDLK_PAGEDOWN; k[Keyboard::KEY_RIGHT] = SDLK_RIGHT; k[Keyboard::KEY_LEFT] = SDLK_LEFT; k[Keyboard::KEY_DOWN] = SDLK_DOWN; k[Keyboard::KEY_UP] = SDLK_UP; k[Keyboard::KEY_NUMLOCKCLEAR] = SDLK_NUMLOCKCLEAR; k[Keyboard::KEY_KP_DIVIDE] = SDLK_KP_DIVIDE; k[Keyboard::KEY_KP_MULTIPLY] = SDLK_KP_MULTIPLY; k[Keyboard::KEY_KP_MINUS] = SDLK_KP_MINUS; k[Keyboard::KEY_KP_PLUS] = SDLK_KP_PLUS; k[Keyboard::KEY_KP_ENTER] = SDLK_KP_ENTER; k[Keyboard::KEY_KP_0] = SDLK_KP_0; k[Keyboard::KEY_KP_1] = SDLK_KP_1; k[Keyboard::KEY_KP_2] = SDLK_KP_2; k[Keyboard::KEY_KP_3] = SDLK_KP_3; k[Keyboard::KEY_KP_4] = SDLK_KP_4; k[Keyboard::KEY_KP_5] = SDLK_KP_5; k[Keyboard::KEY_KP_6] = SDLK_KP_6; k[Keyboard::KEY_KP_7] = SDLK_KP_7; k[Keyboard::KEY_KP_8] = SDLK_KP_8; k[Keyboard::KEY_KP_9] = SDLK_KP_9; k[Keyboard::KEY_KP_PERIOD] = SDLK_KP_PERIOD; k[Keyboard::KEY_KP_COMMA] = SDLK_KP_COMMA; k[Keyboard::KEY_KP_EQUALS] = SDLK_KP_EQUALS; k[Keyboard::KEY_APPLICATION] = SDLK_APPLICATION; k[Keyboard::KEY_POWER] = SDLK_POWER; k[Keyboard::KEY_F13] = SDLK_F13; k[Keyboard::KEY_F14] = SDLK_F14; k[Keyboard::KEY_F15] = SDLK_F15; k[Keyboard::KEY_F16] = SDLK_F16; k[Keyboard::KEY_F17] = SDLK_F17; k[Keyboard::KEY_F18] = SDLK_F18; k[Keyboard::KEY_F19] = SDLK_F19; k[Keyboard::KEY_F20] = SDLK_F20; k[Keyboard::KEY_F21] = SDLK_F21; k[Keyboard::KEY_F22] = SDLK_F22; k[Keyboard::KEY_F23] = SDLK_F23; k[Keyboard::KEY_F24] = SDLK_F24; k[Keyboard::KEY_EXECUTE] = SDLK_EXECUTE; k[Keyboard::KEY_HELP] = SDLK_HELP; k[Keyboard::KEY_MENU] = SDLK_MENU; k[Keyboard::KEY_SEARCH] = SDLK_AC_SEARCH; k[Keyboard::KEY_SELECT] = SDLK_SELECT; k[Keyboard::KEY_STOP] = SDLK_STOP; k[Keyboard::KEY_AGAIN] = SDLK_AGAIN; k[Keyboard::KEY_UNDO] = SDLK_UNDO; k[Keyboard::KEY_CUT] = SDLK_CUT; k[Keyboard::KEY_COPY] = SDLK_COPY; k[Keyboard::KEY_PASTE] = SDLK_PASTE; k[Keyboard::KEY_FIND] = SDLK_FIND; k[Keyboard::KEY_MUTE] = SDLK_MUTE; k[Keyboard::KEY_VOLUMEUP] = SDLK_VOLUMEUP; k[Keyboard::KEY_VOLUMEDOWN] = SDLK_VOLUMEDOWN; k[Keyboard::KEY_ALTERASE] = SDLK_ALTERASE; k[Keyboard::KEY_SYSREQ] = SDLK_SYSREQ; k[Keyboard::KEY_CANCEL] = SDLK_CANCEL; k[Keyboard::KEY_CLEAR] = SDLK_CLEAR; k[Keyboard::KEY_PRIOR] = SDLK_PRIOR; k[Keyboard::KEY_RETURN2] = SDLK_RETURN2; k[Keyboard::KEY_SEPARATOR] = SDLK_SEPARATOR; k[Keyboard::KEY_OUT] = SDLK_OUT; k[Keyboard::KEY_OPER] = SDLK_OPER; k[Keyboard::KEY_CLEARAGAIN] = SDLK_CLEARAGAIN; k[Keyboard::KEY_THOUSANDSSEPARATOR] = SDLK_THOUSANDSSEPARATOR; k[Keyboard::KEY_DECIMALSEPARATOR] = SDLK_DECIMALSEPARATOR; k[Keyboard::KEY_CURRENCYUNIT] = SDLK_CURRENCYUNIT; k[Keyboard::KEY_CURRENCYSUBUNIT] = SDLK_CURRENCYSUBUNIT; k[Keyboard::KEY_LCTRL] = SDLK_LCTRL; k[Keyboard::KEY_LSHIFT] = SDLK_LSHIFT; k[Keyboard::KEY_LALT] = SDLK_LALT; k[Keyboard::KEY_LGUI] = SDLK_LGUI; k[Keyboard::KEY_RCTRL] = SDLK_RCTRL; k[Keyboard::KEY_RSHIFT] = SDLK_RSHIFT; k[Keyboard::KEY_RALT] = SDLK_RALT; k[Keyboard::KEY_RGUI] = SDLK_RGUI; k[Keyboard::KEY_MODE] = SDLK_MODE; k[Keyboard::KEY_AUDIONEXT] = SDLK_AUDIONEXT; k[Keyboard::KEY_AUDIOPREV] = SDLK_AUDIOPREV; k[Keyboard::KEY_AUDIOSTOP] = SDLK_AUDIOSTOP; k[Keyboard::KEY_AUDIOPLAY] = SDLK_AUDIOPLAY; k[Keyboard::KEY_AUDIOMUTE] = SDLK_AUDIOMUTE; k[Keyboard::KEY_MEDIASELECT] = SDLK_MEDIASELECT; k[Keyboard::KEY_BRIGHTNESSDOWN] = SDLK_BRIGHTNESSDOWN; k[Keyboard::KEY_BRIGHTNESSUP] = SDLK_BRIGHTNESSUP; k[Keyboard::KEY_DISPLAYSWITCH] = SDLK_DISPLAYSWITCH; k[Keyboard::KEY_KBDILLUMTOGGLE] = SDLK_KBDILLUMTOGGLE; k[Keyboard::KEY_KBDILLUMDOWN] = SDLK_KBDILLUMDOWN; k[Keyboard::KEY_KBDILLUMUP] = SDLK_KBDILLUMUP; k[Keyboard::KEY_EJECT] = SDLK_EJECT; k[Keyboard::KEY_SLEEP] = SDLK_SLEEP; return k; } std::map<Keyboard::Key, SDL_Keycode> Keyboard::keys = Keyboard::createKeyMap(); } // sdl } // keyboard } // love
31.311189
79
0.733445
ultimateprogramer
c73cf78c3843f574b08ee148adced418d13ec3ae
4,391
cpp
C++
msdb/src/array/array.cpp
KUDB/MSDB
19e89d1d9c09c57b242737f0634ac30b4c8ecfd7
[ "MIT" ]
2
2021-08-31T12:43:16.000Z
2021-12-13T13:49:19.000Z
msdb/src/array/array.cpp
KUDB/MSDB
19e89d1d9c09c57b242737f0634ac30b4c8ecfd7
[ "MIT" ]
3
2021-09-09T17:23:31.000Z
2021-09-09T19:14:50.000Z
msdb/src/array/array.cpp
KUDB/MSDB
19e89d1d9c09c57b242737f0634ac30b4c8ecfd7
[ "MIT" ]
null
null
null
#include <pch.h> #include <array/array.h> #include <util/math.h> #include <util/logger.h> namespace msdb { namespace core { arrayBase::arrayBase(pArrayDesc desc) : chunkBitmap_() { this->desc_ = desc; this->chunkBitmap_ = std::make_shared<bitmap>(desc_->dimDescs_->getChunkSpace().area(), false); } arrayBase::~arrayBase() { //BOOST_LOG_TRIVIAL(debug) << "~arrayBase(): " << this->desc_->name_; this->chunks_.clear(); this->chunkBitmap_ = nullptr; this->desc_ = nullptr; } pArrayDesc arrayBase::getDesc() { return this->desc_; } // TODO::required an attirubteId as an input parameter pChunkIterator arrayBase::getChunkIterator(const iterateMode itMode) { return std::make_shared<chunkIterator>(this->desc_->dimDescs_->getChunkSpace(), &this->chunks_, this->chunkBitmap_, itMode); } arrayBase::size_type arrayBase::getNumChunks() { return this->chunks_.size(); } coor arrayBase::itemCoorToChunkCoor(const coor& itemCoor) { coor chunkCoor(this->desc_->dimDescs_->size()); for (dimensionId d = 0; d < this->desc_->dimDescs_->size(); d++) { chunkCoor[d] = floor(itemCoor[d] / (*this->desc_->dimDescs_)[d]->chunkSize_); } return chunkCoor; } pChunk arrayBase::insertChunk(const attributeId attrId, pChunk inputChunk) { assert(attrId < this->desc_->attrDescs_->size()); this->chunks_.insert(chunkPair(inputChunk->getId(), inputChunk)); this->chunkBitmap_->setExist(inputChunk->getId()); return inputChunk; } void arrayBase::flush() { } pChunk arrayBase::makeChunk(const chunkDesc& desc) { return this->makeChunk(desc.attrDesc_->id_, desc.id_); } void arrayBase::makeChunks(const attributeId attrId, const bitmap& input) { chunkId capacity = this->getChunkIterator()->getCapacity(); for(chunkId cid = 0; cid < capacity; ++cid) { if(input.isExist(cid) && !this->chunkBitmap_->isExist(cid)) { this->makeChunk(attrId, cid); } } } pChunkDesc arrayBase::getChunkDesc(const attributeId attrId, const chunkId cId) { dimension chunkDims = this->desc_->getDimDescs()->getChunkDims(); dimension blockDims = this->desc_->getDimDescs()->getBlockDims(); pAttributeDesc attrDesc = (*this->desc_->getAttrDescs())[attrId]; auto cItr = this->getChunkIterator(); coor chunkCoor = cItr->seqToCoor(cId); dimension sp = chunkDims * chunkCoor; dimension ep = sp + chunkDims; return std::make_shared<chunkDesc>(cId, attrDesc, chunkDims, blockDims, sp, ep, chunkDims.area() * attrDesc->typeSize_); } pChunk arrayBase::getChunk(const chunkId cId) { return this->chunks_[cId]; } arrayId arrayBase::getId() { return this->desc_->id_; } void arrayBase::setId(const arrayId id) { this->desc_->id_ = id; } chunkId arrayBase::getChunkId(pChunkDesc cDesc) { return this->getChunkIdFromItemCoor(cDesc->sp_); } chunkId arrayBase::getChunkIdFromItemCoor(const coor& itemCoor) { coor chunkCoor = itemCoor; for (dimensionId d = this->desc_->dimDescs_->size() - 1; d != -1; --d) { chunkCoor[d] /= this->desc_->dimDescs_->at(d)->chunkSize_; } return this->getChunkIdFromChunkCoor(chunkCoor); } chunkId arrayBase::getChunkIdFromChunkCoor(const coor& chunkCoor) { chunkId id = 0; chunkId offset = 1; for (dimensionId d = this->desc_->dimDescs_->size() - 1; d != -1; d--) { id += offset * chunkCoor[d]; offset *= (*this->desc_->dimDescs_)[d]->getChunkNum(); } return id; } cpBitmap arrayBase::getChunkBitmap() const { return this->chunkBitmap_; } void arrayBase::copyChunkBitmap(cpBitmap chunkBitmap) { this->chunkBitmap_ = std::make_shared<bitmap>(*chunkBitmap); } void arrayBase::replaceChunkBitmap(pBitmap chunkBitmap) { this->chunkBitmap_ = chunkBitmap; } void arrayBase::mergeChunkBitmap(pBitmap chunkBitmap) { this->chunkBitmap_->andMerge(*chunkBitmap); } void arrayBase::print() { auto cit = this->getChunkIterator(); while (!cit->isEnd()) { if(cit->isExist()) { BOOST_LOG_TRIVIAL(debug) << "==============================\n"; BOOST_LOG_TRIVIAL(trace) << "Chunk (" << cit->seqPos() << ") exist\n"; (**cit)->print(); BOOST_LOG_TRIVIAL(debug) << "==============================\n"; }else { //BOOST_LOG_TRIVIAL(trace) << "==============================\n"; //BOOST_LOG_TRIVIAL(trace) << "Chunk (" << cit->seqPos() << ") is not exist\n"; //BOOST_LOG_TRIVIAL(trace) << "==============================\n"; } ++(*cit); } } } // core } // msdb
25.235632
96
0.670918
KUDB
c742c1f6b561b6772a2046f8b7490744bc78e096
1,604
hh
C++
src/cxx/include/data/AggregatedBclFileReader.hh
sbooeshaghi/bcl2fastq
3f39a24cd743fa71fba9b7dcf62e5d33cea8272d
[ "BSD-3-Clause" ]
5
2021-06-07T12:36:11.000Z
2022-02-08T09:49:02.000Z
src/cxx/include/data/AggregatedBclFileReader.hh
sbooeshaghi/bcl2fastq
3f39a24cd743fa71fba9b7dcf62e5d33cea8272d
[ "BSD-3-Clause" ]
1
2022-03-01T23:55:57.000Z
2022-03-01T23:57:15.000Z
src/cxx/include/data/AggregatedBclFileReader.hh
sbooeshaghi/bcl2fastq
3f39a24cd743fa71fba9b7dcf62e5d33cea8272d
[ "BSD-3-Clause" ]
null
null
null
/** * BCL to FASTQ file converter * Copyright (c) 2007-2017 Illumina, Inc. * * This software is covered by the accompanying EULA * and certain third party copyright/licenses, and any user of this * source file is bound by the terms therein. * * \file TileBclFileReader.hh * * \brief Declaration of BCL reader for a single tile. * * \author Aaron Day */ #ifndef BCL2FASTQ_DATA_AGGREGATED_BCL_FILE_READER_HH #define BCL2FASTQ_DATA_AGGREGATED_BCL_FILE_READER_HH #include "data/BclFileReader.hh" #include "data/RawBclBuffer.hh" #include "data/CycleBCIFile.hh" #include "io/SyncFile.hh" #include <boost/filesystem/path.hpp> #include <boost/noncopyable.hpp> #include <memory> namespace bcl2fastq { namespace data { class AggregatedBclFileReader : public BclFileReaderT<io::SyncFile> { public: AggregatedBclFileReader(const::boost::filesystem::path& inputDir, const layout::LaneInfo& laneInfo, common::CycleNumber cycleNumber, size_t cycleIndex, bool ignoreMissingBcls, std::shared_ptr<io::SyncFile> bclFile, std::shared_ptr<data::CycleBCIFile> cycleBciFile); virtual bool read(RawBclBufferGroup& outputBuffer); private: bool openAggFileIfNeeded(); std::shared_ptr<data::CycleBCIFile> cycleBciFile_; }; } // namespace data } // namespace bcl2fastq #endif // BCL2FASTQ_DATA_AGGREGATED_BCL_FILE_READER_HH
28.140351
82
0.642768
sbooeshaghi
c743a759588c916f54a2697485a326917abaea28
2,485
cc
C++
test/generic.cc
imkaywu/open3DCV
33ef0507e565bce2ccff7409ff35a8970e6eed2d
[ "BSD-3-Clause" ]
37
2018-07-30T15:34:29.000Z
2022-01-10T22:50:39.000Z
test/generic.cc
imkaywu/open3DCV
33ef0507e565bce2ccff7409ff35a8970e6eed2d
[ "BSD-3-Clause" ]
1
2020-10-09T17:51:42.000Z
2020-11-11T19:41:06.000Z
test/generic.cc
imkaywu/open3DCV
33ef0507e565bce2ccff7409ff35a8970e6eed2d
[ "BSD-3-Clause" ]
14
2017-12-03T15:24:01.000Z
2021-09-16T02:13:31.000Z
extern "C" { #include <stdlib.h> #include <stdio.h> #include "vl/generic.h" #include "vl/pgm.h" #include "vl/sift.h" } #include <iostream> #include "image.h" int main(int argc, const char * argv[]) { std::string fname = "/Users/BlacKay/Documents/Projects/Images/test/mandrill.pgm"; FILE *in = 0; vl_uint8 *data = 0; vl_sift_pix *fdata = 0; VlPgmImage pim; vl_bool err = VL_ERR_OK ; char err_msg[1024]; int verbose; in = fopen(fname.c_str(), "rb"); // read PGM header err = vl_pgm_extract_head (in, &pim); if (err) { switch (vl_get_last_error()) { case VL_ERR_PGM_IO : snprintf(err_msg, sizeof(err_msg), "Cannot read from '%s'.", fname.c_str()) ; err = VL_ERR_IO ; break ; case VL_ERR_PGM_INV_HEAD : snprintf(err_msg, sizeof(err_msg), "'%s' contains a malformed PGM header.", fname.c_str()) ; err = VL_ERR_IO ; //goto done ; } } if (verbose) printf ("sift: image is %" VL_FMT_SIZE " by %" VL_FMT_SIZE " pixels\n", pim. width, pim. height) ; // allocate buffer data = (vl_uint8*)malloc(vl_pgm_get_npixels (&pim) * vl_pgm_get_bpp (&pim) * sizeof (vl_uint8) ) ; fdata = (vl_sift_pix*)malloc(vl_pgm_get_npixels (&pim) * vl_pgm_get_bpp (&pim) * sizeof (vl_sift_pix)) ; std::cout << "number of pixel:" << vl_pgm_get_npixels(&pim) << std::endl; std::cout << "types per pixel:" << vl_pgm_get_bpp(&pim) << std::endl; if (!data || !fdata) { err = VL_ERR_ALLOC ; snprintf(err_msg, sizeof(err_msg), "Could not allocate enough memory."); //goto done; } // read PGM body err = vl_pgm_extract_data (in, &pim, data) ; if (err) { snprintf(err_msg, sizeof(err_msg), "PGM body malformed.") ; err = VL_ERR_IO ; //goto done ; } open3DCV::Image img; img.init(fname); vector<unsigned char> image; int w, h; img.readPGMImage(fname, image, w, h); std::cout << "Start: VlPgmImage" << std::endl; for (int i = 0; i < 100; ++i) std::cout << (int)data[i] << " " << (int)image[i] << std::endl; std::cout << "End: VlPgmImage" << std::endl; }
28.238636
85
0.517103
imkaywu
c7476c3eb20d5bcc4f8c39599975f1ec7b11cc2c
898
cc
C++
tests/unittests/lite_test.cc
manavrion/segment_tree
20e3513395c8b9c28994817e7df76aa85e41ed85
[ "MIT" ]
null
null
null
tests/unittests/lite_test.cc
manavrion/segment_tree
20e3513395c8b9c28994817e7df76aa85e41ed85
[ "MIT" ]
2
2020-09-08T22:39:12.000Z
2020-10-02T11:02:08.000Z
tests/unittests/lite_test.cc
manavrion/segment_tree
20e3513395c8b9c28994817e7df76aa85e41ed85
[ "MIT" ]
null
null
null
// // Copyright (C) 2020 Ruslan Manaev (manavrion@gmail.com) // This file is part of the segment_tree header-only library. // #include <gtest/gtest.h> #include "manavrion/segment_tree/mapped_segment_tree.h" #include "manavrion/segment_tree/naive_segment_tree.h" #include "manavrion/segment_tree/segment_tree.h" using namespace manavrion::segment_tree; namespace { template <typename SegmentTree> void LiteTest() { SegmentTree st = {0, 1, 2, 3, 4, 5, 6, 7}; EXPECT_EQ(st.query(0, 0), 0); EXPECT_EQ(st.query(0, 1), 0); EXPECT_EQ(st.query(0, 2), 1); EXPECT_EQ(st.query(2, 5), 9); EXPECT_EQ(st.query(6, 7), 6); EXPECT_EQ(st.query(3, 6), 12); } } // namespace TEST(LiteTest, MappedSegmentTree) { LiteTest<mapped_segment_tree<int>>(); } TEST(LiteTest, NaiveSegmentTree) { LiteTest<naive_segment_tree<int>>(); } TEST(LiteTest, SimpleSegmentTree) { LiteTest<segment_tree<int>>(); }
26.411765
75
0.713808
manavrion
c74a0b9fa83fc56225d5a694228f2c1b94ca1638
8,030
cpp
C++
graph_utils/src/graph_utils.cpp
guo-zixuan/exploration-project
2ecd3a68dc92f8461f262c7860fa2de6a5e812b4
[ "MIT" ]
null
null
null
graph_utils/src/graph_utils.cpp
guo-zixuan/exploration-project
2ecd3a68dc92f8461f262c7860fa2de6a5e812b4
[ "MIT" ]
null
null
null
graph_utils/src/graph_utils.cpp
guo-zixuan/exploration-project
2ecd3a68dc92f8461f262c7860fa2de6a5e812b4
[ "MIT" ]
null
null
null
#include "graph_utils.h" #include <queue> #include <vector> #include <misc_utils/misc_utils.h> #include <bits/stdc++.h> #include <math.h> #define INF 0x3f3f3f3f // integer infinity #define PI 3.14159265358979323846 using namespace std; namespace graph_utils_ns { // Function for getting the shortest path on a graph between two vertexes // Input: graph, index of the start vertex and index of the goal vertex // Output: a sequence of vertex ids as the path void ShortestPathBtwVertex(vector<int> &path, const graph_utils::TopologicalGraph &graph, int start_index, int goal_index) { if (start_index == goal_index) { path.clear(); path.push_back(start_index); return; } // Vertices are represented by their index in the graph.vertices list typedef pair<float, int> iPair; // Priority queue of vertices priority_queue<iPair, vector<iPair>, greater<iPair>> pq; // Vector of distances vector<float> dist(graph.vertices.size(), INFINITY); // Vector of backpointers vector<int> backpointers(graph.vertices.size(), INF); // Add the start vertex pq.push(make_pair(0, start_index)); dist[start_index] = 0; // Loop until priority queue is empty while (!pq.empty()) { // Pop the minimum distance vertex int u = pq.top().second; pq.pop(); // Get all adjacent vertices for (auto it = graph.vertices[u].edges.begin(); it != graph.vertices[u].edges.end(); ++it) { // Get vertex label and weight of current adjacent edge of u int v = it->vertex_id_end; float weight = it->traversal_costs; // If there is a shorter path to v through u if (dist[v] > dist[u] + weight) { // Updating distance of v dist[v] = dist[u] + weight; pq.push(make_pair(dist[v], v)); backpointers[v] = u; } } // Early termination if (u == goal_index) { break; } } // Backtrack to find path vector<int> reverse_path; int current = goal_index; if (backpointers[current] == INF) { // no path found // std::cout << "WARNING: no path found " << start_index << "<->" << // goal_index << std::endl; path.clear(); } else { // path found while (current != INF) { reverse_path.push_back(current); current = backpointers[current]; } // Reverse the path (constructing it this way since vector is more efficient // at push_back than insert[0]) path.clear(); for (int i = reverse_path.size() - 1; i >= 0; --i) { path.push_back(reverse_path[i]); } } } /// Compute path length, where path represented by sequence of vertex indices float PathLength(const vector<int> &path, const graph_utils::TopologicalGraph &graph) { float cost = 0; if (path.size() == 0) { std::cout << "WARNING: PathLength queried for empty path" << std::endl; return 0; } for (int i = 0; i < -1 + path.size(); i++) { int index1 = path[i]; int index2 = path[i + 1]; bool found = false; // search for the edge for (auto it = graph.vertices[index1].edges.begin(); it != graph.vertices[index1].edges.end(); ++it) { if (it->vertex_id_end == index2) { cost += it->traversal_costs; found = true; break; } } if (!found) std::cout << "WARNING: edge " << index1 << "<->" << index2 << " not found" << std::endl; } return cost; } /// Find the vertex idx in graph that is closest (Euclidean distance) to pnt int GetClosestVertexIdxToPoint(const graph_utils::TopologicalGraph &graph, const geometry_msgs::Point &pnt) { double best_idx = -1; double best_distance = INFINITY; for (int v_idx = 0; v_idx < graph.vertices.size(); ++v_idx) { double distance = misc_utils_ns::PointXYZDist(pnt, graph.vertices[v_idx].location); if (distance < best_distance && fabs(pnt.z - graph.vertices[v_idx].location.z) < 1.0) { best_idx = v_idx; best_distance = distance; } } // std::cout << "The closest vertex is "<< best_idx<< std::endl; return best_idx; } /// Returns the vertex_index of the first vertex along the path that is beyond /// threshold distance from the 1st vertex on /// path /// if none exist, it returns the last vertex /// To be considered, a vertex must have BOTH accumulated and Euclidean distance /// away /// Euclidean distance only relevant if path wraps back on itself (shouldn't /// happen if it's a "shortest path") /// Assumes path is not empty int GetFirstVertexBeyondThreshold(const geometry_msgs::Point &start_location, const std::vector<int> &path, const graph_utils::TopologicalGraph &graph, const float distance_threshold) { if (path.size() == 1) { // trivial case return path[0]; } // Start with distance to first vertex auto first_vertex_location = graph.vertices[path[0]].location; double distance_along_path = misc_utils_ns::PointXYZDist(start_location, first_vertex_location); // Move along path, accumulating the distance // Pick first for (int i = 1; i < path.size(); i++) { // Extract consecutive pair of graph locations on path int v_idx = path[i]; auto vertex_location_prev = graph.vertices[path[i - 1]].location; auto vertex_location = graph.vertices[path[i]].location; // Accumulate distance distance_along_path += misc_utils_ns::PointXYZDist(vertex_location, vertex_location_prev); // Get Euclidean distance from start double distance_euclidean = misc_utils_ns::PointXYZDist(start_location, vertex_location); // If distance threshold exceeded using BOTH measures if ((distance_along_path >= distance_threshold) && (distance_euclidean >= distance_threshold)) { return v_idx; } } // if none are above the threshold, return index of last point on path return path.back(); } bool PathCircleDetect(std::vector<int> &path, const graph_utils::TopologicalGraph &graph, int next_vertex_index, geometry_msgs::Point rob_pos) { double accumulated_angle_difference = 0; double angle1 = 0; double angle2 = 0; double angle_difference = 0; geometry_msgs::Point pointA, pointB, pointC; std::vector<int>::iterator it = std::find(path.begin(), path.end(), next_vertex_index); if (it != path.end()) { int index = it - path.begin(); if (index >= 3) { // compute path angle from the robot position pointA = rob_pos; pointB = graph.vertices[path[0]].location; pointB = graph.vertices[path[1]].location; angle1 = atan2(pointB.y - pointA.y, pointB.x - pointA.x); angle2 = atan2(pointC.y - pointB.y, pointC.x - pointB.x); angle_difference = angle2 - angle1; if (angle_difference > PI) { angle_difference = angle_difference - 2 * PI; } else if (angle_difference < -PI) { angle_difference = 2 * PI + angle_difference; } accumulated_angle_difference += angle_difference; for (int i = 2; i < index + 1; i++) { pointA = graph.vertices[path[i - 2]].location; pointB = graph.vertices[path[i - 1]].location; pointC = graph.vertices[path[i]].location; angle1 = atan2(pointB.y - pointA.y, pointB.x - pointA.x); angle2 = atan2(pointC.y - pointB.y, pointC.x - pointB.x); angle_difference = angle2 - angle1; if (angle_difference > PI) { angle_difference = angle_difference - 2 * PI; } else if (angle_difference < -PI) { angle_difference = 2 * PI + angle_difference; } accumulated_angle_difference += angle_difference; } if (std::fabs(accumulated_angle_difference) > 2.0 / 3 * PI) { return true; } else { return false; } } else { return false; } } else { return false; } } }
32.510121
80
0.626899
guo-zixuan
c757b3b7c0a178e9dc5c34c01e1d0b8b1da636dd
5,367
cpp
C++
UI/BitmapCatalog.cpp
HaikuArchives/WhisperBeNet
56515401b1eab401a3b2390196f85d70aedaaedf
[ "MIT" ]
1
2021-01-09T14:59:21.000Z
2021-01-09T14:59:21.000Z
UI/BitmapCatalog.cpp
HaikuArchives/WhisperBeNet
56515401b1eab401a3b2390196f85d70aedaaedf
[ "MIT" ]
null
null
null
UI/BitmapCatalog.cpp
HaikuArchives/WhisperBeNet
56515401b1eab401a3b2390196f85d70aedaaedf
[ "MIT" ]
2
2015-01-04T10:10:39.000Z
2020-10-26T08:58:28.000Z
/***********************************************************************************************\ * BeNetBitmapCatalog.cpp * ************************************************************************************************* * Programmer par: Patrick Henri * * Derniere modification: 17-03-99 * ************************************************************************************************* * Cette classe singleton permet de stocker les bitmap. * \***********************************************************************************************/ #ifndef _BitmapCatalog_h #include "BitmapCatalog.h" #endif #include <File.h> #include <TranslatorRoster.h> #include <BitmapStream.h> #include <TranslationUtils.h> //OliverESP: BitmapCatalog* BitmapCatalog::m_pInstance = NULL; /*=============================================================================================*\ | BeNetBitmapCatalog | +-----------------------------------------------------------------------------------------------+ | Effet: Charge en memoire les bitmap. | \*=============================================================================================*/ BitmapCatalog::BitmapCatalog() { m_pLArrow = FetchBitmap("Bitmaps/LArrow.jpg", false); m_pRArrow = FetchBitmap("Bitmaps/RArrow.jpg", false); m_pAccept = FetchBitmap("Bitmaps/Accept.jpg", false); m_pCancel = FetchBitmap("Bitmaps/Cancel.jpg", false); m_pDelete = FetchBitmap("Bitmaps/Delete.jpg", false); m_pStatusBarRemote = FetchBitmap("Bitmaps/statusbar-remote.bmp", true); m_pStatusBarServer = FetchBitmap("Bitmaps/statusbar-server.bmp", true); m_pToolBarRemote = FetchBitmap("Bitmaps/toolbar_connect.bmp", true); m_pToolBarServer = FetchBitmap("Bitmaps/toolbar-online.bmp", true); m_pToolBarBookmarks = FetchBitmap("Bitmaps/toolbar-contacts.bmp", true); m_pToolBarPreferences = FetchBitmap("Bitmaps/toolbar-settings.bmp", true); m_pToolBarHelp = FetchBitmap("Bitmaps/toolbar-help.bmp", true); } /*=============================================================================================*\ | ~BeNetBitmapCatalog | +-----------------------------------------------------------------------------------------------+ | Effet: Detruit la seule instance de la classe ainsi que les bitmap. | \*=============================================================================================*/ BitmapCatalog::~BitmapCatalog() { delete m_pLArrow; delete m_pRArrow; delete m_pAccept; delete m_pCancel; delete m_pDelete; delete m_pStatusBarRemote; delete m_pStatusBarServer; delete m_pToolBarRemote; delete m_pToolBarServer; delete m_pToolBarBookmarks; delete m_pToolBarPreferences; delete m_pToolBarHelp; delete m_pInstance; } /*=============================================================================================*\ | Instance | +-----------------------------------------------------------------------------------------------+ | Effet: Cree la seule instance de la classe si elle n'existe pas deja. | | Sortie: | | BeNetBitmapCatalog*: Le pointeur vers la seule instance de la classe. | \*=============================================================================================*/ BitmapCatalog* BitmapCatalog::Instance() { if(m_pInstance == NULL) m_pInstance = new BitmapCatalog; return m_pInstance; } /*=============================================================================================*\ | FetchBitmap | +-----------------------------------------------------------------------------------------------+ | Effet: Converie une image en un BBitmap. La couleur de transparence est celle du pixel dans | | le coin superieur gauche. | | Entree: | | char *pzFileName: Le path du fichier image a convertir. | | bool bTran: True si on utilise la transparence, false sinon. | | Sortie: | | BBitmap *: Le pointeur le bitmap de l'image. NULL si la conversion a echouer. | \*=============================================================================================*/ BBitmap* BitmapCatalog::FetchBitmap(char* pzFileName, bool bTrans) { BFile file(pzFileName, B_READ_ONLY); BTranslatorRoster *roster = BTranslatorRoster::Default(); BBitmapStream stream; BBitmap *result = NULL; if (roster->Translate(&file, NULL, NULL, &stream, B_TRANSLATOR_BITMAP) < B_OK) return NULL; stream.DetachBitmap(&result); // OliverESP: 7 x 1 so -> #include <TranslationUtils.h> //OliverESP: // less code and works //BBitmap *result = BTranslationUtils::GetBitmapFile(pzFileName); if (result == NULL) return NULL; if(!bTrans) return result; int32 iLenght = result->BitsLength() / 4; int32 i; int32 * cBit = (int32*)result->Bits(); int32 backColor = cBit[result->Bounds().IntegerWidth() - 1]; int32 iTrans = 0; //Determine le mode de definition de couleur switch(result->ColorSpace()) { case B_RGB32: iTrans = B_TRANSPARENT_MAGIC_RGBA32; break; case B_RGB32_BIG: iTrans = B_TRANSPARENT_MAGIC_RGBA32_BIG; break; default: break; //TODO: Major screwup here! } if (iTrans) { for(i = 0; i < iLenght; i++) { if(cBit[i] == backColor) cBit[i] = iTrans; } } return result; }
38.06383
97
0.484069
HaikuArchives
c75b8f6dc620adf01ebc97733ab40ce6c88b1c77
435
cpp
C++
ianlmk/cs161a/c++/misc/zybooks7.2.cpp
ianlmk/cs161
7a50740d1642ca0111a6d0d076b600744552a066
[ "MIT" ]
null
null
null
ianlmk/cs161a/c++/misc/zybooks7.2.cpp
ianlmk/cs161
7a50740d1642ca0111a6d0d076b600744552a066
[ "MIT" ]
1
2022-03-25T18:34:47.000Z
2022-03-25T18:35:23.000Z
ianlmk/cs161a/c++/misc/zybooks7.2.cpp
ianlmk/cs161
7a50740d1642ca0111a6d0d076b600744552a066
[ "MIT" ]
null
null
null
#include <iostream> #include <iomanip> using namespace std; int main() { string word = "words"; cout << "\n\n2 number combos" << endl; for (int i = 0; i < word.length() ; ++i) { cout << word[i] << ","; for (int x = i; x > word.length(); x--) { cout << word[x] << ","; for (int y = x; y < word.length(); ++y) { cout << word[y] << "," << endl; } } cout << endl; } return 0; }
17.4
47
0.452874
ianlmk
c75c39292fde09061c83d84e1d1c77ca842dbc71
2,353
cpp
C++
OgreCWrapper/Src/ManagedRenderTargetListener.cpp
AnomalousMedical/Engine
a19e21f597bd277e4ca17e0e5f3f89577f2307bb
[ "MIT" ]
null
null
null
OgreCWrapper/Src/ManagedRenderTargetListener.cpp
AnomalousMedical/Engine
a19e21f597bd277e4ca17e0e5f3f89577f2307bb
[ "MIT" ]
null
null
null
OgreCWrapper/Src/ManagedRenderTargetListener.cpp
AnomalousMedical/Engine
a19e21f597bd277e4ca17e0e5f3f89577f2307bb
[ "MIT" ]
null
null
null
#include "StdAfx.h" class ManagedRenderTargetListener : Ogre::RenderTargetListener { public: ManagedRenderTargetListener(NativeAction preRenderTargetUpdateCb, NativeAction postRenderTargetUpdateCb, NativeAction preViewportUpdateCb, NativeAction postViewportUpdateCb, NativeAction viewportAddedCb, NativeAction viewportRemovedCb HANDLE_ARG) :preRenderTargetUpdateCb(preRenderTargetUpdateCb), postRenderTargetUpdateCb(postRenderTargetUpdateCb), preViewportUpdateCb(preViewportUpdateCb), postViewportUpdateCb(postViewportUpdateCb), viewportAddedCb(viewportAddedCb), viewportRemovedCb(viewportRemovedCb) ASSIGN_HANDLE_INITIALIZER { } virtual ~ManagedRenderTargetListener() { } virtual void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) { preRenderTargetUpdateCb(PASS_HANDLE); } virtual void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) { postRenderTargetUpdateCb(PASS_HANDLE); } virtual void preViewportUpdate(const Ogre::RenderTargetViewportEvent& evt) { preViewportUpdateCb(PASS_HANDLE); } virtual void postViewportUpdate(const Ogre::RenderTargetViewportEvent& evt) { postViewportUpdateCb(PASS_HANDLE); } virtual void viewportAdded(const Ogre::RenderTargetViewportEvent& evt) { viewportAddedCb(PASS_HANDLE); } virtual void viewportRemoved(const Ogre::RenderTargetViewportEvent& evt) { viewportRemovedCb(PASS_HANDLE); } private: NativeAction preRenderTargetUpdateCb; NativeAction postRenderTargetUpdateCb; NativeAction preViewportUpdateCb; NativeAction postViewportUpdateCb; NativeAction viewportAddedCb; NativeAction viewportRemovedCb; HANDLE_INSTANCE }; extern "C" _AnomalousExport ManagedRenderTargetListener* ManagedRenderTargetListener_Create(NativeAction preRenderTargetUpdateCb, NativeAction postRenderTargetUpdateCb, NativeAction preViewportUpdateCb, NativeAction postViewportUpdateCb, NativeAction viewportAddedCb, NativeAction viewportRemovedCb HANDLE_ARG) { return new ManagedRenderTargetListener(preRenderTargetUpdateCb, postRenderTargetUpdateCb, preViewportUpdateCb, postViewportUpdateCb, viewportAddedCb, viewportRemovedCb PASS_HANDLE_ARG); } extern "C" _AnomalousExport void ManagedRenderTargetListener_Delete(ManagedRenderTargetListener *listener) { delete listener; }
32.680556
311
0.822354
AnomalousMedical
c75c3e8d3776c3977dfeef364cff002732cda124
7,297
hpp
C++
include/nonstd/fifo-set.hpp
cjxgm/fifo-map
714f57b5de6aeab88cd00a0c0def9ae368851dba
[ "MIT" ]
null
null
null
include/nonstd/fifo-set.hpp
cjxgm/fifo-map
714f57b5de6aeab88cd00a0c0def9ae368851dba
[ "MIT" ]
null
null
null
include/nonstd/fifo-set.hpp
cjxgm/fifo-map
714f57b5de6aeab88cd00a0c0def9ae368851dba
[ "MIT" ]
null
null
null
#pragma once // A hash set that guarantees iteration in insertion-order for C++14 or above. // Or you can say, "a FIFO-ordered duplication-free container" if you feel like it. // // It's basically an `std::forward_list` of values, // with a lookup index built using `std::unordered_map`. // // It's a drop-in replacement for `std::unordered_set` // if the interface you used was implemented. // // Time complexity of all implemented operations are basically // the same as `std::unordered_map`, which should be the same as `std::unordered_set`. // // Copyright (C) Giumo Clanjor (哆啦比猫/兰威举), 2020. // Licensed under the MIT License. #include <unordered_map> #include <forward_list> #include <cassert> namespace nonstd { template < class T , class Hash = std::hash<T> , class Equal = std::equal_to<T> > struct fifo_set final { using value_type = T; using hasher = Hash; using equal = Equal; using list_type = std::forward_list<value_type>; using list_iterator = typename list_type::iterator; using list_const_iterator = typename list_type::const_iterator; using iterator = list_iterator; using const_iterator = list_const_iterator; struct value_reference final { value_reference(value_type const& x): x{x} {} auto hash() const -> std::size_t { hasher h{}; return h(x); } friend auto operator == (value_reference const& a, value_reference const& b) -> bool { equal eq{}; return eq(a.x, b.x); } private: value_type const& x; }; struct value_reference_hasher final { auto operator () (value_reference const& xr) const -> std::size_t { return xr.hash(); } }; using map_type = std::unordered_map<value_reference, list_iterator, value_reference_hasher>; using map_iterator = typename map_type::iterator; using size_type = typename map_type::size_type; // rule of five; force noexcept move constructible fifo_set() = default; fifo_set(fifo_set const& x) { for (auto&& kv: x) emplace_back(kv); } auto operator = (fifo_set const& x) -> fifo_set& { clear(); for (auto&& kv: x) emplace_back(kv); return *this; } fifo_set(fifo_set&& other) noexcept : map{std::move(other.map)} , list{std::move(other.list)} , list_back{(list.empty() ? list.before_begin() : other.list_back)} { if (!list.empty()) map.at(list.front()) = list.before_begin(); } auto operator = (fifo_set&& other) noexcept -> fifo_set& { map = std::move(other.map); list = std::move(other.list); list_back = (list.empty() ? list.before_begin() : other.list_back); if (!list.empty()) map.at(list.front()) = list.before_begin(); return *this; } // For interface compatibility with std::unordered_set. template <class... Args> auto emplace(Args&&... args) -> std::pair<iterator, bool> { return emplace_back(std::forward<Args>(args)...); } template <class... Args> auto emplace_back(Args&&... args) -> std::pair<iterator, bool> { value_type value{std::forward<Args>(args)...}; auto map_it = map.find(value); if (map_it == map.end()) { auto list_before_item = list_back; list_back = list.insert_after(list_back, std::move(value)); map.emplace(*list_back, list_before_item); return { list_back, true }; } else { auto list_it = map_it->second; ++list_it; return { list_it, false }; } } template <class... Args> auto emplace_front(Args&&... args) -> std::pair<iterator, bool> { value_type value{std::forward<Args>(args)...}; auto map_it = map.find(value); if (map_it == map.end()) { auto& list_it = (empty() ? list_back : map.at(list.front())); auto list_before_item = list_it; list_it = list.insert_after(list_before_item, std::move(value)); map.emplace(*list_it, list_before_item); return { list_it, true }; } else { auto list_it = map_it->second; ++list_it; return { list_it, false }; } } auto erase(list_iterator list_it) -> void { auto map_it = map.find(*list_it); assert(map_it != map.end()); auto list_before_item = map_it->second; map.erase(map_it); list_it = list.erase_after(list_before_item); if (list_it == list.end()) { list_back = list_before_item; } else { map.at(*list_it) = list_before_item; } } auto erase(value_type const& x) -> void { auto map_it = map.find(x); if (map_it == map.end()) return; auto list_before_item = map_it->second; map.erase(map_it); auto list_it = list.erase_after(list_before_item); if (list_it == list.end()) { list_back = list_before_item; } else { map.at(*list_it) = list_before_item; } } auto clear() -> void { map.clear(); list.clear(); list_back = list.before_begin(); } auto count(value_type const& x) const -> size_type { return map.count(x); } auto size() const -> size_type { return map.size(); } auto empty() const -> bool { return map.empty(); } auto find(value_type const& x) const -> const_iterator { auto map_it = map.find(x); if (map_it == map.end()) return end(); auto list_before_item = map_it->second; return ++list_before_item; } auto find(value_type const& x) -> iterator { auto map_it = map.find(x); if (map_it == map.end()) return end(); auto list_before_item = map_it->second; return ++list_before_item; } auto begin() -> iterator { return list.begin(); } auto end() -> iterator { return list. end(); } auto begin() const -> const_iterator { return list.begin(); } auto end() const -> const_iterator { return list. end(); } auto cbegin() const -> const_iterator { return list.cbegin(); } auto cend() const -> const_iterator { return list. cend(); } private: map_type map; list_type list; list_iterator list_back{list.before_begin()}; }; }
29.905738
100
0.521036
cjxgm
c75d9bba4880f0d536589fcbf0ef236d3655c50b
3,628
cpp
C++
cpp/godot-cpp/src/gen/InputMap.cpp
GDNative-Gradle/proof-of-concept
162f467430760cf959f68f1638adc663fd05c5fd
[ "MIT" ]
1
2021-03-16T09:51:00.000Z
2021-03-16T09:51:00.000Z
cpp/godot-cpp/src/gen/InputMap.cpp
GDNative-Gradle/proof-of-concept
162f467430760cf959f68f1638adc663fd05c5fd
[ "MIT" ]
null
null
null
cpp/godot-cpp/src/gen/InputMap.cpp
GDNative-Gradle/proof-of-concept
162f467430760cf959f68f1638adc663fd05c5fd
[ "MIT" ]
null
null
null
#include "InputMap.hpp" #include <core/GodotGlobal.hpp> #include <core/CoreTypes.hpp> #include <core/Ref.hpp> #include <core/Godot.hpp> #include "__icalls.hpp" #include "InputEvent.hpp" namespace godot { InputMap *InputMap::_singleton = NULL; InputMap::InputMap() { _owner = godot::api->godot_global_get_singleton((char *) "InputMap"); } InputMap::___method_bindings InputMap::___mb = {}; void InputMap::___init_method_bindings() { ___mb.mb_action_add_event = godot::api->godot_method_bind_get_method("InputMap", "action_add_event"); ___mb.mb_action_erase_event = godot::api->godot_method_bind_get_method("InputMap", "action_erase_event"); ___mb.mb_action_erase_events = godot::api->godot_method_bind_get_method("InputMap", "action_erase_events"); ___mb.mb_action_has_event = godot::api->godot_method_bind_get_method("InputMap", "action_has_event"); ___mb.mb_action_set_deadzone = godot::api->godot_method_bind_get_method("InputMap", "action_set_deadzone"); ___mb.mb_add_action = godot::api->godot_method_bind_get_method("InputMap", "add_action"); ___mb.mb_erase_action = godot::api->godot_method_bind_get_method("InputMap", "erase_action"); ___mb.mb_event_is_action = godot::api->godot_method_bind_get_method("InputMap", "event_is_action"); ___mb.mb_get_action_list = godot::api->godot_method_bind_get_method("InputMap", "get_action_list"); ___mb.mb_get_actions = godot::api->godot_method_bind_get_method("InputMap", "get_actions"); ___mb.mb_has_action = godot::api->godot_method_bind_get_method("InputMap", "has_action"); ___mb.mb_load_from_globals = godot::api->godot_method_bind_get_method("InputMap", "load_from_globals"); } void InputMap::action_add_event(const String action, const Ref<InputEvent> event) { ___godot_icall_void_String_Object(___mb.mb_action_add_event, (const Object *) this, action, event.ptr()); } void InputMap::action_erase_event(const String action, const Ref<InputEvent> event) { ___godot_icall_void_String_Object(___mb.mb_action_erase_event, (const Object *) this, action, event.ptr()); } void InputMap::action_erase_events(const String action) { ___godot_icall_void_String(___mb.mb_action_erase_events, (const Object *) this, action); } bool InputMap::action_has_event(const String action, const Ref<InputEvent> event) { return ___godot_icall_bool_String_Object(___mb.mb_action_has_event, (const Object *) this, action, event.ptr()); } void InputMap::action_set_deadzone(const String action, const real_t deadzone) { ___godot_icall_void_String_float(___mb.mb_action_set_deadzone, (const Object *) this, action, deadzone); } void InputMap::add_action(const String action, const real_t deadzone) { ___godot_icall_void_String_float(___mb.mb_add_action, (const Object *) this, action, deadzone); } void InputMap::erase_action(const String action) { ___godot_icall_void_String(___mb.mb_erase_action, (const Object *) this, action); } bool InputMap::event_is_action(const Ref<InputEvent> event, const String action) const { return ___godot_icall_bool_Object_String(___mb.mb_event_is_action, (const Object *) this, event.ptr(), action); } Array InputMap::get_action_list(const String action) { return ___godot_icall_Array_String(___mb.mb_get_action_list, (const Object *) this, action); } Array InputMap::get_actions() { return ___godot_icall_Array(___mb.mb_get_actions, (const Object *) this); } bool InputMap::has_action(const String action) const { return ___godot_icall_bool_String(___mb.mb_has_action, (const Object *) this, action); } void InputMap::load_from_globals() { ___godot_icall_void(___mb.mb_load_from_globals, (const Object *) this); } }
39.868132
113
0.791621
GDNative-Gradle
c75f9c1a3ad094e5958f95b370a65ae9dafced56
12,714
hpp
C++
src/circular_list.hpp
mrtryhard/circular_list
47807fd5025e93b5978011a0927a20b084229d26
[ "BSD-3-Clause" ]
null
null
null
src/circular_list.hpp
mrtryhard/circular_list
47807fd5025e93b5978011a0927a20b084229d26
[ "BSD-3-Clause" ]
1
2018-03-19T22:52:13.000Z
2018-03-19T22:52:13.000Z
src/circular_list.hpp
mrtryhard/circular_list
47807fd5025e93b5978011a0927a20b084229d26
[ "BSD-3-Clause" ]
null
null
null
#ifndef MRT_CONTAINERS_CIRCULAR_LIST_HPP_ #define MRT_CONTAINERS_CIRCULAR_LIST_HPP_ #include <algorithm> #include <cstddef> #include <initializer_list> #include <iterator> namespace mrt { namespace containers { namespace { template<typename T, typename size_type = std::size_t> T* next(T* buffer, size_type max_size, T* position) noexcept { if (position == buffer + max_size) { return buffer; } else { return position + 1; } } template<typename T, typename size_type = std::size_t> T* previous(T* buffer, size_type max_size, T* position) noexcept { if (position == buffer) { return buffer + max_size; } else { return position - 1; } } } template<typename U> class circular_iterator { public: using value_type = U; using pointer = U * ; using const_pointer = const U*; using reference = U & ; using const_reference = const U&; using iterator_category = std::random_access_iterator_tag; using size_type = std::size_t; using difference_type = std::ptrdiff_t; using my_it = circular_iterator<value_type>; public: using _Unchecked_type = circular_iterator<U>; // msvc C4996. private: pointer value; pointer base; size_type max_size; bool tail_over_head; public: circular_iterator() = delete; explicit circular_iterator(pointer val, pointer buffer, size_type max_size, bool tail_over_head) : value{ val }, base{ buffer }, max_size{ max_size }, tail_over_head{ tail_over_head } {} circular_iterator(const circular_iterator<value_type>& other) : value{ other.value }, base{ other.base }, max_size{ other.max_size } {} my_it& operator=(const my_it& other) { value = other.value; base = other.base; max_size = other.max_size; return *this; } reference operator*() noexcept { return *value; } const_reference operator*() const noexcept { return *value; } pointer operator->() noexcept { return &(operator*()); } const_pointer operator->() const noexcept { return &(operator*()); } reference operator [] (difference_type n) noexcept { return *(*this + n); } const_reference operator [] (difference_type n) const noexcept { return *(*this + n); } bool operator==(const my_it& other) { return value == other.value; } bool operator!=(const my_it& other) { return !(*this == other); } my_it& operator+=(difference_type n) noexcept { if (n >= 0) { while (n--) value = previous(base, max_size, value); } else { while (n++) value = next(base, max_size, value); } return *this; } my_it operator+(difference_type n) const noexcept { my_it new_it{ value, base, max_size, tail_over_head }; new_it += n; return new_it; } my_it operator-(difference_type n) const noexcept { my_it new_it{ value, base, max_size, tail_over_head }; new_it += -n; return new_it; } difference_type operator-(my_it n) const noexcept { if (tail_over_head) { return ((base + static_cast<std::ptrdiff_t>(max_size + 1)) - value) + (n.value - base); } else { return n.value - value; } } my_it& operator-=(difference_type n) noexcept { return *this += (-n); } my_it& operator++(int) { value = previous(base, max_size, value); return *this; } my_it& operator++() { value = previous(base, max_size, value); return *this; } my_it& operator--(int) { value = next(base, max_size, value); return *this; } my_it& operator--() { value = next(base, max_size, value); return *this; } bool operator<(my_it b) const noexcept { auto n = (b - *this); return n < 0; } bool operator>(my_it b) const noexcept { return b < *this; } bool operator>=(my_it b) const noexcept { return !(*this < b); } bool operator<=(my_it b) const noexcept { return !(*this > b); } }; template<typename T> class circular_list { public: using value_type = T; using size_type = std::size_t; using pointer = value_type * ; using const_pointer = const pointer; using reference = value_type & ; using const_reference = const value_type&; using iterator = circular_iterator<value_type>; using const_iterator = const circular_iterator<value_type>; using reverse_iterator = std::reverse_iterator<circular_iterator<value_type> >; using const_reverse_iterator = const reverse_iterator; private: size_type max_size; pointer buffer; pointer head; pointer tail; public: circular_list() = delete; explicit circular_list(size_type size) : max_size{ size }, buffer{ new value_type[size + 1] } { head = tail = buffer; } explicit circular_list(std::initializer_list<value_type> list) : max_size{ list.size() }, buffer{ new value_type[list.size() + 1] } { head = buffer + list.size(); tail = buffer; try { std::copy(std::rbegin(list), std::rend(list), begin()); } catch (...) { delete[] buffer; throw; } } template<typename It> circular_list(It first, It last) : max_size{ std::distance(first, last) }, buffer{ new value_type[max_size + 1] }, head{ buffer + 1 }, tail{ buffer } { try { std::copy(first, last, begin()); } catch (...) { delete[] buffer; throw; } } circular_list(circular_list<value_type>&& other) noexcept : max_size{ other.max_size }, buffer{ other.buffer }, head{ other.head }, tail{ other.tail } { other.buffer = {}; other.head = {}; other.tail = {}; other.max_size = {}; } circular_list(const circular_list<value_type>& other) : max_size{ other.max_size }, buffer{ new value_type[max_size + 1] }, head{ buffer + 1 }, tail{ buffer } { try { std::copy(other.crbegin(), other.crend(), begin()); head = buffer + (other.head - other.buffer); tail = buffer + (other.tail - other.buffer); } catch (...) { delete[] buffer; throw; } } circular_list<value_type>& operator=(const circular_list<value_type>& other) { if (this == &other) return *this; head = buffer + 1; tail = buffer; std::copy(other.crbegin(), other.crend(), begin()); head = buffer + (other.head - other.buffer); tail = buffer + (other.tail - other.buffer); return *this; } circular_list<value_type>& operator=(circular_list<value_type>&& other) { delete[] buffer; buffer = other.buffer; head = other.head; tail = other.tail; max_size = other.max_size; other.buffer = {}; other.head = {}; other.tail = {}; other.max_size = {}; return *this; } ~circular_list() { delete[] buffer; } reference front() noexcept { return *previous(buffer, max_size, head); } const_reference front() const noexcept { return *previous(buffer, max_size, head); } reference back() noexcept { return *tail; } const_reference back() const noexcept { return *tail; } void pop() { tail = next(buffer, max_size, tail); } void push(const value_type& element) { *head = element; head = next(buffer, max_size, head); if (head == tail) { tail = next(buffer, max_size, tail); } } void push(value_type&& element) { *head = std::move(element); head = next(buffer, max_size, head); if (head == tail) { tail = next(buffer, max_size, tail); } } void swap(circular_list<value_type>& other) noexcept { std::swap(head, other.head); std::swap(tail, other.tail); std::swap(buffer, other.buffer); std::swap(max_size, other.max_size); } bool empty() const noexcept { return head == tail; } bool full() const noexcept { return next(buffer, max_size, head) == tail; } void clear() noexcept { head = buffer; tail = buffer; } size_type size() const noexcept { if (head >= tail) { return static_cast<size_type>(head - tail); } else { return static_cast<size_type>((head + (max_size + 1) - tail)); } } iterator begin() noexcept { return iterator{ previous(buffer, max_size, head), buffer, max_size, tail > head }; } reverse_iterator rbegin() noexcept { return reverse_iterator{ iterator{ previous(buffer, max_size, tail), buffer, max_size, tail > head } }; } const_iterator cbegin() const noexcept { return const_iterator{ previous(buffer, max_size, head), buffer, max_size, tail > head }; } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator{ const_iterator{ previous(buffer, max_size, tail), buffer, max_size, tail > head } }; } iterator end() noexcept { return iterator{ previous(buffer, max_size, tail), buffer, max_size, tail > head }; } reverse_iterator rend() noexcept { return reverse_iterator{ iterator{ previous(buffer, max_size, head), buffer, max_size, tail > head } }; } const_iterator cend() const noexcept { return const_iterator{ previous(buffer, max_size, tail), buffer, max_size, tail > head }; } const_reverse_iterator crend() const noexcept { return const_reverse_iterator{ const_iterator{ previous(buffer, max_size, head), buffer, max_size, tail > head } }; } }; template <class TValue> void swap(circular_list<TValue>& left, circular_list<TValue>& right) noexcept { left.swap(right); } } } #endif
33.195822
147
0.471606
mrtryhard
c75fc01f8fd87b552cf23271ec96e323eee96c2d
2,232
hpp
C++
external/boost_1_60_0/qsboost/range/size.hpp
wouterboomsma/quickstep
a33447562eca1350c626883f21c68125bd9f776c
[ "MIT" ]
1
2019-06-27T17:54:13.000Z
2019-06-27T17:54:13.000Z
external/boost_1_60_0/qsboost/range/size.hpp
wouterboomsma/quickstep
a33447562eca1350c626883f21c68125bd9f776c
[ "MIT" ]
null
null
null
external/boost_1_60_0/qsboost/range/size.hpp
wouterboomsma/quickstep
a33447562eca1350c626883f21c68125bd9f776c
[ "MIT" ]
null
null
null
// Boost.Range library // // Copyright Thorsten Ottosen 2003-2004. Use, modification and // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // For more information, see http://www.boost.org/libs/range/ // #ifndef QSBOOST_RANGE_SIZE_HPP #define QSBOOST_RANGE_SIZE_HPP #if defined(_MSC_VER) # pragma once #endif #include <qsboost/range/config.hpp> #include <qsboost/range/begin.hpp> #include <qsboost/range/end.hpp> #include <qsboost/range/size_type.hpp> #include <qsboost/range/detail/has_member_size.hpp> #include <qsboost/assert.hpp> #include <qsboost/cstdint.hpp> #include <qsboost/utility.hpp> namespace qsboost { namespace range_detail { template<class SinglePassRange> inline typename ::qsboost::enable_if< has_member_size<SinglePassRange>, typename range_size<const SinglePassRange>::type >::type range_calculate_size(const SinglePassRange& rng) { return rng.size(); } template<class SinglePassRange> inline typename disable_if< has_member_size<SinglePassRange>, typename range_size<const SinglePassRange>::type >::type range_calculate_size(const SinglePassRange& rng) { return std::distance(qsboost::begin(rng), qsboost::end(rng)); } } template<class SinglePassRange> inline typename range_size<const SinglePassRange>::type size(const SinglePassRange& rng) { // Very strange things happen on some compilers that have the range concept // asserts disabled. This preprocessor condition is clearly redundant on a // working compiler but is vital for at least some compilers such as clang 4.2 // but only on the Mac! #if QSBOOST_RANGE_ENABLE_CONCEPT_ASSERT == 1 QSBOOST_RANGE_CONCEPT_ASSERT((qsboost::SinglePassRangeConcept<SinglePassRange>)); #endif #if !QSBOOST_WORKAROUND(__BORLANDC__, QSBOOST_TESTED_AT(0x564)) && \ !QSBOOST_WORKAROUND(__GNUC__, < 3) \ /**/ using namespace range_detail; #endif return range_calculate_size(rng); } } // namespace 'boost' #endif
28.987013
89
0.702957
wouterboomsma
c763f174c1bf57f3f95c19b6bab7bc7a91ef7619
3,552
hpp
C++
sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/delete_key_operation.hpp
chidozieononiwu/azure-sdk-for-cpp
7d9032fcc815523231d6ff3e1d96d6212e94b079
[ "MIT" ]
null
null
null
sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/delete_key_operation.hpp
chidozieononiwu/azure-sdk-for-cpp
7d9032fcc815523231d6ff3e1d96d6212e94b079
[ "MIT" ]
null
null
null
sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/delete_key_operation.hpp
chidozieononiwu/azure-sdk-for-cpp
7d9032fcc815523231d6ff3e1d96d6212e94b079
[ "MIT" ]
null
null
null
// Copyright (c) Microsoft Corporation. All rights reserved. // SPDX-License-Identifier: MIT /** * @file * @brief A long-running operation for deleting a Key. * */ #pragma once #include <azure/core/http/http.hpp> #include <azure/core/operation.hpp> #include <azure/core/operation_status.hpp> #include <azure/core/response.hpp> #include <azure/keyvault/common/internal/keyvault_pipeline.hpp> #include <azure/keyvault/common/keyvault_exception.hpp> #include "azure/keyvault/keys/deleted_key.hpp" #include <memory> #include <string> #include <thread> namespace Azure { namespace Security { namespace KeyVault { namespace Keys { /** * @brief A long running operation to delete a key. * */ class DeleteKeyOperation : public Azure::Core::Operation<Azure::Security::KeyVault::Keys::DeletedKey> { private: /* DeleteKeyOperation can be constructed only by friends classes (internal creation). The * constructor is private and requires internal components.*/ friend class KeyClient; std::shared_ptr<Azure::Security::KeyVault::Common::_internal::KeyVaultPipeline> m_pipeline; Azure::Security::KeyVault::Keys::DeletedKey m_value; std::string m_continuationToken; /* This is the implementation for checking the status of a deleted key. The key is considered * deleted if querying /deletedkeys/keyName returns 200 from server. Or whenever soft-delete is * disabled.*/ std::unique_ptr<Azure::Core::Http::RawResponse> PollInternal( Azure::Core::Context& context) override; Azure::Response<Azure::Security::KeyVault::Keys::DeletedKey> PollUntilDoneInternal( std::chrono::milliseconds period, Azure::Core::Context& context) override { while (true) { // Poll will update the raw response. Poll(context); if (IsDone()) { break; } std::this_thread::sleep_for(period); } return Azure::Response<Azure::Security::KeyVault::Keys::DeletedKey>( m_value, std::make_unique<Azure::Core::Http::RawResponse>(*m_rawResponse)); } /* * Only friend classes are permitted to construct a DeleteOperation. This is because a * KeyVaultPipelne is required and it is not exposed to customers. * * Since C++ doesn't offer `internal` access, we use friends-only instead. */ DeleteKeyOperation( std::shared_ptr<Azure::Security::KeyVault::Common::_internal::KeyVaultPipeline> keyvaultPipeline, Azure::Response<Azure::Security::KeyVault::Keys::DeletedKey> response); /** * @brief Get the #Azure::Core::Http::RawResponse of the operation request. * @return A reference to an #Azure::Core::Http::RawResponse. * @note Does not give up ownership of the RawResponse. */ Azure::Core::Http::RawResponse const& GetRawResponseInternal() const override { return *m_rawResponse; } public: /** * @brief Get the #Azure::Security::KeyVault::Keys::DeletedKey object. * * @remark The deleted key contains the recovery id if the key can be recovered. * * @return A deleted key object. */ Azure::Security::KeyVault::Keys::DeletedKey Value() const override { return m_value; } /** * @brief Get an Url as string which can be used to get the status of the delete key operation. * * @return std::string */ std::string GetResumeToken() const override { return m_continuationToken; } }; }}}} // namespace Azure::Security::KeyVault::Keys
32.888889
99
0.679054
chidozieononiwu
c7647b4f780373217243e89f92ca89defb522190
30,114
cpp
C++
DeepLearningToolKit/Toolkit/Core/Mathematics/SanMathematicsVector.cpp
zxyinz/DeepLearningForBlueShark
025206aa7450b7ec86ebab9ca2bbcabe4421af91
[ "MIT" ]
null
null
null
DeepLearningToolKit/Toolkit/Core/Mathematics/SanMathematicsVector.cpp
zxyinz/DeepLearningForBlueShark
025206aa7450b7ec86ebab9ca2bbcabe4421af91
[ "MIT" ]
null
null
null
DeepLearningToolKit/Toolkit/Core/Mathematics/SanMathematicsVector.cpp
zxyinz/DeepLearningForBlueShark
025206aa7450b7ec86ebab9ca2bbcabe4421af91
[ "MIT" ]
null
null
null
#include"SanMathematicsVector.h" using namespace std; using namespace San; using namespace San::Mathematics; San::Mathematics::stSPOINT2::stSPOINT2(const sfloat x, const sfloat y) :x(x), y(y) { } San::Mathematics::stSPOINT2::~stSPOINT2() { } San::Mathematics::stSPOINT3::stSPOINT3(const sfloat x, const sfloat y, const sfloat z) :x(x), y(y), z(z) { } San::Mathematics::stSPOINT3::~stSPOINT3() { } San::Mathematics::stSPOINT4::stSPOINT4(const sfloat x, const sfloat y, const sfloat z, const sfloat w) :x(x), y(y), z(z), w(w) { } San::Mathematics::stSPOINT4::~stSPOINT4() { } San::Mathematics::SPOINT2::SPOINT2(const sfloat Val) :stSPOINT2(Val, Val) { } San::Mathematics::SPOINT2::SPOINT2(const sfloat x, const sfloat y) :stSPOINT2(x, y) { } San::Mathematics::SPOINT2::SPOINT2(const sfloat* pArray) :stSPOINT2(0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; } } San::Mathematics::SPOINT2::SPOINT2(const SPOINT2 &Point2) :stSPOINT2(Point2.x, Point2.y) { } San::Mathematics::SPOINT2::SPOINT2(const SPOINT3 &Point3) :stSPOINT2(Point3.x, Point3.y) { } San::Mathematics::SPOINT2::SPOINT2(const SPOINT4 &Point4) :stSPOINT2(Point4.x, Point4.y) { } San::Mathematics::SPOINT2::SPOINT2(const SVECTOR2 &Vec2) :stSPOINT2(Vec2.x, Vec2.y) { } San::Mathematics::SPOINT2::SPOINT2(const SVECTOR3 &Vec3) :stSPOINT2(Vec3.x, Vec3.y) { } San::Mathematics::SPOINT2::SPOINT2(const SVECTOR4 &Vec4) :stSPOINT2(Vec4.x, Vec4.y) { } San::Mathematics::SPOINT2::~SPOINT2() { } const sfloat& San::Mathematics::SPOINT2::operator[](const uint32 Position) const { return this->p[Position > 2 ? 2 : Position]; } sfloat& San::Mathematics::SPOINT2::operator[](const uint32 Position) { return this->p[Position > 2 ? 2 : Position]; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; return *this; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; return *this; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; return *this; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; return *this; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; return *this; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; return *this; } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator+(const SPOINT2 &Point2) const { return SPOINT2(this->x + Point2.x, this->y + Point2.y); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator-(const SPOINT2 &Point2) const { return SPOINT2(this->x - Point2.x, this->y - Point2.y); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator*(const SPOINT2 &Point2) const { return SPOINT2(this->x * Point2.x, this->y * Point2.y); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator+(const sfloat Val) const { return SPOINT2(this->x + Val, this->y + Val); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator-(const sfloat Val) const { return SPOINT2(this->x - Val, this->y - Val); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator*(const sfloat Val) const { return SPOINT2(this->x * Val, this->y * Val); } bool San::Mathematics::SPOINT2::operator==(const SPOINT2 &Point2) const { if (!::gloIsFloatEqual(this->x, Point2.x)){ return false; } if (!::gloIsFloatEqual(this->y, Point2.y)){ return false; } //return (::gloIsFloatEqual(this->x, Point2.x) && ::gloIsFloatEqual(this->y, Point2.y)) ? true : false; return true; } bool San::Mathematics::SPOINT2::operator!=(const SPOINT2 &Point2) const { return !((*this) == Point2); } bool San::Mathematics::SPOINT2::operator<(const SPOINT2 &Point2) const { return (this->x < Point2.x) && (this->y < Point2.y); } bool San::Mathematics::SPOINT2::operator>(const SPOINT2 &Point2) const { return (this->x > Point2.x) && (this->y > Point2.y); } bool San::Mathematics::SPOINT2::operator<=(const SPOINT2 &Point2) const { return (this->x <= Point2.x) && (this->y <= Point2.y); } bool San::Mathematics::SPOINT2::operator>=(const SPOINT2 &Point2) const { return (this->x >= Point2.x) && (this->y >= Point2.y); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::iGetHomogeneousPoint() const { if (::gloIsFloatEqual(this->y, 0.0)) { return SPOINT2(this->x, 1.0); } return SPOINT2(this->x/this->y,1.0); } void San::Mathematics::SPOINT2::iHomogenzation() { if (::gloIsFloatEqual(this->y, 0.0)) { this->y = 1.0; return; } this->x = this->x / this->y; this->y = 1.0; } San::Mathematics::SVECTOR2::SVECTOR2(const sfloat Val) :stSPOINT2(Val, Val) { } San::Mathematics::SVECTOR2::SVECTOR2(const sfloat x, const sfloat y) :stSPOINT2(x, y) { } San::Mathematics::SVECTOR2::SVECTOR2(const sfloat* pArray) :stSPOINT2(0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; } } San::Mathematics::SVECTOR2::SVECTOR2(const SVECTOR2 &Vec2) :stSPOINT2(Vec2.x, Vec2.y) { } San::Mathematics::SVECTOR2::SVECTOR2(const SPOINT2 &Point2) :stSPOINT2(Point2.x, Point2.y) { } San::Mathematics::SVECTOR2::SVECTOR2(const SPOINT3 &Point3) :stSPOINT2(Point3.x, Point3.y) { } San::Mathematics::SVECTOR2::SVECTOR2(const SPOINT4 &Point4) :stSPOINT2(Point4.x, Point4.y) { } San::Mathematics::SVECTOR2::SVECTOR2(const SVECTOR3 &Vec3) :stSPOINT2(Vec3.x, Vec3.y) { } San::Mathematics::SVECTOR2::SVECTOR2(const SVECTOR4 &Vec4) :stSPOINT2(Vec4.x, Vec4.y) { } San::Mathematics::SVECTOR2::~SVECTOR2() { } const sfloat& San::Mathematics::SVECTOR2::operator[](const uint32 Position) const { return this->p[Position > 2 ? 2 : Position]; } sfloat& San::Mathematics::SVECTOR2::operator[](const uint32 Position) { return this->p[Position > 2 ? 2 : Position]; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; return *this; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; return *this; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; return *this; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; return *this; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; return *this; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; return *this; } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator+(const SVECTOR2 &Vec2) const { return SVECTOR2(this->x + Vec2.x, this->y + Vec2.y); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator-(const SVECTOR2 &Vec2) const { return SVECTOR2(this->x - Vec2.x, this->y - Vec2.y); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator*(const SVECTOR2 &Vec2) const { return SVECTOR2(this->x * Vec2.x, this->y * Vec2.y); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator+(const sfloat Val) const { return SVECTOR2(this->x + Val, this->y + Val); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator-(const sfloat Val) const { return SVECTOR2(this->x - Val, this->y - Val); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator*(const sfloat Val) const { return SVECTOR2(this->x * Val, this->y * Val); } bool San::Mathematics::SVECTOR2::operator==(const SVECTOR3 &Vec2) const { if (!::gloIsFloatEqual(this->x, Vec2.x)){ return false; } if (!::gloIsFloatEqual(this->y, Vec2.y)){ return false; } return true; } bool San::Mathematics::SVECTOR2::operator!=(const SVECTOR3 &Vec2) const { return !((*this) == Vec2); } bool San::Mathematics::SVECTOR2::operator<(const SVECTOR3 &Vec2) const { return (this->x < Vec2.x) && (this->y < Vec2.y); } bool San::Mathematics::SVECTOR2::operator>(const SVECTOR3 &Vec2) const { return (this->x > Vec2.x) && (this->y > Vec2.y); } bool San::Mathematics::SVECTOR2::operator<=(const SVECTOR3 &Vec2) const { return (this->x <= Vec2.x) && (this->y <= Vec2.y); } bool San::Mathematics::SVECTOR2::operator>=(const SVECTOR3 &Vec2) const { return (this->x >= Vec2.x) && (this->y >= Vec2.y); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::iGetHomogeneousVector() const { return SVECTOR2(this->x, 0.0); } void San::Mathematics::SVECTOR2::iHomogenzation() { this->y = 0.0; } San::Mathematics::SPOINT3::SPOINT3(const sfloat Val) :stSPOINT3(Val, Val, Val) { } San::Mathematics::SPOINT3::SPOINT3(const sfloat x, const sfloat y, const sfloat z) :stSPOINT3(x, y, z) { } San::Mathematics::SPOINT3::SPOINT3(const sfloat* pArray) :stSPOINT3(0.0, 0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; this->z = pArray[2]; } } San::Mathematics::SPOINT3::SPOINT3(const SPOINT3& Point3) :stSPOINT3(Point3.x, Point3.y, Point3.z) { } San::Mathematics::SPOINT3::SPOINT3(const SPOINT2 &Point2, const sfloat z) :stSPOINT3(Point2.x, Point2.y, z) { } San::Mathematics::SPOINT3::SPOINT3(const SPOINT4 &Point4) :stSPOINT3(Point4.x, Point4.y, Point4.z) { /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ } San::Mathematics::SPOINT3::SPOINT3(const SVECTOR2 &Vec2, const sfloat z) :stSPOINT3(Vec2.x, Vec2.y, z) { } San::Mathematics::SPOINT3::SPOINT3(const SVECTOR3 &Vec3) :stSPOINT3(Vec3.x, Vec3.y, Vec3.z) { } San::Mathematics::SPOINT3::SPOINT3(const SVECTOR4 &Vec4) :stSPOINT3(Vec4.x, Vec4.y, Vec4.z) { } San::Mathematics::SPOINT3::~SPOINT3() { } const sfloat& San::Mathematics::SPOINT3::operator[](const uint32 Position) const { return this->p[Position > 3 ? 3 : Position]; } sfloat& San::Mathematics::SPOINT3::operator[](const uint32 Position) { return this->p[Position > 3 ? 3 : Position]; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; this->z = 0.0; return *this; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; this->z = Point3.z; return *this; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; this->z = Point4.z; /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ return *this; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; this->z = 0.0; return *this; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; this->z = Vec3.z; return *this; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; this->z = Vec4.z; return *this; } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator+(const SPOINT3 &Point3) const { return SPOINT3(this->x + Point3.x, this->y + Point3.y, this->z + Point3.z); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator-(const SPOINT3 &Point3) const { return SPOINT3(this->x - Point3.x, this->y - Point3.y, this->z - Point3.z); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator*(const SPOINT3 &Point3) const { return SPOINT3(this->x * Point3.x, this->y * Point3.y, this->z * Point3.z); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator+(const sfloat Val) const { return SPOINT3(this->x + Val, this->y + Val, this->z + Val); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator-(const sfloat Val) const { return SPOINT3(this->x - Val, this->y - Val, this->z - Val); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator*(const sfloat Val) const { return SPOINT3(this->x * Val, this->y * Val, this->z * Val); } bool San::Mathematics::SPOINT3::operator==(const SPOINT3 &Point3) const { if (!::gloIsFloatEqual(this->x, Point3.x)){ return false; } if (!::gloIsFloatEqual(this->y, Point3.y)){ return false; } if (!::gloIsFloatEqual(this->z, Point3.z)){ return false; } return true; } bool San::Mathematics::SPOINT3::operator!=(const SPOINT3 &Point3) const { return !((*this) == Point3); } bool San::Mathematics::SPOINT3::operator<(const SPOINT3 &Point3) const { return (this->x < Point3.x) && (this->y < Point3.y) && (this->z < Point3.z); } bool San::Mathematics::SPOINT3::operator>(const SPOINT3 &Point3) const { return (this->x > Point3.x) && (this->y > Point3.y) && (this->z > Point3.z); } bool San::Mathematics::SPOINT3::operator<=(const SPOINT3 &Point3) const { return (this->x <= Point3.x) && (this->y <= Point3.y) && (this->z <= Point3.z); } bool San::Mathematics::SPOINT3::operator>=(const SPOINT3 &Point3) const { return (this->x >= Point3.x) && (this->y >= Point3.y) && (this->z >= Point3.z); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::iGetHomogeneousPoint() const { if (::gloIsFloatEqual(this->z, 0.0)) { return SPOINT3(this->x, this->y, 1.0); } return SPOINT3(this->x / this->z, this->y / this->z, 1.0); } void San::Mathematics::SPOINT3::iHomogenzation() { if (::gloIsFloatEqual(this->z, 0.0)) { this->z = 1.0; } this->x = this->x / this->z; this->y = this->y / this->z; this->z = 1.0; } San::Mathematics::SVECTOR3::SVECTOR3(const sfloat Val) :stSPOINT3(Val, Val, Val) { } San::Mathematics::SVECTOR3::SVECTOR3(const sfloat x, const sfloat y, const sfloat z) :stSPOINT3(x, y, z) { } San::Mathematics::SVECTOR3::SVECTOR3(const sfloat* pArray) :stSPOINT3(0.0, 0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; this->z = pArray[2]; } } San::Mathematics::SVECTOR3::SVECTOR3(const SVECTOR3 &Vec3) :stSPOINT3(Vec3.x, Vec3.y, Vec3.z) { } San::Mathematics::SVECTOR3::SVECTOR3(const SPOINT2 &Point2, const sfloat z) :stSPOINT3(Point2.x, Point2.y, z) { } San::Mathematics::SVECTOR3::SVECTOR3(const SPOINT3 &Point3) :stSPOINT3(Point3.x, Point3.y, Point3.z) { } San::Mathematics::SVECTOR3::SVECTOR3(const SPOINT4 &Point4) :stSPOINT3(Point4.x, Point4.y, Point4.z) { } San::Mathematics::SVECTOR3::SVECTOR3(const SVECTOR2 &Vec2, const sfloat z) :stSPOINT3(Vec2.x, Vec2.y, z) { } San::Mathematics::SVECTOR3::SVECTOR3(const SVECTOR4 &Vec4) :stSPOINT3(Vec4.x, Vec4.y, Vec4.z) { } San::Mathematics::SVECTOR3::~SVECTOR3() { } const sfloat& San::Mathematics::SVECTOR3::operator[](const uint32 Position) const { return this->p[Position > 3 ? 3 : Position]; } sfloat& San::Mathematics::SVECTOR3::operator[](const uint32 Position) { return this->p[Position > 3 ? 3 : Position]; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; this->z = 0.0; return *this; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; this->z = Point3.z; return *this; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; this->z = Point4.z; return *this; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; this->z = 0.0; return *this; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; this->z = Vec3.z; return *this; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; this->z = Vec4.z; return *this; } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator+(const SVECTOR3 &Vec3) const { return SVECTOR3(this->x + Vec3.x, this->y + Vec3.y, this->z + Vec3.z); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator-(const SVECTOR3 &Vec3) const { return SVECTOR3(this->x - Vec3.x, this->y - Vec3.y, this->z - Vec3.z); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator*(const SVECTOR3 &Vec3) const { return SVECTOR3(this->x * Vec3.x, this->y * Vec3.y, this->z * Vec3.z); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator+(const sfloat Val) const { return SVECTOR3(this->x + Val, this->y + Val, this->z + Val); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator-(const sfloat Val) const { return SVECTOR3(this->x - Val, this->y - Val, this->z - Val); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator*(const sfloat Val) const { return SVECTOR3(this->x * Val, this->y * Val, this->z * Val); } bool San::Mathematics::SVECTOR3::operator==(const SVECTOR3 &Vec3) const { if (!::gloIsFloatEqual(this->x, Vec3.x)){ return false; } if (!::gloIsFloatEqual(this->y, Vec3.y)){ return false; } if (!::gloIsFloatEqual(this->z, Vec3.z)){ return false; } return true; } bool San::Mathematics::SVECTOR3::operator!=(const SVECTOR3 &Vec3) const { return !((*this) == Vec3); } bool San::Mathematics::SVECTOR3::operator<(const SVECTOR3 &Vec3) const { return (this->x < Vec3.x) && (this->y < Vec3.y) && (this->z < Vec3.z); } bool San::Mathematics::SVECTOR3::operator>(const SVECTOR3 &Vec3) const { return (this->x > Vec3.x) && (this->y > Vec3.y) && (this->z > Vec3.z); } bool San::Mathematics::SVECTOR3::operator<=(const SVECTOR3 &Vec3) const { return (this->x <= Vec3.x) && (this->y <= Vec3.y) && (this->z <= Vec3.z); } bool San::Mathematics::SVECTOR3::operator>=(const SVECTOR3 &Vec3) const { return (this->x >= Vec3.x) && (this->y >= Vec3.y) && (this->z >= Vec3.z); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::iGetHomogeneousVector() const { return SVECTOR3(this->x, this->y, 0.0); } void San::Mathematics::SVECTOR3::iHomogenzation() { this->z = 0.0; } San::Mathematics::SPOINT4::SPOINT4(const sfloat Val) :stSPOINT4(Val, Val, Val, Val) { } San::Mathematics::SPOINT4::SPOINT4(const sfloat x, const sfloat y, const sfloat z, const sfloat w) :stSPOINT4(x, y, z, w) { /*if (!::gloIsFloatEqual(w, 1.0)) { if (!gloIsFloatEqual(w, 0.0)) { this->x = this->x / w; this->y = this->y / w; this->z = this->z / w; } }*/ } San::Mathematics::SPOINT4::SPOINT4(const sfloat* pArray) :stSPOINT4(0.0, 0.0, 0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; this->z = pArray[2]; this->w = pArray[3]; } /*if (!::gloIsFloatEqual(pArray[3], 1.0)) { if (!gloIsFloatEqual(pArray[3], 0.0)) { this->x = this->x / pArray[3]; this->y = this->y / pArray[3]; this->z = this->z / pArray[3]; } }*/ } San::Mathematics::SPOINT4::SPOINT4(const SPOINT4 &Point4) :stSPOINT4(Point4.x, Point4.y, Point4.z, Point4.w) { /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ } San::Mathematics::SPOINT4::SPOINT4(const SPOINT2 &Point2, const sfloat z, const sfloat w) :stSPOINT4(Point2.x, Point2.y, z, w) { } San::Mathematics::SPOINT4::SPOINT4(const SPOINT3 &Point3, const sfloat w) :stSPOINT4(Point3.x, Point3.y, Point3.z, w) { } San::Mathematics::SPOINT4::SPOINT4(const SVECTOR2 &Vec2, const sfloat z, const sfloat w) :stSPOINT4(Vec2.x, Vec2.y, z, w) { } San::Mathematics::SPOINT4::SPOINT4(const SVECTOR3 &Vec3, const sfloat w) :stSPOINT4(Vec3.x, Vec3.y, Vec3.z, w) { } San::Mathematics::SPOINT4::SPOINT4(const SVECTOR4 &Vec4) :stSPOINT4(Vec4.x, Vec4.y, Vec4.z, Vec4.w) { } San::Mathematics::SPOINT4::~SPOINT4() { } const sfloat& San::Mathematics::SPOINT4::operator[](const uint32 Position) const { return this->p[Position > 4 ? 4 : Position]; } sfloat& San::Mathematics::SPOINT4::operator[](const uint32 Position) { return this->p[Position > 4 ? 4 : Position]; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; this->z = 0.0; this->w = 0.0; return *this; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; this->z = Point3.z; this->w = 0.0; return *this; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; this->z = Point4.z; this->w = Point4.w; /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ return *this; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator = (const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; this->z = 0.0; this->w = 0.0; return *this; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator = (const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; this->z = Vec3.z; this->w = 0.0; return *this; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; this->z = Vec4.z; this->w = Vec4.w; return *this; } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator+(const SPOINT4 &Point4) const { /*SPOINT4 HomoPointSrc(*this); SPOINT4 HomoPointDesc(Point4);*/ return SPOINT4(this->x + Point4.x, this->y + Point4.y, this->z + Point4.z, this->w + Point4.w); } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator-(const SPOINT4 &Point4) const { /*SPOINT4 HomoPointSrc(*this); SPOINT4 HomoPointDesc(Point4);*/ return SPOINT4(this->x - Point4.x, this->y - Point4.y, this->z - Point4.z, this->w - Point4.w); } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator*(const SPOINT4 &Point4) const { /*SPOINT4 HomoPointSrc(*this); SPOINT4 HomoPointDesc(Point4);*/ return SPOINT4(this->x * Point4.x, this->y * Point4.y, this->z * Point4.z, this->w * Point4.w); } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator+(const sfloat Val) const { return SPOINT4(this->x + Val, this->y + Val, this->z + Val, this->w + Val); } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator-(const sfloat Val) const { return SPOINT4(this->x - Val, this->y - Val, this->z - Val, this->w - Val); } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator*(const sfloat Val) const { return SPOINT4(this->x * Val, this->y * Val, this->z * Val, this->w * Val); } bool San::Mathematics::SPOINT4::operator==(const SPOINT4 &Point4) const { if (!::gloIsFloatEqual(this->x, Point4.x)){ return false; } if (!::gloIsFloatEqual(this->y, Point4.y)){ return false; } if (!::gloIsFloatEqual(this->z, Point4.z)){ return false; } if (!::gloIsFloatEqual(this->w, Point4.w)){ return false; } return true; } bool San::Mathematics::SPOINT4::operator!=(const SPOINT4 &Point4) const { return !((*this) == Point4); } bool San::Mathematics::SPOINT4::operator<(const SPOINT4 &Point4) const { return (this->x < Point4.x) && (this->y < Point4.y) && (this->z < Point4.z) && (this->w < Point4.w); } bool San::Mathematics::SPOINT4::operator>(const SPOINT4 &Point4) const { return (this->x > Point4.x) && (this->y > Point4.y) && (this->z > Point4.z) && (this->w > Point4.w); } bool San::Mathematics::SPOINT4::operator<=(const SPOINT4 &Point4) const { return (this->x <= Point4.x) && (this->y <= Point4.y) && (this->z <= Point4.z) && (this->w <= Point4.w); } bool San::Mathematics::SPOINT4::operator>=(const SPOINT4 &Point4) const { return (this->x >= Point4.x) && (this->y >= Point4.y) && (this->z >= Point4.z) && (this->w >= Point4.w); } SPOINT4 San::Mathematics::SPOINT4::iGetHomogeneousPoint() const { if (::gloIsFloatEqual(this->w, 0.0)) { return SPOINT4(this->x, this->y, this->z, 1.0); } return SPOINT4(this->x / this->w, this->y / this->w, this->z / this->w, 1.0); } void San::Mathematics::SPOINT4::iHomogenzation() { if (::gloIsFloatEqual(this->w, 0.0)) { this->w = 1.0; } this->x = this->x / this->w; this->y = this->y / this->w; this->z = this->z / this->w; this->w = 1.0; } San::Mathematics::SVECTOR4::SVECTOR4(const sfloat Val) :stSPOINT4(Val, Val, Val, Val) { } San::Mathematics::SVECTOR4::SVECTOR4(const sfloat x, const sfloat y, const sfloat z, const sfloat w) :stSPOINT4(x, y, z, w) { /*if (!::gloIsFloatEqual(w, 1.0)) { if (!gloIsFloatEqual(w, 0.0)) { this->x = this->x / w; this->y = this->y / w; this->z = this->z / w; } }*/ } San::Mathematics::SVECTOR4::SVECTOR4(const sfloat* pArray) :stSPOINT4(0.0, 0.0, 0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; this->z = pArray[2]; this->w = pArray[3]; } /*if (!::gloIsFloatEqual(pArray[3], 1.0)) { if (!gloIsFloatEqual(pArray[3], 0.0)) { this->x = this->x / pArray[3]; this->y = this->y / pArray[3]; this->z = this->z / pArray[3]; } }*/ } San::Mathematics::SVECTOR4::SVECTOR4(const SVECTOR4 &Vec4) :stSPOINT4(Vec4.x, Vec4.y, Vec4.z, Vec4.w) { } San::Mathematics::SVECTOR4::SVECTOR4(const SPOINT2 &Point2, const sfloat z, const sfloat w) :stSPOINT4(Point2.x, Point2.y, z, w) { } San::Mathematics::SVECTOR4::SVECTOR4(const SPOINT3 &Point3, const sfloat w) :stSPOINT4(Point3.x, Point3.y, Point3.z, w) { } San::Mathematics::SVECTOR4::SVECTOR4(const SPOINT4 &Point4) :stSPOINT4(Point4.x, Point4.y, Point4.z, Point4.w) { /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ } San::Mathematics::SVECTOR4::SVECTOR4(const SVECTOR2 &Vec2, const sfloat z, const sfloat w) :stSPOINT4(Vec2.x, Vec2.y, z, w) { } San::Mathematics::SVECTOR4::SVECTOR4(const SVECTOR3 &Vec3, const sfloat w) :stSPOINT4(Vec3.x, Vec3.y, Vec3.z, w) { } San::Mathematics::SVECTOR4::~SVECTOR4() { } const sfloat& San::Mathematics::SVECTOR4::operator[](const uint32 Position) const { return this->p[Position > 4 ? 4 : Position]; } sfloat& San::Mathematics::SVECTOR4::operator[](const uint32 Position) { return this->p[Position > 4 ? 4 : Position]; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; this->z = 0.0; this->w = 0.0; return *this; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; this->z = Point3.z; this->w = 0.0; return *this; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; this->z = Point4.z; this->w = Point4.w; /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ return *this; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; this->z = 0.0; this->w = 0.0; return *this; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; this->z = Vec3.z; this->w = 0.0; return *this; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; this->z = Vec4.z; this->w = Vec4.w; return *this; } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator+(const SVECTOR4 &Vec4) const { return SVECTOR4(this->x + Vec4.x, this->y + Vec4.y, this->z + Vec4.z, 0.0); } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator-(const SVECTOR4 &Vec4) const { return SVECTOR4(this->x - Vec4.x, this->y - Vec4.y, this->z - Vec4.z, 0.0); } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator*(const SVECTOR4 &Vec4) const { return SVECTOR4(this->x * Vec4.x, this->y * Vec4.y, this->z * Vec4.z, 0.0); } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator+(const sfloat Val) const { return SVECTOR4(this->x + Val, this->y + Val, this->z + Val, 0.0); } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator-(const sfloat Val) const { return SVECTOR4(this->x - Val, this->y - Val, this->z - Val, 0.0); } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator*(const sfloat Val) const { return SVECTOR4(this->x * Val, this->y * Val, this->z * Val, 0.0); } bool San::Mathematics::SVECTOR4::operator==(const SVECTOR4 &Vec4) const { if (!::gloIsFloatEqual(this->x, Vec4.x)){ return false; } if (!::gloIsFloatEqual(this->y, Vec4.y)){ return false; } if (!::gloIsFloatEqual(this->z, Vec4.z)){ return false; } if (!::gloIsFloatEqual(this->w, Vec4.w)){ return false; } return true; } bool San::Mathematics::SVECTOR4::operator!=(const SVECTOR4 &Vec4) const { return !((*this) == Vec4); } bool San::Mathematics::SVECTOR4::operator<(const SVECTOR4 &Vec4) const { return (this->x < Vec4.x) && (this->y < Vec4.y) && (this->z < Vec4.z) && (this->w < Vec4.w); } bool San::Mathematics::SVECTOR4::operator>(const SVECTOR4 &Vec4) const { return (this->x > Vec4.x) && (this->y > Vec4.y) && (this->z > Vec4.z) && (this->w > Vec4.w); } bool San::Mathematics::SVECTOR4::operator<=(const SVECTOR4 &Vec4) const { return (this->x <= Vec4.x) && (this->y <= Vec4.y) && (this->z <= Vec4.z) && (this->w <= Vec4.w); } bool San::Mathematics::SVECTOR4::operator>=(const SVECTOR4 &Vec4) const { return (this->x >= Vec4.x) && (this->y >= Vec4.y) && (this->z >= Vec4.z) && (this->w >= Vec4.w); } SVECTOR4 San::Mathematics::SVECTOR4::iGetHomogeneousVector() const { return SVECTOR4(this->x, this->y, this->z, 0.0); } void San::Mathematics::SVECTOR4::iHomogenzation() { this->w = 0.0; }
26.696809
105
0.666667
zxyinz
c76949b7596a99dac83e31edef8d490298f98b31
614
cpp
C++
Potion.cpp
DoesItEvenMatter123/PSIO_Project
469bd139999e082f758d4158da67aa3f5b7823fe
[ "MIT" ]
null
null
null
Potion.cpp
DoesItEvenMatter123/PSIO_Project
469bd139999e082f758d4158da67aa3f5b7823fe
[ "MIT" ]
null
null
null
Potion.cpp
DoesItEvenMatter123/PSIO_Project
469bd139999e082f758d4158da67aa3f5b7823fe
[ "MIT" ]
null
null
null
#include "Including.h" #include "Potion.h" Potion::Potion() { setTexture(); potion.setScale(2, 2); vy = 118; } Potion::~Potion() { } void Potion::setTexture() { if (!potionTexture.loadFromFile("red-potion.png")) { std::cout << "Error"; } potion.setTexture(potionTexture); } void Potion::Draw(sf::RenderWindow& window) { window.draw(potion); } void Potion::move() { potion.move(0, vy * clock.getElapsedTime().asSeconds()); clock.restart(); } void Potion::setPosition(float x, float y) { potion.setPosition(x, y); } sf::FloatRect Potion::getGlobalBounds() { return potion.getGlobalBounds(); }
13.347826
57
0.674267
DoesItEvenMatter123
c76c1ea3fc694b248492a124fa587e2365324771
10,783
cpp
C++
jabberbot.cpp
JonathanGuthrie/affirmation-bot
5cb955953ebfa0f0fe3ac59a88927568884b8ce3
[ "Apache-2.0" ]
null
null
null
jabberbot.cpp
JonathanGuthrie/affirmation-bot
5cb955953ebfa0f0fe3ac59a88927568884b8ce3
[ "Apache-2.0" ]
null
null
null
jabberbot.cpp
JonathanGuthrie/affirmation-bot
5cb955953ebfa0f0fe3ac59a88927568884b8ce3
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2010 Jonathan R. Guthrie * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // #include <iostream> #include "jabberbot.hpp" #include <fstream> #include <cstdlib> #include <sstream> #include <syslog.h> void JabberBot::Subscribe(const gloox::Message &stanza) { char keyValue[stanza.from().bare().size()+1]; stanza.from().bare().copy(keyValue, std::string::npos); keyValue[stanza.from().bare().size()] = '\0'; time_t last = 0; Dbt key(keyValue, stanza.from().bare().size()+1); Dbt data(&last, sizeof(time_t)); m_subscriptionDb.put(NULL, &key, &data, 0); m_subscriptionDb.sync(0); time_t now = time(NULL); time_t t1 = random() % ((m_eod - now)/2); time_t t2 = random() % ((m_eod - now)/2); Upcoming newEntry(stanza.from().bare(), now + t1 + t2); m_upcomingQueue.push(newEntry); gloox::Message message(stanza.subtype(), stanza.from(), "You have been subscribed"); m_client->send(message); } void JabberBot::Unsubscribe(const gloox::Message &stanza) { char keyValue[stanza.from().bare().size()+1]; stanza.from().bare().copy(keyValue, std::string::npos); keyValue[stanza.from().bare().size()] = '\0'; Dbt key(keyValue, stanza.from().bare().size()+1); m_subscriptionDb.del(NULL, &key, 0); m_subscriptionDb.sync(0); gloox::Message message(stanza.subtype(), stanza.from(), "You have been unsubscribed"); m_client->send(message); } void JabberBot::Affirmation(const gloox::Message &stanza) { AffirmationList::size_type which = random() % m_affirmations.size(); gloox::Message message(stanza.subtype(), stanza.from(), m_affirmations[which]); m_client->send(message); } void JabberBot::Status(const gloox::Message &stanza) { char keyValue[stanza.from().bare().size()+1]; stanza.from().bare().copy(keyValue, std::string::npos); keyValue[stanza.from().bare().size()] = '\0'; time_t last = 0; Dbt key(keyValue, stanza.from().bare().size()+1); Dbt data; data.set_data(&last); data.set_ulen(sizeof(time_t)); int result = m_subscriptionDb.get(NULL, &key, &data, 0); if (0 != result) { gloox::Message message(stanza.subtype(), stanza.from(), "You are not subscribed"); m_client->send(message); } else { gloox::Message message(stanza.subtype(), stanza.from(), "You are subscribed"); m_client->send(message); } } void JabberBot::DefaultCommand(const gloox::Message &stanza) { // I figure the best thing to do is to send the help message if it doesn't recognize the command sent gloox::Message message(stanza.subtype(), stanza.from(), "I know how to do these things:\nsubscribe - send affirmation to you once per day\nunsubscribe - stop sending you daily affirmations\nstatus - tell you whether or not you're subscribed\naffirmation - send a random affirmation right now\nhelp - send this message\n\nCommands are not case sensitive"); m_client->send(message); } CommandHandlerMap JabberBot::m_handlers; AffirmationList JabberBot::m_affirmations; JabberBot::JabberBot(const std::string &jid_string, const std::string &password, const std::string &affirmation_path, const std::string &db_path) : m_subscriptionDb(NULL, 0) { openlog("affirmations-bot", LOG_PID|LOG_CONS, LOG_DAEMON); Dbc *cursor; m_subscriptionDb.open(NULL, db_path.c_str(), NULL, DB_BTREE, DB_CREATE, 0); m_subscriptionDb.cursor(NULL, &cursor, 0); if (NULL != cursor) { Dbt key, data; time_t now = time(NULL); time_t bod = now - (now % 86400); m_eod = bod + 86400; while (0 == cursor->get(&key, &data, DB_NEXT)) { std::string user((char *)key.get_data()); time_t last = *((time_t*) data.get_data()); if (last < bod) { // He hasn't gotten an affirmation today time_t t1 = random() % ((m_eod - now)/2); time_t t2 = random() % ((m_eod - now)/2); Upcoming newEntry(user, now + t1 + t2); m_upcomingQueue.push(newEntry); } std::ostringstream message; message << "User " << user << " last got an affirmation at " << last; syslog(LOG_NOTICE, message.str().c_str()); } cursor->close(); } if (m_handlers.begin() == m_handlers.end()) { CommandHandler handler; handler.method = &JabberBot::Subscribe; m_handlers.insert(CommandHandlerMap::value_type("subscribe", handler)); handler.method = &JabberBot::Unsubscribe; m_handlers.insert(CommandHandlerMap::value_type("unsubscribe", handler)); handler.method = &JabberBot::Affirmation; m_handlers.insert(CommandHandlerMap::value_type("affirmation", handler)); handler.method = &JabberBot::Status; m_handlers.insert(CommandHandlerMap::value_type("status", handler)); } if (m_affirmations.empty()) { srand(time(NULL)); std::string line; std::ifstream a(affirmation_path.c_str()); while (getline(a, line)) { std::ostringstream message; message << "The line is \"" << line << "\"" << std::endl; syslog(LOG_DEBUG, message.str().c_str()); m_affirmations.push_back(line); } } // std::cout << "Creating the JID from the string \"" << jid_string << "\"" << std::endl; gloox::JID jid(jid_string); // std::cout << "Creating a client from the JID and the password \"" << password << "\"" << std::endl; m_client = new gloox::Client(jid, password); m_client->setServer("talk.google.com"); // std::cout << "Registering the handlers" << std::endl; m_client->registerMessageHandler(this); m_client->logInstance().registerLogHandler(gloox::LogLevelDebug, gloox::LogAreaAll, this); // std::cout << "Running connect" << std::endl; m_client->rosterManager()->registerRosterListener(this, true); m_continueRunning = true; m_sendThread = new boost::thread(SendThreadFunction, this); // Start the thread here m_client->connect(true); // std::cout << "returned from connect" << std::endl; // std::cout << "The connection state is " << ((int) m_client->state()) << std::endl; m_continueRunning = false; } JabberBot::~JabberBot(void) { m_continueRunning = false; m_sendThread->join(); std::ostringstream message; message << "Shutting down cleanly" << std::endl; syslog(LOG_NOTICE, message.str().c_str()); m_subscriptionDb.close(0); } void JabberBot::ProcessSendList(void) { // syslog(LOG_NOTICE, "In Process Send List"); bool updated = false; for (SendList::iterator i=m_sendList.begin(); i != m_sendList.end(); ++i) { gloox::RosterItem *ri = m_client->rosterManager()->getRosterItem(*i); if (nullptr != ri) { if (ri->online()) { AffirmationList::size_type which = random() % m_affirmations.size(); updated = true; gloox::Message message(gloox::Message::MessageType::Chat, *i, m_affirmations[which]); m_client->send(message); // syslog(LOG_NOTICE, "Updating the database"); time_t now = time(NULL); char keyValue[i->bare().size()+1]; i->bare().copy(keyValue, std::string::npos); keyValue[i->bare().size()] = '\0'; Dbt key(keyValue, i->bare().size()+1); Dbt data(&now, sizeof(time_t)); m_subscriptionDb.put(NULL, &key, &data, 0); // syslog(LOG_NOTICE, "Removing the user from the send list"); m_sendList.erase(i); } } } if (updated) { // syslog(LOG_NOTICE, "Updating the database"); m_subscriptionDb.sync(0); } } void JabberBot::ShutDown(void) { m_continueRunning = false; } void JabberBot::RunSession(void) { // syslog(LOG_INFO, "In RunSession"); while(m_continueRunning) { // syslog(LOG_INFO, "In continueRunning loop"); time_t now = time(NULL); while (!m_upcomingQueue.empty() && (now > m_upcomingQueue.top().Next())) { // std::ostringstream message; // message << "Appending " << m_upcomingQueue.top().User().bare() << " to the list of people who get messages now" << std::endl; // syslog(LOG_NOTICE, message.str().c_str()); m_sendList.insert(m_upcomingQueue.top().User()); m_upcomingQueue.pop(); } // syslog(LOG_INFO, "Calling ProcessSendList"); ProcessSendList(); if (m_eod < now) { time_t bod = m_eod; m_eod += 86400; m_sendList.clear(); while (!m_upcomingQueue.empty()) { m_upcomingQueue.pop(); } // syslog(LOG_INFO, "Updating the database"); Dbc *cursor; m_subscriptionDb.cursor(NULL, &cursor, 0); if (NULL != cursor) { Dbt key, data; m_eod = bod + 86400; while (0 == cursor->get(&key, &data, DB_NEXT)) { std::string user((char *)key.get_data()); time_t t1 = random() % 43200; time_t t2 = random() % 43200; Upcoming newEntry(user, bod + t1 + t2); m_upcomingQueue.push(newEntry); // std::ostringstream message; // message << "It is now " << now << " and user " << user << " will next get a message at " << bod + t1 + t2; // syslog(LOG_NOTICE, message.str().c_str()); } cursor->close(); } } // syslog(LOG_INFO, "Sleeping"); sleep(1); } // syslog(LOG_INFO, "Returning from RunSession"); } void *JabberBot::SendThreadFunction(void *instance) { // syslog(LOG_INFO, "In the SendThreadFunction"); JabberBot *self = (JabberBot *)instance; // syslog(LOG_INFO, "Running RunSession"); self->RunSession(); // syslog(LOG_INFO, "Exiting SendThreadFunction"); return nullptr; } void JabberBot::handleMessage(const gloox::Message &stanza, gloox::MessageSession *session) { // std::cout << "Message type: " << ((int) stanza.subtype()) << std::endl; if (0 < stanza.body().size()) { insensitiveString body(stanza.body().c_str()); CommandHandlerMap::iterator h = m_handlers.find(body); if (h != m_handlers.end()) { (this->*h->second.method)(stanza); } else { DefaultCommand(stanza); } } } void JabberBot::handleLog(gloox::LogLevel level, gloox::LogArea area, const std::string &message) { // std::cout << "Log: " << ((int)level) << ", " << ((int) area) << " \"" << message << "\"" << std::endl; // syslog(LOG_INFO, message.c_str()); } bool JabberBot::handleSubscriptionRequest(const gloox::JID &jid, const std::string &msg) { // std::cout << jid.bare() < " is attempting to subscribe with messge \"" << msg << "\"" << std::endl; return true; } bool JabberBot::handleUnsubscriptionRequest(const gloox::JID &jid, const std::string &msg) { // std::cout << jid.bare() < " is attempting to unsubscribe with messge \"" << msg << "\"" << std::endl; return true; }
34.450479
357
0.660855
JonathanGuthrie
c771696033451def3fbcbe3b6dde92cc98444e69
586
hpp
C++
include/Client/EntityDropGenerator.hpp
maximaximal/BomberPi
365c806e3feda7296fc10d5f9655ec696f0ab491
[ "Zlib" ]
null
null
null
include/Client/EntityDropGenerator.hpp
maximaximal/BomberPi
365c806e3feda7296fc10d5f9655ec696f0ab491
[ "Zlib" ]
null
null
null
include/Client/EntityDropGenerator.hpp
maximaximal/BomberPi
365c806e3feda7296fc10d5f9655ec696f0ab491
[ "Zlib" ]
null
null
null
#ifndef CLIENT_ENTITYDROPGENERATOR_HPP #define CLIENT_ENTITYDROPGENERATOR_HPP #include <map> #include <functional> #include <memory> #include <Client/EntityFactory.hpp> #include <glm/vec3.hpp> namespace Client { class EntityDropGenerator { public: EntityDropGenerator(EntityFactory *factory); virtual ~EntityDropGenerator(); void run(const glm::ivec3 &tilePos); void setChance(unsigned int chance); protected: unsigned int m_chance = 900; EntityFactory *m_entityFactory; }; } #endif
20.928571
56
0.663823
maximaximal
c7732b6b1531d2d7cd7a5f99629f040fb73dd2ab
771
cpp
C++
lib/src/cyber/mouse.cpp
yuri-sevatz/cyberpunk-cpp
b0c9a95c012660bfd21c24ac3a69287330d3b3bd
[ "BSD-2-Clause" ]
5
2021-06-12T10:29:58.000Z
2022-03-03T13:21:57.000Z
lib/src/cyber/mouse.cpp
yuri-sevatz/cyber_breach
b0c9a95c012660bfd21c24ac3a69287330d3b3bd
[ "BSD-2-Clause" ]
null
null
null
lib/src/cyber/mouse.cpp
yuri-sevatz/cyber_breach
b0c9a95c012660bfd21c24ac3a69287330d3b3bd
[ "BSD-2-Clause" ]
1
2021-02-21T09:45:37.000Z
2021-02-21T09:45:37.000Z
#include <cyber/mouse.hpp> #include <Windows.h> void mouse_move(cv::Point2l p) { std::array<INPUT,1> input; ZeroMemory(input.data(), sizeof(decltype(input)::value_type) * input.size()); input[0].type = INPUT_MOUSE; input[0].mi.dx = p.x; input[0].mi.dy = p.y; input[0].mi.dwFlags = MOUSEEVENTF_MOVE; SendInput(input.size(), input.data(), sizeof(decltype(input)::value_type)); } void mouse_press(bool press) { std::array<INPUT,1> input; ZeroMemory(input.data(), sizeof(decltype(input)::value_type) * input.size()); input[0].type = INPUT_MOUSE; input[0].mi.dwFlags = press ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP; SendInput(input.size(), input.data(), sizeof(decltype(input)::value_type)); }
30.84
82
0.651102
yuri-sevatz
c775f25bc927067d2612dadea383cbe0805f1c0b
950
cc
C++
test/option_test.cc
bzEq/kl
92de2c1db5ca4bb6c38a632cda7a80d2c9823841
[ "BSD-3-Clause" ]
null
null
null
test/option_test.cc
bzEq/kl
92de2c1db5ca4bb6c38a632cda7a80d2c9823841
[ "BSD-3-Clause" ]
null
null
null
test/option_test.cc
bzEq/kl
92de2c1db5ca4bb6c38a632cda7a80d2c9823841
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 2017 Kai Luo <gluokai@gmail.com>. All rights reserved. // Use of this source code is governed by the BSD license that can be found in // the LICENSE file. #include <iostream> #include <memory> #include <string> #include "kl/option.h" #include "kl/testkit.h" namespace { class O {}; kl::Option<int> Foo() { return kl::Some(13); } kl::Option<int> Spam() { return kl::None(); } } TEST(O, foo) { auto foo = Foo(); ASSERT(foo); ASSERT(*foo == 13); } TEST(O, spam) { auto spam = Spam(); ASSERT(!spam); } struct Imfao { std::string s; }; kl::Option<std::string> Bar() { auto f = std::make_unique<Imfao>(); return f->s; } TEST(O, PassByValue) { auto f = Bar(); ASSERT(f); } class Foobar { public: int Value() { return 7; } std::string String() const { return "Foobar"; } }; TEST(O, MethodAccess) { auto f = kl::Some(Foobar()); ASSERT(f->Value() == 7); ASSERT(f->String() == "Foobar"); } // namespace
17.592593
78
0.612632
bzEq
c777d02bb828423ba2d2c9fca58fd18e396d3691
4,783
cc
C++
src/Router/patShortestPathGeneral.cc
godosou/smaroute
e2ccc9492dff54c8ef5c74d5309d2b06758ba342
[ "MIT" ]
4
2015-02-23T16:02:52.000Z
2021-03-26T17:58:53.000Z
src/Router/patShortestPathGeneral.cc
godosou/smaroute
e2ccc9492dff54c8ef5c74d5309d2b06758ba342
[ "MIT" ]
null
null
null
src/Router/patShortestPathGeneral.cc
godosou/smaroute
e2ccc9492dff54c8ef5c74d5309d2b06758ba342
[ "MIT" ]
5
2015-02-23T16:05:59.000Z
2017-05-04T16:13:16.000Z
/* * patShortestPathGeneral.cc * * Created on: Nov 1, 2011 * Author: jchen */ #include "patShortestPathGeneral.h" #include "patRoadBase.h" #include "patConst.h" #include "patGpsDDR.h" #include "patDisplay.h" #include "patMeasurementDDR.h" patShortestPathGeneral::patShortestPathGeneral(patNetworkBase* a_network ) : network(a_network), minimum_label(a_network->getMinimumLabel()) { //DEBUG_MESSAGE("minimum_label "<<minimum_label); } patShortestPathGeneral::~patShortestPathGeneral() { } bool patShortestPathGeneral::buildShortestPathTree(const patNode* root_node, double ceil) { set<const patNode*> root_nodes; root_nodes.insert(root_node); return buildShortestPathTree(root_nodes, NULL, NULL, ceil); } bool patShortestPathGeneral::buildShortestPathTree(const patNode* root_node, patMeasurementDDR* gps_ddr, set<pair<const patArc*, const patRoadBase*> >* ddr_arcs , double ceil ){ set<const patNode*> root_nodes; root_nodes.insert(root_node); return buildShortestPathTree(root_nodes, gps_ddr, ddr_arcs, ceil); } bool patShortestPathGeneral::buildShortestPathTree(set<const patNode*> root_nodes, patMeasurementDDR* gps_ddr, set<pair<const patArc*, const patRoadBase*> >* ddr_arcs, double ceil) { /** * Preprocessing, build the tree from the roots, set and roots' labels as 0.0. */ for (set<const patNode*>::iterator iter = root_nodes.begin(); iter != root_nodes.end(); ++iter) { m_list_of_nodes.push_back(*iter); shortest_path_tree.setLabel(*iter, 0.0); shortest_path_tree.insertRoot(*iter); } /** * Recursive process to deal with each node */ while (!m_list_of_nodes.empty()) { //Start from the first node in the list. const patNode* node_to_process = *m_list_of_nodes.begin(); m_list_of_nodes.pop_front(); /** * If the label exceeds the distance ceiling, i.e., we have reached the distance limit that we can climb in the tree. * Terminate the process. */ if (shortest_path_tree.getLabel(node_to_process) > ceil) { //DEBUG_MESSAGE("exceed length limit"); break; } //Deal with each outgoing road of the node. const unordered_map<const patNode*, set<const patRoadBase*> >* outgoing_map = network->getOutgoingIncidents(); unordered_map<const patNode*,set<const patRoadBase*> >::const_iterator find_out_going = outgoing_map->find(node_to_process); if(find_out_going==outgoing_map->end()){ continue; } for (set<const patRoadBase*>::const_iterator outgoing_road_iter = find_out_going->second.begin(); outgoing_road_iter != find_out_going->second.end(); ++outgoing_road_iter) { //implement RoadType::getDownNode(); const patNode* down_node = (*outgoing_road_iter)->getDownNode(); const double road_cost = (*outgoing_road_iter)->getLength(); double down_node_label = shortest_path_tree.getLabel(down_node); if (gps_ddr != NULL) { //If we deal with DDR vector<const patArc*> temp_arcs = (*outgoing_road_iter)->getArcList(); //A road may contain several arcs for (vector<const patArc*>::const_iterator arc_iter = temp_arcs.begin(); arc_iter != temp_arcs.end(); ++arc_iter) { if (!gps_ddr->isArcInDomain(*arc_iter,network->getTransportMode())) { if (gps_ddr->detArcDDR(*arc_iter,network->getTransportMode())) { ddr_arcs->insert( pair<const patArc*, const patRoadBase*>( *arc_iter, *outgoing_road_iter)); } } else { ddr_arcs->insert( pair<const patArc*, const patRoadBase*>( *arc_iter, *outgoing_road_iter)); } } if (down_node_label > shortest_path_tree.getLabel(node_to_process) + road_cost) { shortest_path_tree.setLabel( down_node, shortest_path_tree.getLabel(node_to_process) + road_cost); if (shortest_path_tree.getLabel(down_node) < minimum_label) { WARNING("NEGATIVE CYCLE DETECTED:"<<shortest_path_tree.getLabel(down_node)<<","<<minimum_label); return false; } shortest_path_tree.setPredecessor(down_node, *outgoing_road_iter); // shortest_path_tree.insertSuccessor(node_to_process, // *outgoing_road_iter); // Add the node following Bertsekas (1993) if (m_list_of_nodes.empty()) { //DEBUG_MESSAGE("add node to list"<<downNodeId); m_list_of_nodes.push_back(down_node); } else { double top_label = shortest_path_tree.getLabel( m_list_of_nodes.front()); if (down_node_label <= top_label) { m_list_of_nodes.push_front(down_node); } else { m_list_of_nodes.push_back(down_node); } } } } } //DEBUG_MESSAGE(theTree.predecessor[3893]); } return true; } patShortestPathTreeGeneral* patShortestPathGeneral::getTree() { return &shortest_path_tree; }
31.675497
126
0.703742
godosou
c787cb4307b3afb300cc30d5c66163cd911b1db1
1,137
hpp
C++
benchmarks/pantheios.hpp
ashgen/reckless
a50429f3819c92b1276c6023f3befafd90ab25b6
[ "MIT" ]
1
2021-07-09T11:21:46.000Z
2021-07-09T11:21:46.000Z
benchmarks/pantheios.hpp
dheeraj7r/reckless
d18804e0bd2c05cb1cb31bbf2eef8709e45455cc
[ "MIT" ]
null
null
null
benchmarks/pantheios.hpp
dheeraj7r/reckless
d18804e0bd2c05cb1cb31bbf2eef8709e45455cc
[ "MIT" ]
null
null
null
#include <pantheios/pantheios.hpp> #include <pantheios/frontends/fe.simple.h> #include <pantheios/backends/bec.file.h> #include <pantheios/inserters/character.hpp> #include <pantheios/inserters/integer.hpp> #include <pantheios/inserters/real.hpp> #ifdef LOG_ONLY_DECLARE #else extern "C" char const PANTHEIOS_FE_PROCESS_IDENTITY[] = "periodic_calls"; #endif #define LOG_INIT() \ pantheios_be_file_setFilePath("log.txt"); \ pantheios_fe_simple_setSeverityCeiling(PANTHEIOS_SEV_DEBUG) #define LOG_CLEANUP() #define LOG( c, i, f ) pantheios::log_INFORMATIONAL("Hello World! ", pantheios::character(c), " ", pantheios::integer(i), " ", pantheios::real(f)) #define LOG_FILE_WRITE(FileNumber, Percent) \ pantheios::log_INFORMATIONAL("file", pantheios::integer(FileNumber), " (", pantheios::real(Percent), "%)") #define LOG_MANDELBROT(Thread, X, Y, FloatX, FloatY, Iterations) \ pantheios::log_INFORMATIONAL("[T", pantheios::integer(Thread), "] " , pantheios::integer(X) , "," , pantheios::integer(Y) , "/" , pantheios::real(FloatX) , "," , pantheios::real(FloatY) , ": " , pantheios::integer(Iterations) , " iterations")
43.730769
246
0.728232
ashgen
c78baa675a8f0fd8123f7d851d3358c325d64cb8
1,276
cpp
C++
src/Private/AnimSceneActions/WaitForActionFinishedAction.cpp
heltena/KYEngine
4ccb89d0b20683feb245ffe85dd34b6ffdc42c8e
[ "MIT" ]
null
null
null
src/Private/AnimSceneActions/WaitForActionFinishedAction.cpp
heltena/KYEngine
4ccb89d0b20683feb245ffe85dd34b6ffdc42c8e
[ "MIT" ]
null
null
null
src/Private/AnimSceneActions/WaitForActionFinishedAction.cpp
heltena/KYEngine
4ccb89d0b20683feb245ffe85dd34b6ffdc42c8e
[ "MIT" ]
null
null
null
#include <KYEngine/SceneTimelineInfo.h> #include <KYEngine/Private/AnimSceneActions/WaitForActionFinishedAction.h> #include <KYEngine/Utility/TiXmlHelper.h> const std::string WaitForActionFinishedAction::XML_NODE = "wait-for-action-finished"; WaitForActionFinishedAction::WaitForActionFinishedAction() { } WaitForActionFinishedAction::~WaitForActionFinishedAction() { } WaitForActionFinishedAction* WaitForActionFinishedAction::readFromXml(TiXmlElement* node) { WaitForActionFinishedAction* action = new WaitForActionFinishedAction(); const std::string name = TiXmlHelper::readString(node, "name", false, "<<undefined>>"); const std::string actionRef = TiXmlHelper::readString(node, "action-ref", true); action->setName(name); action->setActionRef(actionRef); return action; } void WaitForActionFinishedAction::start(SceneTimelineInfo* info) { if (info->isActionFinished(m_actionRef)) m_isFinished = true; else { m_isFinished = false; info->waitForActionFinished(m_actionRef, this); } } bool WaitForActionFinishedAction::isBlocking() { return true; } bool WaitForActionFinishedAction::isFinished() { return m_isFinished; } void WaitForActionFinishedAction::update(const double elapsedTime, SceneTimelineInfo* info) { }
25.019608
91
0.775862
heltena
c78edeb424cd45f73309489e60109cc7f646de84
1,358
cc
C++
leetcode/78_subsets.cc
norlanliu/algorithm
1684db2631f259b4de567164b3ee866351e5b1b6
[ "MIT" ]
null
null
null
leetcode/78_subsets.cc
norlanliu/algorithm
1684db2631f259b4de567164b3ee866351e5b1b6
[ "MIT" ]
null
null
null
leetcode/78_subsets.cc
norlanliu/algorithm
1684db2631f259b4de567164b3ee866351e5b1b6
[ "MIT" ]
null
null
null
/* * ===================================================================================== * * Filename: 78_subsets.cc * * Description: * * Version: 1.0 * Created: 04/01/2015 10:09:16 PM * Revision: none * Compiler: gcc * * Author: (Qi Liu), liuqi.edward@gmail.com * Organization: antq.com * * ===================================================================================== */ #include<vector> #include<iostream> #include<algorithm> using namespace std; class Solution{ int _n; void EnumAll(vector<int>& instance, vector<int>& data, int start, int k, vector<vector<int> >& ans){ if(k == 0){ ans.push_back(instance); return; } for(int i = start; i < _n - k; ++i){ instance[k-1] = data[i]; EnumAll(instance, data, i+1, k-1, ans); } } public: vector<vector<int> > subsets(vector<int> &S){ vector<int> instance; vector<vector<int> > ans; _n = S.size() + 1; std::sort(S.begin(), S.end(), [](int a, int b){ return a > b; }); for(int i = 0; i < _n; ++i){ instance.resize(i); EnumAll(instance, S, 0, i, ans); } return ans; } }; int main(){ Solution sln; vector<int> s = {1,2, 3}; vector<vector<int> > ans = sln.subsets(s); for(auto & it : ans){ for(auto i : it){ cout<<i<<","; } cout<<endl; } return 0; }
21.555556
101
0.4757
norlanliu
c78fa936a91d02b8c3f3a3c7af6bafee5a607dc4
2,766
cc
C++
Estructuras/LazyST.cc
joaquingx/Competitive
09ddc7e06c4428c21bb9de31a846a8364ea038d1
[ "MIT" ]
1
2018-01-15T09:13:52.000Z
2018-01-15T09:13:52.000Z
Estructuras/LazyST.cc
joaquingx/Competitive
09ddc7e06c4428c21bb9de31a846a8364ea038d1
[ "MIT" ]
null
null
null
Estructuras/LazyST.cc
joaquingx/Competitive
09ddc7e06c4428c21bb9de31a846a8364ea038d1
[ "MIT" ]
1
2018-01-15T09:13:51.000Z
2018-01-15T09:13:51.000Z
#include <bits/stdc++.h> #define MAXN int(1e5) using namespace std; // Based on https://www.hackerearth.com/practice/notes/segment-tree-and-lazy-propagation/ int A[MAXN],tree[4*MAXN],lazy[4*MAXN]; void build(int node, int start, int end) { if(start == end) { // Leaf node will have a single element tree[node] = A[start]; } else { int mid = (start + end) / 2; // Recurse on the left child build(2*node, start, mid); // Recurse on the right child build(2*node+1, mid+1, end); // Internal node will have the sum of both of its children tree[node] = tree[2*node] + tree[2*node+1]; } } void updateRange(int node, int start, int end, int l, int r, int val) { if(lazy[node] != 0) { // This node needs to be updated tree[node] += (end - start + 1) * lazy[node]; // Update it if(start != end) { lazy[node*2] += lazy[node]; // Mark child as lazy lazy[node*2+1] += lazy[node]; // Mark child as lazy } lazy[node] = 0; // Reset it } if(start > end or start > r or end < l) // Current segment is not within range [l, r] return; if(start >= l and end <= r) { // Segment is fully within range tree[node] += (end - start + 1) * val; if(start != end) { // Not leaf node lazy[node*2] += val; lazy[node*2+1] += val; } return; } int mid = (start + end) / 2; updateRange(node*2, start, mid, l, r, val); // Updating left child updateRange(node*2 + 1, mid + 1, end, l, r, val); // Updating right child tree[node] = tree[node*2] + tree[node*2+1]; // Updating root with max value } int queryRange(int node, int start, int end, int l, int r) { if(start > end or start > r or end < l) return 0; // Out of range if(lazy[node] != 0) { // This node needs to be updated tree[node] += (end - start + 1) * lazy[node]; // Update it if(start != end) { lazy[node*2] += lazy[node]; // Mark child as lazy lazy[node*2+1] += lazy[node]; // Mark child as lazy } lazy[node] = 0; // Reset it } if(start >= l and end <= r) // Current segment is totally within range [l, r] return tree[node]; int mid = (start + end) / 2; int p1 = queryRange(node*2, start, mid, l, r); // Query left child int p2 = queryRange(node*2 + 1, mid + 1, end, l, r); // Query right child return (p1 + p2); } int main() { return 0; }
31.431818
102
0.497831
joaquingx