blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
479d970d633c46888edafdf1d3c77a4ac8468a88
b39872cc82dda996e5b3491f403ad45c3fe9f857
/MrOrb/Source/MrOrb/CoinSystem.h
253f90ff1aaf3c5c6e87aab630163aa21f91db8d
[]
no_license
BugiNinja/MrOrb
97d9359391c2ba0da36eb6d815383c743e55dea2
e246b034c9f889f933cc23b0e4c4909c2fa6eba4
refs/heads/master
2020-03-29T08:39:06.605055
2018-12-20T12:39:08
2018-12-20T12:39:08
149,721,594
1
0
null
null
null
null
UTF-8
C++
false
false
1,671
h
CoinSystem.h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "Components/ActorComponent.h" #include "CoinSystem.generated.h" UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) class MRORB_API UCoinSystem : public UActorComponent { GENERATED_BODY() public: UCoinSystem(); protected: virtual void BeginPlay() override; UPROPERTY(VisibleAnywhere, BlueprintReadOnly) int CoinValue; bool ComboOn; bool bComboCoin; bool bResetNeeded; bool bCanPickUp; int ComboCoin; class UPaperSpriteComponent* CurrentSprite; UPaperSpriteComponent* Glow; class APaperCharacter* CurrentPlayer; class UScoreSystemComponent* CurrentScoreSystem; class USceneComponent* ThisObject; class UPaperSprite* FiftyCoinSprite; UPaperSprite* FiveHundredCoinSprite; UPaperSprite* ThousandCoinSprite; UPROPERTY() UMaterial* FirstMaterial; UPROPERTY() UMaterialInstance* SecondMaterial; UPROPERTY() UMaterial* FirstGlowMaterial; UPROPERTY() UMaterialInstance* SecondGlowMaterial; class UBoxComponent* BoxCollider; UFUNCTION(BlueprintCallable) void SetObjects(USceneComponent* thisobject, APaperCharacter* player, UScoreSystemComponent* score, UPaperSpriteComponent* sprite, UPaperSpriteComponent* glow, UBoxComponent* collider); UFUNCTION(BlueprintCallable) void SetupCoin(); UFUNCTION(BlueprintCallable) bool CollidedWithPlayer(); UFUNCTION(BlueprintCallable) void ResetCoin(); UFUNCTION(BlueprintCallable) bool GetResetNeeded(); public: virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; };
c274ac8a8234027c9711b5c97c2f1497cdd1227d
1565116391d3d5248095005f152f315253bbb234
/Ncnn_infer/quality_assessment.h
a3a0743afcb2c5902901702f680a117e89d67fbe
[]
no_license
Devin0202/Frontal-Profile-Face-Classify
c6a0fd22375fe082fc5b131db45e5bf718866999
7411f320a1fc56841f50fe867f009703fcd1718d
refs/heads/master
2022-11-16T08:08:31.184482
2020-07-01T08:55:47
2020-07-01T08:55:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,088
h
quality_assessment.h
/** * @file * @author Devin dai * @version 0.0.1 * @date 2020/06/11 * @brief Deep-learning for distinguishing frontal and profile faces. * @details Use square roi to distinguish frontal and profile faces * based on Tencent-Ncnn. * @section LICENSE * Copyright 2020 Hiscene * * 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. */ # pragma once #include "quality_assessment.mem.h" #include "quality_assessment.id.h" #include <opencv2/opencv.hpp> #include <time.h> #include "net.h" #include "mat.h" namespace hiar_impl { namespace face { /** * @brief Distinguish frontal and profile faces by wrapping Tencent-Ncnn. */ class QualityAssessment { public: /// Ratio of expansion for area where doing blur detecting. const float kExpandingRatio = 1.2; /// Minimum number of landmarks roi's pixels. const int kExpectedPixels = 32 * 32; /// Whether to record time-cost. const bool kIsRecording = false; /// Minimum width of inputing image. const int kTargetWidth = 48; /// Minimum height of inputing image. const int kTargetHeight = 48; /// Normalized parameters for model inputs used by Ncnn. const float kNormVals[3] = {1 / 255.0f, 1 / 255.0f, 1 / 255.0f}; /** * @brief Construct a new QualityAssessment object. */ QualityAssessment(); /** * @brief Destroy the QualityAssessment object. * @remark Release the resource of Ncnn. */ ~QualityAssessment(); /** * @brief Distinguish the face. * * @param input[in] Origin image data. * @param isRgb[in] Confirm the color channels' order. * @return true Frontal face. * @return false Profile face. */ bool Predict(const cv::Mat &input, bool isRgb); /** * @brief Get the cost of single predict by millsecond. * @see QualityAssessment::Predict * * @param prepare_cost[in, out] Time cost for preparing data. * @param infer_cost[in, out] Time cost for inferring. */ void GetCostMs(double &prepare_cost, double &infer_cost); /** * @brief Get blurness of roi. * @param origin_image[in] Original image. * @param face_rect[in] The rectangle with absolute ordinates * to oriImage. All landmarks in this rectangle. * @param landmarks[in] Float array contains landmarks. * Relative ordinates to @see face_rect. * Format as [x, x, x, ..., y, y, y, ...]. * @param landmarks_len[in] Number of landmarks. * @return float Score of blurness. * The smaller score means more blur. * @note The magic number * @see QualityAssessment::kExpectedPixels is for * normalizing the number of pixels when * calculating. * In cv::resize(), cv::INTER_NEAREST maybe not * the best choice. */ float GetBlurScore(const cv::Mat &origin_image, const cv::Rect &face_rect, float* landmarks, int landmarks_len); /** * @brief Loading file line by line. * @param file[in] Path to read file. * @return std::vector<std::string> Save lines in std::vector<std::string>. */ static std::vector<std::string> ReadTxt(const std::string file); /// Recording the score. double score_ = 0; private: /// Larger than this value is frontal, otherwise is profile. const float kThreshold = 0.5; /** * @brief Loading default model. */ void DefaultInit(); /** * @brief Converting rectangle into square with fixed center. * @param rect[in, out] Inputting rectangle. * @note The edge of square is the shorter one * between width and height from rectangle. */ void CenterSquare(cv::Rect &rect); /** * @brief Convert cv::Mat into ncnn::Mat. * @param image[in] Origin image data. * @return ncnn::Mat Data for inferring. * @note There are several pre-processes in the function. */ ncnn::Mat ConvertOneImage(const cv::Mat& image); /** * @brief Get the minimum rectangle containing landmarks. * @param origin_image[in] Original image. * @param face_rect[in] The rectangle with absolute ordinates * to oriImage. All landmarks in this rectangle. * @param landmarks[in] Float array contains landmarks. * Relative ordinates to @see face_rect. * Format as [x, x, x, ..., y, y, y, ...]. * @param landmarks_len[in] Number of landmarks. * @return cv::Rect Minimum rectangle containing all landmarks * with absolute ordinates to oriImage. */ cv::Rect GetRoi(const cv::Mat &origin_image, const cv::Rect &face_rect, float* landmarks, int landmarks_len); /** * @brief Expanding rectangle with fixed center. * @param rect[in, out] Rectangle for modifing @see cv::Rect. * @param ratio[in] Expanding ratio to each edge. */ void RectCenterScale(cv::Rect &rect, const float ratio); /// Saving the model data. ncnn::Net net_; /// Saving the inputting data. ncnn::Mat one_image_values_; /// Saving the outputting data. ncnn::Mat out_; /// Recording the preparing cost. clock_t prepare_cost_ = 0; /// Recording the inferring cost. clock_t infer_cost_ = 0; }; } }
ab15437ba7b5815f6fbc6b1831535e0fd25eb68f
90c09bbe3fb26a406ad694c2dd9d794f7cdd0de6
/Color.h
4dc85f8612e7cc69cf3c2ec7b043265885149320
[]
no_license
davsarkissian/ray_tracer
5bcd8ce12f1af1422270a95e270ea9fc154b6e81
e1a33e2ca43a827419642cf74fe73c069d5a9cef
refs/heads/master
2022-04-11T19:32:49.343641
2020-03-11T13:08:35
2020-03-11T13:08:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
557
h
Color.h
#ifndef __COLOR_H #define __COLOR_H class Color { public: float r; float g; float b; float a; Color(float r_p=0.0, float g_p=0.0, float b_p=0.0, float a_p=1.0); ~Color(){} Color cap(); Color operator * (const float k); Color operator * (const Color c); Color operator + (const Color c); Color operator = (const Color c); Color operator *= (const Color c); Color operator += (const Color c); Color operator *= (const float k); }; #endif
37527d62d9e7a119fb83002da8af2d980b52bb48
6250f3343eff1638912510b66ed936c59796635a
/src_vc141/thirdparty/stlsoft/STLSoft/include/comstl/util/thread_marshal.hpp
db34652ef5b0b23f8958e67d2a2acaa30d5c1e2b
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
nneesshh/mytoolkit
b4b242307a6603bc5785bc130de8f4d3b5ea9265
336ae9c7077c8687a8cf8a2ce4aec804c28ab90c
refs/heads/master
2020-04-05T15:18:07.985547
2018-12-17T11:36:07
2018-12-17T11:36:07
156,961,652
0
2
null
null
null
null
UTF-8
C++
false
false
6,038
hpp
thread_marshal.hpp
/* ///////////////////////////////////////////////////////////////////////// * File: comstl/util/thread_marshal.hpp * * Purpose: Thread marshalling functions. * * Created: 25th May 2002 * Updated: 19th February 2017 * * Home: http://stlsoft.org/ * * Copyright (c) 2002-2017, Matthew Wilson and Synesis Software * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the * names of any contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ////////////////////////////////////////////////////////////////////// */ /** \file comstl/util/thread_marshal.hpp * * \brief [C++ only; requires COM] Thread marshalling functions * (\ref group__library__COM_Utility "COM Utility" Library). */ #ifndef COMSTL_INCL_COMSTL_UTIL_HPP_THREAD_MARSHAL #define COMSTL_INCL_COMSTL_UTIL_HPP_THREAD_MARSHAL #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION # define COMSTL_VER_COMSTL_UTIL_HPP_THREAD_MARSHAL_MAJOR 4 # define COMSTL_VER_COMSTL_UTIL_HPP_THREAD_MARSHAL_MINOR 0 # define COMSTL_VER_COMSTL_UTIL_HPP_THREAD_MARSHAL_REVISION 7 # define COMSTL_VER_COMSTL_UTIL_HPP_THREAD_MARSHAL_EDIT 66 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ /* ///////////////////////////////////////////////////////////////////////// * includes */ #ifndef COMSTL_INCL_COMSTL_H_COMSTL # include <comstl/comstl.h> #endif /* !COMSTL_INCL_COMSTL_H_COMSTL */ #ifdef STLSOFT_TRACE_INCLUDE # pragma message(__FILE__) #endif /* STLSOFT_TRACE_INCLUDE */ #ifndef COMSTL_INCL_COMSTL_UTIL_HPP_INTERFACE_TRAITS # include <comstl/util/interface_traits.hpp> #endif /* !COMSTL_INCL_COMSTL_UTIL_HPP_INTERFACE_TRAITS */ /* ///////////////////////////////////////////////////////////////////////// * namespace */ #ifndef COMSTL_NO_NAMESPACE # if defined(STLSOFT_NO_NAMESPACE) || \ defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) /* There is no stlsoft namespace, so must define ::comstl */ namespace comstl { # else /* Define stlsoft::comstl_project */ namespace stlsoft { namespace comstl_project { # endif /* STLSOFT_NO_NAMESPACE */ #endif /* !COMSTL_NO_NAMESPACE */ /* ///////////////////////////////////////////////////////////////////////// * functions */ /** Marshal a interface to a stream * * \ingroup group__library__COM_Utility * * This function marshals the given interface into a new stream instance, which * is returned to the caller. The stream may then be passed directly to another * thread in the process, from which GetInterfaceAndReleaseStream() may be * called. * * \param pitf The interface pointer to marshal * \param ppstm A pointer to an IStream pointer to receive the stream * \return An HRESULT indicating success or failure * \retval E_OUTOFMEMORY Sufficient memory could not be acquired * \retval S_OK The operation completed successfully */ template <ss_typename_param_k I> inline HRESULT MarshalInterThreadInterfaceInStream(I *pitf, LPSTREAM *ppstm) { return ::CoMarshalInterThreadInterfaceInStream(IID_traits<I>().iid(), pitf, ppstm); } /** Retrieve a marshaled interface pointer from a stream * * \ingroup group__library__COM_Utility * * This function loads a serialised marshalled interface pointer from the given * stream, queries for the interface of the given pointer, and returns the * pointer if successful, and an error code if not. The stream is always * released, irrespective of the success status of the function as a whole. * * \param pstm An IStream pointer from which object is to be unmarshaled * \param ppitf A pointer to the interface pointer to be unmarshaled * \return An HRESULT indicating success or failure * \retval E_INVALIDARG The argument was invalid * \retval S_OK The operation completed successfully */ template <ss_typename_param_k I> inline HRESULT GetInterfaceAndReleaseStream(LPSTREAM pstm, I **ppitf) { return ::CoGetInterfaceAndReleaseStream(pstm, IID_traits<I>().iid(), reinterpret_cast<void**>(ppitf)); } /* ////////////////////////////////////////////////////////////////////// */ #ifndef COMSTL_NO_NAMESPACE # if defined(STLSOFT_NO_NAMESPACE) || \ defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) } /* namespace comstl */ # else } /* namespace comstl_project */ } /* namespace stlsoft */ # endif /* STLSOFT_NO_NAMESPACE */ #endif /* !COMSTL_NO_NAMESPACE */ /* ///////////////////////////////////////////////////////////////////////// * inclusion control */ #ifdef STLSOFT_CF_PRAGMA_ONCE_SUPPORT # pragma once #endif /* STLSOFT_CF_PRAGMA_ONCE_SUPPORT */ #endif /* !COMSTL_INCL_COMSTL_UTIL_HPP_THREAD_MARSHAL */ /* ///////////////////////////// end of file //////////////////////////// */
37cd4e4ea9b5bd377b224b60fb5c1aadd8bd878e
465f1f7bd7dd287eb1e53ce79d986caf941aaeb9
/39. Combination Sum.cpp
a7a02b206c8193aff40fa15f3186e8ca6a4cce35
[]
no_license
gurjotsingh4398/Leetcode-solution
21a70c5e094961e6e5f9ef89f731835126c42a43
7594c3a0167819799a6e09a63717df3b18851bd8
refs/heads/master
2020-04-20T20:39:52.144743
2019-10-06T09:55:56
2019-10-06T09:55:56
169,083,362
2
2
null
2019-10-06T09:55:57
2019-02-04T13:34:58
C++
UTF-8
C++
false
false
1,158
cpp
39. Combination Sum.cpp
// https://leetcode.com/problems/combination-sum/ static const int fastIO = []() { ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }(); class Solution { public: vector<vector<int>> ans; vector<int> temp; void rec(vector<int>& candidates, int target,int sum,int index) { for(int i=index;i<candidates.size();i++) { sum=sum+candidates[i]; temp.push_back(candidates[i]); if(sum==target) { ans.push_back(temp); sum-=temp.back(); temp.pop_back(); return; } else if(sum>target) { sum-=temp.back(); temp.pop_back(); return; } else { rec(candidates,target,sum,i); sum-=temp.back(); temp.pop_back(); } } return; } vector<vector<int>> combinationSum(vector<int>& candidates, int target) { if(candidates.size()==0) return ans; sort(candidates.begin(),candidates.end()); rec(candidates,target,0,0); return ans; } };
6989239f63e24c5363fa7148a8a324e573e0c21f
c082b0764300413fcaa8745b17a8e6ddc16fbd3b
/StacksQueues/test.cpp
7c037269acc12e94884e2171ccd74d499a883031
[]
no_license
ArturoBurela/DataStructures
50d26621a6214ea9bc390d2c174bf1b0de5d9e1c
6347b4e79360c1ef5dd9bd7c803969801fa3900c
refs/heads/master
2021-03-30T18:21:38.230807
2016-11-08T14:13:32
2016-11-08T14:13:32
70,016,615
0
1
null
null
null
null
UTF-8
C++
false
false
2,356
cpp
test.cpp
/* Program to test the Stack and Queue implementations with arrays Gilberto Echeverria gilecheverria@yahoo.com */ #include <iostream> #include <string> #include "Stack.h" #include "Queue.h" void user_menu(); int main() { std::cout << "TEST FOR QUEUES AND STACKS" << std::endl; user_menu(); return 0; } void user_menu() { char option = 'a'; int item; Stack the_stack(10); Queue the_queue(4); while (option != 'q') { std::cout << "\nUser Menu" << std::endl; // Stack options std::cout << " a. Print stack" << std::endl; std::cout << " b. Push into stack" << std::endl; std::cout << " c. Top of the stack" << std::endl; std::cout << " d. Pop from the stack" << std::endl; // Queue options std::cout << " f. Print queue" << std::endl; std::cout << " g. Push into queue" << std::endl; std::cout << " h. Top of the queue" << std::endl; std::cout << " i. Pop from the queue" << std::endl; // Finish the program std::cout << " q. Quit program" << std::endl; std::cout << "Choose an option: "; std::cin >> option; if (option == 'a') { the_stack.print(); } if (option == 'b') { std::cout << "Enter the new item: "; std::cin >> item; the_stack.push(item); } if (option == 'c') { item = the_stack.top(); std::cout << "Item at the top of the stack: " << item << std::endl; } if (option == 'd') { item = the_stack.pop(); std::cout << "Item previously at the top of the stack: " << item << std::endl; } if (option == 'f') { the_queue.print(); } if (option == 'g') { std::cout << "Enter the new item: "; std::cin >> item; the_queue.push(item); } if (option == 'h') { item = the_queue.top(); std::cout << "Item at the end of the queue: " << item << std::endl; } if (option == 'i') { item = the_queue.pop(); std::cout << "Item previously at the end of the queue: " << item << std::endl; } } }
6ce92f2fbb72b8770279821b3a6e1cc1f0125aa5
d5dad6a6e8120ee51a4e2a9bbf9cf20f9584a08a
/BOJ/Simulation/17144.cpp
346fec0f819e019346616d75d6be06ab6631c817
[]
no_license
ssohyunKim/TIL
7661483c5547ab93c6ef3aa6d45bcb0bb2d7e932
281ddfa1beb66a06cd29ca8db6365a801adc7ca8
refs/heads/master
2021-06-25T22:28:51.891522
2020-12-04T14:20:49
2020-12-04T14:20:49
167,283,148
0
0
null
null
null
null
UTF-8
C++
false
false
3,415
cpp
17144.cpp
#include <iostream> #include <vector> using namespace std; int r, c, t; int map[2][50][50]; int up_x, up_y, down_x, down_y; int dy[] = {-1, 1, 0, 0}; int dx[] = {0, 0, -1, 1}; void spread(int cur) { int next = (cur + 1) % 2; for (int y = 0; y < r; y++) { for (int x = 0; x < c; x++) { if (map[cur][y][x] == -1) { map[next][y][x] = -1; } else { map[next][y][x] = 0; } } } for (int y = 0; y < r; y++) { for (int x = 0; x < c; x++) { int val = (map[cur][y][x] / 5); // 확산된 미세먼지의 양 int cnt = 0; // 실제로 확산된 미세먼지의 양 for (int dir = 0; dir < 4; dir++) { int ny = y + dy[dir]; int nx = x + dx[dir]; if (ny < 0 || ny >= r || nx < 0 || nx >= c) continue; if (map[cur][y][x] != -1) { map[next][y][x] += val; cnt += val; } } if (map[next][y][x] != -1) { map[next][y][x] += (map[cur][y][x] - cnt); } } } } void move(int cur) { //상단부분 for(int y = up_y-1; y > 0 ; y--){ map[cur][y][0] = map[cur][y-1][0]; //위쪽의 미세먼지를 아래쪽으로 } for(int x = 0; x < c-1; x++){ map[cur][0][x] = map[cur][0][x+1]; //오른쪽의 미세먼지를 왼쪽으로 } for(int y = 0; y < up_y; y++){ map[cur][y][c-1] = map[cur][y+1][c-1]; //아래의 미세먼지를 위로 } for(int x = c-1; x > 0; x--){ map[cur][up_y][x] = map[cur][up_y][x-1]; //왼쪽의 미세먼지를 오른쪽으로 } map[cur][up_y][1] = 0; //깨끗한 바람 //하단부분 for(int y = down_y+1; y < r ; y++){ map[cur][y][0] = map[cur][y+1][0]; //위쪽의 미세먼지를 아래쪽으로 } for(int x = 0; x < c-1; x++){ map[cur][r-1][x] = map[cur][r-1][x+1]; } for(int y = r-1; y< down_y; y--){ map[cur][y][c-1] = map[cur][y-1][c-1]; } for(int x = c-1; x > 1; x--){ map[cur][down_y][x] = map[cur][down_y][x-1]; } map[cur][down_y][1] = 0; //깨끗한 바람 } int main() { ios_base::sync_with_stdio(false); cin.tie(0); up_y = -1; // 공기청정기 초기화 cin >> r >> c >> t; for (int y = 0; y < r; y++) { for (int x = 0; x < c; x++) { cin >> map[0][y][x]; if (map[0][y][x] == -1) { if (up_y == -1) { up_y = y; up_x = x; } else { down_y = y; down_x = x; } } } } int cur = 0; for (int i = 0; i < t; i++) { spread(cur); cur = (cur + 1) % 2; // 0이면 1, 1이면 0으로 왔다갔다 move(cur); } int cnt = 0; for (int y = 0; y < r; y++) { for (int x = 0; x < c; x++) { if (map[cur][y][x] != -1) { cnt += map[cur][y][x]; } } } cout << cnt << "\n"; return 0; }
e61f337a8018f45fd70811a4651a6c21d7f1fabd
c9b7a7c49390c82f044805175ed03292191a51e3
/other/merge/merge/merge.cpp
4c17ca2575e683d659571f9b0df04aa3d1d85421
[]
no_license
Andriy963/homeworks
a0c441ccba275d15e5c02b144a0dfd7277c21f97
ac900332dbd608b867d2da3cd992b0bc86bfc7b8
refs/heads/master
2020-12-01T11:38:32.580065
2014-11-13T17:03:10
2014-11-13T17:03:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,381
cpp
merge.cpp
// merge.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; void mergesort(int *a, int *b, int start, int end) { int halfpoint; if (start < end) { halfpoint = (start + end) / 2; mergesort(a, b, start, halfpoint); mergesort(a, b, halfpoint + 1, end); merge(a, b, start, halfpoint, end); } } void merge(int *a, int *b, int start, int halfpoint, int end) { int h, i, j, k; h = start; i = start; j = halfpoint + 1; while ((h <= halfpoint) && (j <= end)) { if (a[h] <= a[j]) { b[i] = a[h]; h++; } else { b[i] = a[j]; j++; } i++; } if (h > halfpoint) { for (k = j; k <= end; k++) { b[i] = a[k]; i++; } } else { for (k = h; k <= halfpoint; k++) { b[i] = a[k]; i++; } } // Write the final sorted array to our original one for (k = start; k <= end; k++) { a[k] = b[k]; } } int _tmain(int argc, _TCHAR* argv[]) { int num; cout << "Nece ededi sort etmek isteyirsiniz: "; cin >> num; int *a = new int(num); int *b = new int(num); for (int i = 0; i < num; i++) { cout << (i + 1) << ": "; cin >> a[i]; } // Start merge sort mergesort(a, b, 0, num - 1); // Print the sorted array cout << endl; for (int i = 0; i < num; i++) cout << a[i] << " "; cout << endl; delete[] a; delete[] b; a = NULL; b = NULL; return 0; }
5bb022484036b264e25d2759ef3db5ca560585e5
df1a1b7cf25e6b31b1b5a9935b5aa1ac43c99d67
/443A-Atnlet.cpp
ee453cfdabcc3e23929d35ad3e10361db88851a6
[]
no_license
william1099/CP
6171603e5602c47b8f363e89d50c003be5636137
92288e734b298977063dbe7d075c68a892511b0e
refs/heads/master
2021-04-15T13:20:53.108606
2018-03-24T20:36:18
2018-03-24T20:36:18
126,637,211
1
0
null
null
null
null
UTF-8
C++
false
false
726
cpp
443A-Atnlet.cpp
#include <bits/stdc++.h> using namespace std; const int MAXN=1e4; char a[MAXN]; int main() { string str; long int i,k,count=0; getline(cin,str); //baca string termasuk spasi memset(a,MAXN,0); for (i=0; i<=str.length()-1; i++) { if (str[i]==',' || str[i]=='}') { k=str[i-1]-'0'; if (a[k]==0 && k!=75) { //'a'-'0'=49 'A'-'0'=18 a[k]++; //a[k]==0 memcatat kemunculan 1 kali saja count++; } } } cout<<count<<endl; } /* #include <bits/stdc++.h> using namespace std; int main() { string str; long int i; getline(cin,str); set<char> mySet; for (i=0; i<=str.length()-1; i++) { if (str[i]>=97 && str[i]<=122) { mySet.insert(str[i]); } } cout<<mySet.size()<<endl; return 0; } */
8195fbbe9a6f9b3ca8a2b55fb2de68971109ff9c
b39437582ce07ae9dd19f2742dd5be5ad89d5e8d
/thpool/worker.h
7ecd5958f249960dc0136e75833bf4a1955e8237
[]
no_license
fixee/workspace
014ed90a2be0a977a5da55e4343e30f6bd603355
41b9ffc5844cdca7884667015c254737224b30ae
refs/heads/master
2021-01-10T11:29:00.975855
2015-12-06T03:32:59
2015-12-06T03:32:59
47,409,280
0
0
null
null
null
null
UTF-8
C++
false
false
270
h
worker.h
#ifndef _worker_h_ #define _worker_h_ #include "pthread.h" class threadpool; class worker { public: worker(); ~worker(); void init( threadpool *_pool ); public: static void *work( void *data ); private: threadpool *pool; pthread_t tid; }; #endif//_worker_h_
4144811b9440f676b8e60be0a2d3c90224e49114
e18b4791d07314a9609fdfc9e3efd1c5deb61127
/ProjectTemplate-master/MyProject/src/MyProject/MyProject.cpp
96d6d6b19ab60f1b1efa2f4bbebe41e407a484a4
[ "MIT" ]
permissive
deepakgopinath/AudioFeatureExtractor
f3c69e7110bce67e32cd57b79d016bc4a17029da
78133b7c22ce7da363bc5712b3fc1cf8972b6872
refs/heads/master
2021-01-13T01:26:17.657328
2014-04-14T06:36:48
2014-04-14T06:36:48
18,472,987
1
0
null
null
null
null
UTF-8
C++
false
false
7,358
cpp
MyProject.cpp
// standard headers // project headers #include "MyProjectConfig.h" #include "ErrorDef.h" #include "Util.h" #include "MyProject.h" static const char* kCMyProjectBuildDate = __DATE__; CMyProject::CMyProject (): m_bIsInitialized(false), m_IsSpectralFeatureRequested(false), m_iNumChannels(0), m_fSampleRate(0), m_iBlockSize(0), m_iHopSize(0), m_iNumBlocks(0), m_iBlockCounter(0), m_FFTResult(0), m_ProcBuff(0), m_DownMixedAudio(0), m_FeatureMatrix(0), m_pMyFFt(0), m_pMyInputBuffSrc(0), m_pFeatureExtractor(0) { // this never hurts // this->resetInstance (); } CMyProject::~CMyProject () { this->resetInstance (); } const int CMyProject::getVersion (const Version_t eVersionIdx) { int iVersion = 0; switch (eVersionIdx) { case kMajor: iVersion = MyProject_VERSION_MAJOR; break; case kMinor: iVersion = MyProject_VERSION_MINOR; break; case kPatch: iVersion = MyProject_VERSION_PATCH; break; case kNumVersionInts: iVersion = -1; break; } return iVersion; } const char* CMyProject::getBuildDate () { return kCMyProjectBuildDate; } Error_t CMyProject::createInstance (CMyProject*& pCMyProject) { pCMyProject = new CMyProject (); if (!pCMyProject) return kUnknownError; return kNoError; } Error_t CMyProject::destroyInstance (CMyProject*& pCMyProject) { if (!pCMyProject) return kUnknownError; pCMyProject->resetInstance (); delete pCMyProject; pCMyProject = 0; return kNoError; } Error_t CMyProject::initInstance(int iNumChannels, float fSampleRate, int iBlockSize, int iHopSize, CFft::WindowFunction_t eWindowFunctionType, CFft::Windowing_t eWindow, float fKappa, std::vector<int>optionsArray, int iNumBlocks) { // allocate memory // initialize variables and buffers m_iNumChannels = iNumChannels; m_iBlockSize = iBlockSize; m_iHopSize = iHopSize; m_fSampleRate = fSampleRate; m_vOptionsArray = optionsArray; m_iNumBlocks = iNumBlocks; m_FFTResult = new float[m_iBlockSize]; m_fFftMag = new float[static_cast<int>(m_iBlockSize/2) + 1]; m_pMyInputBuffSrc = new CInputBuffSrc<float>(m_iNumChannels, m_iBlockSize, 0); // zero latency CFft::createInstance(m_pMyFFt); m_pMyFFt->initInstance(m_iBlockSize, 1, eWindowFunctionType, eWindow); m_pFeatureExtractor = new CFeatureExtractor(m_fSampleRate, static_cast<int>(m_iBlockSize/2) + 1, fKappa); m_ProcBuff = new float*[m_iNumChannels]; m_FeatureMatrix = new float*[optionsArray.size()]; m_DownMixedAudio = new float[m_iBlockSize]; for (int i=0; i < optionsArray.size(); i++) // check whether spectral feature was requested by the user { if (optionsArray[i] < CFeatureExtractor::kNumSpectralFeatures) { m_IsSpectralFeatureRequested = true; break; } } for(int i=0; i<optionsArray.size(); i++) { m_FeatureMatrix[i] = new float[m_iNumBlocks]; CUtil::setZero(m_FeatureMatrix[i], m_iNumBlocks); } for(int i=0; i < m_iNumChannels; i++) { m_ProcBuff[i] = new float[m_iBlockSize]; CUtil::setZero(m_ProcBuff[i], m_iBlockSize); } m_bIsInitialized = true; return kNoError; } Error_t CMyProject::resetInstance () { // reset buffers and variables to default values if(m_bIsInitialized) { if(m_pMyFFt) { m_pMyFFt->resetInstance(); m_pMyFFt->destroyInstance(m_pMyFFt); } if(m_pMyInputBuffSrc) { delete m_pMyInputBuffSrc; } if(m_pFeatureExtractor) { delete m_pFeatureExtractor; } if(m_FFTResult) { delete [] m_FFTResult; } if(m_fFftMag) { delete [] m_fFftMag; } if(m_ProcBuff) { for (int i = 0; i < m_iNumChannels; i++) { delete [] m_ProcBuff[i]; } delete [] m_ProcBuff; } if (m_FeatureMatrix) { for (int i = 0; i < m_vOptionsArray.size(); i++) { delete [] m_FeatureMatrix[i]; } delete [] m_FeatureMatrix; } if(m_DownMixedAudio) { delete [] m_DownMixedAudio; } } m_pMyFFt = 0; m_pMyInputBuffSrc = 0; m_pFeatureExtractor = 0; m_FFTResult = 0; m_fFftMag = 0; m_ProcBuff = 0; m_FeatureMatrix = 0; m_DownMixedAudio = 0; m_vOptionsArray.clear(); m_IsSpectralFeatureRequested = false; m_iNumChannels = 0; m_iBlockSize = 0; m_iHopSize = 0; m_iNumBlocks = 0; m_iBlockCounter = 0; m_fSampleRate = 0.0; m_bIsInitialized = false; return kNoError; } Error_t CMyProject::process(float **ppfInputBuffer, float **ppfOutputBuffer, int iNumberOfFrames) { m_pMyInputBuffSrc->setDataPtr2Hold(ppfInputBuffer, iNumberOfFrames); while(m_pMyInputBuffSrc->getBlock(m_ProcBuff, m_iBlockSize, m_iHopSize)) { //downmixing CUtil::setZero(m_DownMixedAudio, m_iBlockSize); // clean up downmixed audio every block. or else it will be accumulating for(int i=0; i<m_iBlockSize; i++) { for(int j=0; j<m_iNumChannels; j++) { m_DownMixedAudio[i] += m_ProcBuff[j][i]; } m_DownMixedAudio[i] = static_cast<float>(m_DownMixedAudio[i]/m_iNumChannels); } if(m_IsSpectralFeatureRequested) // check for spectral, if yes, calculate fft. { m_pMyFFt->doFft(m_FFTResult, m_DownMixedAudio); m_pMyFFt->getMagnitude(m_fFftMag, m_FFTResult); } for(int i=0; i < m_vOptionsArray.size(); i++) { float result = 0.0; // depending on whether the option is if(m_vOptionsArray[i] < CFeatureExtractor::kNumSpectralFeatures) // spectral features { result = m_pFeatureExtractor->extractFeatures(m_fFftMag, static_cast<int>(m_iBlockSize/2) + 1, m_vOptionsArray[i]); }else // Time domain features { result = m_pFeatureExtractor->extractFeatures(m_DownMixedAudio, m_iBlockSize, m_vOptionsArray[i]); } m_FeatureMatrix[i][m_iBlockCounter] = result; // write the result to appropriate row and column in the feature matrix. } m_iBlockCounter++; // this is used to keep track of correct column to which to write to in the feature matrix. } m_pMyInputBuffSrc->releaseDataPtr(); // release ptr at the end of every process call or else the remaining samples would not be buffered for the next process call! return kNoError; } void CMyProject::getSizeOfResult(int &numRows, int &numColumns) { numRows = m_vOptionsArray.size(); numColumns = m_iNumBlocks; } void CMyProject::getResult(float **&featureMatrix) { featureMatrix = m_FeatureMatrix; // pointer by reference. }
f35bb38f789fd14afb4c699245fb303fcaf7a108
3f287d374dbe3f958849f81762236ab77d0b5dea
/tst/unit/binpacks.cpp
049b39baf6e594a97cf7e9bcb0b923998a6d15ca
[]
no_license
lineCode/libhut
8eb1219d4d814b8534bd2cc13614fcf3c7e38b72
a727ec3af764632af316b80a9eb02af1cf02b261
refs/heads/master
2023-03-30T03:54:02.592678
2021-04-04T21:02:55
2021-04-04T21:02:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
93
cpp
binpacks.cpp
#include <gtest/gtest.h> #include "hut/binpacks.hpp" TEST(binpacks, linear1d) { //TODO }
af492d2ea6fb8c36db9609a141798f0341c108c8
5e4a0499ca89a221735911f08acbc58095602d5f
/include/Files.h
5fdbd596a35df1c9f09cacf58663368976dedece
[]
no_license
AdrienBourgois/ModelViewer
3f7bd7e9cb440233a1ba15db46400d1e14ecc375
5672e91f696d6afd4bb56d84af522067a458aaeb
refs/heads/master
2021-01-13T00:45:12.595929
2015-11-17T15:48:46
2015-11-17T15:48:46
46,051,650
1
0
null
null
null
null
UTF-8
C++
false
false
927
h
Files.h
#ifndef __FILES_INCLUDE__ #define __FILES_INCLUDE__ #include <iostream> #include <vector> #include <dirent.h> #include <sys/types.h> namespace id { class FileManager { public: FileManager(); ~FileManager() = default; std::string getPath(); std::vector<std::string> getListFolder() {return this->listFolder;} std::string getListFolder(int n) {return this->listFolder[n];} std::vector<struct dirent*> getList(); void showFolder() {std::cout << "Actual path : " << getPath() << std::endl;} void setPath(std::string); void parentFolder() {this->listFolder.erase(listFolder.end());} void displayFolder(); std::vector<std::string> explodePath(std::string); std::string slashToSpace(std::string); private: std::vector<std::string> listFolder; std::vector<struct dirent*> list; }; }// namespace id #endif
d2519e801aa3f308512c3a0168af97935499ede0
f051d9a41613334e4ba6a5747028fef3a11ac70d
/src/hsp3dish/gameplay/src/lua/lua_Effect.cpp
caa9003c1479df5d974fedbb6751266c7dfbeb70
[ "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
onitama/OpenHSP
d93b50b230234c4792a5199539403ab91f91740a
ba6b92a40c4bc6716208ad4961f11bbd1c7fbd04
refs/heads/master
2023-09-04T09:55:03.935733
2023-08-21T06:52:49
2023-08-21T06:52:49
107,995,606
159
26
BSD-3-Clause
2022-06-18T02:42:50
2017-10-23T14:42:26
C
UTF-8
C++
false
false
43,636
cpp
lua_Effect.cpp
// Autogenerated by gameplay-luagen #include "Base.h" #include "ScriptController.h" #include "lua_Effect.h" #include "Base.h" #include "Effect.h" #include "FileSystem.h" #include "Game.h" #include "Ref.h" namespace gameplay { void luaRegister_Effect() { const luaL_Reg lua_members[] = { {"addRef", lua_Effect_addRef}, {"bind", lua_Effect_bind}, {"getId", lua_Effect_getId}, {"getRefCount", lua_Effect_getRefCount}, {"getUniform", lua_Effect_getUniform}, {"getUniformCount", lua_Effect_getUniformCount}, {"getVertexAttribute", lua_Effect_getVertexAttribute}, {"release", lua_Effect_release}, {"setValue", lua_Effect_setValue}, {NULL, NULL} }; const luaL_Reg lua_statics[] = { {"createFromFile", lua_Effect_static_createFromFile}, {"createFromSource", lua_Effect_static_createFromSource}, {"getCurrentEffect", lua_Effect_static_getCurrentEffect}, {NULL, NULL} }; std::vector<std::string> scopePath; gameplay::ScriptUtil::registerClass("Effect", lua_members, NULL, lua_Effect__gc, lua_statics, scopePath); } static Effect* getInstance(lua_State* state) { void* userdata = luaL_checkudata(state, 1, "Effect"); luaL_argcheck(state, userdata != NULL, 1, "'Effect' expected."); return (Effect*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance; } int lua_Effect__gc(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { void* userdata = luaL_checkudata(state, 1, "Effect"); luaL_argcheck(state, userdata != NULL, 1, "'Effect' expected."); gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)userdata; if (object->owns) { Effect* instance = (Effect*)object->instance; SAFE_RELEASE(instance); } return 0; } lua_pushstring(state, "lua_Effect__gc - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_Effect_addRef(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { Effect* instance = getInstance(state); instance->addRef(); return 0; } lua_pushstring(state, "lua_Effect_addRef - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_Effect_bind(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { Effect* instance = getInstance(state); instance->bind(); return 0; } lua_pushstring(state, "lua_Effect_bind - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_Effect_getId(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { Effect* instance = getInstance(state); const char* result = instance->getId(); // Push the return value onto the stack. lua_pushstring(state, result); return 1; } lua_pushstring(state, "lua_Effect_getId - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_Effect_getRefCount(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { Effect* instance = getInstance(state); unsigned int result = instance->getRefCount(); // Push the return value onto the stack. lua_pushunsigned(state, result); return 1; } lua_pushstring(state, "lua_Effect_getRefCount - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_Effect_getUniform(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 2: { do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL)) { // Get parameter 1 off the stack. const char* param1 = gameplay::ScriptUtil::getString(2, false); Effect* instance = getInstance(state); void* returnPtr = ((void*)instance->getUniform(param1)); if (returnPtr) { gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Uniform"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && lua_type(state, 2) == LUA_TNUMBER) { // Get parameter 1 off the stack. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2); Effect* instance = getInstance(state); void* returnPtr = ((void*)instance->getUniform(param1)); if (returnPtr) { gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Uniform"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } } while (0); lua_pushstring(state, "lua_Effect_getUniform - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 2)."); lua_error(state); break; } } return 0; } int lua_Effect_getUniformCount(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { Effect* instance = getInstance(state); unsigned int result = instance->getUniformCount(); // Push the return value onto the stack. lua_pushunsigned(state, result); return 1; } lua_pushstring(state, "lua_Effect_getUniformCount - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_Effect_getVertexAttribute(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 2: { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL)) { // Get parameter 1 off the stack. const char* param1 = gameplay::ScriptUtil::getString(2, false); Effect* instance = getInstance(state); void* returnPtr = (void*)new GLint(instance->getVertexAttribute(param1)); if (returnPtr) { gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = true; luaL_getmetatable(state, "GLint"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } lua_pushstring(state, "lua_Effect_getVertexAttribute - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 2)."); lua_error(state); break; } } return 0; } int lua_Effect_release(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { Effect* instance = getInstance(state); instance->release(); return 0; } lua_pushstring(state, "lua_Effect_release - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_Effect_setValue(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 3: { do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && lua_type(state, 3) == LUA_TNUMBER) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. float param2 = (float)luaL_checknumber(state, 3); Effect* instance = getInstance(state); instance->setValue(param1, param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TLIGHTUSERDATA)) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. gameplay::ScriptUtil::LuaArray<float> param2 = gameplay::ScriptUtil::getFloatPointer(3); Effect* instance = getInstance(state); instance->setValue(param1, param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && lua_type(state, 3) == LUA_TNUMBER) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. int param2 = (int)luaL_checkint(state, 3); Effect* instance = getInstance(state); instance->setValue(param1, param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TLIGHTUSERDATA)) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. gameplay::ScriptUtil::LuaArray<int> param2 = gameplay::ScriptUtil::getIntPointer(3); Effect* instance = getInstance(state); instance->setValue(param1, param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL)) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Matrix> param2 = gameplay::ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", true, &param2Valid); if (!param2Valid) break; Effect* instance = getInstance(state); instance->setValue(param1, *param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL)) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Matrix> param2 = gameplay::ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false, &param2Valid); if (!param2Valid) break; Effect* instance = getInstance(state); instance->setValue(param1, param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL)) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Vector2> param2 = gameplay::ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", true, &param2Valid); if (!param2Valid) break; Effect* instance = getInstance(state); instance->setValue(param1, *param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL)) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Vector2> param2 = gameplay::ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false, &param2Valid); if (!param2Valid) break; Effect* instance = getInstance(state); instance->setValue(param1, param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL)) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true, &param2Valid); if (!param2Valid) break; Effect* instance = getInstance(state); instance->setValue(param1, *param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL)) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", false, &param2Valid); if (!param2Valid) break; Effect* instance = getInstance(state); instance->setValue(param1, param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL)) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", true, &param2Valid); if (!param2Valid) break; Effect* instance = getInstance(state); instance->setValue(param1, *param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL)) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", false, &param2Valid); if (!param2Valid) break; Effect* instance = getInstance(state); instance->setValue(param1, param2); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL)) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Texture::Sampler> param2 = gameplay::ScriptUtil::getObjectPointer<Texture::Sampler>(3, "TextureSampler", false, &param2Valid); if (!param2Valid) break; Effect* instance = getInstance(state); instance->setValue(param1, param2); return 0; } } while (0); lua_pushstring(state, "lua_Effect_setValue - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } case 4: { do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TLIGHTUSERDATA) && lua_type(state, 4) == LUA_TNUMBER) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. gameplay::ScriptUtil::LuaArray<float> param2 = gameplay::ScriptUtil::getFloatPointer(3); // Get parameter 3 off the stack. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4); Effect* instance = getInstance(state); instance->setValue(param1, param2, param3); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TLIGHTUSERDATA) && lua_type(state, 4) == LUA_TNUMBER) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. gameplay::ScriptUtil::LuaArray<int> param2 = gameplay::ScriptUtil::getIntPointer(3); // Get parameter 3 off the stack. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4); Effect* instance = getInstance(state); instance->setValue(param1, param2, param3); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) && lua_type(state, 4) == LUA_TNUMBER) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Matrix> param2 = gameplay::ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false, &param2Valid); if (!param2Valid) break; // Get parameter 3 off the stack. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4); Effect* instance = getInstance(state); instance->setValue(param1, param2, param3); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) && lua_type(state, 4) == LUA_TNUMBER) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Vector2> param2 = gameplay::ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false, &param2Valid); if (!param2Valid) break; // Get parameter 3 off the stack. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4); Effect* instance = getInstance(state); instance->setValue(param1, param2, param3); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) && lua_type(state, 4) == LUA_TNUMBER) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", false, &param2Valid); if (!param2Valid) break; // Get parameter 3 off the stack. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4); Effect* instance = getInstance(state); instance->setValue(param1, param2, param3); return 0; } } while (0); do { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) && lua_type(state, 4) == LUA_TNUMBER) { // Get parameter 1 off the stack. bool param1Valid; gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid); if (!param1Valid) break; // Get parameter 2 off the stack. bool param2Valid; gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", false, &param2Valid); if (!param2Valid) break; // Get parameter 3 off the stack. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4); Effect* instance = getInstance(state); instance->setValue(param1, param2, param3); return 0; } } while (0); lua_pushstring(state, "lua_Effect_setValue - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 3 or 4)."); lua_error(state); break; } } return 0; } int lua_Effect_static_createFromFile(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 2: { if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) && (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL)) { // Get parameter 1 off the stack. const char* param1 = gameplay::ScriptUtil::getString(1, false); // Get parameter 2 off the stack. const char* param2 = gameplay::ScriptUtil::getString(2, false); void* returnPtr = ((void*)Effect::createFromFile(param1, param2)); if (returnPtr) { gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Effect"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } lua_pushstring(state, "lua_Effect_static_createFromFile - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } case 3: { if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) && (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL)) { // Get parameter 1 off the stack. const char* param1 = gameplay::ScriptUtil::getString(1, false); // Get parameter 2 off the stack. const char* param2 = gameplay::ScriptUtil::getString(2, false); // Get parameter 3 off the stack. const char* param3 = gameplay::ScriptUtil::getString(3, false); void* returnPtr = ((void*)Effect::createFromFile(param1, param2, param3)); if (returnPtr) { gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Effect"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } lua_pushstring(state, "lua_Effect_static_createFromFile - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 2 or 3)."); lua_error(state); break; } } return 0; } int lua_Effect_static_createFromSource(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 2: { if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) && (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL)) { // Get parameter 1 off the stack. const char* param1 = gameplay::ScriptUtil::getString(1, false); // Get parameter 2 off the stack. const char* param2 = gameplay::ScriptUtil::getString(2, false); void* returnPtr = ((void*)Effect::createFromSource(param1, param2)); if (returnPtr) { gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Effect"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } lua_pushstring(state, "lua_Effect_static_createFromSource - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } case 3: { if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) && (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) && (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL)) { // Get parameter 1 off the stack. const char* param1 = gameplay::ScriptUtil::getString(1, false); // Get parameter 2 off the stack. const char* param2 = gameplay::ScriptUtil::getString(2, false); // Get parameter 3 off the stack. const char* param3 = gameplay::ScriptUtil::getString(3, false); void* returnPtr = ((void*)Effect::createFromSource(param1, param2, param3)); if (returnPtr) { gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Effect"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } lua_pushstring(state, "lua_Effect_static_createFromSource - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 2 or 3)."); lua_error(state); break; } } return 0; } int lua_Effect_static_getCurrentEffect(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 0: { void* returnPtr = ((void*)Effect::getCurrentEffect()); if (returnPtr) { gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Effect"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 0)."); lua_error(state); break; } } return 0; } }
afe8c820c8ee366453c4e2c0f3488906b9cfba22
4353864a0a7fe66525dfc3ddbf6e90a25af05b68
/dvc.cpp
38b44d396d397fb5276f5a014b3b8316f4b38f4b
[ "PHP-3.01" ]
permissive
lordgnu/wxPHP
12dc4e1ef31fb01063c763d887f95d727e08e002
368a75c893039e5eaa31bc1ee38e341991039f3f
refs/heads/master
2020-04-16T17:04:42.142204
2012-05-02T13:28:29
2012-05-02T13:28:29
4,203,267
1
0
null
null
null
null
UTF-8
C++
false
false
438,221
cpp
dvc.cpp
/* * @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_wxDataViewModel_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewModel_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif } PHP_METHOD(php_wxDataViewModel, AddNotifier) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::AddNotifier\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 wxDataViewModel::AddNotifier\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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* notifier0 = 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' (&notifier0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &notifier0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(notifier0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(notifier0), _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(notifier0) != 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 wxDataViewModel::AddNotifier((wxDataViewModelNotifier*) object_pointer0_0)\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ((wxDataViewListModel_php*)_this)->AddNotifier((wxDataViewModelNotifier*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ((wxDataViewIndexListModel_php*)_this)->AddNotifier((wxDataViewModelNotifier*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewListStore) { ((wxDataViewListStore_php*)_this)->AddNotifier((wxDataViewModelNotifier*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ((wxDataViewVirtualListModel_php*)_this)->AddNotifier((wxDataViewModelNotifier*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ((wxDataViewTreeStore_php*)_this)->AddNotifier((wxDataViewModelNotifier*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewModel) { ((wxDataViewModel_php*)_this)->AddNotifier((wxDataViewModelNotifier*) object_pointer0_0); } references->AddReference(notifier0); return; break; } } } } PHP_METHOD(php_wxDataViewModel, ChangeValue) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::ChangeValue\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 wxDataViewModel::ChangeValue\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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* variant0 = 0; void* object_pointer0_0 = 0; zval* item0 = 0; void* object_pointer0_1 = 0; long col0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'OOl' (&variant0, php_wxVariant_entry, &item0, php_wxDataViewItem_entry, &col0)\n"); #endif char parse_parameters_string[] = "OOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &variant0, php_wxVariant_entry, &item0, php_wxDataViewItem_entry, &col0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(variant0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(variant0), _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(variant0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 2){ 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_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(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 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxDataViewModel::ChangeValue(*(wxVariant*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) col0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->ChangeValue(*(wxVariant*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->ChangeValue(*(wxVariant*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->ChangeValue(*(wxVariant*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->ChangeValue(*(wxVariant*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_BOOL(return_value, ((wxDataViewTreeStore_php*)_this)->ChangeValue(*(wxVariant*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_BOOL(return_value, ((wxDataViewModel_php*)_this)->ChangeValue(*(wxVariant*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) col0)); } references->AddReference(variant0); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxDataViewModel, Cleared) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::Cleared\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 wxDataViewModel::Cleared\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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(wxDataViewModel::Cleared())\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->Cleared()); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->Cleared()); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->Cleared()); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->Cleared()); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_BOOL(return_value, ((wxDataViewTreeStore_php*)_this)->Cleared()); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_BOOL(return_value, ((wxDataViewModel_php*)_this)->Cleared()); } return; break; } } } } PHP_METHOD(php_wxDataViewModel, Compare) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::Compare\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 wxDataViewModel::Compare\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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* item10 = 0; void* object_pointer0_0 = 0; zval* item20 = 0; void* object_pointer0_1 = 0; long column0; bool ascending0; 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 'OOlb' (&item10, php_wxDataViewItem_entry, &item20, php_wxDataViewItem_entry, &column0, &ascending0)\n"); #endif char parse_parameters_string[] = "OOlb"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item10, php_wxDataViewItem_entry, &item20, php_wxDataViewItem_entry, &column0, &ascending0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item10) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item10), _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(item10) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 2){ if(Z_TYPE_P(item20) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item20), _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(item20) != 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 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxDataViewModel::Compare(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) column0, ascending0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_LONG(return_value, ((wxDataViewListModel_php*)_this)->Compare(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) column0, ascending0)); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_LONG(return_value, ((wxDataViewIndexListModel_php*)_this)->Compare(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) column0, ascending0)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_LONG(return_value, ((wxDataViewListStore_php*)_this)->Compare(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) column0, ascending0)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_LONG(return_value, ((wxDataViewVirtualListModel_php*)_this)->Compare(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) column0, ascending0)); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_LONG(return_value, ((wxDataViewTreeStore_php*)_this)->Compare(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) column0, ascending0)); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_LONG(return_value, ((wxDataViewModel_php*)_this)->Compare(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, (unsigned int) column0, ascending0)); } references->AddReference(item10); references->AddReference(item20); return; break; } } } } PHP_METHOD(php_wxDataViewModel, GetAttr) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::GetAttr\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 wxDataViewModel::GetAttr\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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; long col0; zval* attr0 = 0; void* object_pointer0_2 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'OlO' (&item0, php_wxDataViewItem_entry, &col0, &attr0, php_wxDataViewItemAttr_entry)\n"); #endif char parse_parameters_string[] = "OlO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry, &col0, &attr0, php_wxDataViewItemAttr_entry ) == 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 >= 3){ if(Z_TYPE_P(attr0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(attr0), _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(attr0) != 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 RETURN_BOOL(wxDataViewModel::GetAttr(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->GetAttr(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2)); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->GetAttr(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->GetAttr(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->GetAttr(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2)); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_BOOL(return_value, ((wxDataViewTreeStore_php*)_this)->GetAttr(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2)); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_BOOL(return_value, ((wxDataViewModel_php*)_this)->GetAttr(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2)); } references->AddReference(item0); references->AddReference(attr0); return; break; } } } } unsigned int wxDataViewModel_php::GetColumnCount()const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModel::GetColumnCount\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, "GetColumnCount", 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 'GetColumnCount'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return (unsigned int) Z_LVAL_P(return_value); } wxString wxDataViewModel_php::GetColumnType(unsigned int col)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModel::GetColumnType\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, "GetColumnType", 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], col); #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 'GetColumnType'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return wxString(Z_STRVAL_P(return_value), wxConvUTF8); } wxDataViewItem wxDataViewModel_php::GetParent(const wxDataViewItem& item)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModel::GetParent\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, "GetParent", 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_wxDataViewItem_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&item, le_wxDataViewItem)); #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 'GetParent'!", "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 *(wxDataViewItem*) return_object; } void wxDataViewModel_php::GetValue(wxVariant& variant, const wxDataViewItem& item, unsigned int col)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModel::GetValue\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, "GetValue", 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_wxVariant_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&variant, le_wxVariant)); object_init_ex(arguments[1], php_wxDataViewItem_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&item, le_wxDataViewItem)); ZVAL_LONG(arguments[2], col); #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 'GetValue'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } PHP_METHOD(php_wxDataViewModel, HasContainerColumns) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::HasContainerColumns\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 wxDataViewModel::HasContainerColumns\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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 'O' (&item0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry ) == 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 RETURN_BOOL(wxDataViewModel::HasContainerColumns(*(wxDataViewItem*) object_pointer0_0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->HasContainerColumns(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->HasContainerColumns(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->HasContainerColumns(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->HasContainerColumns(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_BOOL(return_value, ((wxDataViewTreeStore_php*)_this)->HasContainerColumns(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_BOOL(return_value, ((wxDataViewModel_php*)_this)->HasContainerColumns(*(wxDataViewItem*) object_pointer0_0)); } references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxDataViewModel, HasDefaultCompare) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::HasDefaultCompare\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 wxDataViewModel::HasDefaultCompare\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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(wxDataViewModel::HasDefaultCompare())\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->HasDefaultCompare()); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->HasDefaultCompare()); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->HasDefaultCompare()); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->HasDefaultCompare()); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_BOOL(return_value, ((wxDataViewTreeStore_php*)_this)->HasDefaultCompare()); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_BOOL(return_value, ((wxDataViewModel_php*)_this)->HasDefaultCompare()); } return; break; } } } } PHP_METHOD(php_wxDataViewModel, HasValue) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::HasValue\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 wxDataViewModel::HasValue\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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; long col0; 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 'Ol' (&item0, php_wxDataViewItem_entry, &col0)\n"); #endif char parse_parameters_string[] = "Ol"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry, &col0 ) == 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 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxDataViewModel::HasValue(*(wxDataViewItem*) object_pointer0_0, (unsigned) col0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->HasValue(*(wxDataViewItem*) object_pointer0_0, (unsigned) col0)); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->HasValue(*(wxDataViewItem*) object_pointer0_0, (unsigned) col0)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->HasValue(*(wxDataViewItem*) object_pointer0_0, (unsigned) col0)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->HasValue(*(wxDataViewItem*) object_pointer0_0, (unsigned) col0)); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_BOOL(return_value, ((wxDataViewTreeStore_php*)_this)->HasValue(*(wxDataViewItem*) object_pointer0_0, (unsigned) col0)); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_BOOL(return_value, ((wxDataViewModel_php*)_this)->HasValue(*(wxDataViewItem*) object_pointer0_0, (unsigned) col0)); } references->AddReference(item0); return; break; } } } } bool wxDataViewModel_php::IsContainer(const wxDataViewItem& item)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModel::IsContainer\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, "IsContainer", 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_wxDataViewItem_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&item, le_wxDataViewItem)); #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 'IsContainer'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } PHP_METHOD(php_wxDataViewModel, IsEnabled) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::IsEnabled\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 wxDataViewModel::IsEnabled\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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; long col0; 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 'Ol' (&item0, php_wxDataViewItem_entry, &col0)\n"); #endif char parse_parameters_string[] = "Ol"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry, &col0 ) == 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 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxDataViewModel::IsEnabled(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->IsEnabled(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->IsEnabled(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->IsEnabled(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->IsEnabled(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_BOOL(return_value, ((wxDataViewTreeStore_php*)_this)->IsEnabled(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_BOOL(return_value, ((wxDataViewModel_php*)_this)->IsEnabled(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxDataViewModel, ItemAdded) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::ItemAdded\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 wxDataViewModel::ItemAdded\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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; zval* item0 = 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 'OO' (&parent0, php_wxDataViewItem_entry, &item0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "OO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, php_wxDataViewItem_entry, &item0, php_wxDataViewItem_entry ) == 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 >= 2){ 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_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(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 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxDataViewModel::ItemAdded(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->ItemAdded(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->ItemAdded(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->ItemAdded(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->ItemAdded(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_BOOL(return_value, ((wxDataViewTreeStore_php*)_this)->ItemAdded(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_BOOL(return_value, ((wxDataViewModel_php*)_this)->ItemAdded(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } references->AddReference(parent0); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxDataViewModel, ItemChanged) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::ItemChanged\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 wxDataViewModel::ItemChanged\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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 'O' (&item0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry ) == 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 RETURN_BOOL(wxDataViewModel::ItemChanged(*(wxDataViewItem*) object_pointer0_0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->ItemChanged(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->ItemChanged(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->ItemChanged(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->ItemChanged(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_BOOL(return_value, ((wxDataViewTreeStore_php*)_this)->ItemChanged(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_BOOL(return_value, ((wxDataViewModel_php*)_this)->ItemChanged(*(wxDataViewItem*) object_pointer0_0)); } references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxDataViewModel, ItemDeleted) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::ItemDeleted\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 wxDataViewModel::ItemDeleted\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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; zval* item0 = 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 'OO' (&parent0, php_wxDataViewItem_entry, &item0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "OO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, php_wxDataViewItem_entry, &item0, php_wxDataViewItem_entry ) == 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 >= 2){ 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_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(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 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxDataViewModel::ItemDeleted(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->ItemDeleted(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->ItemDeleted(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->ItemDeleted(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->ItemDeleted(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_BOOL(return_value, ((wxDataViewTreeStore_php*)_this)->ItemDeleted(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_BOOL(return_value, ((wxDataViewModel_php*)_this)->ItemDeleted(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1)); } references->AddReference(parent0); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxDataViewModel, RemoveNotifier) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::RemoveNotifier\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 wxDataViewModel::RemoveNotifier\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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* notifier0 = 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' (&notifier0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &notifier0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(notifier0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(notifier0), _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(notifier0) != 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 wxDataViewModel::RemoveNotifier((wxDataViewModelNotifier*) object_pointer0_0)\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ((wxDataViewListModel_php*)_this)->RemoveNotifier((wxDataViewModelNotifier*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ((wxDataViewIndexListModel_php*)_this)->RemoveNotifier((wxDataViewModelNotifier*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewListStore) { ((wxDataViewListStore_php*)_this)->RemoveNotifier((wxDataViewModelNotifier*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ((wxDataViewVirtualListModel_php*)_this)->RemoveNotifier((wxDataViewModelNotifier*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ((wxDataViewTreeStore_php*)_this)->RemoveNotifier((wxDataViewModelNotifier*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewModel) { ((wxDataViewModel_php*)_this)->RemoveNotifier((wxDataViewModelNotifier*) object_pointer0_0); } references->AddReference(notifier0); return; break; } } } } PHP_METHOD(php_wxDataViewModel, Resort) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::Resort\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 wxDataViewModel::Resort\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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 wxDataViewModel::Resort()\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ((wxDataViewListModel_php*)_this)->Resort(); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ((wxDataViewIndexListModel_php*)_this)->Resort(); } else if(parent_rsrc_type == le_wxDataViewListStore) { ((wxDataViewListStore_php*)_this)->Resort(); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ((wxDataViewVirtualListModel_php*)_this)->Resort(); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ((wxDataViewTreeStore_php*)_this)->Resort(); } else if(parent_rsrc_type == le_wxDataViewModel) { ((wxDataViewModel_php*)_this)->Resort(); } return; break; } } } } bool wxDataViewModel_php::SetValue(const wxVariant& variant, const wxDataViewItem& item, unsigned int col) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModel::SetValue\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, "SetValue", 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_wxVariant_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&variant, le_wxVariant)); object_init_ex(arguments[1], php_wxDataViewItem_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&item, le_wxDataViewItem)); ZVAL_LONG(arguments[2], col); #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 'SetValue'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } PHP_METHOD(php_wxDataViewModel, ValueChanged) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModel::ValueChanged\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 wxDataViewModel::ValueChanged\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_wxDataViewModel){ references = &((wxDataViewModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListModel) && (!reference_type_found)){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTreeStore) && (!reference_type_found)){ references = &((wxDataViewTreeStore_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; long col0; 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 'Ol' (&item0, php_wxDataViewItem_entry, &col0)\n"); #endif char parse_parameters_string[] = "Ol"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry, &col0 ) == 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 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxDataViewModel::ValueChanged(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->ValueChanged(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->ValueChanged(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->ValueChanged(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->ValueChanged(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewTreeStore) { ZVAL_BOOL(return_value, ((wxDataViewTreeStore_php*)_this)->ValueChanged(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewModel) { ZVAL_BOOL(return_value, ((wxDataViewModel_php*)_this)->ValueChanged(*(wxDataViewItem*) object_pointer0_0, (unsigned int) col0)); } references->AddReference(item0); return; break; } } } } void php_wxDataViewListModel_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewListModel_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewListModel_php* object = static_cast<wxDataViewListModel_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 wxDataViewListModel done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewListModel, GetAttrByRow) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListModel::GetAttrByRow\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 wxDataViewListModel::GetAttrByRow\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_wxDataViewListModel){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_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 row0; long col0; zval* attr0 = 0; void* object_pointer0_2 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'llO' (&row0, &col0, &attr0, php_wxDataViewItemAttr_entry)\n"); #endif char parse_parameters_string[] = "llO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &row0, &col0, &attr0, php_wxDataViewItemAttr_entry ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(attr0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(attr0), _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(attr0) != 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 RETURN_BOOL(wxDataViewListModel::GetAttrByRow((unsigned int) row0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->GetAttrByRow((unsigned int) row0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->GetAttrByRow((unsigned int) row0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->GetAttrByRow((unsigned int) row0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2)); } else if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->GetAttrByRow((unsigned int) row0, (unsigned int) col0, *(wxDataViewItemAttr*) object_pointer0_2)); } references->AddReference(attr0); return; break; } } } } PHP_METHOD(php_wxDataViewListModel, GetCount) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListModel::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 wxDataViewListModel::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_wxDataViewListModel){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_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(wxDataViewListModel::GetCount())\n\n"); #endif if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_LONG(return_value, ((wxDataViewIndexListModel_php*)_this)->GetCount()); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_LONG(return_value, ((wxDataViewListStore_php*)_this)->GetCount()); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_LONG(return_value, ((wxDataViewVirtualListModel_php*)_this)->GetCount()); } else if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_LONG(return_value, ((wxDataViewListModel_php*)_this)->GetCount()); } return; break; } } } } PHP_METHOD(php_wxDataViewListModel, GetRow) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListModel::GetRow\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 wxDataViewListModel::GetRow\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_wxDataViewListModel){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_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 'O' (&item0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry ) == 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 RETURN_LONG(wxDataViewListModel::GetRow(*(wxDataViewItem*) object_pointer0_0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_LONG(return_value, ((wxDataViewIndexListModel_php*)_this)->GetRow(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_LONG(return_value, ((wxDataViewListStore_php*)_this)->GetRow(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_LONG(return_value, ((wxDataViewVirtualListModel_php*)_this)->GetRow(*(wxDataViewItem*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_LONG(return_value, ((wxDataViewListModel_php*)_this)->GetRow(*(wxDataViewItem*) object_pointer0_0)); } references->AddReference(item0); return; break; } } } } void wxDataViewListModel_php::GetValueByRow(wxVariant& variant, unsigned int row, unsigned int col)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewListModel::GetValueByRow\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, "GetValueByRow", 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_wxVariant_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&variant, le_wxVariant)); ZVAL_LONG(arguments[1], row); ZVAL_LONG(arguments[2], col); #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 'GetValueByRow'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } PHP_METHOD(php_wxDataViewListModel, IsEnabledByRow) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListModel::IsEnabledByRow\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 wxDataViewListModel::IsEnabledByRow\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_wxDataViewListModel){ references = &((wxDataViewListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIndexListModel) && (!reference_type_found)){ references = &((wxDataViewIndexListModel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewListStore) && (!reference_type_found)){ references = &((wxDataViewListStore_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewVirtualListModel) && (!reference_type_found)){ references = &((wxDataViewVirtualListModel_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 row0; long col0; 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' (&row0, &col0)\n"); #endif char parse_parameters_string[] = "ll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &row0, &col0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxDataViewListModel::IsEnabledByRow((unsigned int) row0, (unsigned int) col0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewIndexListModel) { ZVAL_BOOL(return_value, ((wxDataViewIndexListModel_php*)_this)->IsEnabledByRow((unsigned int) row0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewListStore) { ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->IsEnabledByRow((unsigned int) row0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewVirtualListModel) { ZVAL_BOOL(return_value, ((wxDataViewVirtualListModel_php*)_this)->IsEnabledByRow((unsigned int) row0, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewListModel) { ZVAL_BOOL(return_value, ((wxDataViewListModel_php*)_this)->IsEnabledByRow((unsigned int) row0, (unsigned int) col0)); } return; break; } } } } bool wxDataViewListModel_php::SetValueByRow(const wxVariant& variant, unsigned int row, unsigned int col) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewListModel::SetValueByRow\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, "SetValueByRow", 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_wxVariant_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&variant, le_wxVariant)); ZVAL_LONG(arguments[1], row); ZVAL_LONG(arguments[2], col); #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 'SetValueByRow'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } void php_wxDataViewIndexListModel_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewIndexListModel_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewIndexListModel_php* object = static_cast<wxDataViewIndexListModel_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 wxDataViewIndexListModel done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } void php_wxDataViewVirtualListModel_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewVirtualListModel_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewVirtualListModel_php* object = static_cast<wxDataViewVirtualListModel_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 wxDataViewVirtualListModel done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } void php_wxDataViewItemAttr_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewItemAttr_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewItemAttr_php* object = static_cast<wxDataViewItemAttr_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 wxDataViewItemAttr done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewItemAttr, SetBold) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewItemAttr::SetBold\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 wxDataViewItemAttr::SetBold\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_wxDataViewItemAttr){ references = &((wxDataViewItemAttr_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 set0; 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 'b' (&set0)\n"); #endif char parse_parameters_string[] = "b"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &set0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewItemAttr::SetBold(set0)\n\n"); #endif ((wxDataViewItemAttr_php*)_this)->SetBold(set0); return; break; } } } } PHP_METHOD(php_wxDataViewItemAttr, SetColour) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewItemAttr::SetColour\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 wxDataViewItemAttr::SetColour\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_wxDataViewItemAttr){ references = &((wxDataViewItemAttr_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* colour0 = 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 'O' (&colour0, php_wxColour_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &colour0, php_wxColour_entry ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(colour0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(colour0), _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(colour0) != 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 wxDataViewItemAttr::SetColour(*(wxColour*) object_pointer0_0)\n\n"); #endif ((wxDataViewItemAttr_php*)_this)->SetColour(*(wxColour*) object_pointer0_0); references->AddReference(colour0); return; break; } } } } PHP_METHOD(php_wxDataViewItemAttr, SetItalic) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewItemAttr::SetItalic\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 wxDataViewItemAttr::SetItalic\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_wxDataViewItemAttr){ references = &((wxDataViewItemAttr_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 set0; 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 'b' (&set0)\n"); #endif char parse_parameters_string[] = "b"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &set0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewItemAttr::SetItalic(set0)\n\n"); #endif ((wxDataViewItemAttr_php*)_this)->SetItalic(set0); return; break; } } } } PHP_METHOD(php_wxDataViewItemAttr, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewItemAttr::__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; //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 __construct()\n"); #endif _this = new wxDataViewItemAttr_php(); ((wxDataViewItemAttr_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewItemAttr); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewItemAttr_php*) _this)->evnArray); array_init(((wxDataViewItemAttr_php*) _this)->evnArray); ((wxDataViewItemAttr_php*) _this)->phpObj = getThis(); ((wxDataViewItemAttr_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewItemAttr_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_wxDataViewItem_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewItem_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewItem_php* object = static_cast<wxDataViewItem_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 wxDataViewItem done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewItem, GetID) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewItem::GetID\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 wxDataViewItem::GetID\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_wxDataViewItem){ references = &((wxDataViewItem_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 wxDataViewItem::GetID()\n\n"); #endif ZVAL_STRING(return_value, (char*) ((wxDataViewItem_php*)_this)->GetID(), 1); return; break; } } } } PHP_METHOD(php_wxDataViewItem, IsOk) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewItem::IsOk\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 wxDataViewItem::IsOk\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_wxDataViewItem){ references = &((wxDataViewItem_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(wxDataViewItem::IsOk())\n\n"); #endif ZVAL_BOOL(return_value, ((wxDataViewItem_php*)_this)->IsOk()); return; break; } } } } PHP_METHOD(php_wxDataViewItem, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewItem::__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* item1 = 0; void* object_pointer1_0 = 0; bool overload1_called = false; //Parameters for overload 2 char* id2; long id_len2; zval* id2_ref; bool overload2_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' (&item1, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item1, php_wxDataViewItem_entry ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item1), _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(item1) != IS_NULL) { goto overload2; } } overload1_called = true; already_called = true; } } //Overload 2 overload2: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 's' (&id2, &id_len2)\n"); #endif char parse_parameters_string[] = "s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &id2, &id_len2 ) == SUCCESS) { overload2_called = true; already_called = true; char parse_references_string[] = "z"; zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_references_string, &id2_ref ); } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxDataViewItem_php(); ((wxDataViewItem_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(*(wxDataViewItem*) object_pointer1_0)\n"); #endif _this = new wxDataViewItem_php(*(wxDataViewItem*) object_pointer1_0); ((wxDataViewItem_php*) _this)->references.Initialize(); ((wxDataViewItem_php*) _this)->references.AddReference(item1); break; } } } if(overload2_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((void*) id2)\n"); #endif _this = new wxDataViewItem_php((void*) id2); ((wxDataViewItem_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewItem); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewItem_php*) _this)->evnArray); array_init(((wxDataViewItem_php*) _this)->evnArray); ((wxDataViewItem_php*) _this)->phpObj = getThis(); ((wxDataViewItem_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewItem_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_wxDataViewModelNotifier_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewModelNotifier_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewModelNotifier_php* object = static_cast<wxDataViewModelNotifier_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 wxDataViewModelNotifier done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } bool wxDataViewModelNotifier_php::Cleared() { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModelNotifier::Cleared\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, "Cleared", 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 'Cleared'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } PHP_METHOD(php_wxDataViewModelNotifier, GetOwner) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModelNotifier::GetOwner\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 wxDataViewModelNotifier::GetOwner\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_wxDataViewModelNotifier){ references = &((wxDataViewModelNotifier_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 wxDataViewModelNotifier::GetOwner() to return object pointer\n\n"); #endif wxDataViewModel_php* value_to_return0; value_to_return0 = (wxDataViewModel_php*) ((wxDataViewModelNotifier_php*)_this)->GetOwner(); 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_wxDataViewModel_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxDataViewModel)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } bool wxDataViewModelNotifier_php::ItemAdded(const wxDataViewItem& parent, const wxDataViewItem& item) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModelNotifier::ItemAdded\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, "ItemAdded", 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_wxDataViewItem_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&parent, le_wxDataViewItem)); object_init_ex(arguments[1], php_wxDataViewItem_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&item, le_wxDataViewItem)); #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 'ItemAdded'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } bool wxDataViewModelNotifier_php::ItemChanged(const wxDataViewItem& item) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModelNotifier::ItemChanged\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, "ItemChanged", 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_wxDataViewItem_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&item, le_wxDataViewItem)); #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 'ItemChanged'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } bool wxDataViewModelNotifier_php::ItemDeleted(const wxDataViewItem& parent, const wxDataViewItem& item) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModelNotifier::ItemDeleted\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, "ItemDeleted", 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_wxDataViewItem_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&parent, le_wxDataViewItem)); object_init_ex(arguments[1], php_wxDataViewItem_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&item, le_wxDataViewItem)); #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 'ItemDeleted'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } void wxDataViewModelNotifier_php::Resort() { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModelNotifier::Resort\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, "Resort", 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 'Resort'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } PHP_METHOD(php_wxDataViewModelNotifier, SetOwner) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModelNotifier::SetOwner\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 wxDataViewModelNotifier::SetOwner\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_wxDataViewModelNotifier){ references = &((wxDataViewModelNotifier_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* owner0 = 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' (&owner0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &owner0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(owner0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(owner0), _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_wxDataViewListModel && rsrc_type != le_wxDataViewIndexListModel && rsrc_type != le_wxDataViewListStore && rsrc_type != le_wxDataViewVirtualListModel && rsrc_type != le_wxDataViewTreeStore)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(owner0) != 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 wxDataViewModelNotifier::SetOwner((wxDataViewModel*) object_pointer0_0)\n\n"); #endif ((wxDataViewModelNotifier_php*)_this)->SetOwner((wxDataViewModel*) object_pointer0_0); references->AddReference(owner0); return; break; } } } } bool wxDataViewModelNotifier_php::ValueChanged(const wxDataViewItem& item, unsigned int col) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewModelNotifier::ValueChanged\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, "ValueChanged", 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_wxDataViewItem_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&item, le_wxDataViewItem)); ZVAL_LONG(arguments[1], col); #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 'ValueChanged'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } PHP_METHOD(php_wxDataViewModelNotifier, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewModelNotifier::__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; //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 __construct()\n"); #endif _this = new wxDataViewModelNotifier_php(); ((wxDataViewModelNotifier_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewModelNotifier); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewModelNotifier_php*) _this)->evnArray); array_init(((wxDataViewModelNotifier_php*) _this)->evnArray); ((wxDataViewModelNotifier_php*) _this)->phpObj = getThis(); ((wxDataViewModelNotifier_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewModelNotifier_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_wxDataViewRenderer_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewRenderer_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewRenderer_php* object = static_cast<wxDataViewRenderer_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 wxDataViewRenderer done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewRenderer, EnableEllipsize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewRenderer::EnableEllipsize\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 wxDataViewRenderer::EnableEllipsize\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_wxDataViewRenderer){ references = &((wxDataViewRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewBitmapRenderer) && (!reference_type_found)){ references = &((wxDataViewBitmapRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewChoiceRenderer) && (!reference_type_found)){ references = &((wxDataViewChoiceRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewCustomRenderer) && (!reference_type_found)){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewDateRenderer) && (!reference_type_found)){ references = &((wxDataViewDateRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIconTextRenderer) && (!reference_type_found)){ references = &((wxDataViewIconTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewProgressRenderer) && (!reference_type_found)){ references = &((wxDataViewProgressRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTextRenderer) && (!reference_type_found)){ references = &((wxDataViewTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewToggleRenderer) && (!reference_type_found)){ references = &((wxDataViewToggleRenderer_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 mode0; 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 '|l' (&mode0)\n"); #endif char parse_parameters_string[] = "|l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &mode0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewRenderer::EnableEllipsize()\n\n"); #endif if(parent_rsrc_type == le_wxDataViewBitmapRenderer) { ((wxDataViewBitmapRenderer_php*)_this)->EnableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewChoiceRenderer) { ((wxDataViewChoiceRenderer_php*)_this)->EnableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ((wxDataViewCustomRenderer_php*)_this)->EnableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ((wxDataViewSpinRenderer_php*)_this)->EnableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewDateRenderer) { ((wxDataViewDateRenderer_php*)_this)->EnableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewIconTextRenderer) { ((wxDataViewIconTextRenderer_php*)_this)->EnableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewProgressRenderer) { ((wxDataViewProgressRenderer_php*)_this)->EnableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewTextRenderer) { ((wxDataViewTextRenderer_php*)_this)->EnableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewToggleRenderer) { ((wxDataViewToggleRenderer_php*)_this)->EnableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewRenderer) { ((wxDataViewRenderer_php*)_this)->EnableEllipsize(); } return; break; } case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewRenderer::EnableEllipsize((wxEllipsizeMode) mode0)\n\n"); #endif if(parent_rsrc_type == le_wxDataViewBitmapRenderer) { ((wxDataViewBitmapRenderer_php*)_this)->EnableEllipsize((wxEllipsizeMode) mode0); } else if(parent_rsrc_type == le_wxDataViewChoiceRenderer) { ((wxDataViewChoiceRenderer_php*)_this)->EnableEllipsize((wxEllipsizeMode) mode0); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ((wxDataViewCustomRenderer_php*)_this)->EnableEllipsize((wxEllipsizeMode) mode0); } else if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ((wxDataViewSpinRenderer_php*)_this)->EnableEllipsize((wxEllipsizeMode) mode0); } else if(parent_rsrc_type == le_wxDataViewDateRenderer) { ((wxDataViewDateRenderer_php*)_this)->EnableEllipsize((wxEllipsizeMode) mode0); } else if(parent_rsrc_type == le_wxDataViewIconTextRenderer) { ((wxDataViewIconTextRenderer_php*)_this)->EnableEllipsize((wxEllipsizeMode) mode0); } else if(parent_rsrc_type == le_wxDataViewProgressRenderer) { ((wxDataViewProgressRenderer_php*)_this)->EnableEllipsize((wxEllipsizeMode) mode0); } else if(parent_rsrc_type == le_wxDataViewTextRenderer) { ((wxDataViewTextRenderer_php*)_this)->EnableEllipsize((wxEllipsizeMode) mode0); } else if(parent_rsrc_type == le_wxDataViewToggleRenderer) { ((wxDataViewToggleRenderer_php*)_this)->EnableEllipsize((wxEllipsizeMode) mode0); } else if(parent_rsrc_type == le_wxDataViewRenderer) { ((wxDataViewRenderer_php*)_this)->EnableEllipsize((wxEllipsizeMode) mode0); } return; break; } } } } PHP_METHOD(php_wxDataViewRenderer, DisableEllipsize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewRenderer::DisableEllipsize\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 wxDataViewRenderer::DisableEllipsize\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_wxDataViewRenderer){ references = &((wxDataViewRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewBitmapRenderer) && (!reference_type_found)){ references = &((wxDataViewBitmapRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewChoiceRenderer) && (!reference_type_found)){ references = &((wxDataViewChoiceRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewCustomRenderer) && (!reference_type_found)){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewDateRenderer) && (!reference_type_found)){ references = &((wxDataViewDateRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIconTextRenderer) && (!reference_type_found)){ references = &((wxDataViewIconTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewProgressRenderer) && (!reference_type_found)){ references = &((wxDataViewProgressRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTextRenderer) && (!reference_type_found)){ references = &((wxDataViewTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewToggleRenderer) && (!reference_type_found)){ references = &((wxDataViewToggleRenderer_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 wxDataViewRenderer::DisableEllipsize()\n\n"); #endif if(parent_rsrc_type == le_wxDataViewBitmapRenderer) { ((wxDataViewBitmapRenderer_php*)_this)->DisableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewChoiceRenderer) { ((wxDataViewChoiceRenderer_php*)_this)->DisableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ((wxDataViewCustomRenderer_php*)_this)->DisableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ((wxDataViewSpinRenderer_php*)_this)->DisableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewDateRenderer) { ((wxDataViewDateRenderer_php*)_this)->DisableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewIconTextRenderer) { ((wxDataViewIconTextRenderer_php*)_this)->DisableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewProgressRenderer) { ((wxDataViewProgressRenderer_php*)_this)->DisableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewTextRenderer) { ((wxDataViewTextRenderer_php*)_this)->DisableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewToggleRenderer) { ((wxDataViewToggleRenderer_php*)_this)->DisableEllipsize(); } else if(parent_rsrc_type == le_wxDataViewRenderer) { ((wxDataViewRenderer_php*)_this)->DisableEllipsize(); } return; break; } } } } PHP_METHOD(php_wxDataViewRenderer, GetAlignment) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewRenderer::GetAlignment\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 wxDataViewRenderer::GetAlignment\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_wxDataViewRenderer){ references = &((wxDataViewRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewBitmapRenderer) && (!reference_type_found)){ references = &((wxDataViewBitmapRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewChoiceRenderer) && (!reference_type_found)){ references = &((wxDataViewChoiceRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewCustomRenderer) && (!reference_type_found)){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewDateRenderer) && (!reference_type_found)){ references = &((wxDataViewDateRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIconTextRenderer) && (!reference_type_found)){ references = &((wxDataViewIconTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewProgressRenderer) && (!reference_type_found)){ references = &((wxDataViewProgressRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTextRenderer) && (!reference_type_found)){ references = &((wxDataViewTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewToggleRenderer) && (!reference_type_found)){ references = &((wxDataViewToggleRenderer_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(wxDataViewRenderer::GetAlignment())\n\n"); #endif if(parent_rsrc_type == le_wxDataViewBitmapRenderer) { ZVAL_LONG(return_value, ((wxDataViewBitmapRenderer_php*)_this)->GetAlignment()); } else if(parent_rsrc_type == le_wxDataViewChoiceRenderer) { ZVAL_LONG(return_value, ((wxDataViewChoiceRenderer_php*)_this)->GetAlignment()); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ZVAL_LONG(return_value, ((wxDataViewCustomRenderer_php*)_this)->GetAlignment()); } else if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ZVAL_LONG(return_value, ((wxDataViewSpinRenderer_php*)_this)->GetAlignment()); } else if(parent_rsrc_type == le_wxDataViewDateRenderer) { ZVAL_LONG(return_value, ((wxDataViewDateRenderer_php*)_this)->GetAlignment()); } else if(parent_rsrc_type == le_wxDataViewIconTextRenderer) { ZVAL_LONG(return_value, ((wxDataViewIconTextRenderer_php*)_this)->GetAlignment()); } else if(parent_rsrc_type == le_wxDataViewProgressRenderer) { ZVAL_LONG(return_value, ((wxDataViewProgressRenderer_php*)_this)->GetAlignment()); } else if(parent_rsrc_type == le_wxDataViewTextRenderer) { ZVAL_LONG(return_value, ((wxDataViewTextRenderer_php*)_this)->GetAlignment()); } else if(parent_rsrc_type == le_wxDataViewToggleRenderer) { ZVAL_LONG(return_value, ((wxDataViewToggleRenderer_php*)_this)->GetAlignment()); } else if(parent_rsrc_type == le_wxDataViewRenderer) { ZVAL_LONG(return_value, ((wxDataViewRenderer_php*)_this)->GetAlignment()); } return; break; } } } } PHP_METHOD(php_wxDataViewRenderer, GetEllipsizeMode) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewRenderer::GetEllipsizeMode\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 wxDataViewRenderer::GetEllipsizeMode\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_wxDataViewRenderer){ references = &((wxDataViewRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewBitmapRenderer) && (!reference_type_found)){ references = &((wxDataViewBitmapRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewChoiceRenderer) && (!reference_type_found)){ references = &((wxDataViewChoiceRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewCustomRenderer) && (!reference_type_found)){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewDateRenderer) && (!reference_type_found)){ references = &((wxDataViewDateRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIconTextRenderer) && (!reference_type_found)){ references = &((wxDataViewIconTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewProgressRenderer) && (!reference_type_found)){ references = &((wxDataViewProgressRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTextRenderer) && (!reference_type_found)){ references = &((wxDataViewTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewToggleRenderer) && (!reference_type_found)){ references = &((wxDataViewToggleRenderer_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(wxDataViewRenderer::GetEllipsizeMode())\n\n"); #endif if(parent_rsrc_type == le_wxDataViewBitmapRenderer) { ZVAL_LONG(return_value, ((wxDataViewBitmapRenderer_php*)_this)->GetEllipsizeMode()); } else if(parent_rsrc_type == le_wxDataViewChoiceRenderer) { ZVAL_LONG(return_value, ((wxDataViewChoiceRenderer_php*)_this)->GetEllipsizeMode()); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ZVAL_LONG(return_value, ((wxDataViewCustomRenderer_php*)_this)->GetEllipsizeMode()); } else if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ZVAL_LONG(return_value, ((wxDataViewSpinRenderer_php*)_this)->GetEllipsizeMode()); } else if(parent_rsrc_type == le_wxDataViewDateRenderer) { ZVAL_LONG(return_value, ((wxDataViewDateRenderer_php*)_this)->GetEllipsizeMode()); } else if(parent_rsrc_type == le_wxDataViewIconTextRenderer) { ZVAL_LONG(return_value, ((wxDataViewIconTextRenderer_php*)_this)->GetEllipsizeMode()); } else if(parent_rsrc_type == le_wxDataViewProgressRenderer) { ZVAL_LONG(return_value, ((wxDataViewProgressRenderer_php*)_this)->GetEllipsizeMode()); } else if(parent_rsrc_type == le_wxDataViewTextRenderer) { ZVAL_LONG(return_value, ((wxDataViewTextRenderer_php*)_this)->GetEllipsizeMode()); } else if(parent_rsrc_type == le_wxDataViewToggleRenderer) { ZVAL_LONG(return_value, ((wxDataViewToggleRenderer_php*)_this)->GetEllipsizeMode()); } else if(parent_rsrc_type == le_wxDataViewRenderer) { ZVAL_LONG(return_value, ((wxDataViewRenderer_php*)_this)->GetEllipsizeMode()); } return; break; } } } } PHP_METHOD(php_wxDataViewRenderer, GetMode) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewRenderer::GetMode\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 wxDataViewRenderer::GetMode\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_wxDataViewRenderer){ references = &((wxDataViewRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewBitmapRenderer) && (!reference_type_found)){ references = &((wxDataViewBitmapRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewChoiceRenderer) && (!reference_type_found)){ references = &((wxDataViewChoiceRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewCustomRenderer) && (!reference_type_found)){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewDateRenderer) && (!reference_type_found)){ references = &((wxDataViewDateRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIconTextRenderer) && (!reference_type_found)){ references = &((wxDataViewIconTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewProgressRenderer) && (!reference_type_found)){ references = &((wxDataViewProgressRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTextRenderer) && (!reference_type_found)){ references = &((wxDataViewTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewToggleRenderer) && (!reference_type_found)){ references = &((wxDataViewToggleRenderer_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(wxDataViewRenderer::GetMode())\n\n"); #endif if(parent_rsrc_type == le_wxDataViewBitmapRenderer) { ZVAL_LONG(return_value, ((wxDataViewBitmapRenderer_php*)_this)->GetMode()); } else if(parent_rsrc_type == le_wxDataViewChoiceRenderer) { ZVAL_LONG(return_value, ((wxDataViewChoiceRenderer_php*)_this)->GetMode()); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ZVAL_LONG(return_value, ((wxDataViewCustomRenderer_php*)_this)->GetMode()); } else if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ZVAL_LONG(return_value, ((wxDataViewSpinRenderer_php*)_this)->GetMode()); } else if(parent_rsrc_type == le_wxDataViewDateRenderer) { ZVAL_LONG(return_value, ((wxDataViewDateRenderer_php*)_this)->GetMode()); } else if(parent_rsrc_type == le_wxDataViewIconTextRenderer) { ZVAL_LONG(return_value, ((wxDataViewIconTextRenderer_php*)_this)->GetMode()); } else if(parent_rsrc_type == le_wxDataViewProgressRenderer) { ZVAL_LONG(return_value, ((wxDataViewProgressRenderer_php*)_this)->GetMode()); } else if(parent_rsrc_type == le_wxDataViewTextRenderer) { ZVAL_LONG(return_value, ((wxDataViewTextRenderer_php*)_this)->GetMode()); } else if(parent_rsrc_type == le_wxDataViewToggleRenderer) { ZVAL_LONG(return_value, ((wxDataViewToggleRenderer_php*)_this)->GetMode()); } else if(parent_rsrc_type == le_wxDataViewRenderer) { ZVAL_LONG(return_value, ((wxDataViewRenderer_php*)_this)->GetMode()); } return; break; } } } } PHP_METHOD(php_wxDataViewRenderer, GetOwner) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewRenderer::GetOwner\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 wxDataViewRenderer::GetOwner\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_wxDataViewRenderer){ references = &((wxDataViewRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewBitmapRenderer) && (!reference_type_found)){ references = &((wxDataViewBitmapRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewChoiceRenderer) && (!reference_type_found)){ references = &((wxDataViewChoiceRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewCustomRenderer) && (!reference_type_found)){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewDateRenderer) && (!reference_type_found)){ references = &((wxDataViewDateRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIconTextRenderer) && (!reference_type_found)){ references = &((wxDataViewIconTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewProgressRenderer) && (!reference_type_found)){ references = &((wxDataViewProgressRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTextRenderer) && (!reference_type_found)){ references = &((wxDataViewTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewToggleRenderer) && (!reference_type_found)){ references = &((wxDataViewToggleRenderer_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 wxDataViewRenderer::GetOwner() to return object pointer\n\n"); #endif wxDataViewColumn_php* value_to_return0; if(parent_rsrc_type == le_wxDataViewBitmapRenderer) { value_to_return0 = (wxDataViewColumn_php*) ((wxDataViewBitmapRenderer_php*)_this)->GetOwner(); } else if(parent_rsrc_type == le_wxDataViewChoiceRenderer) { value_to_return0 = (wxDataViewColumn_php*) ((wxDataViewChoiceRenderer_php*)_this)->GetOwner(); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { value_to_return0 = (wxDataViewColumn_php*) ((wxDataViewCustomRenderer_php*)_this)->GetOwner(); } else if(parent_rsrc_type == le_wxDataViewSpinRenderer) { value_to_return0 = (wxDataViewColumn_php*) ((wxDataViewSpinRenderer_php*)_this)->GetOwner(); } else if(parent_rsrc_type == le_wxDataViewDateRenderer) { value_to_return0 = (wxDataViewColumn_php*) ((wxDataViewDateRenderer_php*)_this)->GetOwner(); } else if(parent_rsrc_type == le_wxDataViewIconTextRenderer) { value_to_return0 = (wxDataViewColumn_php*) ((wxDataViewIconTextRenderer_php*)_this)->GetOwner(); } else if(parent_rsrc_type == le_wxDataViewProgressRenderer) { value_to_return0 = (wxDataViewColumn_php*) ((wxDataViewProgressRenderer_php*)_this)->GetOwner(); } else if(parent_rsrc_type == le_wxDataViewTextRenderer) { value_to_return0 = (wxDataViewColumn_php*) ((wxDataViewTextRenderer_php*)_this)->GetOwner(); } else if(parent_rsrc_type == le_wxDataViewToggleRenderer) { value_to_return0 = (wxDataViewColumn_php*) ((wxDataViewToggleRenderer_php*)_this)->GetOwner(); } else if(parent_rsrc_type == le_wxDataViewRenderer) { value_to_return0 = (wxDataViewColumn_php*) ((wxDataViewRenderer_php*)_this)->GetOwner(); } 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_wxDataViewColumn_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxDataViewColumn)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } bool wxDataViewRenderer_php::GetValue(wxVariant& value)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewRenderer::GetValue\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, "GetValue", 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_wxVariant_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&value, le_wxVariant)); #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 'GetValue'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } PHP_METHOD(php_wxDataViewRenderer, GetVariantType) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewRenderer::GetVariantType\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 wxDataViewRenderer::GetVariantType\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_wxDataViewRenderer){ references = &((wxDataViewRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewBitmapRenderer) && (!reference_type_found)){ references = &((wxDataViewBitmapRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewChoiceRenderer) && (!reference_type_found)){ references = &((wxDataViewChoiceRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewCustomRenderer) && (!reference_type_found)){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewDateRenderer) && (!reference_type_found)){ references = &((wxDataViewDateRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIconTextRenderer) && (!reference_type_found)){ references = &((wxDataViewIconTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewProgressRenderer) && (!reference_type_found)){ references = &((wxDataViewProgressRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTextRenderer) && (!reference_type_found)){ references = &((wxDataViewTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewToggleRenderer) && (!reference_type_found)){ references = &((wxDataViewToggleRenderer_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_STRING(wxDataViewRenderer::GetVariantType().fn_str(), 1)\n\n"); #endif wxString value_to_return0; if(parent_rsrc_type == le_wxDataViewBitmapRenderer) { value_to_return0 = ((wxDataViewBitmapRenderer_php*)_this)->GetVariantType(); } else if(parent_rsrc_type == le_wxDataViewChoiceRenderer) { value_to_return0 = ((wxDataViewChoiceRenderer_php*)_this)->GetVariantType(); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { value_to_return0 = ((wxDataViewCustomRenderer_php*)_this)->GetVariantType(); } else if(parent_rsrc_type == le_wxDataViewSpinRenderer) { value_to_return0 = ((wxDataViewSpinRenderer_php*)_this)->GetVariantType(); } else if(parent_rsrc_type == le_wxDataViewDateRenderer) { value_to_return0 = ((wxDataViewDateRenderer_php*)_this)->GetVariantType(); } else if(parent_rsrc_type == le_wxDataViewIconTextRenderer) { value_to_return0 = ((wxDataViewIconTextRenderer_php*)_this)->GetVariantType(); } else if(parent_rsrc_type == le_wxDataViewProgressRenderer) { value_to_return0 = ((wxDataViewProgressRenderer_php*)_this)->GetVariantType(); } else if(parent_rsrc_type == le_wxDataViewTextRenderer) { value_to_return0 = ((wxDataViewTextRenderer_php*)_this)->GetVariantType(); } else if(parent_rsrc_type == le_wxDataViewToggleRenderer) { value_to_return0 = ((wxDataViewToggleRenderer_php*)_this)->GetVariantType(); } else if(parent_rsrc_type == le_wxDataViewRenderer) { value_to_return0 = ((wxDataViewRenderer_php*)_this)->GetVariantType(); } char* temp_string0; temp_string0 = (char*)malloc(sizeof(wxChar)*(value_to_return0.size()+1)); strcpy (temp_string0, (const char *) value_to_return0.char_str() ); ZVAL_STRING(return_value, temp_string0, 1); free(temp_string0); return; break; } } } } PHP_METHOD(php_wxDataViewRenderer, SetAlignment) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewRenderer::SetAlignment\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 wxDataViewRenderer::SetAlignment\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_wxDataViewRenderer){ references = &((wxDataViewRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewBitmapRenderer) && (!reference_type_found)){ references = &((wxDataViewBitmapRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewChoiceRenderer) && (!reference_type_found)){ references = &((wxDataViewChoiceRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewCustomRenderer) && (!reference_type_found)){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewDateRenderer) && (!reference_type_found)){ references = &((wxDataViewDateRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIconTextRenderer) && (!reference_type_found)){ references = &((wxDataViewIconTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewProgressRenderer) && (!reference_type_found)){ references = &((wxDataViewProgressRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTextRenderer) && (!reference_type_found)){ references = &((wxDataViewTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewToggleRenderer) && (!reference_type_found)){ references = &((wxDataViewToggleRenderer_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 align0; 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' (&align0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &align0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewRenderer::SetAlignment((int) align0)\n\n"); #endif if(parent_rsrc_type == le_wxDataViewBitmapRenderer) { ((wxDataViewBitmapRenderer_php*)_this)->SetAlignment((int) align0); } else if(parent_rsrc_type == le_wxDataViewChoiceRenderer) { ((wxDataViewChoiceRenderer_php*)_this)->SetAlignment((int) align0); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ((wxDataViewCustomRenderer_php*)_this)->SetAlignment((int) align0); } else if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ((wxDataViewSpinRenderer_php*)_this)->SetAlignment((int) align0); } else if(parent_rsrc_type == le_wxDataViewDateRenderer) { ((wxDataViewDateRenderer_php*)_this)->SetAlignment((int) align0); } else if(parent_rsrc_type == le_wxDataViewIconTextRenderer) { ((wxDataViewIconTextRenderer_php*)_this)->SetAlignment((int) align0); } else if(parent_rsrc_type == le_wxDataViewProgressRenderer) { ((wxDataViewProgressRenderer_php*)_this)->SetAlignment((int) align0); } else if(parent_rsrc_type == le_wxDataViewTextRenderer) { ((wxDataViewTextRenderer_php*)_this)->SetAlignment((int) align0); } else if(parent_rsrc_type == le_wxDataViewToggleRenderer) { ((wxDataViewToggleRenderer_php*)_this)->SetAlignment((int) align0); } else if(parent_rsrc_type == le_wxDataViewRenderer) { ((wxDataViewRenderer_php*)_this)->SetAlignment((int) align0); } return; break; } } } } PHP_METHOD(php_wxDataViewRenderer, SetOwner) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewRenderer::SetOwner\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 wxDataViewRenderer::SetOwner\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_wxDataViewRenderer){ references = &((wxDataViewRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewBitmapRenderer) && (!reference_type_found)){ references = &((wxDataViewBitmapRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewChoiceRenderer) && (!reference_type_found)){ references = &((wxDataViewChoiceRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewCustomRenderer) && (!reference_type_found)){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewDateRenderer) && (!reference_type_found)){ references = &((wxDataViewDateRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIconTextRenderer) && (!reference_type_found)){ references = &((wxDataViewIconTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewProgressRenderer) && (!reference_type_found)){ references = &((wxDataViewProgressRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTextRenderer) && (!reference_type_found)){ references = &((wxDataViewTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewToggleRenderer) && (!reference_type_found)){ references = &((wxDataViewToggleRenderer_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* owner0 = 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' (&owner0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &owner0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(owner0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(owner0), _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(owner0) != 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 wxDataViewRenderer::SetOwner((wxDataViewColumn*) object_pointer0_0)\n\n"); #endif if(parent_rsrc_type == le_wxDataViewBitmapRenderer) { ((wxDataViewBitmapRenderer_php*)_this)->SetOwner((wxDataViewColumn*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewChoiceRenderer) { ((wxDataViewChoiceRenderer_php*)_this)->SetOwner((wxDataViewColumn*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ((wxDataViewCustomRenderer_php*)_this)->SetOwner((wxDataViewColumn*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ((wxDataViewSpinRenderer_php*)_this)->SetOwner((wxDataViewColumn*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewDateRenderer) { ((wxDataViewDateRenderer_php*)_this)->SetOwner((wxDataViewColumn*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewIconTextRenderer) { ((wxDataViewIconTextRenderer_php*)_this)->SetOwner((wxDataViewColumn*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewProgressRenderer) { ((wxDataViewProgressRenderer_php*)_this)->SetOwner((wxDataViewColumn*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewTextRenderer) { ((wxDataViewTextRenderer_php*)_this)->SetOwner((wxDataViewColumn*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewToggleRenderer) { ((wxDataViewToggleRenderer_php*)_this)->SetOwner((wxDataViewColumn*) object_pointer0_0); } else if(parent_rsrc_type == le_wxDataViewRenderer) { ((wxDataViewRenderer_php*)_this)->SetOwner((wxDataViewColumn*) object_pointer0_0); } references->AddReference(owner0); return; break; } } } } bool wxDataViewRenderer_php::SetValue(const wxVariant& value) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewRenderer::SetValue\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, "SetValue", 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_wxVariant_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&value, le_wxVariant)); #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 'SetValue'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } PHP_METHOD(php_wxDataViewRenderer, Validate) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewRenderer::Validate\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 wxDataViewRenderer::Validate\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_wxDataViewRenderer){ references = &((wxDataViewRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewBitmapRenderer) && (!reference_type_found)){ references = &((wxDataViewBitmapRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewChoiceRenderer) && (!reference_type_found)){ references = &((wxDataViewChoiceRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewCustomRenderer) && (!reference_type_found)){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewDateRenderer) && (!reference_type_found)){ references = &((wxDataViewDateRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewIconTextRenderer) && (!reference_type_found)){ references = &((wxDataViewIconTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewProgressRenderer) && (!reference_type_found)){ references = &((wxDataViewProgressRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewTextRenderer) && (!reference_type_found)){ references = &((wxDataViewTextRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewToggleRenderer) && (!reference_type_found)){ references = &((wxDataViewToggleRenderer_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* value0 = 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 'O' (&value0, php_wxVariant_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &value0, php_wxVariant_entry ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(value0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(value0), _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(value0) != 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(wxDataViewRenderer::Validate(*(wxVariant*) object_pointer0_0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewBitmapRenderer) { ZVAL_BOOL(return_value, ((wxDataViewBitmapRenderer_php*)_this)->Validate(*(wxVariant*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewChoiceRenderer) { ZVAL_BOOL(return_value, ((wxDataViewChoiceRenderer_php*)_this)->Validate(*(wxVariant*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ZVAL_BOOL(return_value, ((wxDataViewCustomRenderer_php*)_this)->Validate(*(wxVariant*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ZVAL_BOOL(return_value, ((wxDataViewSpinRenderer_php*)_this)->Validate(*(wxVariant*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewDateRenderer) { ZVAL_BOOL(return_value, ((wxDataViewDateRenderer_php*)_this)->Validate(*(wxVariant*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewIconTextRenderer) { ZVAL_BOOL(return_value, ((wxDataViewIconTextRenderer_php*)_this)->Validate(*(wxVariant*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewProgressRenderer) { ZVAL_BOOL(return_value, ((wxDataViewProgressRenderer_php*)_this)->Validate(*(wxVariant*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewTextRenderer) { ZVAL_BOOL(return_value, ((wxDataViewTextRenderer_php*)_this)->Validate(*(wxVariant*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewToggleRenderer) { ZVAL_BOOL(return_value, ((wxDataViewToggleRenderer_php*)_this)->Validate(*(wxVariant*) object_pointer0_0)); } else if(parent_rsrc_type == le_wxDataViewRenderer) { ZVAL_BOOL(return_value, ((wxDataViewRenderer_php*)_this)->Validate(*(wxVariant*) object_pointer0_0)); } references->AddReference(value0); return; break; } } } } void php_wxDataViewTextRenderer_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewTextRenderer_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewTextRenderer_php* object = static_cast<wxDataViewTextRenderer_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 wxDataViewTextRenderer done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewTextRenderer, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTextRenderer::__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 char* varianttype0; long varianttype_len0; long mode0; long align0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 0 && arguments_received <= 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '|sll' (&varianttype0, &varianttype_len0, &mode0, &align0)\n"); #endif char parse_parameters_string[] = "|sll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &varianttype0, &varianttype_len0, &mode0, &align0 ) == SUCCESS) { overload0_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 wxDataViewTextRenderer_php(); ((wxDataViewTextRenderer_php*) _this)->references.Initialize(); break; } case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8))\n"); #endif _this = new wxDataViewTextRenderer_php(wxString(varianttype0, wxConvUTF8)); ((wxDataViewTextRenderer_php*) _this)->references.Initialize(); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0)\n"); #endif _this = new wxDataViewTextRenderer_php(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0); ((wxDataViewTextRenderer_php*) _this)->references.Initialize(); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0)\n"); #endif _this = new wxDataViewTextRenderer_php(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0); ((wxDataViewTextRenderer_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewTextRenderer); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewTextRenderer_php*) _this)->evnArray); array_init(((wxDataViewTextRenderer_php*) _this)->evnArray); ((wxDataViewTextRenderer_php*) _this)->phpObj = getThis(); ((wxDataViewTextRenderer_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewTextRenderer_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_wxDataViewIconTextRenderer_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewIconTextRenderer_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewIconTextRenderer_php* object = static_cast<wxDataViewIconTextRenderer_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 wxDataViewIconTextRenderer done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewIconTextRenderer, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewIconTextRenderer::__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 char* varianttype0; long varianttype_len0; long mode0; long align0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 0 && arguments_received <= 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '|sll' (&varianttype0, &varianttype_len0, &mode0, &align0)\n"); #endif char parse_parameters_string[] = "|sll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &varianttype0, &varianttype_len0, &mode0, &align0 ) == SUCCESS) { overload0_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 wxDataViewIconTextRenderer_php(); ((wxDataViewIconTextRenderer_php*) _this)->references.Initialize(); break; } case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8))\n"); #endif _this = new wxDataViewIconTextRenderer_php(wxString(varianttype0, wxConvUTF8)); ((wxDataViewIconTextRenderer_php*) _this)->references.Initialize(); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0)\n"); #endif _this = new wxDataViewIconTextRenderer_php(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0); ((wxDataViewIconTextRenderer_php*) _this)->references.Initialize(); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0)\n"); #endif _this = new wxDataViewIconTextRenderer_php(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0); ((wxDataViewIconTextRenderer_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewIconTextRenderer); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewIconTextRenderer_php*) _this)->evnArray); array_init(((wxDataViewIconTextRenderer_php*) _this)->evnArray); ((wxDataViewIconTextRenderer_php*) _this)->phpObj = getThis(); ((wxDataViewIconTextRenderer_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewIconTextRenderer_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_wxDataViewProgressRenderer_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewProgressRenderer_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewProgressRenderer_php* object = static_cast<wxDataViewProgressRenderer_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 wxDataViewProgressRenderer done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewProgressRenderer, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewProgressRenderer::__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 char* label0; long label_len0; char* varianttype0; long varianttype_len0; long mode0; long align0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 0 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '|ssll' (&label0, &label_len0, &varianttype0, &varianttype_len0, &mode0, &align0)\n"); #endif char parse_parameters_string[] = "|ssll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &label0, &label_len0, &varianttype0, &varianttype_len0, &mode0, &align0 ) == SUCCESS) { overload0_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 wxDataViewProgressRenderer_php(); ((wxDataViewProgressRenderer_php*) _this)->references.Initialize(); break; } case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(label0, wxConvUTF8))\n"); #endif _this = new wxDataViewProgressRenderer_php(wxString(label0, wxConvUTF8)); ((wxDataViewProgressRenderer_php*) _this)->references.Initialize(); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(label0, wxConvUTF8), wxString(varianttype0, wxConvUTF8))\n"); #endif _this = new wxDataViewProgressRenderer_php(wxString(label0, wxConvUTF8), wxString(varianttype0, wxConvUTF8)); ((wxDataViewProgressRenderer_php*) _this)->references.Initialize(); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(label0, wxConvUTF8), wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0)\n"); #endif _this = new wxDataViewProgressRenderer_php(wxString(label0, wxConvUTF8), wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0); ((wxDataViewProgressRenderer_php*) _this)->references.Initialize(); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(label0, wxConvUTF8), wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0)\n"); #endif _this = new wxDataViewProgressRenderer_php(wxString(label0, wxConvUTF8), wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0); ((wxDataViewProgressRenderer_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewProgressRenderer); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewProgressRenderer_php*) _this)->evnArray); array_init(((wxDataViewProgressRenderer_php*) _this)->evnArray); ((wxDataViewProgressRenderer_php*) _this)->phpObj = getThis(); ((wxDataViewProgressRenderer_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewProgressRenderer_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_wxDataViewSpinRenderer_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewSpinRenderer_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewSpinRenderer_php* object = static_cast<wxDataViewSpinRenderer_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 wxDataViewSpinRenderer done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewSpinRenderer, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewSpinRenderer::__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 long min0; long max0; long mode0; long align0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 2 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'll|ll' (&min0, &max0, &mode0, &align0)\n"); #endif char parse_parameters_string[] = "ll|ll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &min0, &max0, &mode0, &align0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((int) min0, (int) max0)\n"); #endif _this = new wxDataViewSpinRenderer_php((int) min0, (int) max0); ((wxDataViewSpinRenderer_php*) _this)->references.Initialize(); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((int) min0, (int) max0, (wxDataViewCellMode) mode0)\n"); #endif _this = new wxDataViewSpinRenderer_php((int) min0, (int) max0, (wxDataViewCellMode) mode0); ((wxDataViewSpinRenderer_php*) _this)->references.Initialize(); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((int) min0, (int) max0, (wxDataViewCellMode) mode0, (int) align0)\n"); #endif _this = new wxDataViewSpinRenderer_php((int) min0, (int) max0, (wxDataViewCellMode) mode0, (int) align0); ((wxDataViewSpinRenderer_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewSpinRenderer); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewSpinRenderer_php*) _this)->evnArray); array_init(((wxDataViewSpinRenderer_php*) _this)->evnArray); ((wxDataViewSpinRenderer_php*) _this)->phpObj = getThis(); ((wxDataViewSpinRenderer_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewSpinRenderer_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_wxDataViewToggleRenderer_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewToggleRenderer_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewToggleRenderer_php* object = static_cast<wxDataViewToggleRenderer_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 wxDataViewToggleRenderer done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewToggleRenderer, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewToggleRenderer::__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 char* varianttype0; long varianttype_len0; long mode0; long align0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 0 && arguments_received <= 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '|sll' (&varianttype0, &varianttype_len0, &mode0, &align0)\n"); #endif char parse_parameters_string[] = "|sll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &varianttype0, &varianttype_len0, &mode0, &align0 ) == SUCCESS) { overload0_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 wxDataViewToggleRenderer_php(); ((wxDataViewToggleRenderer_php*) _this)->references.Initialize(); break; } case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8))\n"); #endif _this = new wxDataViewToggleRenderer_php(wxString(varianttype0, wxConvUTF8)); ((wxDataViewToggleRenderer_php*) _this)->references.Initialize(); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0)\n"); #endif _this = new wxDataViewToggleRenderer_php(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0); ((wxDataViewToggleRenderer_php*) _this)->references.Initialize(); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0)\n"); #endif _this = new wxDataViewToggleRenderer_php(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0); ((wxDataViewToggleRenderer_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewToggleRenderer); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewToggleRenderer_php*) _this)->evnArray); array_init(((wxDataViewToggleRenderer_php*) _this)->evnArray); ((wxDataViewToggleRenderer_php*) _this)->phpObj = getThis(); ((wxDataViewToggleRenderer_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewToggleRenderer_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_wxDataViewChoiceRenderer_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewChoiceRenderer_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewChoiceRenderer_php* object = static_cast<wxDataViewChoiceRenderer_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 wxDataViewChoiceRenderer done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewChoiceRenderer, GetChoice) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewChoiceRenderer::GetChoice\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 wxDataViewChoiceRenderer::GetChoice\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_wxDataViewChoiceRenderer){ references = &((wxDataViewChoiceRenderer_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 index0; 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' (&index0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &index0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_STRING(wxDataViewChoiceRenderer::GetChoice((size_t) index0).fn_str(), 1)\n\n"); #endif wxString value_to_return1; value_to_return1 = ((wxDataViewChoiceRenderer_php*)_this)->GetChoice((size_t) index0); char* temp_string1; temp_string1 = (char*)malloc(sizeof(wxChar)*(value_to_return1.size()+1)); strcpy (temp_string1, (const char *) value_to_return1.char_str() ); ZVAL_STRING(return_value, temp_string1, 1); free(temp_string1); return; break; } } } } PHP_METHOD(php_wxDataViewChoiceRenderer, GetChoices) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewChoiceRenderer::GetChoices\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 wxDataViewChoiceRenderer::GetChoices\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_wxDataViewChoiceRenderer){ references = &((wxDataViewChoiceRenderer_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 wxDataViewChoiceRenderer::GetChoices() to return strings array\n\n"); #endif wxArrayString value_to_return0; value_to_return0 = ((wxDataViewChoiceRenderer_php*)_this)->GetChoices(); char* temp_string0; array_init(return_value); for(size_t i=0; i<value_to_return0.GetCount(); i++) { temp_string0 = (char*)malloc(sizeof(wxChar)*(value_to_return0[i].size()+1)); strcpy (temp_string0, (const char *) value_to_return0[i].char_str() ); add_next_index_string(return_value, (char*) temp_string0, 1); free(temp_string0); } return; break; } } } } PHP_METHOD(php_wxDataViewChoiceRenderer, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewChoiceRenderer::__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 zval* choices0 = 0; long mode0; long alignment0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'a|ll' (&choices0, &mode0, &alignment0)\n"); #endif char parse_parameters_string[] = "a|ll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &choices0, &mode0, &alignment0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { wxArrayString strings_array0_0; bool strings_continue0_0 = true; switch(arguments_received) { case 1: { int array_index0_0 = 0; zval** temp_array_value0_0 = 0; while(strings_continue0_0) { if(zend_hash_index_find(HASH_OF(choices0), array_index0_0, (void**)&temp_array_value0_0) == SUCCESS) { convert_to_string(*temp_array_value0_0); strings_array0_0.Add(wxString(Z_STRVAL_PP(temp_array_value0_0), wxConvUTF8)); array_index0_0++; } else { strings_continue0_0 = false; } } #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(strings_array0_0)\n"); #endif _this = new wxDataViewChoiceRenderer_php(strings_array0_0); ((wxDataViewChoiceRenderer_php*) _this)->references.Initialize(); break; } case 2: { int array_index0_0 = 0; zval** temp_array_value0_0 = 0; while(strings_continue0_0) { if(zend_hash_index_find(HASH_OF(choices0), array_index0_0, (void**)&temp_array_value0_0) == SUCCESS) { convert_to_string(*temp_array_value0_0); strings_array0_0.Add(wxString(Z_STRVAL_PP(temp_array_value0_0), wxConvUTF8)); array_index0_0++; } else { strings_continue0_0 = false; } } #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(strings_array0_0, (wxDataViewCellMode) mode0)\n"); #endif _this = new wxDataViewChoiceRenderer_php(strings_array0_0, (wxDataViewCellMode) mode0); ((wxDataViewChoiceRenderer_php*) _this)->references.Initialize(); break; } case 3: { int array_index0_0 = 0; zval** temp_array_value0_0 = 0; while(strings_continue0_0) { if(zend_hash_index_find(HASH_OF(choices0), array_index0_0, (void**)&temp_array_value0_0) == SUCCESS) { convert_to_string(*temp_array_value0_0); strings_array0_0.Add(wxString(Z_STRVAL_PP(temp_array_value0_0), wxConvUTF8)); array_index0_0++; } else { strings_continue0_0 = false; } } #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(strings_array0_0, (wxDataViewCellMode) mode0, (int) alignment0)\n"); #endif _this = new wxDataViewChoiceRenderer_php(strings_array0_0, (wxDataViewCellMode) mode0, (int) alignment0); ((wxDataViewChoiceRenderer_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewChoiceRenderer); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewChoiceRenderer_php*) _this)->evnArray); array_init(((wxDataViewChoiceRenderer_php*) _this)->evnArray); ((wxDataViewChoiceRenderer_php*) _this)->phpObj = getThis(); ((wxDataViewChoiceRenderer_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewChoiceRenderer_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_wxDataViewDateRenderer_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewDateRenderer_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewDateRenderer_php* object = static_cast<wxDataViewDateRenderer_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 wxDataViewDateRenderer done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewDateRenderer, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewDateRenderer::__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 char* varianttype0; long varianttype_len0; long mode0; long align0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 0 && arguments_received <= 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '|sll' (&varianttype0, &varianttype_len0, &mode0, &align0)\n"); #endif char parse_parameters_string[] = "|sll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &varianttype0, &varianttype_len0, &mode0, &align0 ) == SUCCESS) { overload0_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 wxDataViewDateRenderer_php(); ((wxDataViewDateRenderer_php*) _this)->references.Initialize(); break; } case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8))\n"); #endif _this = new wxDataViewDateRenderer_php(wxString(varianttype0, wxConvUTF8)); ((wxDataViewDateRenderer_php*) _this)->references.Initialize(); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0)\n"); #endif _this = new wxDataViewDateRenderer_php(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0); ((wxDataViewDateRenderer_php*) _this)->references.Initialize(); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0)\n"); #endif _this = new wxDataViewDateRenderer_php(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0); ((wxDataViewDateRenderer_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewDateRenderer); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewDateRenderer_php*) _this)->evnArray); array_init(((wxDataViewDateRenderer_php*) _this)->evnArray); ((wxDataViewDateRenderer_php*) _this)->phpObj = getThis(); ((wxDataViewDateRenderer_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewDateRenderer_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_wxDataViewCustomRenderer_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewCustomRenderer_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewCustomRenderer_php* object = static_cast<wxDataViewCustomRenderer_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 wxDataViewCustomRenderer done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewCustomRenderer, ActivateCell) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewCustomRenderer::ActivateCell\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 wxDataViewCustomRenderer::ActivateCell\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_wxDataViewCustomRenderer){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_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* cell0 = 0; void* object_pointer0_0 = 0; zval* model0 = 0; void* object_pointer0_1 = 0; zval* item0 = 0; void* object_pointer0_2 = 0; long col0; zval* mouseEvent0 = 0; void* object_pointer0_4 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'OzOlz' (&cell0, php_wxRect_entry, &model0, &item0, php_wxDataViewItem_entry, &col0, &mouseEvent0)\n"); #endif char parse_parameters_string[] = "OzOlz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &cell0, php_wxRect_entry, &model0, &item0, php_wxDataViewItem_entry, &col0, &mouseEvent0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(cell0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(cell0), _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(cell0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 2){ if(Z_TYPE_P(model0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(model0), _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_wxDataViewListModel && rsrc_type != le_wxDataViewIndexListModel && rsrc_type != le_wxDataViewListStore && rsrc_type != le_wxDataViewVirtualListModel && rsrc_type != le_wxDataViewTreeStore)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(model0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ 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_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(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 5){ if(Z_TYPE_P(mouseEvent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(mouseEvent0), _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(mouseEvent0) != 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 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxDataViewCustomRenderer::ActivateCell(*(wxRect*) object_pointer0_0, (wxDataViewModel*) object_pointer0_1, *(wxDataViewItem*) object_pointer0_2, (unsigned int) col0, (const wxMouseEvent*) object_pointer0_4))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ZVAL_BOOL(return_value, ((wxDataViewSpinRenderer_php*)_this)->ActivateCell(*(wxRect*) object_pointer0_0, (wxDataViewModel*) object_pointer0_1, *(wxDataViewItem*) object_pointer0_2, (unsigned int) col0, (const wxMouseEvent*) object_pointer0_4)); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ZVAL_BOOL(return_value, ((wxDataViewCustomRenderer_php*)_this)->ActivateCell(*(wxRect*) object_pointer0_0, (wxDataViewModel*) object_pointer0_1, *(wxDataViewItem*) object_pointer0_2, (unsigned int) col0, (const wxMouseEvent*) object_pointer0_4)); } references->AddReference(cell0); references->AddReference(model0); references->AddReference(item0); references->AddReference(mouseEvent0); return; break; } } } } PHP_METHOD(php_wxDataViewCustomRenderer, CreateEditorCtrl) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewCustomRenderer::CreateEditorCtrl\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 wxDataViewCustomRenderer::CreateEditorCtrl\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_wxDataViewCustomRenderer){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_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; zval* labelRect0 = 0; void* object_pointer0_1 = 0; zval* value0 = 0; void* object_pointer0_2 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'zOO' (&parent0, &labelRect0, php_wxRect_entry, &value0, php_wxVariant_entry)\n"); #endif char parse_parameters_string[] = "zOO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &labelRect0, php_wxRect_entry, &value0, php_wxVariant_entry ) == 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 >= 2){ if(Z_TYPE_P(labelRect0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(labelRect0), _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(labelRect0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(value0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(value0), _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(value0) != 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 wxDataViewCustomRenderer::CreateEditorCtrl((wxWindow*) object_pointer0_0, *(wxRect*) object_pointer0_1, *(wxVariant*) object_pointer0_2) to return object pointer\n\n"); #endif wxWindow_php* value_to_return3; if(parent_rsrc_type == le_wxDataViewSpinRenderer) { value_to_return3 = (wxWindow_php*) ((wxDataViewSpinRenderer_php*)_this)->CreateEditorCtrl((wxWindow*) object_pointer0_0, *(wxRect*) object_pointer0_1, *(wxVariant*) object_pointer0_2); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { value_to_return3 = (wxWindow_php*) ((wxDataViewCustomRenderer_php*)_this)->CreateEditorCtrl((wxWindow*) object_pointer0_0, *(wxRect*) object_pointer0_1, *(wxVariant*) 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_wxWindow_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxWindow)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(parent0); references->AddReference(value0); return; break; } } } } PHP_METHOD(php_wxDataViewCustomRenderer, GetAttr) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewCustomRenderer::GetAttr\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 wxDataViewCustomRenderer::GetAttr\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_wxDataViewCustomRenderer){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_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 wxDataViewCustomRenderer::GetAttr() to return object reference\n\n"); #endif wxDataViewItemAttr_php* value_to_return0; if(parent_rsrc_type == le_wxDataViewSpinRenderer) { value_to_return0 = (wxDataViewItemAttr_php*) &((wxDataViewSpinRenderer_php*)_this)->GetAttr(); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { value_to_return0 = (wxDataViewItemAttr_php*) &((wxDataViewCustomRenderer_php*)_this)->GetAttr(); } 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_wxDataViewItemAttr_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxDataViewItemAttr)); } if(value_to_return0 != _this && return_is_user_initialized){ //Prevent adding references to it self references->AddReference(return_value); } return; break; } } } } wxSize wxDataViewCustomRenderer_php::GetSize()const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewCustomRenderer::GetSize\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, "GetSize", 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 'GetSize'!", "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_wxDataViewCustomRenderer, GetValueFromEditorCtrl) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewCustomRenderer::GetValueFromEditorCtrl\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 wxDataViewCustomRenderer::GetValueFromEditorCtrl\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_wxDataViewCustomRenderer){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_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* editor0 = 0; void* object_pointer0_0 = 0; zval* value0 = 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 'zO' (&editor0, &value0, php_wxVariant_entry)\n"); #endif char parse_parameters_string[] = "zO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &editor0, &value0, php_wxVariant_entry ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(editor0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(editor0), _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(editor0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 2){ if(Z_TYPE_P(value0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(value0), _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(value0) != 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 RETURN_BOOL(wxDataViewCustomRenderer::GetValueFromEditorCtrl((wxWindow*) object_pointer0_0, *(wxVariant*) object_pointer0_1))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ZVAL_BOOL(return_value, ((wxDataViewSpinRenderer_php*)_this)->GetValueFromEditorCtrl((wxWindow*) object_pointer0_0, *(wxVariant*) object_pointer0_1)); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ZVAL_BOOL(return_value, ((wxDataViewCustomRenderer_php*)_this)->GetValueFromEditorCtrl((wxWindow*) object_pointer0_0, *(wxVariant*) object_pointer0_1)); } references->AddReference(editor0); references->AddReference(value0); return; break; } } } } PHP_METHOD(php_wxDataViewCustomRenderer, HasEditorCtrl) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewCustomRenderer::HasEditorCtrl\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 wxDataViewCustomRenderer::HasEditorCtrl\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_wxDataViewCustomRenderer){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_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(wxDataViewCustomRenderer::HasEditorCtrl())\n\n"); #endif if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ZVAL_BOOL(return_value, ((wxDataViewSpinRenderer_php*)_this)->HasEditorCtrl()); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ZVAL_BOOL(return_value, ((wxDataViewCustomRenderer_php*)_this)->HasEditorCtrl()); } return; break; } } } } PHP_METHOD(php_wxDataViewCustomRenderer, LeftClick) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewCustomRenderer::LeftClick\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 wxDataViewCustomRenderer::LeftClick\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_wxDataViewCustomRenderer){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_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* cursor0 = 0; void* object_pointer0_0 = 0; zval* cell0 = 0; void* object_pointer0_1 = 0; zval* model0 = 0; void* object_pointer0_2 = 0; zval* item0 = 0; void* object_pointer0_3 = 0; long col0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'OOzOl' (&cursor0, php_wxPoint_entry, &cell0, php_wxRect_entry, &model0, &item0, php_wxDataViewItem_entry, &col0)\n"); #endif char parse_parameters_string[] = "OOzOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &cursor0, php_wxPoint_entry, &cell0, php_wxRect_entry, &model0, &item0, php_wxDataViewItem_entry, &col0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(cursor0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(cursor0), _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(cursor0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 2){ if(Z_TYPE_P(cell0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(cell0), _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(cell0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(model0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(model0), _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 || (rsrc_type != le_wxDataViewListModel && rsrc_type != le_wxDataViewIndexListModel && rsrc_type != le_wxDataViewListStore && rsrc_type != le_wxDataViewVirtualListModel && rsrc_type != le_wxDataViewTreeStore)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(model0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ 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_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(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 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxDataViewCustomRenderer::LeftClick(*(wxPoint*) object_pointer0_0, *(wxRect*) object_pointer0_1, (wxDataViewModel*) object_pointer0_2, *(wxDataViewItem*) object_pointer0_3, (unsigned int) col0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ZVAL_BOOL(return_value, ((wxDataViewSpinRenderer_php*)_this)->LeftClick(*(wxPoint*) object_pointer0_0, *(wxRect*) object_pointer0_1, (wxDataViewModel*) object_pointer0_2, *(wxDataViewItem*) object_pointer0_3, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ZVAL_BOOL(return_value, ((wxDataViewCustomRenderer_php*)_this)->LeftClick(*(wxPoint*) object_pointer0_0, *(wxRect*) object_pointer0_1, (wxDataViewModel*) object_pointer0_2, *(wxDataViewItem*) object_pointer0_3, (unsigned int) col0)); } references->AddReference(cursor0); references->AddReference(cell0); references->AddReference(model0); references->AddReference(item0); return; break; } } } } bool wxDataViewCustomRenderer_php::Render(wxRect cell, wxDC* dc, int state) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxDataViewCustomRenderer::Render\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, "Render", 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_wxRect_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&cell, le_wxRect)); object_init_ex(arguments[1], php_wxDC_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)dc, le_wxDC)); ZVAL_LONG(arguments[2], 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, 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 'Render'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } PHP_METHOD(php_wxDataViewCustomRenderer, RenderText) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewCustomRenderer::RenderText\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 wxDataViewCustomRenderer::RenderText\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_wxDataViewCustomRenderer){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_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 char* text0; long text_len0; long xoffset0; zval* cell0 = 0; void* object_pointer0_2 = 0; zval* dc0 = 0; void* object_pointer0_3 = 0; long state0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'slOzl' (&text0, &text_len0, &xoffset0, &cell0, php_wxRect_entry, &dc0, &state0)\n"); #endif char parse_parameters_string[] = "slOzl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &text0, &text_len0, &xoffset0, &cell0, php_wxRect_entry, &dc0, &state0 ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(cell0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(cell0), _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(cell0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(dc0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(dc0), _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 || (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)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(dc0) != 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 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewCustomRenderer::RenderText(wxString(text0, wxConvUTF8), (int) xoffset0, *(wxRect*) object_pointer0_2, (wxDC*) object_pointer0_3, (int) state0)\n\n"); #endif if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ((wxDataViewSpinRenderer_php*)_this)->RenderText(wxString(text0, wxConvUTF8), (int) xoffset0, *(wxRect*) object_pointer0_2, (wxDC*) object_pointer0_3, (int) state0); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ((wxDataViewCustomRenderer_php*)_this)->RenderText(wxString(text0, wxConvUTF8), (int) xoffset0, *(wxRect*) object_pointer0_2, (wxDC*) object_pointer0_3, (int) state0); } references->AddReference(dc0); return; break; } } } } PHP_METHOD(php_wxDataViewCustomRenderer, StartDrag) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewCustomRenderer::StartDrag\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 wxDataViewCustomRenderer::StartDrag\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_wxDataViewCustomRenderer){ references = &((wxDataViewCustomRenderer_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxDataViewSpinRenderer) && (!reference_type_found)){ references = &((wxDataViewSpinRenderer_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* cursor0 = 0; void* object_pointer0_0 = 0; zval* cell0 = 0; void* object_pointer0_1 = 0; zval* model0 = 0; void* object_pointer0_2 = 0; zval* item0 = 0; void* object_pointer0_3 = 0; long col0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'OOzOl' (&cursor0, php_wxPoint_entry, &cell0, php_wxRect_entry, &model0, &item0, php_wxDataViewItem_entry, &col0)\n"); #endif char parse_parameters_string[] = "OOzOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &cursor0, php_wxPoint_entry, &cell0, php_wxRect_entry, &model0, &item0, php_wxDataViewItem_entry, &col0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(cursor0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(cursor0), _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(cursor0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 2){ if(Z_TYPE_P(cell0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(cell0), _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(cell0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(model0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(model0), _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 || (rsrc_type != le_wxDataViewListModel && rsrc_type != le_wxDataViewIndexListModel && rsrc_type != le_wxDataViewListStore && rsrc_type != le_wxDataViewVirtualListModel && rsrc_type != le_wxDataViewTreeStore)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(model0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ 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_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(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 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxDataViewCustomRenderer::StartDrag(*(wxPoint*) object_pointer0_0, *(wxRect*) object_pointer0_1, (wxDataViewModel*) object_pointer0_2, *(wxDataViewItem*) object_pointer0_3, (unsigned int) col0))\n\n"); #endif if(parent_rsrc_type == le_wxDataViewSpinRenderer) { ZVAL_BOOL(return_value, ((wxDataViewSpinRenderer_php*)_this)->StartDrag(*(wxPoint*) object_pointer0_0, *(wxRect*) object_pointer0_1, (wxDataViewModel*) object_pointer0_2, *(wxDataViewItem*) object_pointer0_3, (unsigned int) col0)); } else if(parent_rsrc_type == le_wxDataViewCustomRenderer) { ZVAL_BOOL(return_value, ((wxDataViewCustomRenderer_php*)_this)->StartDrag(*(wxPoint*) object_pointer0_0, *(wxRect*) object_pointer0_1, (wxDataViewModel*) object_pointer0_2, *(wxDataViewItem*) object_pointer0_3, (unsigned int) col0)); } references->AddReference(cursor0); references->AddReference(cell0); references->AddReference(model0); references->AddReference(item0); return; break; } } } } void php_wxDataViewBitmapRenderer_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewBitmapRenderer_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewBitmapRenderer_php* object = static_cast<wxDataViewBitmapRenderer_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 wxDataViewBitmapRenderer done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewBitmapRenderer, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewBitmapRenderer::__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 char* varianttype0; long varianttype_len0; long mode0; long align0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 0 && arguments_received <= 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '|sll' (&varianttype0, &varianttype_len0, &mode0, &align0)\n"); #endif char parse_parameters_string[] = "|sll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &varianttype0, &varianttype_len0, &mode0, &align0 ) == SUCCESS) { overload0_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 wxDataViewBitmapRenderer_php(); ((wxDataViewBitmapRenderer_php*) _this)->references.Initialize(); break; } case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8))\n"); #endif _this = new wxDataViewBitmapRenderer_php(wxString(varianttype0, wxConvUTF8)); ((wxDataViewBitmapRenderer_php*) _this)->references.Initialize(); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0)\n"); #endif _this = new wxDataViewBitmapRenderer_php(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0); ((wxDataViewBitmapRenderer_php*) _this)->references.Initialize(); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0)\n"); #endif _this = new wxDataViewBitmapRenderer_php(wxString(varianttype0, wxConvUTF8), (wxDataViewCellMode) mode0, (int) align0); ((wxDataViewBitmapRenderer_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewBitmapRenderer); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewBitmapRenderer_php*) _this)->evnArray); array_init(((wxDataViewBitmapRenderer_php*) _this)->evnArray); ((wxDataViewBitmapRenderer_php*) _this)->phpObj = getThis(); ((wxDataViewBitmapRenderer_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewBitmapRenderer_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_wxDataViewColumn_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewColumn_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewColumn_php* object = static_cast<wxDataViewColumn_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 wxDataViewColumn done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewColumn, GetModelColumn) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewColumn::GetModelColumn\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 wxDataViewColumn::GetModelColumn\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_wxDataViewColumn){ references = &((wxDataViewColumn_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(wxDataViewColumn::GetModelColumn())\n\n"); #endif ZVAL_LONG(return_value, ((wxDataViewColumn_php*)_this)->GetModelColumn()); return; break; } } } } PHP_METHOD(php_wxDataViewColumn, GetOwner) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewColumn::GetOwner\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 wxDataViewColumn::GetOwner\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_wxDataViewColumn){ references = &((wxDataViewColumn_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 wxDataViewColumn::GetOwner() to return object pointer\n\n"); #endif wxDataViewCtrl_php* value_to_return0; value_to_return0 = (wxDataViewCtrl_php*) ((wxDataViewColumn_php*)_this)->GetOwner(); 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_wxDataViewCtrl_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxDataViewCtrl)); } 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_wxDataViewColumn, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewColumn::__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 char* title0; long title_len0; zval* renderer0 = 0; void* object_pointer0_1 = 0; long model_column0; long width0; long align0; long flags0; bool overload0_called = false; //Parameters for overload 1 zval* bitmap1 = 0; void* object_pointer1_0 = 0; zval* renderer1 = 0; void* object_pointer1_1 = 0; long model_column1; long width1; long align1; long flags1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 3 && arguments_received <= 6) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'szl|lll' (&title0, &title_len0, &renderer0, &model_column0, &width0, &align0, &flags0)\n"); #endif char parse_parameters_string[] = "szl|lll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &title0, &title_len0, &renderer0, &model_column0, &width0, &align0, &flags0 ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(renderer0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(renderer0), _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_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)) { goto overload1; } } else if(Z_TYPE_P(renderer0) != IS_NULL) { goto overload1; } } overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received >= 3 && arguments_received <= 6) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Ozl|lll' (&bitmap1, php_wxBitmap_entry, &renderer1, &model_column1, &width1, &align1, &flags1)\n"); #endif char parse_parameters_string[] = "Ozl|lll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &bitmap1, php_wxBitmap_entry, &renderer1, &model_column1, &width1, &align1, &flags1 ) == 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 ) { 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 >= 2){ if(Z_TYPE_P(renderer1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(renderer1), _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 || (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)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(renderer1) != 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 __construct(wxString(title0, wxConvUTF8), (wxDataViewRenderer*) object_pointer0_1, (unsigned int) model_column0)\n"); #endif _this = new wxDataViewColumn_php(wxString(title0, wxConvUTF8), (wxDataViewRenderer*) object_pointer0_1, (unsigned int) model_column0); ((wxDataViewColumn_php*) _this)->references.Initialize(); ((wxDataViewColumn_php*) _this)->references.AddReference(renderer0); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(title0, wxConvUTF8), (wxDataViewRenderer*) object_pointer0_1, (unsigned int) model_column0, (int) width0)\n"); #endif _this = new wxDataViewColumn_php(wxString(title0, wxConvUTF8), (wxDataViewRenderer*) object_pointer0_1, (unsigned int) model_column0, (int) width0); ((wxDataViewColumn_php*) _this)->references.Initialize(); ((wxDataViewColumn_php*) _this)->references.AddReference(renderer0); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(title0, wxConvUTF8), (wxDataViewRenderer*) object_pointer0_1, (unsigned int) model_column0, (int) width0, (wxAlignment) align0)\n"); #endif _this = new wxDataViewColumn_php(wxString(title0, wxConvUTF8), (wxDataViewRenderer*) object_pointer0_1, (unsigned int) model_column0, (int) width0, (wxAlignment) align0); ((wxDataViewColumn_php*) _this)->references.Initialize(); ((wxDataViewColumn_php*) _this)->references.AddReference(renderer0); break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(title0, wxConvUTF8), (wxDataViewRenderer*) object_pointer0_1, (unsigned int) model_column0, (int) width0, (wxAlignment) align0, (int) flags0)\n"); #endif _this = new wxDataViewColumn_php(wxString(title0, wxConvUTF8), (wxDataViewRenderer*) object_pointer0_1, (unsigned int) model_column0, (int) width0, (wxAlignment) align0, (int) flags0); ((wxDataViewColumn_php*) _this)->references.Initialize(); ((wxDataViewColumn_php*) _this)->references.AddReference(renderer0); break; } } } if(overload1_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(*(wxBitmap*) object_pointer1_0, (wxDataViewRenderer*) object_pointer1_1, (unsigned int) model_column1)\n"); #endif _this = new wxDataViewColumn_php(*(wxBitmap*) object_pointer1_0, (wxDataViewRenderer*) object_pointer1_1, (unsigned int) model_column1); ((wxDataViewColumn_php*) _this)->references.Initialize(); ((wxDataViewColumn_php*) _this)->references.AddReference(bitmap1); ((wxDataViewColumn_php*) _this)->references.AddReference(renderer1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(*(wxBitmap*) object_pointer1_0, (wxDataViewRenderer*) object_pointer1_1, (unsigned int) model_column1, (int) width1)\n"); #endif _this = new wxDataViewColumn_php(*(wxBitmap*) object_pointer1_0, (wxDataViewRenderer*) object_pointer1_1, (unsigned int) model_column1, (int) width1); ((wxDataViewColumn_php*) _this)->references.Initialize(); ((wxDataViewColumn_php*) _this)->references.AddReference(bitmap1); ((wxDataViewColumn_php*) _this)->references.AddReference(renderer1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(*(wxBitmap*) object_pointer1_0, (wxDataViewRenderer*) object_pointer1_1, (unsigned int) model_column1, (int) width1, (wxAlignment) align1)\n"); #endif _this = new wxDataViewColumn_php(*(wxBitmap*) object_pointer1_0, (wxDataViewRenderer*) object_pointer1_1, (unsigned int) model_column1, (int) width1, (wxAlignment) align1); ((wxDataViewColumn_php*) _this)->references.Initialize(); ((wxDataViewColumn_php*) _this)->references.AddReference(bitmap1); ((wxDataViewColumn_php*) _this)->references.AddReference(renderer1); break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(*(wxBitmap*) object_pointer1_0, (wxDataViewRenderer*) object_pointer1_1, (unsigned int) model_column1, (int) width1, (wxAlignment) align1, (int) flags1)\n"); #endif _this = new wxDataViewColumn_php(*(wxBitmap*) object_pointer1_0, (wxDataViewRenderer*) object_pointer1_1, (unsigned int) model_column1, (int) width1, (wxAlignment) align1, (int) flags1); ((wxDataViewColumn_php*) _this)->references.Initialize(); ((wxDataViewColumn_php*) _this)->references.AddReference(bitmap1); ((wxDataViewColumn_php*) _this)->references.AddReference(renderer1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewColumn); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewColumn_php*) _this)->evnArray); array_init(((wxDataViewColumn_php*) _this)->evnArray); ((wxDataViewColumn_php*) _this)->phpObj = getThis(); ((wxDataViewColumn_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewColumn_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_wxDataViewColumn, GetRenderer) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewColumn::GetRenderer\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 wxDataViewColumn::GetRenderer\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_wxDataViewColumn){ references = &((wxDataViewColumn_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 wxDataViewColumn::GetRenderer() to return object pointer\n\n"); #endif wxDataViewRenderer_php* value_to_return0; value_to_return0 = (wxDataViewRenderer_php*) ((wxDataViewColumn_php*)_this)->GetRenderer(); 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_wxDataViewRenderer_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxDataViewRenderer)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } void php_wxDataViewListStore_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewListStore_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewListStore_php* object = static_cast<wxDataViewListStore_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 wxDataViewListStore done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewListStore, AppendColumn) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListStore::AppendColumn\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 wxDataViewListStore::AppendColumn\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_wxDataViewListStore){ references = &((wxDataViewListStore_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 char* varianttype0; long varianttype_len0; 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 's' (&varianttype0, &varianttype_len0)\n"); #endif char parse_parameters_string[] = "s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &varianttype0, &varianttype_len0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewListStore::AppendColumn(wxString(varianttype0, wxConvUTF8))\n\n"); #endif ((wxDataViewListStore_php*)_this)->AppendColumn(wxString(varianttype0, wxConvUTF8)); return; break; } } } } PHP_METHOD(php_wxDataViewListStore, DeleteAllItems) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListStore::DeleteAllItems\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 wxDataViewListStore::DeleteAllItems\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_wxDataViewListStore){ references = &((wxDataViewListStore_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 wxDataViewListStore::DeleteAllItems()\n\n"); #endif ((wxDataViewListStore_php*)_this)->DeleteAllItems(); return; break; } } } } PHP_METHOD(php_wxDataViewListStore, DeleteItem) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListStore::DeleteItem\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 wxDataViewListStore::DeleteItem\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_wxDataViewListStore){ references = &((wxDataViewListStore_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 pos0; 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' (&pos0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &pos0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewListStore::DeleteItem((unsigned) pos0)\n\n"); #endif ((wxDataViewListStore_php*)_this)->DeleteItem((unsigned) pos0); return; break; } } } } PHP_METHOD(php_wxDataViewListStore, GetColumnCount) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListStore::GetColumnCount\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 wxDataViewListStore::GetColumnCount\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_wxDataViewListStore){ references = &((wxDataViewListStore_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(wxDataViewListStore::GetColumnCount())\n\n"); #endif ZVAL_LONG(return_value, ((wxDataViewListStore_php*)_this)->GetColumnCount()); return; break; } } } } PHP_METHOD(php_wxDataViewListStore, GetColumnType) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListStore::GetColumnType\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 wxDataViewListStore::GetColumnType\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_wxDataViewListStore){ references = &((wxDataViewListStore_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 col0; 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' (&col0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &col0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_STRING(wxDataViewListStore::GetColumnType((unsigned int) col0).fn_str(), 1)\n\n"); #endif wxString value_to_return1; value_to_return1 = ((wxDataViewListStore_php*)_this)->GetColumnType((unsigned int) col0); char* temp_string1; temp_string1 = (char*)malloc(sizeof(wxChar)*(value_to_return1.size()+1)); strcpy (temp_string1, (const char *) value_to_return1.char_str() ); ZVAL_STRING(return_value, temp_string1, 1); free(temp_string1); return; break; } } } } PHP_METHOD(php_wxDataViewListStore, GetValueByRow) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListStore::GetValueByRow\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 wxDataViewListStore::GetValueByRow\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_wxDataViewListStore){ references = &((wxDataViewListStore_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* value0 = 0; void* object_pointer0_0 = 0; long row0; long col0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Oll' (&value0, php_wxVariant_entry, &row0, &col0)\n"); #endif char parse_parameters_string[] = "Oll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &value0, php_wxVariant_entry, &row0, &col0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(value0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(value0), _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(value0) != 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 wxDataViewListStore::GetValueByRow(*(wxVariant*) object_pointer0_0, (unsigned int) row0, (unsigned int) col0)\n\n"); #endif ((wxDataViewListStore_php*)_this)->GetValueByRow(*(wxVariant*) object_pointer0_0, (unsigned int) row0, (unsigned int) col0); references->AddReference(value0); return; break; } } } } PHP_METHOD(php_wxDataViewListStore, InsertColumn) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListStore::InsertColumn\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 wxDataViewListStore::InsertColumn\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_wxDataViewListStore){ references = &((wxDataViewListStore_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 pos0; char* varianttype0; long varianttype_len0; 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 'ls' (&pos0, &varianttype0, &varianttype_len0)\n"); #endif char parse_parameters_string[] = "ls"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &pos0, &varianttype0, &varianttype_len0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewListStore::InsertColumn((unsigned int) pos0, wxString(varianttype0, wxConvUTF8))\n\n"); #endif ((wxDataViewListStore_php*)_this)->InsertColumn((unsigned int) pos0, wxString(varianttype0, wxConvUTF8)); return; break; } } } } PHP_METHOD(php_wxDataViewListStore, PrependColumn) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListStore::PrependColumn\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 wxDataViewListStore::PrependColumn\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_wxDataViewListStore){ references = &((wxDataViewListStore_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 char* varianttype0; long varianttype_len0; 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 's' (&varianttype0, &varianttype_len0)\n"); #endif char parse_parameters_string[] = "s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &varianttype0, &varianttype_len0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewListStore::PrependColumn(wxString(varianttype0, wxConvUTF8))\n\n"); #endif ((wxDataViewListStore_php*)_this)->PrependColumn(wxString(varianttype0, wxConvUTF8)); return; break; } } } } PHP_METHOD(php_wxDataViewListStore, SetValueByRow) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListStore::SetValueByRow\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 wxDataViewListStore::SetValueByRow\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_wxDataViewListStore){ references = &((wxDataViewListStore_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* value0 = 0; void* object_pointer0_0 = 0; long row0; long col0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Oll' (&value0, php_wxVariant_entry, &row0, &col0)\n"); #endif char parse_parameters_string[] = "Oll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &value0, php_wxVariant_entry, &row0, &col0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(value0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(value0), _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(value0) != 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 RETURN_BOOL(wxDataViewListStore::SetValueByRow(*(wxVariant*) object_pointer0_0, (unsigned int) row0, (unsigned int) col0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxDataViewListStore_php*)_this)->SetValueByRow(*(wxVariant*) object_pointer0_0, (unsigned int) row0, (unsigned int) col0)); references->AddReference(value0); return; break; } } } } PHP_METHOD(php_wxDataViewListStore, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewListStore::__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; //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 __construct()\n"); #endif _this = new wxDataViewListStore_php(); ((wxDataViewListStore_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewListStore); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewListStore_php*) _this)->evnArray); array_init(((wxDataViewListStore_php*) _this)->evnArray); ((wxDataViewListStore_php*) _this)->phpObj = getThis(); ((wxDataViewListStore_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewListStore_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_wxDataViewTreeStore_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewTreeStore_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewTreeStore_php* object = static_cast<wxDataViewTreeStore_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 wxDataViewTreeStore done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewTreeStore, AppendContainer) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::AppendContainer\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 wxDataViewTreeStore::AppendContainer\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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; char* text0; long text_len0; zval* icon0 = 0; void* object_pointer0_2 = 0; zval* expanded0 = 0; void* object_pointer0_3 = 0; zval* data0 = 0; void* object_pointer0_4 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 2 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Os|OOz' (&parent0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &expanded0, php_wxIcon_entry, &data0)\n"); #endif char parse_parameters_string[] = "Os|OOz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &expanded0, php_wxIcon_entry, &data0 ) == 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 >= 3){ 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_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(icon0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(expanded0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(expanded0), _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(expanded0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 5){ 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_4 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_4 || (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 wxDataViewTreeStore::AppendContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8)) to return new object\n\n"); #endif wxDataViewItem value_to_return2; value_to_return2 = ((wxDataViewTreeStore_php*)_this)->AppendContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8)); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return2, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::AppendContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2) to return new object\n\n"); #endif wxDataViewItem value_to_return3; value_to_return3 = ((wxDataViewTreeStore_php*)_this)->AppendContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return3, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(icon0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::AppendContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, *(wxIcon*) object_pointer0_3) to return new object\n\n"); #endif wxDataViewItem value_to_return4; value_to_return4 = ((wxDataViewTreeStore_php*)_this)->AppendContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, *(wxIcon*) object_pointer0_3); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return4, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(expanded0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::AppendContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, *(wxIcon*) object_pointer0_3, (wxClientData*) object_pointer0_4) to return new object\n\n"); #endif wxDataViewItem value_to_return5; value_to_return5 = ((wxDataViewTreeStore_php*)_this)->AppendContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, *(wxIcon*) object_pointer0_3, (wxClientData*) object_pointer0_4); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return5, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(expanded0); references->AddReference(data0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, AppendItem) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::AppendItem\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 wxDataViewTreeStore::AppendItem\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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; char* text0; long text_len0; zval* icon0 = 0; void* object_pointer0_2 = 0; zval* data0 = 0; void* object_pointer0_3 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 2 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Os|Oz' (&parent0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &data0)\n"); #endif char parse_parameters_string[] = "Os|Oz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &data0 ) == 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 >= 3){ 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_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(icon0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ 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_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 || (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 wxDataViewTreeStore::AppendItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8)) to return new object\n\n"); #endif wxDataViewItem value_to_return2; value_to_return2 = ((wxDataViewTreeStore_php*)_this)->AppendItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8)); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return2, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::AppendItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2) to return new object\n\n"); #endif wxDataViewItem value_to_return3; value_to_return3 = ((wxDataViewTreeStore_php*)_this)->AppendItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return3, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(icon0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::AppendItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, (wxClientData*) object_pointer0_3) to return new object\n\n"); #endif wxDataViewItem value_to_return4; value_to_return4 = ((wxDataViewTreeStore_php*)_this)->AppendItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, (wxClientData*) object_pointer0_3); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return4, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(data0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, DeleteAllItems) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::DeleteAllItems\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 wxDataViewTreeStore::DeleteAllItems\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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 wxDataViewTreeStore::DeleteAllItems()\n\n"); #endif ((wxDataViewTreeStore_php*)_this)->DeleteAllItems(); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, DeleteChildren) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::DeleteChildren\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 wxDataViewTreeStore::DeleteChildren\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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 'O' (&item0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry ) == 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 wxDataViewTreeStore::DeleteChildren(*(wxDataViewItem*) object_pointer0_0)\n\n"); #endif ((wxDataViewTreeStore_php*)_this)->DeleteChildren(*(wxDataViewItem*) object_pointer0_0); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, DeleteItem) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::DeleteItem\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 wxDataViewTreeStore::DeleteItem\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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 'O' (&item0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry ) == 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 wxDataViewTreeStore::DeleteItem(*(wxDataViewItem*) object_pointer0_0)\n\n"); #endif ((wxDataViewTreeStore_php*)_this)->DeleteItem(*(wxDataViewItem*) object_pointer0_0); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, GetChildCount) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::GetChildCount\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 wxDataViewTreeStore::GetChildCount\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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; 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 'O' (&parent0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, php_wxDataViewItem_entry ) == 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."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxDataViewTreeStore::GetChildCount(*(wxDataViewItem*) object_pointer0_0))\n\n"); #endif ZVAL_LONG(return_value, ((wxDataViewTreeStore_php*)_this)->GetChildCount(*(wxDataViewItem*) object_pointer0_0)); references->AddReference(parent0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, GetItemData) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::GetItemData\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 wxDataViewTreeStore::GetItemData\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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 'O' (&item0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry ) == 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 wxDataViewTreeStore::GetItemData(*(wxDataViewItem*) object_pointer0_0) to return object pointer\n\n"); #endif wxClientData_php* value_to_return1; value_to_return1 = (wxClientData_php*) ((wxDataViewTreeStore_php*)_this)->GetItemData(*(wxDataViewItem*) 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_wxDataViewTreeStore, GetItemExpandedIcon) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::GetItemExpandedIcon\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 wxDataViewTreeStore::GetItemExpandedIcon\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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 'O' (&item0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry ) == 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 wxDataViewTreeStore::GetItemExpandedIcon(*(wxDataViewItem*) object_pointer0_0) to return object reference\n\n"); #endif wxIcon_php* value_to_return1; value_to_return1 = (wxIcon_php*) &((wxDataViewTreeStore_php*)_this)->GetItemExpandedIcon(*(wxDataViewItem*) object_pointer0_0); 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_wxIcon_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return1, le_wxIcon)); } if(value_to_return1 != _this && return_is_user_initialized){ //Prevent adding references to it self references->AddReference(return_value); } references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, GetItemIcon) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::GetItemIcon\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 wxDataViewTreeStore::GetItemIcon\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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 'O' (&item0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry ) == 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 wxDataViewTreeStore::GetItemIcon(*(wxDataViewItem*) object_pointer0_0) to return object reference\n\n"); #endif wxIcon_php* value_to_return1; value_to_return1 = (wxIcon_php*) &((wxDataViewTreeStore_php*)_this)->GetItemIcon(*(wxDataViewItem*) object_pointer0_0); 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_wxIcon_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return1, le_wxIcon)); } if(value_to_return1 != _this && return_is_user_initialized){ //Prevent adding references to it self references->AddReference(return_value); } references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, GetItemText) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::GetItemText\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 wxDataViewTreeStore::GetItemText\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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 'O' (&item0, php_wxDataViewItem_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry ) == 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 RETURN_STRING(wxDataViewTreeStore::GetItemText(*(wxDataViewItem*) object_pointer0_0).fn_str(), 1)\n\n"); #endif wxString value_to_return1; value_to_return1 = ((wxDataViewTreeStore_php*)_this)->GetItemText(*(wxDataViewItem*) object_pointer0_0); char* temp_string1; temp_string1 = (char*)malloc(sizeof(wxChar)*(value_to_return1.size()+1)); strcpy (temp_string1, (const char *) value_to_return1.char_str() ); ZVAL_STRING(return_value, temp_string1, 1); free(temp_string1); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, GetNthChild) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::GetNthChild\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 wxDataViewTreeStore::GetNthChild\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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 pos0; 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 'Ol' (&parent0, php_wxDataViewItem_entry, &pos0)\n"); #endif char parse_parameters_string[] = "Ol"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, php_wxDataViewItem_entry, &pos0 ) == 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."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::GetNthChild(*(wxDataViewItem*) object_pointer0_0, (unsigned int) pos0) to return new object\n\n"); #endif wxDataViewItem value_to_return2; value_to_return2 = ((wxDataViewTreeStore_php*)_this)->GetNthChild(*(wxDataViewItem*) object_pointer0_0, (unsigned int) pos0); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return2, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, InsertContainer) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::InsertContainer\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 wxDataViewTreeStore::InsertContainer\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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; zval* previous0 = 0; void* object_pointer0_1 = 0; char* text0; long text_len0; zval* icon0 = 0; void* object_pointer0_3 = 0; zval* expanded0 = 0; void* object_pointer0_4 = 0; zval* data0 = 0; void* object_pointer0_5 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 3 && arguments_received <= 6) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'OOs|OOz' (&parent0, php_wxDataViewItem_entry, &previous0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &expanded0, php_wxIcon_entry, &data0)\n"); #endif char parse_parameters_string[] = "OOs|OOz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, php_wxDataViewItem_entry, &previous0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &expanded0, php_wxIcon_entry, &data0 ) == 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 >= 2){ if(Z_TYPE_P(previous0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(previous0), _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(previous0) != 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(expanded0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(expanded0), _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(expanded0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 6){ 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_5 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_5 || (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 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::InsertContainer(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8)) to return new object\n\n"); #endif wxDataViewItem value_to_return3; value_to_return3 = ((wxDataViewTreeStore_php*)_this)->InsertContainer(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8)); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return3, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(previous0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::InsertContainer(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_3) to return new object\n\n"); #endif wxDataViewItem value_to_return4; value_to_return4 = ((wxDataViewTreeStore_php*)_this)->InsertContainer(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_3); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return4, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(previous0); references->AddReference(icon0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::InsertContainer(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_3, *(wxIcon*) object_pointer0_4) to return new object\n\n"); #endif wxDataViewItem value_to_return5; value_to_return5 = ((wxDataViewTreeStore_php*)_this)->InsertContainer(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_3, *(wxIcon*) object_pointer0_4); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return5, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(previous0); references->AddReference(icon0); references->AddReference(expanded0); return; break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::InsertContainer(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_3, *(wxIcon*) object_pointer0_4, (wxClientData*) object_pointer0_5) to return new object\n\n"); #endif wxDataViewItem value_to_return6; value_to_return6 = ((wxDataViewTreeStore_php*)_this)->InsertContainer(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_3, *(wxIcon*) object_pointer0_4, (wxClientData*) object_pointer0_5); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return6, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(previous0); references->AddReference(icon0); references->AddReference(expanded0); references->AddReference(data0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, InsertItem) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::InsertItem\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 wxDataViewTreeStore::InsertItem\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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; zval* previous0 = 0; void* object_pointer0_1 = 0; char* text0; long text_len0; zval* icon0 = 0; void* object_pointer0_3 = 0; zval* data0 = 0; void* object_pointer0_4 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 3 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'OOs|Oz' (&parent0, php_wxDataViewItem_entry, &previous0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &data0)\n"); #endif char parse_parameters_string[] = "OOs|Oz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, php_wxDataViewItem_entry, &previous0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &data0 ) == 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 >= 2){ if(Z_TYPE_P(previous0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(previous0), _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(previous0) != 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(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_4 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_4 || (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 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::InsertItem(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8)) to return new object\n\n"); #endif wxDataViewItem value_to_return3; value_to_return3 = ((wxDataViewTreeStore_php*)_this)->InsertItem(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8)); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return3, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(previous0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::InsertItem(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_3) to return new object\n\n"); #endif wxDataViewItem value_to_return4; value_to_return4 = ((wxDataViewTreeStore_php*)_this)->InsertItem(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_3); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return4, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(previous0); references->AddReference(icon0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::InsertItem(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_3, (wxClientData*) object_pointer0_4) to return new object\n\n"); #endif wxDataViewItem value_to_return5; value_to_return5 = ((wxDataViewTreeStore_php*)_this)->InsertItem(*(wxDataViewItem*) object_pointer0_0, *(wxDataViewItem*) object_pointer0_1, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_3, (wxClientData*) object_pointer0_4); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return5, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(previous0); references->AddReference(icon0); references->AddReference(data0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, PrependContainer) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::PrependContainer\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 wxDataViewTreeStore::PrependContainer\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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; char* text0; long text_len0; zval* icon0 = 0; void* object_pointer0_2 = 0; zval* expanded0 = 0; void* object_pointer0_3 = 0; zval* data0 = 0; void* object_pointer0_4 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 2 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Os|OOz' (&parent0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &expanded0, php_wxIcon_entry, &data0)\n"); #endif char parse_parameters_string[] = "Os|OOz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &expanded0, php_wxIcon_entry, &data0 ) == 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 >= 3){ 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_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(icon0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(expanded0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(expanded0), _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(expanded0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 5){ 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_4 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_4 || (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 wxDataViewTreeStore::PrependContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8)) to return new object\n\n"); #endif wxDataViewItem value_to_return2; value_to_return2 = ((wxDataViewTreeStore_php*)_this)->PrependContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8)); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return2, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::PrependContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2) to return new object\n\n"); #endif wxDataViewItem value_to_return3; value_to_return3 = ((wxDataViewTreeStore_php*)_this)->PrependContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return3, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(icon0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::PrependContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, *(wxIcon*) object_pointer0_3) to return new object\n\n"); #endif wxDataViewItem value_to_return4; value_to_return4 = ((wxDataViewTreeStore_php*)_this)->PrependContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, *(wxIcon*) object_pointer0_3); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return4, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(expanded0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::PrependContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, *(wxIcon*) object_pointer0_3, (wxClientData*) object_pointer0_4) to return new object\n\n"); #endif wxDataViewItem value_to_return5; value_to_return5 = ((wxDataViewTreeStore_php*)_this)->PrependContainer(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, *(wxIcon*) object_pointer0_3, (wxClientData*) object_pointer0_4); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return5, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(expanded0); references->AddReference(data0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, PrependItem) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::PrependItem\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 wxDataViewTreeStore::PrependItem\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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; char* text0; long text_len0; zval* icon0 = 0; void* object_pointer0_2 = 0; zval* data0 = 0; void* object_pointer0_3 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 2 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Os|Oz' (&parent0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &data0)\n"); #endif char parse_parameters_string[] = "Os|Oz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, php_wxDataViewItem_entry, &text0, &text_len0, &icon0, php_wxIcon_entry, &data0 ) == 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 >= 3){ 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_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(icon0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ 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_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 || (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 wxDataViewTreeStore::PrependItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8)) to return new object\n\n"); #endif wxDataViewItem value_to_return2; value_to_return2 = ((wxDataViewTreeStore_php*)_this)->PrependItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8)); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return2, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::PrependItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2) to return new object\n\n"); #endif wxDataViewItem value_to_return3; value_to_return3 = ((wxDataViewTreeStore_php*)_this)->PrependItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return3, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(icon0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::PrependItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, (wxClientData*) object_pointer0_3) to return new object\n\n"); #endif wxDataViewItem value_to_return4; value_to_return4 = ((wxDataViewTreeStore_php*)_this)->PrependItem(*(wxDataViewItem*) object_pointer0_0, wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_2, (wxClientData*) object_pointer0_3); void* ptr = safe_emalloc(1, sizeof(wxDataViewItem_php), 0); memcpy(ptr, &value_to_return4, sizeof(wxDataViewItem)); object_init_ex(return_value, php_wxDataViewItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxDataViewItem)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(data0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, SetItemData) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::SetItemData\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 wxDataViewTreeStore::SetItemData\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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 'Oz' (&item0, php_wxDataViewItem_entry, &data0)\n"); #endif char parse_parameters_string[] = "Oz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry, &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 wxDataViewTreeStore::SetItemData(*(wxDataViewItem*) object_pointer0_0, (wxClientData*) object_pointer0_1)\n\n"); #endif ((wxDataViewTreeStore_php*)_this)->SetItemData(*(wxDataViewItem*) object_pointer0_0, (wxClientData*) object_pointer0_1); references->AddReference(item0); references->AddReference(data0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, SetItemExpandedIcon) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::SetItemExpandedIcon\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 wxDataViewTreeStore::SetItemExpandedIcon\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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* icon0 = 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 'OO' (&item0, php_wxDataViewItem_entry, &icon0, php_wxIcon_entry)\n"); #endif char parse_parameters_string[] = "OO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry, &icon0, php_wxIcon_entry ) == 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(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_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(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 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::SetItemExpandedIcon(*(wxDataViewItem*) object_pointer0_0, *(wxIcon*) object_pointer0_1)\n\n"); #endif ((wxDataViewTreeStore_php*)_this)->SetItemExpandedIcon(*(wxDataViewItem*) object_pointer0_0, *(wxIcon*) object_pointer0_1); references->AddReference(item0); references->AddReference(icon0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, SetItemIcon) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::SetItemIcon\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 wxDataViewTreeStore::SetItemIcon\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_wxDataViewTreeStore){ references = &((wxDataViewTreeStore_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* icon0 = 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 'OO' (&item0, php_wxDataViewItem_entry, &icon0, php_wxIcon_entry)\n"); #endif char parse_parameters_string[] = "OO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, php_wxDataViewItem_entry, &icon0, php_wxIcon_entry ) == 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(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_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(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 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewTreeStore::SetItemIcon(*(wxDataViewItem*) object_pointer0_0, *(wxIcon*) object_pointer0_1)\n\n"); #endif ((wxDataViewTreeStore_php*)_this)->SetItemIcon(*(wxDataViewItem*) object_pointer0_0, *(wxIcon*) object_pointer0_1); references->AddReference(item0); references->AddReference(icon0); return; break; } } } } PHP_METHOD(php_wxDataViewTreeStore, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewTreeStore::__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; //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 __construct()\n"); #endif _this = new wxDataViewTreeStore_php(); ((wxDataViewTreeStore_php*) _this)->references.Initialize(); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewTreeStore); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewTreeStore_php*) _this)->evnArray); array_init(((wxDataViewTreeStore_php*) _this)->evnArray); ((wxDataViewTreeStore_php*) _this)->phpObj = getThis(); ((wxDataViewTreeStore_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewTreeStore_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_wxDataViewIconText_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxDataViewIconText_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxDataViewIconText_php* object = static_cast<wxDataViewIconText_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 wxDataViewIconText done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } PHP_METHOD(php_wxDataViewIconText, GetIcon) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewIconText::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 wxDataViewIconText::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_wxDataViewIconText){ references = &((wxDataViewIconText_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 wxDataViewIconText::GetIcon() to return object reference\n\n"); #endif wxIcon_php* value_to_return0; value_to_return0 = (wxIcon_php*) &((wxDataViewIconText_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_wxIcon_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxIcon)); } if(value_to_return0 != _this && return_is_user_initialized){ //Prevent adding references to it self references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxDataViewIconText, GetText) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewIconText::GetText\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 wxDataViewIconText::GetText\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_wxDataViewIconText){ references = &((wxDataViewIconText_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_STRING(wxDataViewIconText::GetText().fn_str(), 1)\n\n"); #endif wxString value_to_return0; value_to_return0 = ((wxDataViewIconText_php*)_this)->GetText(); char* temp_string0; temp_string0 = (char*)malloc(sizeof(wxChar)*(value_to_return0.size()+1)); strcpy (temp_string0, (const char *) value_to_return0.char_str() ); ZVAL_STRING(return_value, temp_string0, 1); free(temp_string0); return; break; } } } } PHP_METHOD(php_wxDataViewIconText, SetIcon) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewIconText::SetIcon\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 wxDataViewIconText::SetIcon\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_wxDataViewIconText){ references = &((wxDataViewIconText_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* icon0 = 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 'O' (&icon0, php_wxIcon_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &icon0, php_wxIcon_entry ) == SUCCESS) { if(arguments_received >= 1){ 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_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(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 wxDataViewIconText::SetIcon(*(wxIcon*) object_pointer0_0)\n\n"); #endif ((wxDataViewIconText_php*)_this)->SetIcon(*(wxIcon*) object_pointer0_0); references->AddReference(icon0); return; break; } } } } PHP_METHOD(php_wxDataViewIconText, SetText) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewIconText::SetText\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 wxDataViewIconText::SetText\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_wxDataViewIconText){ references = &((wxDataViewIconText_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 char* text0; long text_len0; 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 's' (&text0, &text_len0)\n"); #endif char parse_parameters_string[] = "s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &text0, &text_len0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxDataViewIconText::SetText(wxString(text0, wxConvUTF8))\n\n"); #endif ((wxDataViewIconText_php*)_this)->SetText(wxString(text0, wxConvUTF8)); return; break; } } } } PHP_METHOD(php_wxDataViewIconText, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxDataViewIconText::__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 char* text0; long text_len0; zval* icon0 = 0; void* object_pointer0_1 = 0; bool overload0_called = false; //Parameters for overload 1 zval* other1 = 0; void* object_pointer1_0 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 0 && arguments_received <= 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '|sO' (&text0, &text_len0, &icon0, php_wxIcon_entry)\n"); #endif char parse_parameters_string[] = "|sO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &text0, &text_len0, &icon0, php_wxIcon_entry ) == SUCCESS) { if(arguments_received >= 2){ 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_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_1 ) { goto overload1; } } else if(Z_TYPE_P(icon0) != IS_NULL) { goto overload1; } } 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' (&other1, php_wxDataViewIconText_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &other1, php_wxDataViewIconText_entry ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(other1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(other1), _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(other1) != 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 wxDataViewIconText_php(); ((wxDataViewIconText_php*) _this)->references.Initialize(); break; } case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(text0, wxConvUTF8))\n"); #endif _this = new wxDataViewIconText_php(wxString(text0, wxConvUTF8)); ((wxDataViewIconText_php*) _this)->references.Initialize(); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_1)\n"); #endif _this = new wxDataViewIconText_php(wxString(text0, wxConvUTF8), *(wxIcon*) object_pointer0_1); ((wxDataViewIconText_php*) _this)->references.Initialize(); ((wxDataViewIconText_php*) _this)->references.AddReference(icon0); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct(*(wxDataViewIconText*) object_pointer1_0)\n"); #endif _this = new wxDataViewIconText_php(*(wxDataViewIconText*) object_pointer1_0); ((wxDataViewIconText_php*) _this)->references.Initialize(); ((wxDataViewIconText_php*) _this)->references.AddReference(other1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxDataViewIconText); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxDataViewIconText_php*) _this)->evnArray); array_init(((wxDataViewIconText_php*) _this)->evnArray); ((wxDataViewIconText_php*) _this)->phpObj = getThis(); ((wxDataViewIconText_php*) _this)->InitProperties(); #ifdef ZTS ((wxDataViewIconText_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 }
cb58c82306aae4b43b863e8d36ba2175df43e624
b7b18b312fc0e2bd51b03ed1e6efc643edefc599
/duplicate.cpp
88d775df493c84dc8512f652729707879ff30aab
[]
no_license
IgorRas/studia_przed_spec
43c367e8a7399e85de85fd449189a930044ea1e3
925302da13287b48941521be02ca7a87a766ffdd
refs/heads/main
2023-08-13T10:29:08.078983
2021-10-19T00:14:40
2021-10-19T00:14:40
418,700,324
0
0
null
null
null
null
UTF-8
C++
false
false
873
cpp
duplicate.cpp
#include <algorithm> #include <iostream> #include <vector> //Wczytuje liczby //Wypisuje powtarzajoce sie std::vector<int> function1(std::vector<int> vector) { std::vector<int> koniec; for (auto ite = vector.begin(); ite < vector.end(); ++ite) { std::vector<int>::iterator it, it1; it = std::adjacent_find(vector.begin(), vector.end()); if(it!=vector.end()){ it1 = std::find_if(koniec.begin(), koniec.end(), [it](int x) { return x==*it; } ); if(it1==koniec.end()){ koniec.push_back(*it); } vector.erase(it); } } return koniec; } int main () { int x; std::vector<int> numbers; for(;std::cin>>x;) numbers.push_back(x); std::sort(numbers.begin(), numbers.end()); std::vector<int> koniec1 = function1(numbers); for (auto ite = koniec1.begin(); ite < koniec1.end(); ++ite) std::cout << *ite << ' ' ; }
a86dcd54474913f72c088d52817acd73b865dbe0
ce97830743a2da78b698e597fdf36b017b3fd455
/КП.cpp
a8b9787c7743c54dd61d32a1220b6094975873c3
[]
no_license
LSTAlex/Guap-2019-KP
99294fc964cc9c4ee4bccd043dadc3fa457eef42
29745b6424c94db9a8310e054adffcf2d96f9de8
refs/heads/main
2023-04-11T09:33:16.165399
2021-04-12T10:41:15
2021-04-12T10:41:15
357,153,223
0
0
null
null
null
null
UTF-8
C++
false
false
7,163
cpp
КП.cpp
#include <iostream> #include <iomanip> // Манипуляторы ввода-вывода (табличная печать) #include <fstream> #include <vector> #include <string> #include <algorithm> #include <Windows.h> using namespace std; // Ввод строки, пробелы заменяются на подчеркивания string input_string() { string s; getline(cin, s); // Заменим все пробелы на подчеркивание for (size_t i = 0; i < s.size(); i++) { if (s[i] == ' ' || s[i] == '\t') s[i] = '_'; } return s; } bool is_number(string s) { for (size_t i = 0; i < s.size(); i++) { if (s[i] < '0' || s[i]>'9') { return false; } } return true; } int is_number1(string s) { int n; for (size_t i = 0; i < s.size(); i++) { if (s[i] < '0' || s[i]>'9') { size_t sz; n = stoi(s, &sz); } } return n; } // ввод числа с проверкой, если не число, то повторный ввод int input_int() { while (1) { string s; getline(cin, s); if (!s.empty()) { if (is_number(s)) { size_t sz; int value = stoi(s, &sz); return value; } } cout << "Ошибка: ожидается число!" << endl; } } //------------------------------------------------- struct Aeroflot { string destination; int flight_id; string plane_type; void print() const { // setw - задает ширину поля для вывода cout << left; cout << setw(20) << destination; cout << setw(15) << flight_id; cout << setw(20) << plane_type << endl; } }; class Database { vector<Aeroflot> flight; public: void load(); void print(); void append(); void find(string destination); void save(); void sort_by_destination(); void remove(int id); void edit(int id); bool flight_id_exists(int id); }; void menu() // ф-ция для вывода пунктов меню в консоль { cout << "0. Выйти из программы" << endl; cout << "1. Загрузить из файла" << endl; cout << "2. Печать рейсов" << endl; cout << "3. Добавить рейс" << endl; cout << "4. Найти рейс по пункту назначения" << endl; cout << "5. Сохранить в файл" << endl; cout << "6. Сортировать по пункту назначения" << endl; cout << "7. Удалить рейс по номеру" << endl; cout << "8. Изменить рейс по номеру" << endl; cout << endl; } void Database::load() { ifstream fin("input.txt"); if (!fin) { cout << "Ошибка: не могу открыть файл!" << endl; return; } flight.clear(); int n; fin >> n; if (!fin.good()) { cout << "Ошибка формата файла или пустой файл!" << endl; return; } if (n == 0) { cout << "В файле нет записей" << endl; } for (int i = 0; i < n; i++) { Aeroflot f; fin >> f.destination; string str_id; fin >> str_id; if (is_number(str_id)) { size_t sz; f.flight_id = stoi(str_id, &sz); if (flight_id_exists(f.flight_id)) { fin >> f.plane_type; continue; } } else { fin >> f.plane_type; continue; } fin >> f.plane_type; flight.push_back(f); } fin.close(); } void Database::print() { cout << left; cout << setw(20) << "Пункт назначения"; cout << setw(15) << "Номер рейса"; cout << setw(20) << "Тип самолета" << endl; for (size_t i = 0; i < flight.size(); i++) { flight[i].print(); } cout << endl; } bool Database::flight_id_exists(int id) { // Проверим, что рейса с таким номером еще нет for (int i = 0; i < flight.size(); i++) { if (flight[i].flight_id == id) { return true; // рейс найден } } return false; } void Database::append() { Aeroflot f; cout << "Номер рейса: "; f.flight_id = input_int(); if (flight_id_exists(f.flight_id)) { cout << "Ошибка: рейс с таким номером уже есть!" << endl; return; } cout << "Пункт назначения: "; f.destination = input_string(); cout << "Тип самолета: "; f.plane_type = input_string(); flight.push_back(f); } void Database::find(string destination) { for (const auto& f : flight) { if (f.destination == destination) { f.print(); } } } void Database::remove(int id) { auto it = flight.begin(); for (; it != flight.end(); ++it) { if (it->flight_id == id) break; } if (it != flight.end()) flight.erase(it); else cout << "Удаляемый рейс не найден!" << endl; } void Database::edit(int id) { auto it = flight.begin(); for (; it != flight.end(); ++it) { if (it->flight_id == id) break; } if (it != flight.end()) { Aeroflot f; cout << "Пункт назначения: "; f.destination = input_string(); do { cout << "Номер рейса: "; f.flight_id = input_int(); if (flight_id_exists(f.flight_id) && f.flight_id != it->flight_id) { cout << "Ошибка: рейс с таким номером уже есть!" << endl; } else break; } while (1); cout << "Тип самолета: "; f.plane_type = input_string(); *it = f; } else cout << "Редактируемый рейс не найден!" << endl; } void Database::save() { ofstream fout("input.txt"); int n = flight.size(); fout << n << endl; for (const auto& f : flight) { fout << f.destination << "\t" << f.flight_id << "\t" << f.plane_type << endl; } fout.close(); } bool compareByDestination(const Aeroflot& a1, const Aeroflot& a2) { return a1.destination < a2.destination; } void Database::sort_by_destination() { sort(flight.begin(), flight.end(), compareByDestination); } int main() { setlocale(LC_ALL, "Russian"); SetConsoleCP(1251); // Ввод с консоли в кодировке 1251 SetConsoleOutputCP(1251); Database db; string n; int num; int choise = 0; do { menu(); cin >> choise; cin.get(); switch (choise) { case 1: db.load(); break; case 2: db.print(); break; case 3: db.append(); break; case 4: cout << "Введите пункт назначения искомого рейса: "; //cin >> n; n = input_string(); db.find(n); break; case 5: db.save(); break; case 6: db.sort_by_destination(); break; case 7: cout << "Введите номер удаляемого рейса: "; num = input_int(); db.remove(num); break; case 8: cout << "Введите номер редактируемого рейса: "; int num = input_int(); db.edit(num); break; } } while (choise != 0); return 0; }
1f86ca9d0c9f26ab83ca164ac0c62fe1491aa09d
028173f576b5f2364b800bbfca3dc6be8a238bc3
/include/asio2/util/event_dispatcher.hpp
b1d030156066cfe06eb7cf632568eec417194eb3
[ "ICU", "BSL-1.0" ]
permissive
zhllxt/asio2
ca6f98b0c599ebb3eeb13cd79ddb9db6e8ca3666
ac8c79964d79020091e38fcbb4ae9dccccb3b03c
refs/heads/main
2023-09-02T18:56:45.036564
2023-05-09T04:57:23
2023-05-09T04:57:23
108,554,985
636
166
BSL-1.0
2023-04-10T09:27:16
2017-10-27T14:17:35
C++
UTF-8
C++
false
false
59,641
hpp
event_dispatcher.hpp
// eventpp library // Copyright (C) 2018 Wang Qi (wqking) // Github: https://github.com/wqking/eventpp // 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. /* * This code is modified from eventpp * * author : zhllxt * email : 37792738@qq.com * */ //{ // std::cout << std::endl << "event_dispatcher tutorial 1, basic" << std::endl; // // // The namespace is asio2 // // The first template parameter int is the event type, // // the event type can be any type such as std::string, int, etc. // // The second is the prototype of the listener. // asio2::event_dispatcher<int, void ()> dispatcher; // // // Add a listener. As the type of dispatcher, // // here 3 and 5 is the event type, // // []() {} is the listener. // // Lambda is not required, any function or std::function // // or whatever function object with the required prototype is fine. // dispatcher.append_listener(3, []() { // std::cout << "Got event 3." << std::endl; // }); // dispatcher.append_listener(5, []() { // std::cout << "Got event 5." << std::endl; // }); // dispatcher.append_listener(5, []() { // std::cout << "Got another event 5." << std::endl; // }); // // // Dispatch the events, the first argument is always the event type. // dispatcher.dispatch(3); // dispatcher.dispatch(5); //} // //{ // std::cout << std::endl << "event_dispatcher tutorial 2, listener with parameters" << std::endl; // // // The listener has two parameters. // asio2::event_dispatcher<int, void (const std::string &, const bool)> dispatcher; // // dispatcher.append_listener(3, [](const std::string & s, const bool b) { // std::cout << std::boolalpha << "Got event 3, s is " << s << " b is " << b << std::endl; // }); // // The listener prototype doesn't need to be exactly same as the dispatcher. // // It would be find as long as the arguments is compatible with the dispatcher. // dispatcher.append_listener(5, [](std::string s, int b) { // std::cout << std::boolalpha << "Got event 5, s is " << s << " b is " << b << std::endl; // }); // dispatcher.append_listener(5, [](const std::string & s, const bool b) { // std::cout << std::boolalpha << "Got another event 5, s is " << s << " b is " << b << std::endl; // }); // // // Dispatch the events, the first argument is always the event type. // dispatcher.dispatch(3, "Hello", true); // dispatcher.dispatch(5, "World", false); //} // //{ // std::cout << std::endl << "event_dispatcher tutorial 3, customized Event struct" << std::endl; // // // Define an Event to hold all parameters. // struct MyEvent // { // int type; // std::string message; // int param; // }; // // // Define policies to let the dispatcher knows how to // // extract the event type. // struct MyEventPolicies // { // static int get_event(const MyEvent & e, bool /*b*/) // { // return e.type; // } // // // single_thread, free lock // using thread_t = asio2::dispatcheres::single_thread; // }; // // // Pass MyEventPolicies as the third template argument of event_dispatcher. // // Note: the first template argument is the event type type int, not MyEvent. // asio2::event_dispatcher< // int, // void (const MyEvent &, bool), // MyEventPolicies // > dispatcher; // // // Add a listener. // // Note: the first argument is the event type of type int, not MyEvent. // dispatcher.append_listener(3, [](const MyEvent & e, bool b) { // std::cout // << std::boolalpha // << "Got event 3" << std::endl // << "Event::type is " << e.type << std::endl // << "Event::message is " << e.message << std::endl // << "Event::param is " << e.param << std::endl // << "b is " << b << std::endl // ; // }); // // // Dispatch the event. // // The first argument is Event. // dispatcher.dispatch(MyEvent { 3, "Hello world", 38 }, true); //} // //struct Tutor4MyEvent { // Tutor4MyEvent() : type(0), canceled(false) // { // } // explicit Tutor4MyEvent(const int type) // : type(type), canceled(false) // { // } // // int type; // mutable bool canceled; //}; // //struct Tutor4MyEventPolicies //{ // // E is Tutor4MyEvent and get_event doesn't need to be template. // // We make it template to show get_event can be templated member. // template <typename E> // static int get_event(const E & e) // { // return e.type; // } // // // E is Tutor4MyEvent and can_continue_invoking doesn't need to be template. // // We make it template to show can_continue_invoking can be templated member. // template <typename E> // static bool can_continue_invoking(const E & e) // { // return ! e.canceled; // } //}; // //{ // std::cout << std::endl << "event_dispatcher tutorial 4, event canceling" << std::endl; // // asio2::event_dispatcher<int, void (const Tutor4MyEvent &), Tutor4MyEventPolicies> dispatcher; // // dispatcher.append_listener(3, [](const Tutor4MyEvent & e) { // std::cout << "Got event 3" << std::endl; // e.canceled = true; // }); // dispatcher.append_listener(3, [](const Tutor4MyEvent & /*e*/) { // std::cout << "Should not get this event 3" << std::endl; // }); // // dispatcher.dispatch(Tutor4MyEvent(3)); //} // //{ // std::cout << std::endl << "event_dispatcher tutorial 5, event filter" << std::endl; // // struct MyPolicies { // using mixins_t = asio2::dispatcheres::mixin_list<asio2::dispatcheres::mixin_filter>; // }; // asio2::event_dispatcher<int, void (int e, int i, std::string), MyPolicies> dispatcher; // // dispatcher.append_listener(3, [](const int /*e*/, const int i, const std::string & s) { // std::cout // << "Got event 3, i was 1 but actural is " << i // << " s was Hello but actural is " << s // << std::endl // ; // }); // dispatcher.append_listener(5, [](const int /*e*/, const int /*i*/, const std::string & /*s*/) { // std::cout << "Shout not got event 5" << std::endl; // }); // // // Add three event filters. // // // The first filter modifies the input arguments to other values, then the subsequence filters // // and listeners will see the modified values. // dispatcher.append_filter([](const int e, int & i, std::string & s) -> bool { // std::cout << "Filter 1, e is " << e << " passed in i is " << i << " s is " << s << std::endl; // i = 38; // s = "Hi"; // std::cout << "Filter 1, changed i is " << i << " s is " << s << std::endl; // return true; // }); // // // The second filter filters out all event of 5. So no listeners on event 5 can be triggered. // // The third filter is not invoked on event 5 also. // dispatcher.append_filter([](const int e, int & i, std::string & s) -> bool { // std::cout << "Filter 2, e is " << e << " passed in i is " << i << " s is " << s << std::endl; // if(e == 5) { // return false; // } // return true; // }); // // // The third filter just prints the input arguments. // dispatcher.append_filter([](const int e, int & i, std::string & s) -> bool { // std::cout << "Filter 3, e is " << e << " passed in i is " << i << " s is " << s << std::endl; // return true; // }); // // // Dispatch the events, the first argument is always the event type. // dispatcher.dispatch(3, 1, "Hello"); // dispatcher.dispatch(5, 2, "World"); //} #ifndef __ASIO2_EVENT_DISPATCHER_HPP__ #define __ASIO2_EVENT_DISPATCHER_HPP__ #include <cassert> #include <string> #include <functional> #include <type_traits> #include <mutex> #include <shared_mutex> #include <memory> #include <utility> #include <tuple> #include <atomic> #include <condition_variable> #include <map> #include <unordered_map> #include <list> #include <thread> #include <initializer_list> #include <vector> #include <optional> // when compiled with "Visual Studio 2017 - Windows XP (v141_xp)" // there is hasn't shared_mutex #ifndef ASIO2_HAS_SHARED_MUTEX #if defined(_MSC_VER) #if defined(_HAS_SHARED_MUTEX) #if _HAS_SHARED_MUTEX #define ASIO2_HAS_SHARED_MUTEX 1 #define asio2_shared_mutex std::shared_mutex #define asio2_shared_lock std::shared_lock #define asio2_unique_lock std::unique_lock #else #define ASIO2_HAS_SHARED_MUTEX 0 #define asio2_shared_mutex std::mutex #define asio2_shared_lock std::lock_guard #define asio2_unique_lock std::lock_guard #endif #else #define ASIO2_HAS_SHARED_MUTEX 1 #define asio2_shared_mutex std::shared_mutex #define asio2_shared_lock std::shared_lock #define asio2_unique_lock std::unique_lock #endif #else #define ASIO2_HAS_SHARED_MUTEX 1 #define asio2_shared_mutex std::shared_mutex #define asio2_shared_lock std::shared_lock #define asio2_unique_lock std::unique_lock #endif #endif namespace asio2 { namespace dispatcheres { template <typename F, template <typename> class T> struct transform_arguments; template <template <typename> class T, typename RT, typename ...Args> struct transform_arguments <RT (Args...), T> { using type = RT (typename T<Args>::type...); }; template <typename F, typename Replacement> struct replace_return_type; template <typename Replacement, typename RT, typename ...Args> struct replace_return_type <RT (Args...), Replacement> { using type = Replacement (Args...); }; template <int N, int M> struct int_to_constant_helper { template <typename C, typename ...Args> static auto find(const int index, C && c, Args && ...args) -> decltype(std::declval<C>().template operator()<0>(std::declval<Args>()...)) { if(N == index) { return c.template operator()<N>(std::forward<Args>(args)...); } else { return int_to_constant_helper<N + 1, M>::find(index, std::forward<C>(c), std::forward<Args>(args)...); } } }; template <int M> struct int_to_constant_helper <M, M> { template <typename C, typename ...Args> static auto find(const int /*index*/, C && c, Args && ...args) -> decltype(std::declval<C>().template operator()<0>(std::declval<Args>()...)) { return decltype(c.template operator()<0>(std::forward<Args>(args)...))(); } }; template <int M, typename C, typename ...Args> auto int_to_constant(const int index, C && c, Args && ...args) -> decltype(std::declval<C>().template operator()<0>(std::declval<Args>()...)) { return int_to_constant_helper<0, M>::find(index, std::forward<C>(c), std::forward<Args>(args)...); } template <typename F, typename ...Args> struct can_invoke { template <typename U, typename ...X> static auto invoke(int) -> decltype(std::declval<U>()(std::declval<X>()...), std::true_type()); template <typename U, typename ...X> static auto invoke(...) -> std::false_type; enum { value = !! decltype(invoke<F, Args...>(0))() }; }; template <typename T> struct shift_tuple; template <typename A, typename ...Args> struct shift_tuple <std::tuple<A, Args...> > { using type = std::tuple<Args...>; }; template <> struct shift_tuple <std::tuple<> > { using type = std::tuple<>; }; // for compile time debug template<typename T> void print_type_in_compile_time(T * = 0) { static_assert(std::is_same<T, int>::value && ! std::is_same<T, int>::value, "The error shows the type name."); } template<int N> void print_int_in_compile_time() { int n = 0; switch(n) { case N: case N: break; }; } } //namespace dispatcheres //------------------------------------------------------------------------------------------------- namespace dispatcheres { struct tag_homo {}; struct tag_callback_list : public tag_homo {}; struct tag_event_dispatcher : public tag_homo {}; struct tag_event_queue : public tag_homo {}; template < typename MutexT = asio2_shared_mutex, template <typename > class SharedLockT = asio2_shared_lock, template <typename > class UniqueLockT = asio2_unique_lock, template <typename > class AtomicT = std::atomic, typename ConditionVariableT = std::condition_variable > struct general_thread { using mutex = MutexT; template <typename T> using shared_lock = SharedLockT<T>; template <typename T> using unique_lock = UniqueLockT<T>; template <typename T> using atomic = AtomicT<T>; using condition_variable = ConditionVariableT; }; struct multiple_thread { using mutex = asio2_shared_mutex; template <typename T> using shared_lock = asio2_shared_lock<T>; template <typename T> using unique_lock = asio2_unique_lock<T>; template <typename T> using atomic = std::atomic<T>; using condition_variable = std::condition_variable; }; struct single_thread { struct mutex { inline void lock () noexcept {} inline void unlock() noexcept {} }; template <typename T> struct shared_lock { using mutex_type = T; inline shared_lock() noexcept = default; inline shared_lock(shared_lock&& other) noexcept = default; inline explicit shared_lock(mutex_type&) noexcept {} inline ~shared_lock() noexcept {}; inline void lock () noexcept {} inline void unlock() noexcept {} }; template <typename T> struct unique_lock { using mutex_type = T; inline unique_lock() noexcept = default; inline unique_lock(unique_lock&& other) noexcept = default; inline explicit unique_lock(mutex_type&) noexcept {} inline ~unique_lock() noexcept {}; inline void lock () noexcept {} inline void unlock() noexcept {} }; template <typename T> struct atomic { inline atomic() = default; constexpr atomic(T desired) noexcept : value(desired) { } inline void store(T desired, std::memory_order /*order*/ = std::memory_order_seq_cst) noexcept { value = desired; } inline T load(std::memory_order /*order*/ = std::memory_order_seq_cst) const noexcept { return value; } inline T exchange(T desired, std::memory_order /*order*/ = std::memory_order_seq_cst) noexcept { const T old = value; value = desired; return old; } inline T operator ++ () noexcept { return ++value; } inline T operator -- () noexcept { return --value; } T value{}; }; struct condition_variable { inline void notify_one() noexcept { } template <class Predicate> inline void wait(std::unique_lock<std::mutex> & /*lock*/, Predicate /*pred*/) noexcept { } template <class Rep, class Period, class Predicate> inline bool wait_for(std::unique_lock<std::mutex> & /*lock*/, const std::chrono::duration<Rep, Period> & /*rel_time*/, Predicate /*pred*/) noexcept { return true; } }; }; struct argument_passing_auto_detect { enum { can_include_event_type = true, can_exclude_event_type = true }; }; struct argument_passing_include_event { enum { can_include_event_type = true, can_exclude_event_type = false }; }; struct argument_passing_exclude_event { enum { can_include_event_type = false, can_exclude_event_type = true }; }; struct default_policy { }; template <template <typename> class ...user_mixins> struct mixin_list { }; } //namespace dispatcheres //------------------------------------------------------------------------------------------------- namespace dispatcheres { template <typename T> struct has_type_argument_passing_mode { template <typename C> static std::true_type test(typename C::argument_passing_mode *) ; template <typename C> static std::false_type test(...); enum { value = !! decltype(test<T>(0))() }; }; template <typename T, bool, typename Default> struct select_argument_passing_mode { using type = typename T::argument_passing_mode; }; template <typename T, typename Default> struct select_argument_passing_mode <T, false, Default> { using type = Default; }; // https://en.cppreference.com/w/cpp/types/void_t // primary template handles types that have no nested ::type member: template< class, class = void > struct has_type_thread_t : std::false_type { }; // specialization recognizes types that do have a nested ::type member: template< class T > struct has_type_thread_t<T, std::void_t<typename T::thread_t>> : std::true_type { }; template <typename T, bool> struct select_thread { using type = typename T::thread_t; }; template <typename T> struct select_thread <T, false> { using type = multiple_thread; }; // primary template handles types that have no nested ::type member: template< class, class = void > struct has_type_callback_t : std::false_type { }; // specialization recognizes types that do have a nested ::type member: template< class T > struct has_type_callback_t<T, std::void_t<typename T::callback_t>> : std::true_type { }; template <typename T, bool, typename D> struct select_callback { using type = typename T::callback_t; }; template <typename T, typename D> struct select_callback<T, false, D> { using type = D; }; // primary template handles types that have no nested ::type member: template< class, class = void > struct has_type_user_data_t : std::false_type { }; // specialization recognizes types that do have a nested ::type member: template< class T > struct has_type_user_data_t<T, std::void_t<typename T::user_data_t>> : std::true_type { }; // primary template handles types that have no nested ::type member: template< class, class = void > struct has_type_listener_name_t : std::false_type { }; // specialization recognizes types that do have a nested ::type member: template< class T > struct has_type_listener_name_t<T, std::void_t<typename T::listener_name_t>> : std::true_type { }; template <typename T, bool, typename D> struct select_listener_name { using type = typename T::listener_name_t; }; template <typename T, typename D> struct select_listener_name<T, false, D> { using type = D; }; template <typename T, typename ...Args> struct has_function_get_event { template <typename C> static std::true_type test(decltype(C::get_event(std::declval<Args>()...)) *); template <typename C> static std::false_type test(...); enum { value = !! decltype(test<T>(0))() }; }; template <typename E> struct default_get_event { template <typename U, typename ...Args> static E get_event(U && e, Args && ...) { return e; } }; template <typename T, typename Key, bool> struct select_get_event { using type = T; }; template <typename T, typename Key> struct select_get_event<T, Key, false> { using type = default_get_event<Key>; }; template <typename T, typename ...Args> struct has_function_can_continue_invoking { template <typename C> static std::true_type test(decltype(C::can_continue_invoking(std::declval<Args>()...)) *) ; template <typename C> static std::false_type test(...); enum { value = !! decltype(test<T>(0))() }; }; struct default_can_continue_invoking { template <typename ...Args> static bool can_continue_invoking(Args && ...) { return true; } }; template <typename T, bool> struct select_can_continue_invoking { using type = T; }; template <typename T> struct select_can_continue_invoking<T, false> { using type = default_can_continue_invoking; }; template <typename T> struct has_template_map_t { template <typename C> static std::true_type test(typename C::template map_t<int, int> *) ; template <typename C> static std::false_type test(...); enum { value = !! decltype(test<T>(0))() }; }; template <typename T> class has_std_hash { template <typename C> static std::true_type test(decltype(std::hash<C>()(std::declval<C>())) *) ; template <typename C> static std::false_type test(...); public: enum { value = !! decltype(test<T>(0))() }; }; template <typename Key, typename Value, typename T, bool> struct select_map { using type = typename T::template map_t<Key, Value>; }; template <typename Key, typename Value, typename T> struct select_map<Key, Value, T, false> { using type = typename std::conditional< has_std_hash<Key>::value, std::unordered_map<Key, Value>, std::map<Key, Value> >::type; }; template <typename ListenerNameType, typename EventType, typename Value, typename T, bool> struct select_listener_name_map { using type = typename T::template map_t<ListenerNameType, typename T::template map_t<EventType, Value>>; }; template <typename ListenerNameType, typename EventType, typename Value, typename T> struct select_listener_name_map<ListenerNameType, EventType, Value, T, false> { using type = typename std::conditional< has_std_hash<ListenerNameType>::value, typename std::conditional_t< has_std_hash<EventType>::value, std::unordered_map<ListenerNameType, std::unordered_multimap<EventType, Value>>, std::unordered_map<ListenerNameType, std::multimap<EventType, Value>> >, typename std::conditional_t< has_std_hash<EventType>::value, std::map<ListenerNameType, std::unordered_multimap<EventType, Value>>, std::map<ListenerNameType, std::multimap<EventType, Value>> > >::type; }; template <typename T> struct has_template_queue_list_t { template <typename C> static std::true_type test(typename C::template queue_list_t<int> *); template <typename C> static std::false_type test(...); enum { value = !! decltype(test<T>(0))() }; }; template <typename Value, typename T, bool> struct select_queue_list { using type = typename T::template queue_list_t<Value>; }; template <typename Value, typename T> struct select_queue_list<Value, T, false> { using type = std::list<Value>; }; template <typename T> struct has_type_mixins_t { template <typename C> static std::true_type test(typename C::mixins_t *) ; template <typename C> static std::false_type test(...); enum { value = !! decltype(test<T>(0))() }; }; template <typename T, bool> struct select_mixins { using type = typename T::mixins_t; }; template <typename T> struct select_mixins <T, false> { using type = mixin_list<>; }; template <typename Root, typename TList> struct inherit_mixins; template <typename Root, template <typename> class T, template <typename> class ...Args> struct inherit_mixins <Root, mixin_list<T, Args...> > { using type = T <typename inherit_mixins<Root, mixin_list<Args...> >::type>; }; template <typename Root> struct inherit_mixins <Root, mixin_list<> > { using type = Root; }; template <typename Root, typename TList, typename Func> struct for_each_mixins; template <typename Func, typename Root, template <typename> class T, template <typename> class ...Args> struct for_each_mixins <Root, mixin_list<T, Args...>, Func> { using type = typename inherit_mixins<Root, mixin_list<T, Args...> >::type; template <typename ...A> static bool for_each(A && ...args) { if(Func::template for_each<type>(args...)) { return for_each_mixins<Root, mixin_list<Args...>, Func>::for_each(std::forward<A>(args)...); } return false; } }; template <typename Root, typename Func> struct for_each_mixins <Root, mixin_list<>, Func> { using type = Root; template <typename ...A> static bool for_each(A && .../*args*/) { return true; } }; template <typename T, typename ...Args> struct has_function_mixin_before_dispatch { template <typename C> static std::true_type test( decltype(std::declval<C>().mixin_before_dispatch(std::declval<Args>()...)) * ); template <typename C> static std::false_type test(...); enum { value = !! decltype(test<T>(0))() }; }; } //namespace dispatcheres //------------------------------------------------------------------------------------------------- namespace dispatcheres { template < typename EventTypeT, typename ProtoType, typename PolicyType > class callback_list_base; template < typename EventTypeT, typename PrototypeT, typename PolicyT, typename MixinRootT > class event_dispatcher_base; template < typename EventTypeT, typename PolicyType, bool HasTypeUserData, typename ProtoType > class node_traits; template < typename EventTypeT, typename PolicyType, typename ReturnType, typename ...Args > class node_traits< EventTypeT, PolicyType, true, ReturnType (Args...) > { private: template < typename, typename, typename > friend class callback_list_base; template < typename, typename, typename, typename > friend class event_dispatcher_base; public: using policy_type = PolicyType; using event_type = EventTypeT; using callback_type = typename select_callback< policy_type, has_type_callback_t<policy_type>::value, std::function<ReturnType (Args...)> >::type; using listener_name_type = typename select_listener_name< policy_type, has_type_listener_name_t<policy_type>::value, std::string_view >::type; using user_data_type = typename policy_type::user_data_t; struct node; using node_ptr = std::shared_ptr<node>; struct node { private: template < typename, typename, typename > friend class callback_list_base; template < typename, typename, typename, typename > friend class event_dispatcher_base; public: using counter_type = unsigned int; node(const listener_name_type& nm, const event_type& e, callback_type cb, const counter_type count) : evt(e), callback(std::move(cb)), counter(count), name(nm) { } inline const event_type get_event_type() const noexcept { return evt; } inline const listener_name_type get_listener_name() const noexcept { return name; } inline node& set_user_data(user_data_type data) noexcept { userdata = std::move(data); return (*this); } inline const user_data_type& get_user_data() const noexcept { return userdata; } protected: event_type evt; callback_type callback; counter_type counter; listener_name_type name{}; user_data_type userdata{}; node_ptr prev; node_ptr next; }; }; template < typename EventTypeT, typename PolicyType, typename ReturnType, typename ...Args > class node_traits< EventTypeT, PolicyType, false, ReturnType (Args...) > { private: template < typename, typename, typename > friend class callback_list_base; template < typename, typename, typename, typename > friend class event_dispatcher_base; public: using policy_type = PolicyType; using event_type = EventTypeT; using callback_type = typename select_callback< policy_type, has_type_callback_t<policy_type>::value, std::function<ReturnType (Args...)> >::type; using listener_name_type = typename select_listener_name< policy_type, has_type_listener_name_t<policy_type>::value, std::string_view >::type; using user_data_type = void; struct node; using node_ptr = std::shared_ptr<node>; struct node { private: template < typename, typename, typename > friend class callback_list_base; template < typename, typename, typename, typename > friend class event_dispatcher_base; public: using counter_type = unsigned int; node(const listener_name_type& nm, const event_type& e, callback_type cb, const counter_type count) : evt(e), callback(std::move(cb)), counter(count), name(nm) { } inline const event_type get_event_type() const noexcept { return evt; } inline const listener_name_type get_listener_name() const noexcept { return name; } protected: event_type evt; callback_type callback; counter_type counter; listener_name_type name{}; node_ptr prev; node_ptr next; }; }; template < typename EventTypeT, typename PolicyType, typename ReturnType, typename ...Args > class callback_list_base< EventTypeT, ReturnType (Args...), PolicyType > : public node_traits<EventTypeT, PolicyType, has_type_user_data_t<PolicyType>::value, ReturnType(Args...)> { private: template < typename, typename, typename, typename > friend class event_dispatcher_base; public: using node_traits_type = node_traits<EventTypeT, PolicyType, has_type_user_data_t<PolicyType>::value, ReturnType(Args...)>; using this_type = callback_list_base< EventTypeT, ReturnType(Args...), PolicyType >; using policy_type = PolicyType; using event_type = EventTypeT; using thread_type = typename select_thread<policy_type, has_type_thread_t<policy_type>::value>::type; using callback_type = typename node_traits_type::callback_type; using listener_name_type = typename node_traits_type::listener_name_type; using can_continue_invoking_type = typename select_can_continue_invoking< policy_type, has_function_can_continue_invoking<policy_type, Args...>::value >::type; using node = typename node_traits_type::node; using node_ptr = typename node_traits_type::node_ptr; class handle_type : public std::weak_ptr<node> { private: using super = std::weak_ptr<node>; public: using super::super; inline operator bool () const noexcept { return ! this->expired(); } }; using counter_type = typename node::counter_type; static constexpr counter_type removed_counter = 0; public: using node_wptr = handle_type; using mutex_type = typename thread_type::mutex; public: callback_list_base() noexcept : head() , tail() , list_mtx_() , current_counter_(0) { } callback_list_base(const callback_list_base & other) : callback_list_base() { size_ = other.size_; copy_from(other.head); } callback_list_base(callback_list_base && other) noexcept : callback_list_base() { swap(other); } // If we use pass by value idiom and omit the 'this' check, // when assigning to self there is a deep copy which is inefficient. callback_list_base & operator = (const callback_list_base & other) { if(this != &other) { callback_list_base copied(other); swap(copied); } return *this; } callback_list_base & operator = (callback_list_base && other) noexcept { if(this != &other) { do_free_all_nodes(); head = std::move(other.head); tail = std::move(other.tail); current_counter_ = other.current_counter_.load(); size_ = other.size_; } return *this; } ~callback_list_base() { // Don't lock mutex here since it may throw exception do_free_all_nodes(); } void swap(callback_list_base & other) noexcept { using std::swap; swap(head, other.head); swap(tail, other.tail); swap(size_, other.size_); const auto value = current_counter_.load(); current_counter_.exchange(other.current_counter_.load()); other.current_counter_.exchange(value); } inline bool empty() const noexcept { // Don't lock the mutex for performance reason. // !head still works even when the underlying raw pointer is garbled (for other thread is writting to head) // And empty() doesn't guarantee the list is still empty after the function returned. //std::lock_guard<mutex_type> guard(list_mtx_); return ! head; } inline operator bool() const noexcept { return ! empty(); } node_wptr append(const listener_name_type& name, const event_type& e, callback_type cb) { node_ptr n(do_allocate_node(name, e, std::move(cb))); typename thread_type::template unique_lock<mutex_type> guard(list_mtx_); if(head) { n->prev = tail; tail->next = n; tail = n; } else { head = n; tail = n; } ++size_; return node_wptr(n); } node_wptr prepend(const listener_name_type& name, const event_type& e, callback_type cb) { node_ptr n(do_allocate_node(name, e, std::move(cb))); typename thread_type::template unique_lock<mutex_type> guard(list_mtx_); if(head) { n->next = head; head->prev = n; head = n; } else { head = n; tail = n; } ++size_; return node_wptr(n); } node_wptr insert(const listener_name_type& name, const event_type& e, callback_type cb, const node_wptr & before) { node_ptr before_node = before.lock(); if(before_node) { node_ptr n(do_allocate_node(name, e, std::move(cb))); typename thread_type::template unique_lock<mutex_type> guard(list_mtx_); do_insert(n, before_node); ++size_; return node_wptr(n); } return append(name, e, std::move(cb)); } bool remove(const node_wptr & nwptr) { auto n = nwptr.lock(); if (n) { typename thread_type::template unique_lock<mutex_type> guard(list_mtx_); do_free_node(n); --size_; return true; } return false; } inline std::size_t size() const noexcept { return size_; } inline void clear() noexcept { callback_list_base other{}; swap(other); } protected: inline void iterator_move_to_next(node_ptr& n) noexcept { typename thread_type::template shared_lock<mutex_type> guard(list_mtx_); n = n->next; } inline void iterator_move_to_prev(node_ptr& n) noexcept { typename thread_type::template shared_lock<mutex_type> guard(list_mtx_); n = n->prev; } public: class iterator { public: using iterator_category = std::bidirectional_iterator_tag; using value_type = node_ptr; using difference_type = std::ptrdiff_t; using pointer = value_type&; using reference = value_type&; explicit iterator(this_type& m) : master_(m) { } explicit iterator(this_type& m, value_type v) : master_(m), value_(std::move(v)) { } explicit iterator(const this_type& m) : master_(const_cast<this_type&>(m)) { } explicit iterator(const this_type& m, value_type v) : master_(const_cast<this_type&>(m)), value_(std::move(v)) { } [[nodiscard]] reference operator*() noexcept { return value_; } [[nodiscard]] pointer operator->() noexcept { return value_; } iterator& operator++() noexcept { if (value_) { master_.iterator_move_to_next(value_); } return (*this); } iterator& operator--() noexcept { if (value_) { master_.iterator_move_to_prev(value_); } return (*this); } [[nodiscard]] bool operator==(const iterator& right) const { return (value_.get() == right.value_.get()); } [[nodiscard]] bool operator!=(const iterator& right) const { return (value_.get() != right.value_.get()); } protected: this_type& master_; value_type value_{}; }; using const_iterator = iterator; /// Return a const iterator to the beginning of the field sequence. inline iterator begin() noexcept { typename thread_type::template shared_lock<mutex_type> guard(list_mtx_); return iterator(*this, head); } /// Return a const iterator to the end of the field sequence. inline iterator end() noexcept { return iterator(*this); } /// Return a const iterator to the beginning of the field sequence. inline const_iterator begin() const noexcept { typename thread_type::template shared_lock<mutex_type> guard(list_mtx_); return (const_iterator(*this, head)); } /// Return a const iterator to the end of the field sequence. inline const_iterator end() const noexcept { return (const_iterator(*this)); } /// Return a const iterator to the beginning of the field sequence. inline const_iterator cbegin() const noexcept { return (begin()); } /// Return a const iterator to the end of the field sequence. inline const_iterator cend() const noexcept { return (end()); } template <typename Func> void for_each(Func && func) const { do_for_each_if([&func, this](node_ptr & n) -> bool { do_for_each_invoke<void>(func, n); return true; }); } template <typename Func> bool for_each_if(Func && func) const { return do_for_each_if([&func, this](node_ptr & n) -> bool { return do_for_each_invoke<bool>(func, n); }); } #if !defined(__GNUC__) || __GNUC__ >= 5 void operator() (Args ...args) const { for_each_if([&args...](callback_type & cb) -> bool { // We can't use std::forward here, because if we use std::forward, // for arg that is passed by value, and the callback prototype accepts it by value, // std::forward will move it and may cause the original value invalid. // That happens on any value-to-value passing, no matter the callback moves it or not. cb(args...); return can_continue_invoking_type::can_continue_invoking(args...); }); } #else // This is a patch version for GCC 4. It inlines the unrolled do_for_each_if. // GCC 4.8.3 doesn't supporting parameter pack catpure in lambda, see, // https://github.com/wqking/eventpp/issues/19 // This is a compromised patch for GCC 4, it may be not maintained or updated unless there are bugs. // We don't use the patch as main code because the patch generates longer code, and duplicated with do_for_each_if. void operator() (Args ...args) const { node_ptr n; { typename thread_type::template shared_lock<mutex_type> guard(list_mtx_); n = head; } const counter_type counter = current_counter_.load(std::memory_order_acquire); while(n) { if(n->counter != removed_counter && counter >= n->counter) { n->callback(args...); if(! can_continue_invoking_type::can_continue_invoking(args...)) { break; } } { typename thread_type::template shared_lock<mutex_type> guard(list_mtx_); n = n->next; } } } #endif private: template <typename F> bool do_for_each_if(F && f) const { node_ptr n; { typename thread_type::template shared_lock<mutex_type> guard(list_mtx_); n = head; } const counter_type counter = current_counter_.load(std::memory_order_acquire); while(n) { if(n->counter != removed_counter && counter >= n->counter) { if(! f(n)) { return false; } } { typename thread_type::template shared_lock<mutex_type> guard(list_mtx_); n = n->next; } } return true; } template <typename RT, typename Func> inline auto do_for_each_invoke(Func && func, node_ptr & n) const -> typename std::enable_if<can_invoke<Func, node_wptr, callback_type &>::value, RT>::type { return func(node_wptr(n), n->callback); } template <typename RT, typename Func> inline auto do_for_each_invoke(Func && func, node_ptr & n) const -> typename std::enable_if<can_invoke<Func, callback_type &>::value, RT>::type { return func(n->callback); } void do_insert(node_ptr & n, node_ptr & before_node) { n->prev = before_node->prev; n->next = before_node; if(before_node->prev) { before_node->prev->next = n; } before_node->prev = n; if(before_node == head) { head = n; } } inline node_ptr do_allocate_node(const listener_name_type& name, const event_type& e, callback_type cb) { return std::make_shared<node>(name, e, std::move(cb), get_next_counter()); } void do_free_node(const node_ptr & cn) { node_ptr & n = const_cast<node_ptr &>(cn); if(n->next) { n->next->prev = n->prev; } if(n->prev) { n->prev->next = n->next; } // Mark it as deleted, this must be before the assignment of head and tail below, // because node can be a reference to head or tail, and after the assignment, node // can be null pointer. n->counter = removed_counter; if(head == n) { head = n->next; } if(tail == n) { tail = n->prev; } // don't modify n->prev or n->next // because node may be still used in a loop. } void do_free_all_nodes() { node_ptr n = head; head.reset(); while(n) { node_ptr next = n->next; n->prev.reset(); n->next.reset(); n = next; } n.reset(); } counter_type get_next_counter() { counter_type result = ++current_counter_;; if(result == 0) { // overflow, let's reset all nodes' counters. { typename thread_type::template unique_lock<mutex_type> guard(list_mtx_); node_ptr n = head; while(n) { n->counter = 1; n = n->next; } } result = ++current_counter_; } return result; } void copy_from(const node_ptr & from_head) { node_ptr from_node(from_head); node_ptr n; const counter_type counter = get_next_counter(); while(from_node) { const node_ptr next_node(std::make_shared<node>(from_node->evt, from_node->callback, counter)); next_node->prev = n; if(n) { n->next = next_node; } else { n = next_node; head = n; } n = next_node; from_node = from_node->next; } tail = n; } private: node_ptr head; node_ptr tail; mutable mutex_type list_mtx_; typename thread_type::template atomic<counter_type> current_counter_; std::size_t size_ = 0; }; } //namespace dispatcheres namespace dispatcheres { template < typename EventTypeT, typename PrototypeT, typename PolicyT = default_policy > class callback_list : public dispatcheres::callback_list_base<EventTypeT, PrototypeT, PolicyT>, public tag_callback_list { private: using super = dispatcheres::callback_list_base<EventTypeT, PrototypeT, PolicyT>; public: using super::super; friend void swap(callback_list & first, callback_list & second) noexcept { first.swap(second); } }; } //namespace dispatcheres //------------------------------------------------------------------------------------------------- namespace dispatcheres { template < typename EventTypeT, typename PolicyT, typename MixinRootT, typename ReturnType, typename ...Args > class event_dispatcher_base < EventTypeT, ReturnType (Args...), PolicyT, MixinRootT > { public: using this_type = event_dispatcher_base< EventTypeT, ReturnType (Args...), PolicyT, MixinRootT >; using mixin_root_type = typename std::conditional< std::is_same<MixinRootT, void>::value, this_type, MixinRootT >::type; using policy_type = PolicyT; using thread_type = typename select_thread<PolicyT, has_type_thread_t<PolicyT>::value>::type; using argument_passing_mode_type = typename select_argument_passing_mode< PolicyT, has_type_argument_passing_mode<PolicyT>::value, argument_passing_auto_detect >::type; using callback_type = typename select_callback< PolicyT, has_type_callback_t<PolicyT>::value, std::function<ReturnType (Args...)> >::type; using callback_list_type = callback_list<EventTypeT, ReturnType (Args...), PolicyT>; using listener_name_type = typename callback_list_type::listener_name_type; using proto_type = ReturnType (Args...); using map_type = typename select_map< EventTypeT, callback_list_type, PolicyT, has_template_map_t<PolicyT>::value >::type; using listener_name_map_type = typename select_listener_name_map< listener_name_type, EventTypeT, typename callback_list_type::node_wptr, PolicyT, has_template_map_t<PolicyT>::value >::type; using mixins_type = typename dispatcheres::select_mixins< PolicyT, dispatcheres::has_type_mixins_t<PolicyT>::value >::type; public: using listener_wptr = typename callback_list_type::node_wptr; using listener_type = listener_wptr; using event_type = EventTypeT; using mutex_type = typename thread_type::mutex; public: event_dispatcher_base() : listener_map_() , listener_mtx_() , listener_name_map_() { } event_dispatcher_base(const event_dispatcher_base & other) : listener_map_(other.listener_map_) , listener_mtx_() , listener_name_map_(other.listener_name_map_) { } event_dispatcher_base(event_dispatcher_base && other) noexcept : listener_map_(std::move(other.listener_map_)) , listener_mtx_() , listener_name_map_(std::move(other.listener_name_map_)) { } event_dispatcher_base & operator = (const event_dispatcher_base & other) { listener_map_ = other.listener_map_; listener_name_map_ = other.listener_name_map_; return *this; } event_dispatcher_base & operator = (event_dispatcher_base && other) noexcept { listener_map_ = std::move(other.listener_map_); listener_name_map_ = std::move(other.listener_name_map_); return *this; } void swap(event_dispatcher_base & other) noexcept { using std::swap; swap(listener_map_, other.listener_map_); swap(listener_name_map_, other.listener_name_map_); } listener_wptr append_listener(const event_type& e, callback_type cb) { return append_listener(listener_name_type{}, e, std::move(cb)); } std::vector<listener_wptr> append_listener(const std::initializer_list<event_type>& es, const callback_type& cb) { return append_listener(listener_name_type{}, es, cb); } listener_wptr prepend_listener(const event_type& e, callback_type cb) { return prepend_listener(listener_name_type{}, e, std::move(cb)); } std::vector<listener_wptr> prepend_listener(const std::initializer_list<event_type>& es, const callback_type& cb) { return prepend_listener(listener_name_type{}, es, cb); } listener_wptr insert_listener(const event_type& e, callback_type cb, const listener_wptr & before) { return insert_listener(listener_name_type{}, e, std::move(cb), before); } template<class Function> typename std::enable_if_t<can_invoke<Function, typename callback_list_type::node_ptr&>::value, listener_wptr> insert_listener(const event_type& e, callback_type cb, Function&& pred) { return insert_listener(listener_name_type{}, e, std::move(cb), std::forward<Function>(pred)); } listener_wptr append_listener(const listener_name_type& name, const event_type& e, callback_type cb) { typename thread_type::template unique_lock<mutex_type> guard(listener_mtx_); listener_wptr ptr = listener_map_[e].append(name, e, std::move(cb)); listener_name_map_[name].emplace(e, ptr); return ptr; } std::vector<listener_wptr> append_listener( const listener_name_type& name, const std::initializer_list<event_type>& es, const callback_type& cb) { typename thread_type::template unique_lock<mutex_type> guard(listener_mtx_); std::vector<listener_wptr> v; v.reserve(es.size()); for (auto& e : es) { listener_wptr ptr = listener_map_[e].append(name, e, cb); listener_name_map_[name].emplace(e, ptr); v.emplace_back(std::move(ptr)); } return v; } listener_wptr prepend_listener(const listener_name_type& name, const event_type & e, callback_type cb) { typename thread_type::template unique_lock<mutex_type> guard(listener_mtx_); listener_wptr ptr = listener_map_[e].prepend(name, e, std::move(cb)); listener_name_map_[name].emplace(e, ptr); return ptr; } std::vector<listener_wptr> prepend_listener( const listener_name_type& name, const std::initializer_list<event_type>& es, const callback_type& cb) { typename thread_type::template unique_lock<mutex_type> guard(listener_mtx_); std::vector<listener_wptr> v; v.reserve(es.size()); for (auto it = std::rbegin(es); it != std::rend(es); ++it) { listener_wptr ptr = listener_map_[*it].prepend(name, *it, cb); listener_name_map_[name].emplace(*it, ptr); v.emplace(v.begin(), std::move(ptr)); } return v; } listener_wptr insert_listener( const listener_name_type& name, const event_type& e, callback_type cb, const listener_wptr & before) { auto n = before.lock(); typename thread_type::template unique_lock<mutex_type> guard(listener_mtx_); if (n) { if (n->evt != e) { #if defined(_DEBUG) || defined(DEBUG) assert(false); #endif return listener_wptr(); } } listener_wptr ptr = listener_map_[e].insert(name, e, std::move(cb), before); listener_name_map_[name].emplace(e, ptr); return ptr; } /** * @param pred The check function, use to determin which listener of the new listener will be insert before * the "pred" Function signature : bool(auto& listener_ptr) * eg: * dispatcher.insert_listener("listener_a", 3, * []() * { * // this is the listener callback function * }, * [index](auto& listener_ptr) -> bool * { * // this is the check function * * return (index < listener_ptr->get_user_data()); * * // if this function return true , the new listener will be insert before "listener_ptr" * // if this function return false, then will be check the next listener in the list * // if all checks return false, then the new listener will be append after the tail. * } * ); */ template<class Function> typename std::enable_if_t<can_invoke<Function, typename callback_list_type::node_ptr&>::value, listener_wptr> insert_listener(const listener_name_type& name, const event_type & e, callback_type cb, Function&& pred) { typename thread_type::template unique_lock<mutex_type> guard(listener_mtx_); // Returns a reference to the value that is mapped to a key equivalent to key, // performing an insertion if such key does not already exist. callback_list_type& cblist = listener_map_[e]; for (auto it = cblist.begin(); it != cblist.end(); ++it) { if (pred(*it)) { listener_wptr ptr = cblist.insert(name, e, std::move(cb), *it); listener_name_map_[name].emplace(e, ptr); return ptr; } } listener_wptr ptr = cblist.append(name, e, std::move(cb)); listener_name_map_[name].emplace(e, ptr); return ptr; } bool remove_listener(const listener_wptr& listener) { auto n = listener.lock(); if (n) { typename thread_type::template unique_lock<mutex_type> guard(listener_mtx_); auto it1 = listener_name_map_.find(n->name); if (it1 != this->listener_name_map_.end()) { auto& inner_map = it1->second; auto&& [beg, end] = inner_map.equal_range(n->evt); for (auto it = beg; it != end; ++it) { if (it->second.lock().get() == n.get()) { inner_map.erase(it); break; } } if (inner_map.empty()) { listener_name_map_.erase(n->name); } } auto it2 = this->listener_map_.find(n->evt); if (it2 != this->listener_map_.end()) { callback_list_type& cblist = it2->second; bool r = cblist.remove(listener); if (cblist.empty()) { this->listener_map_.erase(n->evt); } return r; } } return false; } bool remove_listener(const listener_name_type& name, const event_type & e) { typename thread_type::template unique_lock<mutex_type> guard(listener_mtx_); auto it1 = this->listener_name_map_.find(name); auto it2 = this->listener_map_.find(e); if (it1 != this->listener_name_map_.end() && it2 != this->listener_map_.end()) { callback_list_type& cblist = it2->second; auto& inner_map = it1->second; auto&& [beg, end] = inner_map.equal_range(e); bool r = false; for (auto it = beg; it != end;) { r |= cblist.remove(it->second); it = inner_map.erase(it); } if (inner_map.empty()) { this->listener_name_map_.erase(name); } if (cblist.empty()) { this->listener_map_.erase(e); } return r; } return false; } bool remove_listener(const listener_name_type& name) { typename thread_type::template unique_lock<mutex_type> guard(listener_mtx_); auto it1 = listener_name_map_.find(name); if (it1 != this->listener_name_map_.end()) { bool r = false; auto& inner_map = it1->second; for (auto it = inner_map.begin(); it != inner_map.end();) { auto n = it->second.lock(); if (n) { auto it2 = this->listener_map_.find(n->evt); if (it2 != this->listener_map_.end()) { callback_list_type& cblist = it2->second; r |= cblist.remove(it->second); if (cblist.empty()) { this->listener_map_.erase(n->evt); } } } it = inner_map.erase(it); } if (inner_map.empty()) { listener_name_map_.erase(name); } return r; } return false; } void clear_listeners() noexcept { typename thread_type::template unique_lock<mutex_type> guard(listener_mtx_); for (auto& [e, cblist] : listener_map_) { std::ignore = e; cblist.clear(); } listener_map_.clear(); listener_name_map_.clear(); } std::size_t get_listener_count(const event_type& e) { const callback_list_type* callable_list = do_find_callable_list(e); if (callable_list) { return callable_list->size(); } return 0; } /** * Note : the "listener_name_type" maybe equal to the "event_type". * so we can't use this function overloading, but we can use the std::optional<event_type>. */ //std::size_t get_listener_count_by_name(const listener_name_type& name) {...} std::size_t get_listener_count(const listener_name_type& name, std::optional<event_type> e = std::nullopt) { if (listener_name_map_.empty()) return 0; typename thread_type::template shared_lock<mutex_type> guard(listener_mtx_); auto it = listener_name_map_.find(name); if (it != listener_name_map_.end()) { if (e.has_value()) return it->second.count(e.value()); else return it->second.size(); } return 0; } std::size_t get_listener_count() { if (listener_map_.empty()) return 0; std::size_t count = 0; typename thread_type::template shared_lock<mutex_type> guard(listener_mtx_); for (auto& [e, cblist] : listener_map_) { std::ignore = e; count += cblist.size(); } #if defined(_DEBUG) || defined(DEBUG) std::size_t count2 = 0; for (auto&[name, mulmap] : listener_name_map_) { std::ignore = name; count2 += mulmap.size(); } assert(count == count2); #endif return count; } bool has_any_listener(const event_type & e) const { const callback_list_type * callable_list = do_find_callable_list(e); if(callable_list) { return ! callable_list->empty(); } return false; } inline callback_list_type* find_listeners(const event_type & e) { return do_find_callable_list(e); } /** * @param pred Find the listener by user defined rule * the "pred" Function signature : bool(auto& listener_ptr) */ template<class Function> inline listener_wptr find_listener_if(const event_type & e, Function&& pred) { typename thread_type::template shared_lock<mutex_type> guard(listener_mtx_); auto it1 = this->listener_map_.find(e); if (it1 != this->listener_map_.end()) { callback_list_type& cblist = it1->second; for (auto it2 = cblist.begin(); it2 != cblist.end(); ++it2) { if (pred(*it2)) { return listener_wptr(*it2); } } } return listener_wptr(); } template <typename Func> void for_each(const event_type & e, Func && func) const { const callback_list_type * callable_list = do_find_callable_list(e); if(callable_list) { callable_list->for_each(std::forward<Func>(func)); } } template <typename Func> bool for_each_if(const event_type & e, Func && func) const { const callback_list_type * callable_list = do_find_callable_list(e); if (callable_list) { return callable_list->for_each_if(std::forward<Func>(func)); } return true; } void dispatch(Args ...args) const { static_assert(argument_passing_mode_type::can_include_event_type, "Dispatching arguments count doesn't match required (event type should be included)."); using get_event_t = typename select_get_event< PolicyT, EventTypeT, has_function_get_event<PolicyT, Args...>::value>::type; const event_type e = get_event_t::get_event(args...); direct_dispatch(e, std::forward<Args>(args)...); } template <typename T> void dispatch(T && first, Args ...args) const { static_assert(argument_passing_mode_type::can_exclude_event_type, "Dispatching arguments count doesn't match required (event type should NOT be included)."); using get_event_t = typename select_get_event< PolicyT, EventTypeT, has_function_get_event<PolicyT, T &&, Args...>::value>::type; const event_type e = get_event_t::get_event(std::forward<T>(first), args...); direct_dispatch(e, std::forward<Args>(args)...); } // Bypass any get_event policy. The first argument is the event type. // Most used for internal purpose. void direct_dispatch(const event_type & e, Args ...args) const { if(! dispatcheres::for_each_mixins<mixin_root_type, mixins_type, do_mixin_before_dispatch>::for_each( this, typename std::add_lvalue_reference<Args>::type(args)...)) { return; } const callback_list_type * callable_list = do_find_callable_list(e); if(callable_list) { (*callable_list)(std::forward<Args>(args)...); } } protected: inline const callback_list_type * do_find_callable_list(const event_type & e) const { return do_find_callable_list_helper(this, e); } inline callback_list_type * do_find_callable_list(const event_type & e) { return do_find_callable_list_helper(this, e); } private: // template helper to avoid code duplication in do_find_callable_list template <typename T> static auto do_find_callable_list_helper(T * self, const event_type & e) -> typename std::conditional<std::is_const<T>::value, const callback_list_type *, callback_list_type *>::type { if (self->listener_map_.empty()) return nullptr; typename thread_type::template shared_lock<mutex_type> guard(self->listener_mtx_); auto it = self->listener_map_.find(e); if(it != self->listener_map_.end()) { return &it->second; } else { return nullptr; } } private: // Mixin related struct do_mixin_before_dispatch { template <typename T, typename Self, typename ...A> static auto for_each(const Self * self, A && ...args) -> typename std::enable_if<has_function_mixin_before_dispatch<T, A...>::value, bool>::type { return static_cast<const T *>(self)->mixin_before_dispatch(std::forward<A>(args)...); } template <typename T, typename Self, typename ...A> static auto for_each(const Self * /*self*/, A && ... /*args*/) -> typename std::enable_if<! has_function_mixin_before_dispatch<T, A...>::value, bool>::type { return true; } }; private: map_type listener_map_; mutable mutex_type listener_mtx_; listener_name_map_type listener_name_map_; }; } //namespace dispatcheres //------------------------------------------------------------------------------------------------- namespace dispatcheres { template <typename Base> class mixin_filter : public Base { private: using super = Base; using bool_reference_prototype = typename dispatcheres::replace_return_type< typename dispatcheres::transform_arguments< typename super::proto_type, std::add_lvalue_reference >::type, bool >::type; using filter_func_type = std::function<bool_reference_prototype>; using filter_list_type = callback_list<char, bool_reference_prototype>; using listener_name_type = typename filter_list_type::listener_name_type; public: using filter_wptr = typename filter_list_type::node_wptr; using filter_type = filter_wptr; public: inline filter_wptr append_filter(const filter_func_type& filter_func) { return filter_list_.append(listener_name_type{}, '0', filter_func); } inline bool remove_filter(const filter_wptr & filter) { return filter_list_.remove(filter); } inline void clear_filters() noexcept { return filter_list_.clear(); } inline std::size_t get_filter_count() const noexcept { return filter_list_.size(); } template <typename ...Args> inline bool mixin_before_dispatch(Args && ...args) const { if(! filter_list_.empty()) { if(! filter_list_.for_each_if([&args...](typename filter_list_type::callback_type & cb) { return cb(args...); }) ) { return false; } } return true; } private: filter_list_type filter_list_; }; } //namespace dispatcheres //------------------------------------------------------------------------------------------------- template < typename EventT, typename PrototypeT, typename PolicyT = dispatcheres::default_policy > class event_dispatcher : public dispatcheres::inherit_mixins< dispatcheres::event_dispatcher_base<EventT, PrototypeT, PolicyT, void>, typename dispatcheres::select_mixins<PolicyT, dispatcheres::has_type_mixins_t<PolicyT>::value >::type >::type, public dispatcheres::tag_event_dispatcher { private: using super = typename dispatcheres::inherit_mixins< dispatcheres::event_dispatcher_base<EventT, PrototypeT, PolicyT, void>, typename dispatcheres::select_mixins<PolicyT, dispatcheres::has_type_mixins_t<PolicyT>::value >::type >::type; public: using super::super; friend void swap(event_dispatcher & first, event_dispatcher & second) noexcept { first.swap(second); } }; } //namespace asio2 #endif
42ed3049461f3376166b18394d4b477497f9dd65
1afc8cdbd3a6d627415b346293416ede54bf31e2
/codeforces/1199/C.cpp
4efd06ebf4f7d268205c9dbd2c6dd816749099ea
[]
no_license
umangja/CompetitiveProgrammingSolution
bf6944b81373061124179db5ba2ce2612032e1fe
d622398e40dadadde191c0d9b34a9fcd4735c69c
refs/heads/master
2023-03-25T23:05:09.596577
2021-02-23T09:07:00
2021-03-14T15:22:40
341,297,361
0
0
null
null
null
null
UTF-8
C++
false
false
2,004
cpp
C.cpp
/*input 8 63 1 2 3 4 5 6 7 8 */ //assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define pii pair<ll int,ll int> #define vpii vector< pii > #define vi vector<ll int> #define vs vector< string > #define vvi vector< vector< ll > > #define inf (ll)1e18 #define all(it,a) for(auto it=(a).begin();it!=(a).end();it++) #define F first #define S second #define sz(x) (ll int)x.size() #define rep(i,a,b) for(ll int i=a;i<b;i++) #define repr(i,a,b) for(ll int i=a;i>b;i--) #define lbnd lower_bound #define ubnd upper_bound #define mp make_pair #define whatis(x) cout << #x << " is " << x << "\n"; #define graph(n) adj(n,vector< ll > () ) //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const ll N=4e5+5; ll fq[N]; int solve() { ll n,I;cin>>n>>I; vi a(n); set<ll> st; rep(i,0,n) cin>>a[i],st.insert(a[i]); ll count=0; map<ll,ll> hash; all(it,st) { hash[*it]=count; count++; } rep(i,0,n) a[i]=hash[a[i]],fq[a[i]]++; ll no = count; ll k_max; if((8*I)/n>=60) k_max=inf; else k_max = (ll)pow(2,(8*I)/n); // rep(i,0,no) cout<<fq[i]<<" "; ll s=0; rep(i,0,min(k_max,no)) s+=fq[i]; ll ans=s; rep(i,k_max,no) { s = s+fq[i]-fq[i-k_max]; ans=max(s,ans); } ll ts=0; rep(i,0,no) ts+=fq[i]; cout<<ts-ans<<"\n"; return 0; } int main() { auto start = chrono::high_resolution_clock::now(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll test_cases=1; //cin>>test_cases; while(test_cases--) solve(); auto stop = chrono::high_resolution_clock::now(); auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start); // cout<<"\nduration: "<<(double)duration.count()<<" milliseconds"; }
31cc30c94c2994289768e9b29ba09766b814b481
482e90cd68bdd37d8ce99f2403a1d2ec5e80551b
/test/sketch.cpp
53f7ecbcfc7bbbaa2350efc96f712f5d71b39ff5
[]
no_license
fs3l/cmo-enclave
91e263d0160d995f04ec75a89670eea774c3c0f7
543f4d74de52a2a00011d7f16b2210226bdcb4b9
refs/heads/master
2023-01-15T04:04:52.246959
2018-09-27T03:19:59
2018-09-27T03:19:59
111,944,957
0
0
null
null
null
null
UTF-8
C++
false
false
778
cpp
sketch.cpp
#include "./helper.h" #include <sys/time.h> #ifdef SGX_APP #include "./sgx_helper.h" #include "st" #include "algo_u.h" #else #include "algo.h" #endif BOOST_AUTO_TEST_CASE(sketch_test) { int32_t len = 100000; int32_t range = 1; int32_t* output = new int32_t[range]; //printf("output addr = %p \n",output); memset(output,0,4*range); int32_t input[len]; //printf("input addr = %p \n",input); for(int i = 0; i <len;i++){ input[i] = rand()%len; } struct timeval begin,end; gettimeofday(&begin,NULL); sketch(input,output,len); gettimeofday(&end,NULL); for(int i = 0;i<range;i++) printf("result = %d\n",output[i]); printf("time spent=%ld\n",1000000*(end.tv_sec-begin.tv_sec)+end.tv_usec-begin.tv_usec); }
f95ef9aab66dbe67b7d4e64d5389df9c06f5ae40
f0198f5f498db29b2da5c7e73d92505a2279fc33
/RcEngine/Tools/MeshImporter/AssimpProcesser.h
ad94e3656039eae1a9a80a75e303e0843902844b
[]
no_license
ruitaocc/RcEngine
ed9921c730e6441d94ec9b24c9f96fb9afb1a62c
4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b
refs/heads/master
2021-01-15T20:58:30.765816
2015-02-02T12:54:55
2015-02-02T12:54:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,993
h
AssimpProcesser.h
#pragma once #include <iostream> #include <fstream> #include <set> #include <unordered_map> #include <assimp/Importer.hpp> // C++ importer interface #include <assimp/scene.h> // Output data structure #include <assimp/postprocess.h> // Post processing flags #include "Core/Prerequisites.h" #include "Graphics/GraphicsCommon.h" #include "Graphics/Skeleton.h" #include "Math/ColorRGBA.h" #include "Math/MathUtil.h" #pragma comment(lib, "assimp.lib") using namespace std; using namespace RcEngine; static const uint32_t MAT_AMBIENT_COLOR = 0x1; static const uint32_t MAT_DIFFUSE_COLOR = 0x2; static const uint32_t MAT_SPECULAR_COLOR = 0x4; static const uint32_t MAT_EMISSIVE_COLOR = 0x8; static const uint32_t MAT_POWER_COLOR = 0x10; struct MaterialData { MaterialData() : MaterialFlags(0) { } String Name; ColorRGBA Ambient; ColorRGBA Diffuse; ColorRGBA Specular; ColorRGBA Emissive; float Power; uint32_t MaterialFlags; unordered_map<String, String> Textures; }; struct MeshPartData { String Name; String MaterialName; IndexBufferType IndexFormat; uint32_t StartIndex; uint32_t IndexCount; uint32_t VertexCount; uint32_t StartVertex; shared_ptr<VertexDeclaration> VertexDeclaration; BoundingSpheref BoundingSphere; vector<char> IndexData; vector<char> VertexData; }; struct OutModel { OutModel() : RootBone(NULL), RootNode(NULL), TotalVertices(0), TotalIndices(0) { } String OutName; vector<aiMesh*> Meshes; vector<aiNode*> MeshNodes; vector<aiNode*> Bones; vector<aiAnimation*> Animations; vector<BoundingSpheref> BoneSpheres; aiNode* RootNode; aiNode* RootBone; uint32_t TotalVertices; uint32_t TotalIndices; vector<shared_ptr<MeshPartData> > MeshParts; vector<shared_ptr<MaterialData> > Materials; BoundingSpheref MeshBoundingSphere; shared_ptr<Skeleton> Skeleton; }; class AssimpProcesser { public: AssimpProcesser(void); ~AssimpProcesser(void); bool Process(const char* filePath, const char* skeleton, const vector<String>& clips); private: void ProcessScene(const aiScene* scene); shared_ptr<MaterialData> ProcessMaterial(aiMaterial* material); void ProcessAnimations(); void ExportXML( OutModel& outModel); void ExportBinary( OutModel& outModel ); void GetBoundingBox(const aiScene* scene, aiVector3D* min, aiVector3D* max); void ExportModel( OutModel& outModel, const String& outName ); private: void CollectMaterials(); void CollectMeshes(OutModel& outModel, aiNode* rootNode); void CollectBones(OutModel& outModel); void CollectBonesFinal(vector<aiNode*>& bones, const set<aiNode*>& necessary, aiNode* node); void CollectAnimations(OutModel& model, aiScene* scene); void BuildAndSaveModel(OutModel& outModel); void BuildAndSaveAnimations(OutModel& model); void BuildBoneCollisions(); void BuildSkeleton(OutModel& model); private: aiScene* mAIScene; String mSkeletonFile; String mFilename; vector<String> mAnimationClips; String mName; OutModel mModel; };
372edeefab38abb11cbe06873f03758bde7f7952
db9b731edb4790a169cba7f651d9f5bc22151f1d
/Lab 2/Лаба 2/Лаба 2.cpp
b720d55dbc097e6c490e228fc1125688d9ce7178
[]
no_license
KopeikinD/LABS
ecce77e468e3aa118c3f2e19820ee51db8a55fde
a19d54751767c6dcf2b9c59f7b41fdac3faaf38b
refs/heads/main
2023-09-04T00:54:20.427060
2021-11-03T14:30:49
2021-11-03T14:30:49
424,224,511
0
0
null
null
null
null
UTF-8
C++
false
false
1,433
cpp
Лаба 2.cpp
 #include <iostream> #include <string> using namespace std; void zadanie1() { string string1; cout << "Введите строку" << endl; getline(cin, string1); int count = 1; for (int i = 0; i < string1.length(); i++) { if (string1[i] == string1[i + 1]) count++; else { cout << (int)string1[i] << count; count = 1; } } cout << endl; } void zadanie2() { int N; cout << "Введите размер массива: "; cin >> N; int* sortmas = new int[N]; int count = 0; // for (int i = 0; i < N; i++) cin >> sortmas[i]; for (int i = 0; i < N; i++) { for (int j = i; j > 0 && sortmas[j - 1] > sortmas[j]; j--) swap(sortmas[j - 1], sortmas[j]); } cout << "Отсортированный массив: "; for (int i = 0; i < N; i++) cout << sortmas[i] << " "; cout << endl; } void zadanie3() { string str1, str2, str3; int pos; cout << "Введите строку: "; getline(cin, str1); cout << "Какую подстроку искать?: "; getline(cin, str2); cout << "Заменить на: "; getline(cin, str3); while ((pos = str1.find(str2, 0)) != string::npos) str1.replace(pos, str2.length(), str3); cout << "Строка после замены: " << str1; } int main() { setlocale(LC_ALL, "Russian"); cout << "Задание 1:" << endl; zadanie1(); cout << "Задание 2:" << endl; zadanie2(); cout << "Задание 3:" << endl; zadanie3(); }
5c9aad40165470df99be62403ef1ebf5e00377c1
3a9f925f2882c95ab38a4de875cd6cd3c03df160
/core/header/algorithm/BaseAlgorithm.hpp
0a07249caf12ab8f1d4656a8da615e564f285d1f
[]
no_license
KnifeOnlyI/ScratchBall
0ef060f225a403a166a936964196868eb0be8222
fb549ccd7ff7094a0497c14705cc5a0b9eecb8f6
refs/heads/master
2023-04-25T03:26:13.342238
2021-04-28T05:03:13
2021-04-28T05:03:13
362,343,905
0
0
null
null
null
null
UTF-8
C++
false
false
377
hpp
BaseAlgorithm.hpp
#ifndef SCRATCHBALL_BASEALGORITHM_HPP #define SCRATCHBALL_BASEALGORITHM_HPP #include "Context.hpp" class BaseAlgorithm { public: explicit BaseAlgorithm(Context &context); virtual void load() const = 0; virtual void update() const = 0; [[nodiscard]] Context &getContext() const; private: Context &_context; }; #endif //SCRATCHBALL_BASEALGORITHM_HPP
2ea95c11b8a96905c9d3c6f2a92ad6cf207a1ce0
20200b151be309568210c3bcc992fb4f2699d1d2
/Visualization/StackSidebar.cpp
e24f993d4a75e12e2c3251845b91b74b7e1911e5
[]
no_license
anilhakanyarici/memory-managed-visual-cpp-linux
0f9856de8888c1343555bd63d59554d21e19f2cd
fe250cfe49f79731b3cd239c100e1daffaf45db0
refs/heads/master
2021-01-15T17:15:53.272594
2017-08-08T23:51:30
2017-08-08T23:51:30
99,745,315
0
1
null
null
null
null
UTF-8
C++
false
false
331
cpp
StackSidebar.cpp
#include "StackSidebar.h" StackSidebar *StackSidebar::New() { return (StackSidebar *)gtk_stack_sidebar_new(); } Stack *StackSidebar::stack() const { return (Stack *)gtk_stack_sidebar_get_stack(GTK_STACK_SIDEBAR(this)); } void StackSidebar::stack(Stack *s) { gtk_stack_sidebar_set_stack(GTK_STACK_SIDEBAR(this), GTK_STACK(s)); }
ffcf79785a18d5603a5e101ea992212be977e7e2
c1b5749073da5f718476e9842a1d79562681c8b4
/個人制作/Collect/ソースコード/entity/light.cpp
04ed0c7001982a60abfbc40d3b16b7512c830681
[]
no_license
TakanashiRuka/Game
36d2fce25c49384eeeec266a51b4bef58139ba52
daec40a812eeabb0ca304913d897ae58d4dbe3b1
refs/heads/master
2020-05-22T22:50:45.834281
2019-05-14T06:12:23
2019-05-14T06:12:23
186,551,982
0
0
null
null
null
null
UTF-8
C++
false
false
1,753
cpp
light.cpp
#include "..\entity\light.h" #include "..\graphics\directx11.h" #include "..\framework\data.h" #include "..\framework\debug.h" constexpr float view_width = 10; constexpr float view_height = 10; constexpr float near_z = 0.1f; constexpr float far_z = 17.3f; using namespace DirectX; Light::Light(Scene* parent) : Entity(parent) { this->tag_ = "light"; this->data_->CreateConstantBuffer(this->constant_buffer_, ConstantBufferType::Light); CBufferLight cb; cb.light_view = XMMatrixLookAtLH(XMLoadFloat4(&this->light_), XMVectorSet(0, 0, 0, 0), XMVectorSet(0, 1, 0, 0)); cb.light_projection = XMMatrixOrthographicLH(view_width, view_height, near_z, far_z); cb.light = this->light_; this->data_->UpdateConstantBuffer(this->constant_buffer_, &cb); this->graphics_->device_context_->VSSetConstantBuffers(2, 1, &this->constant_buffer_); this->graphics_->device_context_->PSSetConstantBuffers(2, 1, &this->constant_buffer_); } Light::~Light() { } void Light::Draw(RenderingPass pass) { switch (pass) { case RenderingPass::Debug: { Debug::DrawLight(this->light_, this->ambient_, this->diffuse_, this->specular_); } break; } } void Light::SetLightPos(DirectX::XMFLOAT3 pos) { CBufferLight cb; cb.light_view = XMMatrixLookAtLH(XMVectorSet(this->light_.x + pos.x, this->light_.y, this->light_.z + pos.z, this->light_.w), XMVectorSet(pos.x, 0, pos.z, 0), XMVectorSet(0, 1, 0, 0)); cb.light_projection = XMMatrixOrthographicLH(view_width, view_height, near_z, far_z); cb.light = this->light_; this->data_->UpdateConstantBuffer(this->constant_buffer_, &cb); this->graphics_->device_context_->VSSetConstantBuffers(2, 1, &this->constant_buffer_); this->graphics_->device_context_->PSSetConstantBuffers(2, 1, &this->constant_buffer_); }
e53c2e2b4a343c480dab64b863200a78a80b1268
742182b23044c91df9a3d99652697152fc13f91d
/Div1/SRM561Div1/Easy.cpp
b1dae1b12c71bfdc8fcecff942b4412d574bd5f8
[]
no_license
iseki-masaya/topcoder
15e052bff8043f60a15969acc723e2550eae262c
c85ba323476b03abbc22a758e5724f15796ee62b
refs/heads/master
2016-09-11T02:00:10.773000
2015-04-26T02:41:05
2015-04-26T02:41:05
9,335,477
0
0
null
null
null
null
UTF-8
C++
false
false
5,637
cpp
Easy.cpp
#include <vector> #include <string> #include <iostream> #include <fstream> #include <sstream> #include <list> #include <algorithm> #include <sstream> #include <set> #include <cmath> #include <map> #include <stack> #include <queue> #include <cstdio> #include <cstdlib> #include <cstring> #include <numeric> #define INF (1<<28) #define EPS 1e-8 using namespace std; typedef pair<int, char> P; const char ch[2] = {'L','M'}; class ICPCBalloons { public: int calc(vector<int> l_rest,vector<int> m_rest,vector<int> &l_req,vector<int> &m_req) { int res = 0; for (int n=0; n<2; ++n) { int N = n ? (int)l_rest.size() : (int)m_rest.size(); int M = n ? (int)l_req.size() : (int)m_req.size(); vector<int> &rest = n ? l_rest : m_rest; vector<int> &req = n ? l_req : m_req; for (int i=N; i<M; ++i) { rest.push_back(0); } int sum = 0; int sub = 0; for (int i=0; i<M; ++i) { sum += rest[i] - req[i]; if (rest[i] < req[i]) sub += req[i] - rest[i]; } for (int i=M; i<N; ++i) { sum += rest[i]; } if (sum < 0) { return INF; } res += sub; } return res; } int minRepaintings(vector <int> balloonCount, string balloonSize, vector <int> maxAccepted) { int N = (int)balloonCount.size(); int M = (int)maxAccepted.size(); vector<int> l_rest,m_rest; for (int i=0; i<N; ++i) { if (balloonSize[i] == 'L') { l_rest.push_back(balloonCount[i]); } else { m_rest.push_back(balloonCount[i]); } } sort(l_rest.begin(), l_rest.end(), greater<int>()); sort(m_rest.begin(), m_rest.end(), greater<int>()); sort(maxAccepted.begin(), maxAccepted.end(), greater<int>()); int limit = (1<<M); int ans = INF; for (int mask=0; mask<limit; ++mask) { vector<int> l_req,m_req; for (int i=0; i<M; ++i) { if ((mask>>i)&1) { l_req.push_back(maxAccepted[i]); } else { m_req.push_back(maxAccepted[i]); } } ans = min( ans , calc(l_rest,m_rest,l_req,m_req) ); } return ans == INF ? -1 : ans; } // BEGIN CUT HERE public: void run_test(int Case) { if ((Case == -1) || (Case == 0)) test_case_0(); if ((Case == -1) || (Case == 1)) test_case_1(); if ((Case == -1) || (Case == 2)) test_case_2(); if ((Case == -1) || (Case == 3)) test_case_3(); if ((Case == -1) || (Case == 4)) test_case_4(); if ((Case == -1) || (Case == 5)) test_case_5(); } private: template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); } void verify_case(int Case, const int &Expected, const int &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: \"" << Expected << '\"' << endl; cerr << "\tReceived: \"" << Received << '\"' << endl; } } void test_case_0() { int Arr0[] = {100}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); string Arg1 = "L"; int Arr2[] = {1,2,3,4,5}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arg3 = 10; verify_case(0, Arg3, minRepaintings(Arg0, Arg1, Arg2)); } void test_case_1() { int Arr0[] = {100}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); string Arg1 = "M"; int Arr2[] = {10,20,30,40,50}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arg3 = -1; verify_case(1, Arg3, minRepaintings(Arg0, Arg1, Arg2)); } void test_case_2() { int Arr0[] = {5,6,1,5,6,1,5,6,1}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); string Arg1 = "MLMMLMMLM"; int Arr2[] = {7,7,4,4,7,7}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arg3 = 6; verify_case(2, Arg3, minRepaintings(Arg0, Arg1, Arg2)); } void test_case_3() { int Arr0[] = {100,100}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); string Arg1 = "ML"; int Arr2[] = {50,51,51}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arg3 = -1; verify_case(3, Arg3, minRepaintings(Arg0, Arg1, Arg2)); } void test_case_4() { int Arr0[] = {8,5,1,4,1,1,3,1,3,3,5,4,5,6,9}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); string Arg1 = "MMMLLLMMLLMLMLM"; int Arr2[] = {3,5,3,3,5,6,4,6,4,2,3,7,1,5,2}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arg3 = 5; verify_case(4, Arg3, minRepaintings(Arg0, Arg1, Arg2)); } void test_case_5() { int Arr0[] = {1,18,4,7,19,7,7,1,4,8,10,5,14,13,8,22,6,3,13,5,3,4,2,1,3,15,19,4,5,9,4,11,2,7,12,20,11,26,22,7,2,10,9,20,13,20,2,9,11,9}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); string Arg1 = "LLMLLLLMLLLLLLLLLLLLMLLLLLLLLLLMMLMLLLMLLLLLLLLMLL"; int Arr2[] = {44,59,29,53,16,23,13,14,29,42,13,15,66,4,47}; vector <int> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); int Arg3 = 210; verify_case(5, Arg3, minRepaintings(Arg0, Arg1, Arg2)); } // END CUT HERE }; // BEGIN CUT HERE int main() { ICPCBalloons ___test; ___test.run_test(-1); } // END CUT HERE
a1844194462314fc488f275f7ca99099932bae76
c33e840f5503365b39ad0118ce12200bc79dd428
/Implementacao/Regras.hpp
c2601be30aaca8c5ec71d9aed6f43894b294a74a
[]
no_license
gabrielissantos/JvTron-3.0
24d0a823f83e3e13471cd3983f5089b05b9edd89
d2523f078372d721c4f2f73df2913054bb542435
refs/heads/master
2020-12-25T19:03:12.534108
2017-07-15T19:55:55
2017-07-15T19:55:55
94,019,172
0
0
null
null
null
null
UTF-8
C++
false
false
6,110
hpp
Regras.hpp
/* JvAsteroids: Trabalho 3 Departamento de Computação UFSCar Universidade Federal de São Carlos Disciplina: Estrutura de Dados Professor: Roberto Ferrari Aluno(a): RA: João Gabriel Melo Barbirato 726546 Leonardo de Oliveira Peralta 726556 Gabrieli Santos 726523 Controle de Versão: https://github.com/gabrielissantos/JvTron-3.0 */ #include <iostream> #include "Tela.hpp" #include <string.h> #include <SFML/Graphics.hpp> class Regras : public Tela{ private: // atributos privados const int maxNumeroTeclas; // numero de teclas const int maxNumeroBotoes; float largura, altura, centrox, centroy; // variáveis pra guardar medidas da tela utilizada int numeroItem; sf::Text titulo; sf::Font fonte; sf::Text botao; sf::Text *infos; // vetor de textoBotao para teclas sf::Text *descricaoTeclas; // descricao das teclas sf::RectangleShape *tecla; // vetor de teclas // métodos privados void desenha(sf::RenderWindow &) const; public: // métodos públicos Regras(float larg, float alt); ~Regras(); virtual int Executar(sf::RenderWindow &App, int & score); }; // Implementação dos métodos // Construtor // Inicializa e configura os atributos Regras::Regras(float larg, float alt): maxNumeroTeclas(4), maxNumeroBotoes(1){ std::string textoBotao = "Menu"; // textoBotao do botão std::string instrucoes[maxNumeroTeclas] = { // informacoes sobre as teclas "^", "<", ">", "space" }; std::string descricao[maxNumeroTeclas] = { "Mover o personagem", "Rodar anti-horario", "Rodar horario", "atirar" }; numeroItem = 0; // alocação de posições descricaoTeclas = new sf::Text[maxNumeroTeclas]; // veteor para descricao das teclas tecla = new sf::RectangleShape[maxNumeroTeclas]; // vetor de teclas infos = new sf::Text[maxNumeroTeclas]; // vetor de informações // variaveis das medidas largura = larg; altura = alt; centrox = largura/2; centroy = altura/2; if (!fonte.loadFromFile("Tr2n.ttf")){} // fonte das letras // inicializando titulo titulo.setCharacterSize(50); titulo.setString("REGRAS"); titulo.setFont(fonte); titulo.setPosition(sf::Vector2f(centrox - titulo.getCharacterSize()*2, centroy-altura*1/3 + titulo.getCharacterSize() - 150)); titulo.setColor(sf::Color(0,255,255)); // inicializando botoes botao.setFont(fonte); botao.setCharacterSize(30); botao.setColor(sf::Color(0,255,255)); botao.setString(textoBotao); botao.setPosition(sf::Vector2f(centrox - botao.getCharacterSize()*1.25, altura-100)); // inicializando descricoes dos botoes for(int i=0; i < maxNumeroTeclas; i++){ descricaoTeclas[i].setString(descricao[i]); descricaoTeclas[i].setFont(fonte); descricaoTeclas[i].setCharacterSize(30); descricaoTeclas[i].setColor(sf::Color::White); if(i == maxNumeroTeclas-1) descricaoTeclas[i].setPosition(sf::Vector2f(40+largura/(maxNumeroTeclas), (titulo.getCharacterSize() + 60) + i*altura/(maxNumeroTeclas+3))); else descricaoTeclas[i].setPosition(sf::Vector2f(largura/(maxNumeroTeclas), (titulo.getCharacterSize() + 60) + i*altura/(maxNumeroTeclas+3))); } // inicializando as infos for(int i=0; i < maxNumeroTeclas; i++){ infos[i].setString(instrucoes[i]); infos[i].setFont(fonte); infos[i].setCharacterSize(30); infos[i].setColor(sf::Color(0,255,255)); if(i == maxNumeroTeclas-1){ tecla[i].setSize(sf::Vector2f(120,40)); infos[i].setPosition(sf::Vector2f(60 + largura/(maxNumeroTeclas+10), (titulo.getCharacterSize()+60) + i*altura/(maxNumeroTeclas+3))); tecla[i].setPosition(sf::Vector2f(50 + largura/(maxNumeroTeclas+10), (titulo.getCharacterSize()+60) + i*altura/(maxNumeroTeclas+3))); }else{ tecla[i].setSize(sf::Vector2f(40,40)); infos[i].setPosition(sf::Vector2f(100 + largura/(maxNumeroTeclas+10), (titulo.getCharacterSize()+60) + i*altura/(maxNumeroTeclas+3))); tecla[i].setPosition(sf::Vector2f(90 + largura/(maxNumeroTeclas+10), (titulo.getCharacterSize()+60) + i*altura/(maxNumeroTeclas+3))); } tecla[i].setFillColor(sf::Color(32,32,32)); tecla[i].setOutlineThickness(1); tecla[i].setOutlineColor(sf::Color(0,255,255)); } } // fim construtor // Destrutor // Deleta o vetor de teclas Regras::~Regras(){ delete infos; delete tecla; delete descricaoTeclas; }; // Executar // Recebe por referência a janela da biblioteca gráfica int Regras::Executar(sf::RenderWindow &App, int & score){ // declaracao de variaveis sf::Event Event; // eventos de jogo bool executando = true; while (executando){ // loop da tela // Verificação de eventos while (App.pollEvent(Event)){ // loop de eventos if (Event.type == sf::Event::Closed){ // se fechar a tela return (-1); // fim jogo } // ao pressionar botões if (Event.type == sf::Event::KeyPressed){ switch (Event.key.code){ case sf::Keyboard::Return: return(0); break; default: break; } } }// fim loop de eventos // desenhar coisas na tela App.clear(); desenha(App); // chamada de método desenha App.display(); } // fim loop da tela // não há como chegar até aqui mas, se acontecer, termine o programa. return (-1); } // fim Executar // Desenha // Método que desenha na tela alguns atributos void Regras::desenha(sf::RenderWindow & App) const{ sf::RectangleShape linhas; // retângulo para linhas // configuração do retangulo linhas.setPosition(sf::Vector2f(50, 50)); linhas.setFillColor(sf::Color(32,32,32)); linhas.setOutlineThickness(1); linhas.setOutlineColor(sf::Color(0,255,255)); linhas.setSize(sf::Vector2f(largura-100, altura -100)); // desenha na janela App.clear(sf::Color(32,32,32)); App.draw(linhas); App.draw(titulo); App.draw(botao); for(int i = 0; i < maxNumeroTeclas; i++){ App.draw(tecla[i]); App.draw(infos[i]); App.draw(descricaoTeclas[i]); } }; // fim desenha
239cca4bd6c8bacb0f6a8d77b36de84b92ab8784
3b504460d1c09c0926c93cb5caa5a3b7e0c1c821
/MySerialServer.h
7ce2147ac6ba3191ea438e0cbff54d340b19639d
[]
no_license
MorAl2/Generalized-Server-Side-Implementation
7f16a934561558482f7defd1c968b64cea97818d
f0e2c80c48e988e54acef54958c712a3318bef66
refs/heads/master
2020-12-06T02:06:02.706122
2020-06-07T22:48:02
2020-06-07T22:48:02
232,309,793
0
1
null
null
null
null
UTF-8
C++
false
false
773
h
MySerialServer.h
#ifndef GENERALIZED_SERVER_SIDE_IMPLEMENTATION_MYSERIALSERVER_H #define GENERALIZED_SERVER_SIDE_IMPLEMENTATION_MYSERIALSERVER_H #include "ClientHandler.h" #include "Server.h" #include <thread> using namespace std; using namespace server_side; // running the server with serial input handle. class MySerialServer : public server_side::Server { int port; ClientHandler* handler; public: /** * open server and wait for clients * @param port port number to listen * @param c object of ClientHandler - define type of conversation */ thread* open(int port, ClientHandler *c); /** * stop Listening for Clients. */ virtual void stop(); void run(); }; #endif //GENERALIZED_SERVER_SIDE_IMPLEMENTATION_MYSERIALSERVER_H
b97fbae933443162773e4b427448f35d82242be5
7205bc2ed945400eaf4fb532565a729ce481cc21
/noteplayer.h
f3cdbe66d5a3a77b6ea15995a14e33ca4fedd7e8
[]
no_license
Tatane/DrumPart
41e973f00dc9c7f9961cbd24a90c99c571a5cc24
d1e93225701efc7dd5c9ce3d5a43ca9093d9146a
refs/heads/master
2020-09-01T04:30:07.101835
2019-11-05T01:31:26
2019-11-05T01:31:26
218,881,350
0
0
null
null
null
null
UTF-8
C++
false
false
384
h
noteplayer.h
#ifndef NOTEPLAYER_H #define NOTEPLAYER_H #include <map> #include "soundmixer.h" using namespace std; class NotePlayer { public: void play(short pitch); protected: NotePlayer(); SoundMixer * soundMixer; map<short, int> mapNotePitchToSoundSampleIndex; // map Pitch to sound sample index. private: virtual void loadSoundFiles() = 0; }; #endif // NOTEPLAYER_H
6948f83580eb1e9b08dd98001f636835adb5babf
9813b37706567312356aa0e3a6a014709a135942
/ch06/ch06_Rotary_Interrupt/Basic/Basic.ino
f0edeb8394c9c4aa3cfeb9792ae87fb4c4a15069
[]
no_license
bjepson/Arduino-Cookbook-3ed-INO
3476f987b55ba8bfb4eb52e299f223b28dc5cd80
12148225ee774643a879d8f51e310917cb47ed8d
refs/heads/master
2022-02-02T22:15:12.097700
2022-01-29T15:12:32
2022-01-29T15:12:32
204,302,305
30
14
null
null
null
null
UTF-8
C++
false
false
474
ino
Basic.ino
/* Rotary Encoder Library example * Read the rotary encoder with a library that uses interrrupts * to process the encoder's activity */ #include <Encoder.h> Encoder myEnc(2, 3); // Use pins 4, 5 on the MKR family of boards void setup() { Serial.begin(9600); } long lastPosition = -999; void loop() { long currentPosition = myEnc.read(); if (currentPosition != lastPosition) { lastPosition = currentPosition; Serial.println(currentPosition); } }
ac7ce8fd3f374eba6a554908fe5be4ff8c7985aa
e80b882a90d031e9a7b522814a4d4a1b4ac6e964
/2021-08-16/16_997_FindtheTownJudge.cpp
32a7eaf5f9377204ca915fde1bc5807439e8085a
[]
no_license
DeveshDutt2710/CP_Weekwise
9ccf211cdb7964525e403d401db1c2135573d669
c367a494a69f42bd2085fc16505ee749716a7f99
refs/heads/main
2023-08-05T09:09:25.497086
2021-09-19T17:43:24
2021-09-19T17:43:24
355,271,716
0
0
null
null
null
null
UTF-8
C++
false
false
1,062
cpp
16_997_FindtheTownJudge.cpp
/* https://leetcode.com/problems/find-the-town-judge/ 997_FindtheTownJudge In a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the town judge. If the town judge exists, then: The town judge trusts nobody. Everybody (except for the town judge) trusts the town judge. There is exactly one person that satisfies properties 1 and 2. You are given an array trust where trust[i] = [ai, bi] representing that the person labeled ai trusts the person labeled bi. Return the label of the town judge if the town judge exists and can be identified, or return -1 otherwise. */ class Solution { public: int findJudge(int n, vector<vector<int>>& trust) { if(trust.empty() && n==1) return 1; vector<int> out(n+1,0); vector<int> in(n+1,0); for(auto edge : trust){ out[edge[0]]++; in[edge[1]]++; } for(int i=0;i<=n;i++){ if(out[i]==0 && in[i]==n-1) return i; } return -1; } };
335b77a4031ce2668f1bbf032c940eb50237158f
7a439d4dd5485d62fa8c3ff243d400bc8dcc33ac
/clients/optimizationClient/src/RhinoFileIO.cpp
6aa2e58d96bdc036e2314a57e10513fbe21ad746
[]
no_license
DrStS/EMPIRE-Testing
82a23e35aa3bb58aa0012784016f642284920a5b
af06b6c54f40acf84c34d1a75e1c5e16afc7eb08
refs/heads/master
2020-04-01T18:22:19.493171
2018-10-17T16:47:26
2018-10-17T16:47:26
153,488,010
1
2
null
null
null
null
UTF-8
C++
false
false
4,987
cpp
RhinoFileIO.cpp
/* * RhinoFileIO.cpp * * Created on: Jun 5, 2014 * Author: fabien */ #include "RhinoFileIO.h" #include "helper.h" #include <iostream> #include <fstream> #include <sstream> #include <vector> #include <algorithm> namespace optclient { using namespace std; void readMetaData(std::string filename, int& numPatches, std::vector<double>& nodesCoordinates) { string line; ifstream myfile(filename.c_str()); if (myfile.is_open()) while (getline(myfile,line)) { if(line.find("ND-COOR")!=string::npos) { getline(myfile,line); do{ //until no more node data found double node_tmp; stringstream sstream(line); string tmp; //skip word NODE while(tmp!="X") sstream>>tmp; //search for word X sstream>>node_tmp; nodesCoordinates.push_back(node_tmp); while(tmp!="Y")sstream>>tmp; //search for word Y sstream>>node_tmp; nodesCoordinates.push_back(node_tmp); while(tmp!="Z")sstream>>tmp; //search for word Z sstream>>node_tmp; nodesCoordinates.push_back(node_tmp); getline(myfile,line); }while(line.find("NODE")!=std::string::npos); } if(line.find("NURBS_PATCH")!=string::npos) { numPatches++; // count number of line with word NURBS_PATCH found } } myfile.close(); } void readNurbsPatch(std::string filename,int patchID, bool& type, int& pDegree, std::vector<double>& uKnotVector, int& qDegree, std::vector<double>& vKnotVector, int& uNumControlPoints, int& vNumControlPoints, std::vector<int>& nodeNet, std::vector<double>& weights) { string line; ifstream myfile(filename.c_str()); int ctrl_id; if (myfile.is_open()) while (getline(myfile,line)) { if(line.find("NURBS_PATCH")!=string::npos) { stringstream sstream(line); string tmp; sstream>>tmp; ///skip word NURSB_PATCH /// Check id int id; sstream >> id; if(id != patchID) continue; sstream>>tmp; //skip word : string typeStr; sstream>>typeStr; if(typeStr =="NURBS_2D") { type=1; getline(myfile,line); do { //until node patch information found stringstream sstream2(line); sstream2>>tmp; //get first word if(tmp=="CTRL_PTS"){ sstream2>>tmp; sstream2>>tmp; sstream2>>ctrl_id; } if(tmp=="NCTRL"){ sstream2>>tmp; sstream2>>uNumControlPoints; uNumControlPoints++; //FIXME file value always N-1 CP than reality. Why ? } if(tmp=="MCTRL"){ sstream2>>tmp; sstream2>>vNumControlPoints; vNumControlPoints++; //FIXME file value always N-1 CP than reality. Why ? } if(tmp=="PDEG"){ sstream2>>tmp; sstream2>>pDegree; } if(tmp=="QDEG"){ sstream2>>tmp; sstream2>>qDegree; } if(tmp=="UKNOT"){ sstream2>>tmp; //remove "=" std::getline(sstream2,tmp,','); do{ double knot=helper::str_to_num<double>(tmp); uKnotVector.push_back(knot); tmp.clear(); std::getline(sstream2,tmp,','); }while(tmp!=""); } if(tmp=="VKNOT"){ sstream2>>tmp; //remove "=" std::getline(sstream2,tmp,','); do{ double knot=helper::str_to_num<double>(tmp); vKnotVector.push_back(knot); tmp.clear(); std::getline(sstream2,tmp,','); }while(tmp!="" ); } getline(myfile,line); } while(line.find("UKNOT")!=string::npos || line.find("VKNOT")!=string::npos || line.find("PDEG")!=string::npos || line.find("QDEG")!=string::npos || line.find("MCTRL")!=string::npos || line.find("NCTRL")!=string::npos || line.find("CTRL_PTS")!=string::npos); break; } } } myfile.close(); // cout<<"PDEG "<<pDegree<<"/ QDEG"<<qDegree<<endl; // cout<<"NCTRL "<<uNumControlPoints<<"/ MCTRL"<<vNumControlPoints<<endl; // cout<<"VKNOT "<<vKnotVector.size()<<"/ UKNOT"<<uKnotVector.size()<<endl; /// read controls points information related to this patch readCP(filename,ctrl_id,nodeNet,weights); // cout<<"WEIGHT "<<weights.size()<<endl; // cout<<"nodeNet "<<nodeNet.size()<<endl; } void readCP(std::string filename,int cpID, std::vector<int>& nodeNet, std::vector<double>& weights) { string line; ifstream myfile(filename.c_str()); if (myfile.is_open()) while (getline(myfile,line)) { if(line.find("CTRL_PTS_NODES")!=string::npos) { int ctrl_id; string tmp; int tmp_node_id; double tmp_weight; stringstream sstream(line); /// Check id sstream>>tmp; //skip word CTRL_PTS_NODES sstream>>ctrl_id; if(ctrl_id != cpID) continue; getline(myfile,line); do { stringstream sstream2(line); sstream2>>tmp; //skip word NODE_ID sstream2>>tmp_node_id; nodeNet.push_back(tmp_node_id-1); //store C-style node reference sstream2>>tmp; //skip word W sstream2>>tmp_weight; weights.push_back(tmp_weight); getline(myfile,line); }while(line.find("NODE_ID")!=string::npos); } } myfile.close(); } } /* namespace optclient */
8013cb8154925a511f4566281419e1414294f50e
deb4260cfd57440c637b6de4cd3a9e5d2d2d74c0
/src/graphics/renderer.cpp
f333339753a64710a34f81c8dcdedc7f589542da
[]
no_license
tokobaku/kekule_engine
ffb0c34e1f4152643bd66d498fb2c97456b1cffc
fd16294633ea03f740414f91da7fa156d809f4e3
refs/heads/master
2020-04-02T04:10:57.454094
2019-05-14T14:35:56
2019-05-14T14:35:56
148,146,739
0
0
null
null
null
null
UTF-8
C++
false
false
1,581
cpp
renderer.cpp
#include "renderer.h" #include "renderable.h" namespace kekule { std::set<Renderer::RendererLayer> Renderer::mQueue; Renderer::RendererLayer::RendererLayer () :queue(), layer() {} Renderer::RendererLayer::RendererLayer (const IRenderable* item) :queue({item}), layer(item->layer) {} Renderer::RendererLayer::RendererLayer (const int& layer) :queue(), layer(layer) {} Renderer::RendererLayer::~RendererLayer () {} bool Renderer::RendererLayer::operator< (const Renderer::RendererLayer& other) const { return this->layer < other.layer; } bool Renderer::RendererLayer::operator<= (const Renderer::RendererLayer& other) const { return this->layer <= other.layer; } bool Renderer::RendererLayer::operator> (const Renderer::RendererLayer& other) const { return this->layer > other.layer; } bool Renderer::RendererLayer::operator>= (const Renderer::RendererLayer& other) const { return this->layer >= other.layer; } bool Renderer::RendererLayer::operator== (const Renderer::RendererLayer& other) const { return this->layer == other.layer; } bool Renderer::RendererLayer::operator!= (const Renderer::RendererLayer& other) const { return this->layer != other.layer; } void Renderer::RendererLayer::render () const { auto first = queue.begin(); auto last = queue.end(); while (first != last) { (*first)->glRender(); first = queue.erase(first); } } void Renderer::render () { auto first = mQueue.begin(); auto last = mQueue.end(); while (first != last) { first->render(); first = mQueue.erase(first); } } }
669f59b7989431f43a5d3350082055f2ad0f02ea
14cadc1eb363ab693df1aae3ed622feb77d9b82c
/Lab-03/CohenSutherland.cpp
d3c7d3da5fd9040551e63e78b5d0460b18089b2e
[]
no_license
Sowmik23/Computer_Graphics_Lab
d8ea18c81bdc5900f9448800d3437a1b872fb746
53959367d3d266f43c4c81ee7c34125bc600c12d
refs/heads/master
2020-12-27T05:26:43.606723
2020-02-24T13:34:35
2020-02-24T13:34:35
237,779,795
0
1
null
null
null
null
UTF-8
C++
false
false
9,610
cpp
CohenSutherland.cpp
#ifdef _WIN32 #include <windows.h> #pragma comment(lib,"OpenGL32.lib") #pragma comment(lib,"GLUT32.lib") #pragma warning(disable:4244) #pragma warning(disable:4305) #endif #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <time.h> #define PI acos(-1.0) #include <GL/glut.h> #define PDD pair<double,double> #include<bits/stdc++.h> using namespace std; static int slices = 16; static int stacks = 16; int Wi=640, He=480; bool colored = false; int boundary = 150; int Xmin = -boundary; int Xmax = boundary; int Ymin = -boundary; int Ymax = boundary; const int LEFT = 1; const int RIGHT = 2; const int BOTTOM = 4; const int TOP = 8; int start=202; void myInit (void); void display(void); void reshape (int w, int h); void cohen_Sutherland(double x0,double y0,double x1,double y1); void myInit (void) { glClearColor(0.0, 0.0, 0.0,1.0); } void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluOrtho2D (-Wi/2, Wi/2-1, -He/2, He/2-1); // size of projection plane (origin at the center) glMatrixMode (GL_MODELVIEW); glLoadIdentity (); } void GridDraw() { glBegin(GL_LINES); glColor3f(1.0,1.0,1.0); // glVertex2i(-320,0); // glVertex2i(319,0); // glVertex2i(0,239); // glVertex2i(0,-240); glVertex2i(boundary,He/2-1); glVertex2i(boundary,-He/2); glVertex2i(Wi/2-1,-boundary); glVertex2i(-Wi/2,-boundary); glVertex2i(-boundary,He/2-1); glVertex2i(-boundary,-He/2); glVertex2i(Wi/2-1,boundary); glVertex2i(-Wi/2,boundary); glEnd(); } void drawPixel(int x,int y) { glVertex2i(x,y); } void drawPixelZone(int x,int y,int zone) { if(zone==0) { if(colored) glColor3f(1.0, 0.0, 0.0);///Red drawPixel(x,y); } else if(zone==1) { if(colored) glColor3f(0.0,1.0,0.0);///Green drawPixel(y,x); } else if(zone==2) { if(colored) glColor3f(0.0,0.0,1.0);///Blue drawPixel(-y,x); } else if(zone==3) { if(colored) glColor3f(1.0,1.0,0.0);///Yellow drawPixel(-x,y); } else if(zone==4) { if(colored) glColor3f(1.0,0.1,1.0);///Purple drawPixel(-x,-y); } else if(zone==5) { if(colored) glColor3f(0,1.0,1.0);///Cyan drawPixel(-y,-x); } else if(zone==6) { if(colored) glColor3f(1.0,1.0,1.0);///White drawPixel(y,-x); } else if(zone==7) { if(colored) glColor3f(1.0,0.5,0.0);///Orange drawPixel(x,-y); } } void drawLine0(int x,int y,int x0,int y0,int zone) { int dx = x0-x, dy = y0-y; int d = 2*dy - dx; int dE = 2*dy, dNE = 2*(dy-dx); drawPixelZone(x,y,zone); while(x<x0) { if(d>0) { x++; y++; d+=dNE; } else { x++; d+=dE; } drawPixelZone(x,y,zone); } } int zoneDetection(int x0,int y0,int x1,int y1) { int dx = x1 - x0; int dy = y1 - y0; if(dx>=0 && dy>=0) { if(dx>=dy) return 0; else return 1; } else if(dx<0 && dy>=0) { if(dy>=abs(dx)) return 2; else return 3; } else if(dx<0 && dy<0) { if(abs(dx)>=abs(dy)) return 4; else return 5; } else if(dx>=0 && dy<0) { if(abs(dy)>=dx) return 6; else return 7; } } void drawLine(int x0,int y0,int x1,int y1) { int zone = zoneDetection(x0,y0,x1,y1); if(zone==0) drawLine0(x0,y0,x1,y1,zone); else if(zone==1) drawLine0(y0,x0,y1,x1,zone); else if(zone==2) drawLine0(y0,-x0,y1,-x1,zone); else if(zone==3) drawLine0(-x0,y0,-x1,y1,zone); else if(zone==4) drawLine0(-x0,-y0,-x1,-y1,zone); else if(zone==5) drawLine0(-y0,-x0,-y1,-x1,zone); else if(zone==6) drawLine0(-y0,x0,-y1,x1,zone); else if(zone==7) drawLine0(x0,-y0,x1,-y1,zone); } int makeCode(double x,double y) { int code = 0; if(y>Ymax) code |= TOP; else if(y<Ymin) code |= BOTTOM; if(x>Xmax) code |= RIGHT; else if(x<Xmin) code |= LEFT; return code; } int x_0 = -200; int y_0 = -200; int x_1 = 200; int y_1 = 200; int cnt=0; void myMouse (int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON and state == GLUT_UP) { int a,b,c,d; if(cnt%2==1){ a =x-320; b = 240-y; x_0 = a; y_0 = b; printf("a,b: %d %d\n",a,b); } else if(cnt%2==0){ c =x-320; d = 240-y; x_1 = c; y_1 = d; printf("c,d: %d %d\n",c,d); start = 101; printf("%d %d %d %d\n",x_0,y_0,x_1,y_1); printf("changed start: %d\n",start ); } cnt++; } } void cohen_Sutherland(double x0,double y0,double x1,double y1) { // glPointSize(3); // glColor3f(1.0,1.0,1.0); // glBegin(GL_POINTS); // glVertex2i(x0,y0); // glVertex2i(x1,y1); // glEnd(); // glPointSize(1); glBegin(GL_POINTS); int code0,code1,code; double x,y; double x0_ = x0; double x1_ = x1; double y0_ = y0; double y1_ = y1; code0 = makeCode(x0,y0); code1 = makeCode(x1,y1); while(true) { if ((code0 == 0) && (code1 == 0)) //fully accepted { glEnd(); glPointSize(4); glColor3f(1.0,1.0,1.0); glBegin(GL_POINTS); glVertex2i(x0,y0); glVertex2i(x1,y1); glEnd(); glPointSize(1); glBegin(GL_POINTS); glColor3f(1.0,1.0,0.0);///Yellow drawLine(x0,y0,x1,y1); break; //exit(); } else if (code0 & code1)//fully rejected { glColor3f(1.0, 0.0, 0.0);///Red drawLine(x0,y0,x1,y1); break; //exit(); } else //partial { int code; double x, y; if (code0) code = code0; else code = code1; if (code & TOP) { x = x0 + (x1 - x0) * (Ymax - y0) / (y1 - y0); y = Ymax; } else if (code & BOTTOM) { x = x0 + (x1 - x0) * (Ymin - y0) / (y1 - y0); y = Ymin; } else if (code & RIGHT) { y = y0 + (y1 - y0) * (Xmax - x0) / (x1 - x0); x = Xmax; } else if (code & LEFT) { y = y0 + (y1 - y0) * (Xmin - x0) / (x1 - x0); x = Xmin; } if(code == code0) { glColor3f(0.5, 0.5, 0.5); drawLine(x0,y0,x,y); x0 = x; y0 = y; code0 = makeCode(x0,y0); } else { glColor3f(0.5, 0.5, 0.5); drawLine(x1,y1,x,y); x1 = x; y1 = y; code1 = makeCode(x1,y1); } }//partial }//while loop glEnd(); }//end of function void display() { glClear(GL_COLOR_BUFFER_BIT); glColor3f(0, 0, 0); GridDraw(); // glBegin(GL_LINES); glBegin(GL_POINTS); /* int x0 = -200; int y0 = -200; int x1 = 200; int y1 = 200; */ // drawPixel(x0,y0); // drawPixel(x1,y1); // srand(time(NULL)); /* int numberOfLines = 100; for(int i=0; i<=numberOfLines; i++) { int x0 = -320 + rand()%640; int y0 = -240 + rand()%480; int x1 = -320 + rand()%640; int y1 = -240 + rand()%480; cohen_Sutherland(x0,y0,x1,y1); }*/ /*if(start==202){ glutMouseFunc(myMouse); glutMouseFunc(myMouse); printf("%d cnt start %d\n",cnt,start); cohen_Sutherland(x_0,y_0,x_1,y_1); if(start==101){ printf("*********************hhkjhkhjhkhkjkjh %d %d %d %d\n",x_0,y_0,x_1,y_1); cohen_Sutherland(x_0,y_0,x_1,y_1); start = 202; } }*/ if(start==101){ printf("##########################hhkjhkhjhkhkjkjh %d %d %d %d\n",x_0,y_0,x_1,y_1); cohen_Sutherland(x_0,y_0,x_1,y_1); start = 202; } cohen_Sutherland(x_0,y_0,x_1,y_1); glEnd(); glFlush(); } static void key(unsigned char key, int x, int y) { switch (key) { case 27 : case 'q': exit(0); break; case '+': slices++; stacks++; break; case '-': if (slices>3 && stacks>3) { slices--; stacks--; } break; } glutPostRedisplay(); } static void idle(void) { glutPostRedisplay(); } int main (int argc, char **argv) { glutInit (&argc, argv); // to initialize the toolkit; glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); // sets the display mode glutInitWindowSize (Wi, He); // sets the window size glutInitWindowPosition (0, 0); // sets the starting position for the window glutCreateWindow ("Graphics Lab 2"); // creates the window and sets the title myInit(); // additional initializations as necessary glutReshapeFunc(reshape); glutDisplayFunc(display); glutKeyboardFunc(key); glutMouseFunc(myMouse); //glutIdleFunc(idle); glutMainLoop(); // go into a loop until event occurs return 0; }
a5ab68ecdae393bfc6bc41fbed133bc843a1685c
1f203bc69fed71220638ea0a813b370dae980454
/Example3_Lighting/Example3_Lighting/marbleShader.h
0fe2639d75a4be786c14c90e828b673177656951
[]
no_license
bMeile/graphicsCoursework
b51845e1b71685d25740bb2abec976762d4cd41b
834afb4cbd1e5adeca58a1348aafc3f244eae94d
refs/heads/master
2020-09-25T05:47:37.846581
2019-12-04T18:29:29
2019-12-04T18:29:29
225,931,233
0
0
null
null
null
null
UTF-8
C++
false
false
823
h
marbleShader.h
#pragma once #include "DXF.h" #include <stdio.h> using namespace std; using namespace DirectX; class marbleShader : public BaseShader { private: struct LightBufferType { XMFLOAT4 ambient; XMFLOAT4 diffuse; XMFLOAT4 specular; XMFLOAT3 direction; float specPower; }; struct CameraBufferType { XMFLOAT3 camPosition; float padding2; }; public: marbleShader(ID3D11Device* device, HWND hwnd); ~marbleShader(); void setShaderParameters(ID3D11DeviceContext* deviceContext, const XMMATRIX &world, const XMMATRIX &view, const XMMATRIX &projection, ID3D11ShaderResourceView* texture, Light* light, XMFLOAT3 cameraPosition); private: void initShader(WCHAR*, WCHAR*); private: ID3D11Buffer * matrixBuffer; ID3D11SamplerState* sampleState; ID3D11Buffer* cameraBuffer; ID3D11Buffer* lightBuffer; };
3cb178ce298ef0bba65cdee6cbaf0d3ba8c9567f
29116e539917eb31bc4ec56e015ee8f729dd951b
/Dioskuria-Server/src/globals.cpp
adb5744cb79b3a174f92750b620752dd190d455c
[ "Unlicense" ]
permissive
alvin-nt/Simple-TCP-Chat
16ede731105ee77573b867f660b0986fcd2ace57
409c2fbf1567553d525d528d80a921af70e0344e
refs/heads/master
2021-01-01T16:34:05.797158
2014-12-17T10:22:04
2014-12-17T10:22:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
909
cpp
globals.cpp
/* * globals.cpp * * Created on: Dec 5, 2014 * Author: asseylum */ #include "ServerThread.h" #include "ServerClasses/Group.h" #include "ServerClasses/User.h" #include <string> using namespace std; class Group; class ServerThread; std::vector<ServerThread*> threadPool; std::vector<Group*> groupList; bool isUserOnline(User user); bool isUserOnline(string user); bool isUserOnline(User user) { threadPoolMutex.lock(); bool online = false; for(unsigned int i = 0; i < threadPool.size(); i++){ if(user.getUserName() == threadPool.at(i)->threadName) { online = true; break; } } threadPoolMutex.unlock(); return online; } bool isUserOnline(string user) { threadPoolMutex.lock(); bool online = false; for(unsigned int i = 0; i < threadPool.size(); i++){ if(user == threadPool.at(i)->threadName) { online = true; break; } } threadPoolMutex.unlock(); return online; }
0181d7377a35f42a109a6e24fc86a7f7b3923fd0
311614346b33960f9d879105540ceaf10a02f83d
/Laboratori/Bloc 3/S4/4. Semàfor en display/MyLabel.h
52fc2f9a0fb98143b32bb724aa4518a147e9329c
[]
no_license
mcasellas/FIB-IDI
d659e2e094326a53defd4b10f56967b7f3bb6742
84b1f353ec90b3a89fbbaae4cacc5f8adb80660d
refs/heads/master
2021-04-25T06:30:58.442283
2018-07-16T21:27:50
2018-07-16T21:27:50
122,231,407
0
0
null
null
null
null
UTF-8
C++
false
false
280
h
MyLabel.h
#include <QLabel> class MyLabel : public QLabel { Q_OBJECT QString original; public: MyLabel(QWidget* parent = 0); public slots: void Truncar(int); void SetOriginal(QString); signals: void enviaText (const QString &); };
04b8293368e433d9a4984a1bf5d8ccdf9ccc5277
0f5e28d45ccc39f055aa4677eff874c561dc20db
/main.cpp
eba5b80e61333cd05d7758188e33d02c19f975b3
[]
no_license
Maybe707/MLbasicExampleCPP
6f821510782c57ec279dcdba73a8211e8cf74ae2
663dfc34b2b84f17266aefc1a34d59d006b4b5de
refs/heads/main
2023-01-12T02:58:39.820863
2020-11-13T17:49:42
2020-11-13T17:49:42
312,641,054
2
0
null
null
null
null
UTF-8
C++
false
false
3,204
cpp
main.cpp
#include <iostream> #include <cmath> #include <cstdlib> #include <iostream> #include <random> #include <sstream> #include "mathlibrery.cpp" int main() { srand(static_cast<unsigned int>(time(0))); Matrix<double, 4, 3> streetlights = {{1.0, 0.0, 1.0}, {0.0, 1.0, 1.0}, {0.0, 0.0, 1.0}, {1.0, 1.0, 1.0}}; //streetlights = {{1.0, 0.0, 1.0}, //{0.0, 1.0, 1.0}, //{0.0, 0.0, 1.0}, //{1.0, 1.0, 1.0}}; Matrix<double, 1, 4> tempMatrix = {{1.0, 1.0, 0.0, 0.0}}; //tempMatrix = {{1.0, 1.0, 0.0, 0.0}}; Matrix<double, 4, 1> walk_vs_stop; walk_vs_stop = tempMatrix.matrixTranspose(); Matrix<double, 3, 4> weights_0_1 = {{0.1, -0.5, 0.4, 0.7}, {0.2, -0.7, 0.3, 0.9}, {0.1, -0.8, 0.3, 0.5}}; Matrix<double, 4, 1> weights_1_2 = {{0.2}, {-0.5}, {0.3}, {0.7}}; double alpha = 0.5; /*Matrix<double, 3, 4> weights_0_1; Matrix<double, 4, 1> weights_1_2; weightsGenerator(weights_0_1); weightsGenerator(weights_1_2); */ for(int i = 0; i < 600000; ++i) { double layer_2_error = 0; for(int j = 0; j < 4; ++j) { double reluResult[4]{}; Matrix<double, 1, 3> layer_0; layer_0 = cutFunction(streetlights, j); Matrix<double, 1, 4> layer_1; layer_1 = layer_0 * weights_0_1; relu(layer_1); Matrix<double, 1, 1> layer_2; layer_2 = layer_1 * weights_1_2; Matrix<double, 1, 1> wvsCut; wvsCut = cutFunction(walk_vs_stop, j); Matrix<double, 1, 1> layer_2_delta; layer_2_delta = layer_2 - wvsCut; Matrix<double, 1, 1> matrixSqrt; matrixSqrt = layer_2_delta * layer_2_delta; layer_2_error = layer_2_error + matrixSqrt[0][0]; Matrix<double, 1, 4> weight_1_2_Transpose; weight_1_2_Transpose = weights_1_2.matrixTranspose(); Matrix<double, 1, 4> layer_1_delta; layer_1_delta = layer_2_delta * weight_1_2_Transpose; relu2deriv(layer_1, reluResult); for(int k = 0; k < 1; ++k) for(int l = 0; l < 4; ++l) { layer_1_delta[k][l] = layer_1_delta[k][l] * reluResult[l]; } Matrix<double, 4, 1> layer_1_Transpose; layer_1_Transpose = layer_1.matrixTranspose(); Matrix<double, 4, 1> inst1; inst1 = (layer_1_Transpose * layer_2_delta) * alpha; weights_1_2 = weights_1_2 - inst1; Matrix<double, 3, 1> layer_0_Transpose; layer_0_Transpose = layer_0.matrixTranspose(); Matrix<double, 3, 4> inst2; inst2 = (layer_0_Transpose * layer_1_delta) * alpha; weights_0_1 = weights_0_1 - inst2; } if(i % 10 == 9) //std::cout << "Error: " << layer_2_error << std::endl; printf("%.16e\n", layer_2_error); } return 0; }
af30200a790179a7ad7dfaf0296ed608af4412b8
cc4007fb715c470d27f5187742c7bccf47658426
/1.cpp
52966325564c3f0aa26f9fbb3da2d2e23fd277cb
[]
no_license
NguyenDat280898/T1911E
4bbe30d9480aa234820a3e32ef0db903aea333a6
72190438fea23621cac36aff20e9e73486381cbd
refs/heads/master
2020-09-23T00:28:04.480375
2019-12-13T08:02:00
2019-12-13T08:02:00
225,353,662
0
0
null
null
null
null
UTF-8
C++
false
false
237
cpp
1.cpp
#include <stdio.h> #include <math.h> int main (){ int a,b; printf ("nhap 2 so a,b=\n"); scanf ("%d",&a); scanf ("%d",&b); if (a>=b){ printf ("ket qua :%f\n",(float)a/b); }else{ printf ("ket qua :%d\n",a*b); } return 0; }
ee18e4f427000134b9ae1ddc241618584297483f
056c0c7ce2f7015805305a25a5443790629e3ba8
/kod_client/main.cpp
ae058332c0c72f83523fb8df4fa908335fd21206
[]
no_license
ModunZhang/kod_robot
06ddc4b924d97ad2b00533273db1704802697750
e79233394319190f852532666a2dbbfcbb1d9f0a
refs/heads/master
2021-03-24T13:03:03.012543
2016-02-01T09:01:49
2016-02-01T09:01:49
35,024,596
0
1
null
null
null
null
UTF-8
C++
false
false
20,248
cpp
main.cpp
// // main.cpp // kod_client // // Created by gaozhou on 15/1/19. // Copyright (c) 2015年 batcat. All rights reserved. // #include <iostream> #include <sys/types.h> #include <sys/socket.h> #include <sys/wait.h> #include <netinet/in.h> #include <arpa/inet.h> #include <assert.h> #include <signal.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <fcntl.h> #include <stdlib.h> #include <pthread.h> #include <libgen.h> #include <iostream> #include <sstream> #include <math.h> #include <stdio.h> #include <string.h> #include <semaphore.h> extern "C"{ #include "../lua/lua.h" #include "../lua/lualib.h" #include "../lua/lauxlib.h" #include "../tolua/tolua++.h" #include "../tolua/tolua_fix.h" #include "../openssl/dh.h" #include "../openssl/rc4.h" } #include "Common.h" #include "CTimerHandle.h" #include "../lua_engine/CCLuaEngine.h" extern "C" { typedef union uwb { unsigned w; unsigned char b[4]; } WBunion; typedef unsigned Digest[4]; static unsigned f0( unsigned abcd[] ){ return ( abcd[1] & abcd[2]) | (~abcd[1] & abcd[3]);} static unsigned f1( unsigned abcd[] ){ return ( abcd[3] & abcd[1]) | (~abcd[3] & abcd[2]);} static unsigned f2( unsigned abcd[] ){ return abcd[1] ^ abcd[2] ^ abcd[3];} static unsigned f3( unsigned abcd[] ){ return abcd[2] ^ (abcd[1] |~ abcd[3]);} typedef unsigned (*DgstFctn)(unsigned a[]); static unsigned * calcKs( unsigned *k) { double s, pwr; int i; pwr = pow( 2, 32); for (i=0; i<64; i++) { s = fabs(sin(1+i)); k[i] = (unsigned)( s * pwr ); } return k; } // ROtate v Left by amt bits static unsigned rol( unsigned v, short amt ) { unsigned msk1 = (1<<amt) -1; return ((v>>(32-amt)) & msk1) | ((v<<amt) & ~msk1); } unsigned * md5( const char *msg, int mlen) { static Digest h0 = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476 }; // static Digest h0 = { 0x01234567, 0x89ABCDEF, 0xFEDCBA98, 0x76543210 }; static DgstFctn ff[] = { &f0, &f1, &f2, &f3 }; static short M[] = { 1, 5, 3, 7 }; static short O[] = { 0, 1, 5, 0 }; static short rot0[] = { 7,12,17,22}; static short rot1[] = { 5, 9,14,20}; static short rot2[] = { 4,11,16,23}; static short rot3[] = { 6,10,15,21}; static short *rots[] = {rot0, rot1, rot2, rot3 }; static unsigned kspace[64]; static unsigned *k; static Digest h; Digest abcd; DgstFctn fctn; short m, o, g; unsigned f; short *rotn; union { unsigned w[16]; char b[64]; }mm; int os = 0; int grp, grps, q, p; unsigned char *msg2; if (k==NULL) k= calcKs(kspace); for (q=0; q<4; q++) h[q] = h0[q]; // initialize { grps = 1 + (mlen+8)/64; msg2 = (unsigned char *)malloc( 64*grps); memcpy( msg2, msg, mlen); msg2[mlen] = (unsigned char)0x80; q = mlen + 1; while (q < 64*grps){ msg2[q] = 0; q++ ; } { // unsigned char t; WBunion u; u.w = 8*mlen; // t = u.b[0]; u.b[0] = u.b[3]; u.b[3] = t; // t = u.b[1]; u.b[1] = u.b[2]; u.b[2] = t; q -= 8; memcpy(msg2+q, &u.w, 4 ); } } for (grp=0; grp<grps; grp++) { memcpy( mm.b, msg2+os, 64); for(q=0;q<4;q++) abcd[q] = h[q]; for (p = 0; p<4; p++) { fctn = ff[p]; rotn = rots[p]; m = M[p]; o= O[p]; for (q=0; q<16; q++) { g = (m*q + o) % 16; f = abcd[1] + rol( abcd[0]+ fctn(abcd) + k[q+16*p] + mm.w[g], rotn[q%4]); abcd[0] = abcd[3]; abcd[3] = abcd[2]; abcd[2] = abcd[1]; abcd[1] = f; } } for (p=0; p<4; p++) h[p] += abcd[p]; os += 64; } if( msg2 ) free( msg2 ); return h; } #define SMALL_CHUNK 256 #define CHECK_GE(a, b) CHECK((a) >= (b)) #define CHECK(exp) do { if (!(exp)) abort(); } while (0) static const unsigned char group_modp1[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd, 0xef, 0x95, 0x19, 0xb3, 0xcd, 0x3a, 0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d, 0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, 0xc2, 0x45, 0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, 0xf4, 0x4c, 0x42, 0xe9, 0xa6, 0x3a, 0x36, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static const unsigned char group_modp5[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd, 0xef, 0x95, 0x19, 0xb3, 0xcd, 0x3a, 0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d, 0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, 0xc2, 0x45, 0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, 0xf4, 0x4c, 0x42, 0xe9, 0xa6, 0x37, 0xed, 0x6b, 0x0b, 0xff, 0x5c, 0xb6, 0xf4, 0x06, 0xb7, 0xed, 0xee, 0x38, 0x6b, 0xfb, 0x5a, 0x89, 0x9f, 0xa5, 0xae, 0x9f, 0x24, 0x11, 0x7c, 0x4b, 0x1f, 0xe6, 0x49, 0x28, 0x66, 0x51, 0xec, 0xe4, 0x5b, 0x3d, 0xc2, 0x00, 0x7c, 0xb8, 0xa1, 0x63, 0xbf, 0x05, 0x98, 0xda, 0x48, 0x36, 0x1c, 0x55, 0xd3, 0x9a, 0x69, 0x16, 0x3f, 0xa8, 0xfd, 0x24, 0xcf, 0x5f, 0x83, 0x65, 0x5d, 0x23, 0xdc, 0xa3, 0xad, 0x96, 0x1c, 0x62, 0xf3, 0x56, 0x20, 0x85, 0x52, 0xbb, 0x9e, 0xd5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6d, 0x67, 0x0c, 0x35, 0x4e, 0x4a, 0xbc, 0x98, 0x04, 0xf1, 0x74, 0x6c, 0x08, 0xca, 0x23, 0x73, 0x27, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static const unsigned char two_generator[] = { 2 }; typedef struct dh_st DH; void freeDh(void *d) { if(d) { DH_free((DH*)d); } } void * createdh() { DH* d = DH_new(); d->p = BN_bin2bn((const unsigned char*)group_modp1, sizeof(group_modp1), 0); d->g = BN_bin2bn((const unsigned char*)two_generator, 1, 0); int codes; if (!DH_check(d, &codes)) { assert(0); } if (!DH_generate_key(d)) { assert(0); } return (void *)d; } unsigned char* getpublickey(void * d, int * len) { if (!d) { assert(0); } DH * dh = (DH*)d; if (dh->pub_key == NULL) { assert(0); } int dataSize = BN_num_bytes(dh->pub_key); unsigned char* data = (unsigned char*)malloc(dataSize); BN_bn2bin(dh->pub_key, (unsigned char*)data); *len = dataSize; return data; } char * computesecret(void * d, const char * buffer, int len) { if (!d) { assert(0); } DH* dh = (DH*)d; BIGNUM* key = BN_bin2bn((const unsigned char *)(buffer), len, 0); int dataSize = DH_size(dh); char* data = (char*)malloc(dataSize); int size = DH_compute_key((unsigned char*)data,key,dh); if (size == -1) { int checkResult; int checked; checked = DH_check_pub_key(dh, key, &checkResult); BN_free(key); free(data); if (!checked) { assert(0); } else if (checkResult) { if (checkResult & DH_CHECK_PUBKEY_TOO_SMALL) { assert(0); } else if (checkResult & DH_CHECK_PUBKEY_TOO_LARGE) { assert(0); } else { assert(0); } } else { assert(0); } } BN_free(key); CHECK_GE(size, 0); // DH_size returns number of bytes in a prime number // DH_compute_key returns number of bytes in a remainder of exponent, which // may have less bytes than a prime number. Therefore add 0-padding to the // allocated buffer. if (size != dataSize) { CHECK(dataSize > size); memmove(data + dataSize - size, data, size); memset(data, 0, dataSize - size); } return data; } char * rc4(char * key_buf, const char * in, int in_len) { size_t key_buf_len = strlen(key_buf); size_t datalen = in_len; char * out = (char *)malloc(datalen); memmove(out, in, datalen); unsigned char *md = (unsigned char *)md5((char *)key_buf, key_buf_len); RC4_KEY rc4_key; RC4_set_key(&rc4_key, 16, md); RC4(&rc4_key, datalen, (const unsigned char *)in, (unsigned char *)out); return out; } unsigned char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int _base64Decode(const unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len ) { static char inalphabet[256], decoder[256]; int i, bits, c = 0, char_count, errors = 0; unsigned int input_idx = 0; unsigned int output_idx = 0; for (i = (sizeof alphabet) - 1; i >= 0 ; i--) { inalphabet[alphabet[i]] = 1; decoder[alphabet[i]] = i; } char_count = 0; bits = 0; for( input_idx=0; input_idx < input_len ; input_idx++ ) { c = input[ input_idx ]; if (c == '=') break; if (c > 255 || ! inalphabet[c]) continue; bits += decoder[c]; char_count++; if (char_count == 4) { output[ output_idx++ ] = (bits >> 16); output[ output_idx++ ] = ((bits >> 8) & 0xff); output[ output_idx++ ] = ( bits & 0xff); bits = 0; char_count = 0; } else { bits <<= 6; } } if( c == '=' ) { switch (char_count) { case 1: #if (CC_TARGET_PLATFORM != CC_PLATFORM_BADA) fprintf(stderr, "base64Decode: encoding incomplete: at least 2 bits missing"); #endif errors++; break; case 2: output[ output_idx++ ] = ( bits >> 10 ); break; case 3: output[ output_idx++ ] = ( bits >> 16 ); output[ output_idx++ ] = (( bits >> 8 ) & 0xff); break; } } else if ( input_idx < input_len ) { if (char_count) { #if (CC_TARGET_PLATFORM != CC_PLATFORM_BADA) fprintf(stderr, "base64 encoding incomplete: at least %d bits truncated", ((4 - char_count) * 6)); #endif errors++; } } *output_len = output_idx; return errors; } void _base64Encode( const unsigned char *input, unsigned int input_len, char *output ) { unsigned int char_count; unsigned int bits; unsigned int input_idx = 0; unsigned int output_idx = 0; char_count = 0; bits = 0; for( input_idx=0; input_idx < input_len ; input_idx++ ) { bits |= input[ input_idx ]; char_count++; if (char_count == 3) { output[ output_idx++ ] = alphabet[(bits >> 18) & 0x3f]; output[ output_idx++ ] = alphabet[(bits >> 12) & 0x3f]; output[ output_idx++ ] = alphabet[(bits >> 6) & 0x3f]; output[ output_idx++ ] = alphabet[bits & 0x3f]; bits = 0; char_count = 0; } else { bits <<= 8; } } if (char_count) { if (char_count == 1) { bits <<= 8; } output[ output_idx++ ] = alphabet[(bits >> 18) & 0x3f]; output[ output_idx++ ] = alphabet[(bits >> 12) & 0x3f]; if (char_count > 1) { output[ output_idx++ ] = alphabet[(bits >> 6) & 0x3f]; } else { output[ output_idx++ ] = '='; } output[ output_idx++ ] = '='; } output[ output_idx++ ] = 0; } int base64Decode(const unsigned char *in, unsigned int inLength, unsigned char **out) { unsigned int outLength = 0; //should be enough to store 6-bit buffers in 8-bit buffers *out = (unsigned char*)malloc(inLength * 3.0f / 4.0f + 1); if( *out ) { int ret = _base64Decode(in, inLength, *out, &outLength); if (ret > 0 ) { #if (CC_TARGET_PLATFORM != CC_PLATFORM_BADA) printf("Base64Utils: error decoding"); #endif free(*out); *out = nullptr; outLength = 0; } } return outLength; } int base64Encode(const unsigned char *in, unsigned int inLength, char **out) { unsigned int outLength = inLength * 4 / 3 + (inLength % 3 > 0 ? 4 : 0); //should be enough to store 8-bit buffers in 6-bit buffers *out = (char*)malloc(outLength+1); if( *out ) { _base64Encode(in, inLength, *out); } return outLength; } }; // //#include "../cjson/lua_cjson.h" //static luaL_Reg luax_exts[] = { // {"cjson", luaopen_cjson_safe}, // {NULL, NULL} //}; //void luaopen_lua_extensions_more(lua_State *L) //{ // // load extensions // luaL_Reg* lib = luax_exts; // lua_getglobal(L, "package"); // lua_getfield(L, -1, "preload"); // for (; lib->func; lib++) // { // lua_pushcfunction(L, lib->func); // lua_setfield(L, -2, lib->name); // } // lua_pop(L, 2); //} std::map<CCPomelo*, LuaEngine*> GlobalPomeloToLuaEngine; #ifndef MULTI_THREAD #define MULTI_THREAD 0 #endif const int MAX_CLIENT = 1; static int pipefds[MAX_CLIENT * 2] = {}; static int pipefd[2]; void sig_handler( int sig ) { if (sig == SIGCHLD) { wait(NULL); // return; } printf("receive sig %d\n", sig); int save_errno = errno; int msg = sig; send( pipefd[1], (char *)&msg, 1, 0 ); errno = save_errno; } void addsig( int sig ) { struct sigaction sa; memset( &sa, '\0', sizeof( sa ) ); sa.sa_handler = sig_handler; sa.sa_flags |= SA_RESTART; sigfillset( &sa.sa_mask ); assert( sigaction( sig, &sa, NULL ) != -1 ); } void open_tolua_fix(lua_State *L) { lua_pushstring(L, TOLUA_REFID_PTR_MAPPING); lua_newtable(L); lua_rawset(L, LUA_REGISTRYINDEX); lua_pushstring(L, TOLUA_REFID_TYPE_MAPPING); lua_newtable(L); lua_rawset(L, LUA_REGISTRYINDEX); lua_pushstring(L, TOLUA_REFID_FUNCTION_MAPPING); lua_newtable(L); lua_rawset(L, LUA_REGISTRYINDEX); } static const char * device_id_string = NULL; static int l_device_id(lua_State *L){ lua_pushstring(L, device_id_string); return 1; } static int thread_exit(lua_State *L){ if(MULTI_THREAD) { pthread_exit(0); } else { exit(0); } return 0; } // static bool stop_server = false; void * client(void * data) { CCPomelo *pomelo = static_cast<CCPomelo*>(data); lua_State* L = GlobalPomeloToLuaEngine[pomelo]->getLuaStack()->getLuaState(); luaL_openlibs(L); open_tolua_fix(L); tolua_cc_pomelo_open(L); tolua_cc_lua_extension(L); int n = pomelo->GetSelfIndex(); stringstream ss; string s; ss << device_id_string; ss << "_"; ss << n; ss >> s; lua_pushstring(L, s.c_str()); lua_setglobal(L, "GlobalDeviceId"); lua_pushcfunction(L, thread_exit); lua_setglobal(L, "threadExit"); if (luaL_loadfile(L, "main.lua") || lua_pcall(L, 0, 0, 0)){ printf("cannot run *.lua %s", lua_tostring(L, -1)); } fd_set time_set, test_set; FD_ZERO( &time_set ); FD_SET( pomelo->GetReadFd(), &time_set ); bool time_out = false; while( !stop_server ) { test_set = time_set; struct timeval timeout; timeout.tv_sec = 1; timeout.tv_usec = 0; int result = select( pomelo->GetReadFd() + 1, &test_set, (fd_set *)0, (fd_set *)0, &timeout ); switch(result) { case 0: { time_out = true; break; } case -1: { if ( errno == EINTR ) { continue; } perror("select"); return 0; } default: { if(FD_ISSET( pomelo->GetReadFd(), &test_set ) ) { char signals[1024]; int ret = recv( pomelo->GetReadFd(), signals, sizeof( signals ), 0 ); if ( ret == -1 ) { printf("errors occurs\n"); continue; } else if ( ret == 0 ) { continue; } else { for (int i = 0; i < ret; ++i) { switch( signals[i] ) { case SIGTERM: { stop_server = true; } default: { pomelo->getTimerHandle()->tick(); } } } } } break; } } if ( time_out ) { time_out = false; pomelo->getTimerHandle()->tick(); lua_getglobal(L, "Run"); if (lua_pcall(L, 0, 0, 0)){ printf("Run error %s", lua_tostring(L, -1)); } } } return 0; } void run() { fd_set test_set; FD_ZERO(&test_set); FD_SET(pipefd[0], &test_set); CONTINUE: int result = select( pipefd[0] + 1, &test_set, (fd_set *)0, (fd_set *)0, NULL); switch(result) { case -1: { if ( errno == EINTR ) { goto CONTINUE; } perror("select"); stop_server = true; } default: { if(FD_ISSET(pipefd[0], &test_set)) { char signals[1024]; int ret = recv( pipefd[0], signals, sizeof( signals ), 0 ); if ( ret == -1 ) { printf("errors occurs\n"); // continue; stop_server = true; } else if ( ret == 0 ) { // continue; stop_server = true; } else { for (int i = 0; i < ret; ++i) { switch( signals[i] ) { case SIGTERM: { stop_server = true; } default: { } } } } } break; } } } int main(int argc, char *argv[]) { // char * encrypt = rc4("hello", "123456", 6); if ( argc <= 1 ) { device_id_string = "1"; } else { device_id_string = argv[1]; } addsig(SIGTERM); addsig(SIGCHLD); int ret = socketpair( PF_UNIX, SOCK_STREAM, 0, pipefd ); assert( ret != -1 ); // 多线程模式 if(MULTI_THREAD) { pthread_t clients[MAX_CLIENT] = {}; CCPomelo *pomelos[MAX_CLIENT] = {}; for (int i = 0; i < MAX_CLIENT; ++i) { // sleep(1); CCPomelo * pomelo = new CCPomelo(); int ret = socketpair( PF_UNIX, SOCK_STREAM, 0, &pipefds[i] ); assert( ret != -1 ); pomelo->setWirtePipeFd(pipefds[i + 1]); pomelo->setReadPipeFd(pipefds[i]); GlobalPomeloToLuaEngine.insert(std::make_pair(pomelo, new LuaEngine())); pomelos[i] = pomelo; } for (int i = 0; i < MAX_CLIENT; ++i) { if ((ret = pthread_create(clients + i, NULL, client, pomelos[i])) != 0) { fprintf(stderr, "pthread create: %s\n", strerror(ret)); exit(EXIT_FAILURE); } } run(); for (int i = 0; i < MAX_CLIENT; ++i) { void *value; if ((ret = pthread_join(clients[i], &value)) != 0) { fprintf(stderr, "pthread join: %s\n", strerror(ret)); exit(EXIT_FAILURE); } } } else // 单线程模式 { CCPomelo * pomelo = new CCPomelo(); pomelo->setWirtePipeFd(pipefd[1]); pomelo->setReadPipeFd(pipefd[0]); GlobalPomeloToLuaEngine.insert(std::make_pair(pomelo, new LuaEngine())); client(pomelo); } for ( auto item : GlobalPomeloToLuaEngine ) { delete item.first; delete item.second; } GlobalPomeloToLuaEngine.clear(); close(pipefd[0]); close(pipefd[1]); return 0; }
e7dd0159b631f4b33ec273cd5fc33abc795438d1
8b9d62f665770666e11079cbfcaf133f4ad4e19c
/hazelcast/include/hazelcast/client/topic/listener.h
cda6259444b23aefbfb0abd870d510ba8c5f38b2
[ "Apache-2.0" ]
permissive
ihsandemir/hazelcast-cpp-client
d30fee3a8f421d50f3f3e1cffbcd60d014c6e418
cef6d68e47afb9ab91a3c73d2c8da9c08bf5d868
refs/heads/master
2023-08-17T15:27:35.847711
2023-08-14T17:56:02
2023-08-14T17:56:02
45,042,631
0
1
Apache-2.0
2020-03-26T13:12:22
2015-10-27T13:25:02
C++
UTF-8
C++
false
false
2,457
h
listener.h
/* * Copyright (c) 2008-2023, Hazelcast, Inc. All Rights Reserved. * * 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. */ #pragma once #include <functional> #include "hazelcast/util/export.h" #include "hazelcast/util/type_traits.h" #include "hazelcast/util/noop.h" #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) #pragma warning(push) #pragma warning(disable : 4251) // for dll export #endif namespace hazelcast { namespace client { namespace topic { class message; namespace impl { class TopicEventHandlerImpl; } /** * Listen to messages from an ITopic * \see ITopic::add_message_listener */ class HAZELCAST_API listener final { public: /** * Set an handler function to be invoked when a message is received for the * subscribed topic. * * \warning * In order to guarantee message ordering, there is only one thread that * invokes the given function. The user should off-load any time consuming * operation to another thread. * * \param h a `void` function object that is callable with a single * parameter of type `Message &&` */ template<typename Handler, typename = util::enable_if_rvalue_ref_trait<Handler&&>> listener& on_received(Handler&& h) & { received_ = std::move(h); return *this; } /** * \copydoc Listener::on_received */ template<typename Handler, typename = util::enable_if_rvalue_ref_trait<Handler&&>> listener&& on_received(Handler&& h) && { on_received(std::move(h)); return std::move(*this); } private: using HandlerType = std::function<void(message&&)>; HandlerType received_ = util::noop<message&&>; friend class impl::TopicEventHandlerImpl; }; } // namespace topic } // namespace client } // namespace hazelcast #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) #pragma warning(pop) #endif
979ba43a1148f71557d0e5cf01b69ce0ca17db91
333c2bbb0703e2d6f0a8569d87691f802dc63030
/utils/RobotDisplayer/ConfigurationManager.cpp
dedc0500ed990234693ff101d39a25bfa1398f30
[]
no_license
tectronics/galileocpelyon
6ec8134d224237fa24856f377b6ae05f43f1f4f2
ac4328e8b5045fa8dec3e2d19cb9a83e97e27813
refs/heads/master
2018-01-11T15:01:00.830144
2011-09-28T19:27:46
2011-09-28T19:27:46
46,212,047
0
0
null
null
null
null
UTF-8
C++
false
false
4,259
cpp
ConfigurationManager.cpp
#include "ConfigurationManager.hpp" #define P_RECENT_FILES "recentFiles" #define P_GEOMETRY "geometry" #define P_LAST_USED_FOLDER "lastUsedFolder" #define P_FILTER_LIST "filterList" #define P_SP_OM "SP_OpenMode" #define P_SP_BR "SP_BaudRate" #define P_SP_PN "SP_PortName" #define P_SP_TO "SP_TimeOut" #define P_SP_DB "SP_DataBits" #define P_SP_FC "SP_FlowControl" #define P_SP_P "SP_Parity" #define P_SP_SB "SP_StopBits" #define P_LAST_USED_SESSION "LastUsedSession" #define P_MAX_RECENT_FILES 10 ConfigurationManager::ConfigurationManager(QObject* parent) : QObject(parent) { QCoreApplication::setOrganizationDomain("galileo-cpe.net"); QCoreApplication::setOrganizationName("Galileo"); QCoreApplication::setApplicationName("GGDE"); m_settings = new QSettings(); m_recentFiles = m_settings->value(P_RECENT_FILES, QVariant()).toStringList(); while(m_recentFiles.size() > P_MAX_RECENT_FILES) { m_recentFiles.pop_back(); } m_lastUsedFolder = m_settings->value(P_LAST_USED_FOLDER, QVariant()).toString(); } ConfigurationManager::~ConfigurationManager() { m_settings->setValue(P_RECENT_FILES, m_recentFiles); m_settings->setValue(P_LAST_USED_FOLDER, m_lastUsedFolder); delete m_settings; } void ConfigurationManager::saveGeometry(QByteArray geometry) { m_settings->setValue(P_GEOMETRY, geometry); } void ConfigurationManager::addRecentFile(const QString& fileName) { int i; for(i = 0; i < m_recentFiles.size(); i++) { if(m_recentFiles.at(i) == fileName) { if(i != 0) { m_recentFiles.move(i, 0); emit refreshRecentList(); } break; } } if(i == m_recentFiles.size()) { if(i >= P_MAX_RECENT_FILES) m_recentFiles.pop_back(); m_recentFiles.push_front(fileName); emit refreshRecentList(); } } void ConfigurationManager::saveLastUsedFolder(const QString& folder) { m_lastUsedFolder = folder.left(folder.lastIndexOf('/')); } QString& ConfigurationManager::getLastUsedFolder() { return m_lastUsedFolder; } QByteArray ConfigurationManager::getGeometry() { return m_settings->value(P_GEOMETRY, QVariant()).toByteArray(); } QStringList& ConfigurationManager::getRecentFilesList() { return m_recentFiles; } void ConfigurationManager::getSerialPortInfo(int& openModePos, int& baudRatePos, QString& portName, long& m_timeout, int& dataBitsPos, int& flowControlPos, int& parityPos, int& stopBitPos) { openModePos = m_settings->value(P_SP_OM, G_DEFAULT_SP_OM).toInt(); baudRatePos = m_settings->value(P_SP_BR, G_DEFAULT_SP_BR).toInt(); portName = m_settings->value(P_SP_PN, "/dev/ttyUSB0").toString(); // using "/dev/ttyUSB0" instead of default value m_timeout = m_settings->value(P_SP_TO, G_DEFAULT_SP_TIMEOUT).toInt(); dataBitsPos = m_settings->value(P_SP_DB, G_DEFAULT_SP_DATA_BITS).toInt(); flowControlPos = m_settings->value(P_SP_FC, G_DEFAULT_SP_FLOW_CONTROL).toInt(); parityPos = m_settings->value(P_SP_P, G_DEFAULT_SP_PARITY).toInt(); stopBitPos = m_settings->value(P_SP_SB, G_DEFAULT_SP_STOP_BITS).toInt(); } void ConfigurationManager::saveSerialPortInfo(int openModePos, int baudRatePos, const QString& portName, long m_timeout, int dataBitsPos, int flowControlPos, int parityPos, int stopBitPos) { m_settings->setValue(P_SP_OM, openModePos); m_settings->setValue(P_SP_BR, baudRatePos); m_settings->setValue(P_SP_PN, portName); m_settings->setValue(P_SP_TO, (int)m_timeout); m_settings->setValue(P_SP_DB, dataBitsPos); m_settings->setValue(P_SP_FC, flowControlPos); m_settings->setValue(P_SP_P, parityPos); m_settings->setValue(P_SP_SB, stopBitPos); } QStringList ConfigurationManager::getLastUsedSession() { return m_settings->value(P_LAST_USED_SESSION, QVariant()).toStringList(); } QStringList ConfigurationManager::getFilterList() { return m_settings->value(P_FILTER_LIST, QVariant()).toStringList(); } void ConfigurationManager::saveFilterList(QStringList list) { m_settings->setValue(P_FILTER_LIST, list); } void ConfigurationManager::saveLastUsedSession(QStringList list) { m_settings->setValue(P_LAST_USED_SESSION, list); }
263e49e40c409c34d3207262a3b541333e36f96e
4ed7dd878a2b34bace1fd91a49106eebe570a360
/HOJ/hoj1757.cpp
245a6ce28817758eaf8c86fbc2ae53a7fc98672d
[]
no_license
mayukuner/AC
fb63be04a1fcf7f3af080aa50bf7c6e0e070b1b9
c21b2970b7288d7b36cbed468101446c615e79ff
refs/heads/master
2020-12-15T02:38:51.758676
2017-10-11T13:01:11
2017-10-11T13:01:11
46,971,415
3
1
null
null
null
null
UTF-8
C++
false
false
1,272
cpp
hoj1757.cpp
#include<stdio.h> #include<algorithm> #include<string.h> #define For(i,n) for(int i=1; i<=n; i++) #define Rep(i,n) for(int i=0; i<n; i++) using namespace std; typedef long long LL; const int n=3; int mod; struct Mat{ int num[n][n]; Mat(){ memset(num,0,sizeof(num)); } Mat operator*(Mat r){ Mat ret; Rep(i,n)Rep(j,n)Rep(k,n){ ret.num[i][j]=(ret.num[i][j]+num[i][k]*(LL)r[k][j]%mod)%mod; printf("%d %d %d\n",i,j,k); } return ret; } int* operator[](int r){ return num[r]; } }mat; Mat fp(int p){ Mat t=mat,ret; Rep(i,n)ret.num[i][i]=1; while(p){ if(p&1)ret=ret*t; t=t*t; p>>=1; } return ret; } int main(){ #ifndef ONLINE_JUDGE freopen("in.txt","r",stdin); #endif int k; Mat t; Rep(i,n)Rep(j,n)t[i][j]=i*n+j; t*t; Rep(i,n){ Rep(j,n)printf("%4d",t[i][j]); puts(""); } if(0)while(scanf("%d%d",&k,&mod)!=EOF){ memset(mat.num,0,sizeof(mat.num)); Rep(i,n)scanf("%d",&mat[0][i]); if(k<10){ printf("%d\n",k%mod); continue; } Rep(i,n-1)mat[i+1][i]=1; Mat fmat=fp(k-9); Rep(i,n){ Rep(j,n)printf("%4d",fmat[i][j]); puts(""); } int ans=0; Rep(i,n)ans=(ans+fmat.num[0][i]*i%mod)%mod; printf("%d\n",ans); } return 0; }
064c90c0c9e0be9d6c26eb51f65311edee9822d7
b7f3edb5b7c62174bed808079c3b21fb9ea51d52
/base/trace_event/traced_value.h
a7e7ea4a35756705638d5b4ca8c40f9c663929d9
[ "BSD-3-Clause" ]
permissive
otcshare/chromium-src
26a7372773b53b236784c51677c566dc0ad839e4
64bee65c921db7e78e25d08f1e98da2668b57be5
refs/heads/webml
2023-03-21T03:20:15.377034
2020-11-16T01:40:14
2020-11-16T01:40:14
209,262,645
18
21
BSD-3-Clause
2023-03-23T06:20:07
2019-09-18T08:52:07
null
UTF-8
C++
false
false
8,821
h
traced_value.h
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BASE_TRACE_EVENT_TRACED_VALUE_H_ #define BASE_TRACE_EVENT_TRACED_VALUE_H_ #include <stddef.h> #include <memory> #include <sstream> #include <string> #include <vector> #include "base/macros.h" #include "base/pickle.h" #include "base/strings/string_piece.h" #include "base/trace_event/trace_event_impl.h" namespace base { class Value; namespace trace_event { class BASE_EXPORT TracedValue : public ConvertableToTraceFormat { public: // TODO(oysteine): |capacity| is not used in any production code. Consider // removing it. explicit TracedValue(size_t capacity = 0); ~TracedValue() override; void EndDictionary(); void EndArray(); // These methods assume that |name| is a long lived "quoted" string. void SetInteger(const char* name, int value); void SetDouble(const char* name, double value); void SetBoolean(const char* name, bool value); void SetString(const char* name, base::StringPiece value); void SetValue(const char* name, TracedValue* value); void BeginDictionary(const char* name); void BeginArray(const char* name); // These, instead, can be safely passed a temporary string. void SetIntegerWithCopiedName(base::StringPiece name, int value); void SetDoubleWithCopiedName(base::StringPiece name, double value); void SetBooleanWithCopiedName(base::StringPiece name, bool value); void SetStringWithCopiedName(base::StringPiece name, base::StringPiece value); void SetValueWithCopiedName(base::StringPiece name, TracedValue* value); void BeginDictionaryWithCopiedName(base::StringPiece name); void BeginArrayWithCopiedName(base::StringPiece name); void AppendInteger(int); void AppendDouble(double); void AppendBoolean(bool); void AppendString(base::StringPiece); void BeginArray(); void BeginDictionary(); // ConvertableToTraceFormat implementation. void AppendAsTraceFormat(std::string* out) const override; bool AppendToProto(ProtoAppender* appender) override; void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead) override; // TracedValue::Build is a friend of TracedValue::DictionaryItem. class BASE_EXPORT DictionaryItem; // Helper to enable easier initialization of TracedValue. This is intended for // quick local debugging as there is overhead of creating // std::initializer_list of name-value objects. This method does not support // creation of dictionaries or arrays. // // Example: // auto value = TracedValue::Build({ // {"int_var_name", 42}, // {"double_var_name", 3.14}, // {"string_var_name", "hello world"} // }); // // |name| is assumed to be a long lived "quoted" string. static std::unique_ptr<TracedValue> Build( std::initializer_list<DictionaryItem> items); // DictionaryItem instance represents a single name-value pair. class DictionaryItem { public: // These constructors assume that |name| is a long lived "quoted" string. DictionaryItem(const char* name, int value); DictionaryItem(const char* name, double value); DictionaryItem(const char* name, bool value); DictionaryItem(const char* name, void* value); // StringPiece's backing storage / const char* pointer needs to remain valid // until TracedValue::Build is called. DictionaryItem(const char* name, base::StringPiece value); // Define an explicit overload for const char* to resolve the ambiguity // between the base::StringPiece, void*, and bool constructors for string // literals. DictionaryItem(const char* name, const char* value); private: friend std::unique_ptr<TracedValue> TracedValue::Build( std::initializer_list<DictionaryItem> items); void WriteToValue(TracedValue* value) const; union KeptValue { int int_value; double double_value; bool bool_value; base::StringPiece string_piece_value; void* void_ptr_value; // Default constructor is implicitly deleted because union field has a // non-trivial default constructor. KeptValue() {} }; // Reimplementing a subset of C++17 std::variant. enum class KeptValueType { kIntType, kDoubleType, kBoolType, kStringPieceType, kVoidPtrType, }; KeptValue kept_value_; const char* name_; KeptValueType kept_value_type_; }; // A custom serialization class can be supplied by implementing the // Writer interface and supplying a factory class to SetWriterFactoryCallback. // Primarily used by Perfetto to write TracedValues directly into its proto // format, which lets us do a direct memcpy() in AppendToProto() rather than // a JSON serialization step in AppendAsTraceFormat. class BASE_EXPORT Writer { public: virtual ~Writer() = default; virtual void BeginArray() = 0; virtual void BeginDictionary() = 0; virtual void EndDictionary() = 0; virtual void EndArray() = 0; // These methods assume that |name| is a long lived "quoted" string. virtual void SetInteger(const char* name, int value) = 0; virtual void SetDouble(const char* name, double value) = 0; virtual void SetBoolean(const char* name, bool value) = 0; virtual void SetString(const char* name, base::StringPiece value) = 0; virtual void SetValue(const char* name, Writer* value) = 0; virtual void BeginDictionary(const char* name) = 0; virtual void BeginArray(const char* name) = 0; // These, instead, can be safely passed a temporary string. virtual void SetIntegerWithCopiedName(base::StringPiece name, int value) = 0; virtual void SetDoubleWithCopiedName(base::StringPiece name, double value) = 0; virtual void SetBooleanWithCopiedName(base::StringPiece name, bool value) = 0; virtual void SetStringWithCopiedName(base::StringPiece name, base::StringPiece value) = 0; virtual void SetValueWithCopiedName(base::StringPiece name, Writer* value) = 0; virtual void BeginDictionaryWithCopiedName(base::StringPiece name) = 0; virtual void BeginArrayWithCopiedName(base::StringPiece name) = 0; virtual void AppendInteger(int) = 0; virtual void AppendDouble(double) = 0; virtual void AppendBoolean(bool) = 0; virtual void AppendString(base::StringPiece) = 0; virtual void AppendAsTraceFormat(std::string* out) const = 0; virtual bool AppendToProto(ProtoAppender* appender); virtual void EstimateTraceMemoryOverhead( TraceEventMemoryOverhead* overhead) = 0; virtual bool IsPickleWriter() const = 0; virtual bool IsProtoWriter() const = 0; }; typedef std::unique_ptr<Writer> (*WriterFactoryCallback)(size_t capacity); static void SetWriterFactoryCallback(WriterFactoryCallback callback); protected: TracedValue(size_t capacity, bool forced_json); std::unique_ptr<base::Value> ToBaseValue() const; private: std::unique_ptr<Writer> writer_; #ifndef NDEBUG // In debug builds checks the pairings of {Start,End}{Dictionary,Array} std::vector<bool> nesting_stack_; #endif DISALLOW_COPY_AND_ASSIGN(TracedValue); }; // TracedValue that is convertable to JSON format. This has lower performance // than the default TracedValue in production code, and should be used only for // testing and debugging. Should be avoided in tracing. It's for // testing/debugging code calling value dumping function designed for tracing, // like the following: // // TracedValueJSON value; // AsValueInto(&value); // which is designed for tracing. // return value.ToJSON(); // // If the code is merely for testing/debugging, base::Value should be used // instead. class BASE_EXPORT TracedValueJSON : public TracedValue { public: explicit TracedValueJSON(size_t capacity = 0) : TracedValue(capacity, /*forced_josn*/ true) {} using TracedValue::ToBaseValue; // Converts the value into a JSON string without formatting. Suitable for // printing a simple value or printing a value in a single line context. std::string ToJSON() const; // Converts the value into a formatted JSON string, with indentation, spaces // and new lines for better human readability of complex values. std::string ToFormattedJSON() const; }; // Return std::string representation given by |value|'s ostream operator<<. template <typename T> std::string ValueToString(const T& value) { std::stringstream ss; ss << value; return ss.str(); } } // namespace trace_event } // namespace base #endif // BASE_TRACE_EVENT_TRACED_VALUE_H_
690e272e52afce33304ff3f7f11d6ca7d0b8eb11
5afea00591b958a38b5b3989bba0b6d6460c8718
/client/Game.h
0431dfb1c72c3be0bb4c27eaa36cdc1fbe2129b3
[]
no_license
proheap/UNO
982d958271617f968a1d8188fdd2d010b907b7bd
e4224abb3434a258dcb7437ad367212134b6180e
refs/heads/master
2021-06-14T14:20:41.196866
2021-04-20T19:45:22
2021-04-20T19:45:22
165,445,053
4
0
null
null
null
null
UTF-8
C++
false
false
2,004
h
Game.h
#pragma once #define FILE_CHANGE_COLOR "assets/change_color.png" #define CHANGE_COLOR_POSX 400 #define CHANGE_COLOR_POSY 285 #define CHANGE_COLOR_WIDTH 150 #define FILE_BLUE "assets/blue.png" #define FILE_RED "assets/red.png" #define FILE_GREEN "assets/green.png" #define FILE_YELLOW "assets/yellow.png" #define COLOR_POSX 585 #define COLOR_POSY 415 #define COLOR_WIDTH 110 #define FILE_UNO_BUTTON "assets/uno-button.png" #define UNO_BUTTON_POSX 1100 #define UNO_BUTTON_POSY 450 #define UNO_BUTTON_WIDTH 130 #define UNO_BUTTON_HEIGHT 100 #include <iostream> #include <array> #include "heap_monitor.h" #include "Player.h" #include "Opponent.h" #include "Table.h" #include "WindowObject.h" using namespace std; class Game { public: Game(SDL_Renderer* renderer); ~Game(); void createPlayer(int order); void addOpponent(int order); void startGame(); void showOpponentsCards(); void showUnoButton(); void hideUnoButton(); void updateOpponentCards(int opponent, int cardsCount); void addPlayerCard(char cardColor, char cardSymbol); void addPlayedCard(char cardColor, char cardSymbol); void playRound(int orderCard); bool pollEventsGame(SDL_Event event, char* message); bool eventUnoButton(SDL_Event event, char* message, bool oneCard); vector<Opponent*>* getOpponents(); vector<WindowObject*>* getGameObjects(); vector<WindowObject*>* getPlayerHandObjects(); vector<WindowObject*>* getOpponentsHandObjects(); private: vector<Opponent*> _opponents; Table* _table; Player* _player; int _playerOrder; bool _changingColor; bool _changedColor; bool _unoPressed; SDL_Renderer* _renderer; vector<WindowObject*> _gameObjects; vector<WindowObject*> _playerHandObjects; vector<WindowObject*> _opponentsHandObjects; WindowObject* _deckObject; WindowObject* _playedCardObject; WindowObject* _changeColorObject; WindowObject* _colorBlueObject; WindowObject* _colorRedObject; WindowObject* _colorGreenObject; WindowObject* _colorYellowObject; WindowObject* _unoButton; };
43df88bfe5277898b84d8624e69f17175bb6bc12
ed42197170d1361f8c5f76de43d2e3c04c8ce79c
/include/bp_datastructures/patientestimates.h
0ec25a769d7bc07403f28cf5060d6e6e902f8952
[]
no_license
BayesPulse/libpulsatile
2ab991bbffa111d70ec6a9e36c74bbe34141a227
42ef4acef1f0b663faf2a7446aaa67df2fed94d9
refs/heads/master
2022-05-01T21:52:54.961243
2019-09-06T00:41:47
2019-09-06T00:41:47
115,029,164
2
2
null
2019-12-19T02:11:16
2017-12-21T17:10:48
Objective-C
UTF-8
C++
false
false
2,311
h
patientestimates.h
#ifndef GUARD_patientestimates_h #define GUARD_patientestimates_h #include <RcppArmadillo.h> #ifndef NORINSIDE #include <RInside.h> #endif #include <bp_mcmc/utils.h> // // patientestimates.h // defining the estimates object used at the patient level // // Author: Matt Mulvahill // Notes: // using namespace Rcpp; // // PatientEstimates structure // // TODO: abandoned inheritance approach -- clean up comments // 1. PatientEstimates_Pop is the version of the 'common parms' mcmc chain // (patient-level estimates) that is used in the population model. // // 2. PatientEstimates_Single is the single-subject version, which adds two // parameters. These two parameters are estimated at the population level in // the pop model. // struct PatientEstimates { // Used in all models arma::vec baseline_halflife; //double baseline; //double halflife; double errorsq; // model error (variance) double mass_mean; double width_mean; //int pulse_count; // function of linked list instead?; // Always use these functions to get these values. removed them as separate // member variables to ensure the result is always up-to-date double get_decay() { return log(2) / baseline_halflife(1); } double get_logerrorsq() { return log(errorsq); } // // For population-only model (just constructor is unique) // PatientEstimates(double sv_baseline, double sv_halflife, double sv_errorsq, double sv_mass_mean, double sv_width_mean) { baseline_halflife = { sv_baseline, sv_halflife }; errorsq = sv_errorsq; mass_mean = sv_mass_mean; width_mean = sv_width_mean; //pulse_count = 1; } // // For single-subject model only // double mass_sd; double width_sd; // Single-subject constructor: PatientEstimates(double sv_baseline, double sv_halflife, double sv_errorsq, double sv_mass_mean, double sv_width_mean, double sv_mass_sd, double sv_width_sd) : PatientEstimates(sv_baseline, sv_halflife, sv_errorsq, sv_mass_mean, sv_width_mean) { mass_sd = sv_mass_sd; width_sd = sv_width_sd; } }; #endif
aa5ca3cb48aa91cc452416e2cde87a04fa51ef17
9e2201dccea7c979d25999935d46e6b08c3001cd
/recorderwidget.h
12bced01454a98afc4dd642bc17b35c793983763
[]
no_license
wbt729/pure
93edf2e3a1e3efd81a8741d37d635fd50a01406b
0ac56d440420d3756ffce0420992dd84460b08b4
refs/heads/master
2021-01-15T16:56:38.474510
2012-05-25T14:32:05
2012-05-25T14:32:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
423
h
recorderwidget.h
#ifndef RECORDERWIDGET_H #define RECORDERWIDGET_H #include <QWidget> #include <qdebug.h> #include <QFile> #include "ui_recorderwidget.h" class RecorderWidget : public QWidget { Q_OBJECT public: RecorderWidget(QWidget *parent = 0); ~RecorderWidget(); private: Ui::RecorderWidget ui; QString filename; QFile file; QTextStream out; public slots: void input(double, double, double); }; #endif // RECORDERWIDGET_H
aadd3455e58a0bce3bcd78cb8ff17ddf5aa89e1b
f67f4c6d0d3570d1e99598f51af6fc08f57ad13a
/Recursion 2/Staircase.cpp
ae17003c9e68527bacaa901a936fdffe878d8256
[]
no_license
prateek200/Data-Structures-and-Algorithm
71af2e32d93b9efbc5c1a3ab2193d1121031a381
94a9be5140d18edd613d31aa6d314a69cf428202
refs/heads/main
2023-07-07T07:06:43.066760
2021-08-12T09:05:12
2021-08-12T09:05:12
381,647,197
0
0
null
null
null
null
UTF-8
C++
false
false
345
cpp
Staircase.cpp
int staircase(int n, int count = 0) { if (n <= 0) { if (n == 0) { return (count + 1); } else { return (count); } } int ans = staircase(n - 1, count); int ans1 = staircase(n - 2, ans); int k = staircase(n - 3, ans1); return (k); }
22b44f6002fb91a79f70b1fe13b5bb97f7621302
4057c476345d46141e8c4f43707f2c31a237bdaa
/src/xci/core/EditBuffer.h
499d60aaa2eca5d1b5a6f75c7ddfea7d46ec612c
[ "Apache-2.0" ]
permissive
rbrich/xcikit
25c6895755841b9eaa8d6a5e8321e5e2fc48e8b0
c1d7061ef0a4e8bfc88d784ae64ffc8ad5035e11
refs/heads/master
2023-09-04T15:20:40.477588
2023-08-31T20:23:15
2023-08-31T20:23:15
124,593,515
18
1
Apache-2.0
2023-09-12T18:51:25
2018-03-09T21:09:23
C++
UTF-8
C++
false
false
2,411
h
EditBuffer.h
// EditBuffer.h created on 2021-02-27 as part of xcikit project // https://github.com/rbrich/xcikit // // Copyright 2021 Radek Brich // Licensed under the Apache License, Version 2.0 (see LICENSE file) #ifndef XCI_CORE_EDITBUFFER_H #define XCI_CORE_EDITBUFFER_H #include <string> #include <string_view> namespace xci::core { /// Internal buffer for text-editing components /// Tracks cursor position and supports various editing operations at the cursor class EditBuffer { public: EditBuffer() = default; explicit EditBuffer(std::string initial_content) : m_content(std::move(initial_content)), m_cursor(m_content.size()) {} void clear() { m_content.clear(); m_cursor = 0; } void set_content(std::string content) { m_content = std::move(content); m_cursor = m_content.size(); } /// Cursor position, valid range is: /// * from 0 - at beginning, before first char /// * to content.size() - at end, after last char size_t cursor() const { return m_cursor; } void set_cursor(size_t absolute_position); const std::string& content() const { return m_content; } std::string_view content_view() const { return m_content; } bool empty() const { return m_content.empty(); } std::string_view content_upto_cursor() const { return std::string_view(m_content).substr(0, m_cursor); } std::string_view content_from_cursor() const { return std::string_view(m_content).substr(m_cursor); } void insert(std::string_view text); // Keyboard actions - returns true when buffer was modified (action succeeded) bool delete_left(); // Backspace bool delete_right(); // Delete bool move_left(); // Left bool move_right(); // Right bool move_up(); // Up bool move_down(); // Down bool move_to_line_beginning(); // Home bool move_to_line_end(); // End bool move_to_beginning(); // PgUp, Alt + Home bool move_to_end(); // PgDown, Alt + End bool skip_word_left(); // Alt + Left bool skip_word_right(); // Alt + Right bool delete_word_left(); // Alt + Backspace bool delete_word_right(); // Alt + Delete bool is_word_char_left_of_cursor() const; private: std::string m_content; size_t m_cursor = 0; }; } // namespace xci::core #endif // include guard
b26cc067bcc12bdef0b77624c248f91a42136ecf
cfeac52f970e8901871bd02d9acb7de66b9fb6b4
/generated/src/aws-cpp-sdk-budgets/source/model/ExecutionType.cpp
1ba198b0ea763e6efe861760b00b082022750241
[ "Apache-2.0", "MIT", "JSON" ]
permissive
aws/aws-sdk-cpp
aff116ddf9ca2b41e45c47dba1c2b7754935c585
9a7606a6c98e13c759032c2e920c7c64a6a35264
refs/heads/main
2023-08-25T11:16:55.982089
2023-08-24T18:14:53
2023-08-24T18:14:53
35,440,404
1,681
1,133
Apache-2.0
2023-09-12T15:59:33
2015-05-11T17:57:32
null
UTF-8
C++
false
false
2,778
cpp
ExecutionType.cpp
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/budgets/model/ExecutionType.h> #include <aws/core/utils/HashingUtils.h> #include <aws/core/Globals.h> #include <aws/core/utils/EnumParseOverflowContainer.h> using namespace Aws::Utils; namespace Aws { namespace Budgets { namespace Model { namespace ExecutionTypeMapper { static const int APPROVE_BUDGET_ACTION_HASH = HashingUtils::HashString("APPROVE_BUDGET_ACTION"); static const int RETRY_BUDGET_ACTION_HASH = HashingUtils::HashString("RETRY_BUDGET_ACTION"); static const int REVERSE_BUDGET_ACTION_HASH = HashingUtils::HashString("REVERSE_BUDGET_ACTION"); static const int RESET_BUDGET_ACTION_HASH = HashingUtils::HashString("RESET_BUDGET_ACTION"); ExecutionType GetExecutionTypeForName(const Aws::String& name) { int hashCode = HashingUtils::HashString(name.c_str()); if (hashCode == APPROVE_BUDGET_ACTION_HASH) { return ExecutionType::APPROVE_BUDGET_ACTION; } else if (hashCode == RETRY_BUDGET_ACTION_HASH) { return ExecutionType::RETRY_BUDGET_ACTION; } else if (hashCode == REVERSE_BUDGET_ACTION_HASH) { return ExecutionType::REVERSE_BUDGET_ACTION; } else if (hashCode == RESET_BUDGET_ACTION_HASH) { return ExecutionType::RESET_BUDGET_ACTION; } EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { overflowContainer->StoreOverflow(hashCode, name); return static_cast<ExecutionType>(hashCode); } return ExecutionType::NOT_SET; } Aws::String GetNameForExecutionType(ExecutionType enumValue) { switch(enumValue) { case ExecutionType::APPROVE_BUDGET_ACTION: return "APPROVE_BUDGET_ACTION"; case ExecutionType::RETRY_BUDGET_ACTION: return "RETRY_BUDGET_ACTION"; case ExecutionType::REVERSE_BUDGET_ACTION: return "REVERSE_BUDGET_ACTION"; case ExecutionType::RESET_BUDGET_ACTION: return "RESET_BUDGET_ACTION"; default: EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); } return {}; } } } // namespace ExecutionTypeMapper } // namespace Model } // namespace Budgets } // namespace Aws
db6557d5dedb88751dd1f954426e43662d57cdce
cb99855f65aba64e6dc08fc280362e0be5941554
/Lite oj/Accepted/1043 - Triangle Partitioning.cpp
0473ffd000fa9d99444207af837d66f76595b821
[]
no_license
tawsif93/ProgrammingCode
a4f2ed703a3ed45bad4f211ba16663ce9d9adb46
b7a1445c7bdcd606ca419cf07806328d6d7ceceb
refs/heads/master
2021-01-10T19:09:35.261052
2015-03-16T16:02:09
2015-03-16T16:02:09
32,336,279
1
0
null
null
null
null
UTF-8
C++
false
false
321
cpp
1043 - Triangle Partitioning.cpp
#include<iostream> #include<cmath> #include<iomanip> using namespace std; int main() { int t; double a,b,c, AD,ratio; cin >> t; for(int i =0 ; i < t; i++) { cin >> a >> b >> c >> ratio; AD = a * sqrt( ratio /(ratio +1)); cout << "Case " << i+1 << ": " << setprecision(12) << AD << endl; } }
d42e451c46a4fcf33d05504005266c2397c3ea08
62bf95c1cc2607e2b0a97ccc54e2fb85c1a38164
/Server/Src/GameServer/GameObject/SceneObject.cpp
a7fe873dc3a5a74cdb97cac269b8d887da6af7b9
[]
no_license
pengbn/GameProject3
e053c7d09993c5bd4952061ead49d8b36ae56266
da290e812330ae96f2b49b5d8098a6718433a6ca
refs/heads/master
2021-08-08T02:45:48.615017
2017-11-09T12:12:15
2017-11-09T12:12:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,614
cpp
SceneObject.cpp
#include "stdafx.h" #include "SceneObject.h" #include "../GameService.h" #include "../Message/Msg_Copy.pb.h" #include "BuffObject.h" #include "Log.h" CSceneObject::CSceneObject(UINT64 uGuid, UINT32 dwActorID, UINT32 dwObjType, UINT32 dwCamp, std::string strName) { m_dwProxyConnID = 0; m_dwClientConnID = 0; m_dwObjState = 0; m_bEnter = FALSE; memset(m_Propertys, 0, sizeof(m_Propertys)); m_uGuid = uGuid; m_dwActorID = dwActorID; m_dwObjType = dwObjType; m_dwCamp = dwCamp; m_strName = strName; m_bDataChange = FALSE; m_SkillObject.SetHostObject(this); } CSceneObject::~CSceneObject() { } //BOOL CSceneObject::StartSkill() //{ //UINT32 SkillID; //UINT32 targets[1]; //BOOL bKill; //需要检 /* 1. 技能是否存在。 2. 技能CD是否可以施放。 3. 技能是否可以打中指定的目标. 4. 玩家是否增加buff. //技能分类。 1. 立即攻击技有, 只有CD, 方向, 2. 增加buff的技能, 就增加buff. 3. 位移技能, 需要带位移长度。 4. 波次技能。 就是每一帆的收集攻击的对象.就是分成两部分。 5. 时长技能。 放出去就有位移,由客户端自己算打中谁,服务器验证一下。就转发。 //实现设想两种。 1. 一放一个技能,就new一个技能对象。 在线这个技能对象里就update,不断的update,由技能本身去改变状态,寻找攻击目标. 2. 服务器不管过程。 由客户端去驱动攻击状态。 */ /* buff类型, buff的特效就不用管了。 1. 增加属性, 加上就上, 减掉就取消。 2. 修改状态, 3. 每秒造成伤害 4. 攻击时增加伤害 5. 持线伤害 玩家需要对应的状态 1. 无敌。 2. 不能移动。 */ //return TRUE; //} BOOL CSceneObject::SetConnectID(UINT32 dwProxyID, UINT32 dwClientID) { m_dwProxyConnID = dwProxyID; m_dwClientConnID = dwClientID; return TRUE; } // BOOL CPlayerObject::AttackEvent() // { // UINT32 SkillID; // UINT32 targets[]; // // // } BOOL CSceneObject::SendMsgProtoBuf(UINT32 dwMsgID, const google::protobuf::Message& pdata) { return ServiceBase::GetInstancePtr()->SendMsgProtoBuf(m_dwProxyConnID, dwMsgID, GetObjectGUID(), m_dwClientConnID, pdata); } BOOL CSceneObject::SendMsgRawData(UINT32 dwMsgID, const char* pdata, UINT32 dwLen) { return ServiceBase::GetInstancePtr()->SendMsgRawData(m_dwProxyConnID, dwMsgID, GetObjectGUID(), m_dwClientConnID, pdata, dwLen); } BOOL CSceneObject::OnUpdate( UINT64 dwTick ) { UpdateBuff(dwTick); m_SkillObject.OnUpdate(dwTick); return TRUE; } UINT32 CSceneObject::GetHp() { return m_Propertys[HP]; } UINT32 CSceneObject::GetMp() { return m_Propertys[MP]; } VOID CSceneObject::AddHp( UINT32 dwValue ) { m_Propertys[HP] += dwValue; } VOID CSceneObject::SubHp( UINT32 dwValue ) { m_Propertys[HP] -= dwValue; if(m_Propertys[HP] < 0) { m_Propertys[HP] = 0; } } VOID CSceneObject::AddMp( UINT32 dwValue ) { m_Propertys[MP] += dwValue; } VOID CSceneObject::SubMp( UINT32 dwValue ) { m_Propertys[MP] -= dwValue; if(m_Propertys[MP] < 0) { m_Propertys[MP] = 0; } } UINT64 CSceneObject::GetObjectGUID() { return m_uGuid; } UINT32 CSceneObject::GetActorID() { return m_dwActorID; } UINT32 CSceneObject::GetObjType() { return m_dwObjType; } UINT32 CSceneObject::GetCamp() { return m_dwCamp; } BOOL CSceneObject::IsConnected() { return (m_dwClientConnID != 0) && (m_dwProxyConnID != 0); } BOOL CSceneObject::IsEnterCopy() { return m_bEnter; } VOID CSceneObject::SetEnterCopy() { m_bEnter = TRUE; } BOOL CSceneObject::SaveNewObject( ObjectNewNty& Nty ) { NewItem* pItem = Nty.add_newlist(); pItem->set_objectguid(m_uGuid); pItem->set_objtype(m_dwObjType); pItem->set_actorid(m_dwActorID); pItem->set_name(m_strName); pItem->set_level(m_dwLevel); pItem->set_summonid(m_uSummonerID); pItem->set_controlerid(m_uControlerID); pItem->set_hostguid(m_uHostGuid); pItem->set_x(m_x); pItem->set_x(m_y); pItem->set_z(m_z); pItem->set_ft(m_ft);; pItem->set_hp(m_Propertys[HP]); pItem->set_mp(m_Propertys[MP]); pItem->set_hpmax(m_Propertys[HP_MAX]); pItem->set_mpmax(m_Propertys[MP_MAX]); return TRUE; } BOOL CSceneObject::IsDie() { if(m_Propertys[HP] <= 0) { return TRUE; } return FALSE; } BOOL CSceneObject::SetPos(FLOAT x, FLOAT y, FLOAT z, FLOAT ft) { m_x = x; m_y = y; m_z = z; m_ft = ft; return TRUE; } UINT32 CSceneObject::GetLastSkillTime(UINT32 dwSkillID) { auto itor = m_mapSkillTime.find(dwSkillID); if(itor != m_mapSkillTime.end()) { return itor->second; } return 0; } BOOL CSceneObject::SetLastSkillTime(UINT32 dwSkillID, UINT32 dwTime) { m_mapSkillTime.insert(std::make_pair(dwSkillID, dwTime)); return TRUE; } BOOL CSceneObject::SaveBattleResult(ResultPlayer* pResult) { pResult->set_objectid(m_uGuid); pResult->set_actorid(m_dwActorID); pResult->set_result(m_dwResult); pResult->set_damage(m_dwDamage); return TRUE; } BOOL CSceneObject::AddBuff(UINT32 dwBuffID) { CBuffObject* pBuffObject = new CBuffObject(this, dwBuffID); ERROR_RETURN_FALSE(pBuffObject != NULL); pBuffObject->OnAddBuff(); m_mapBuff.insert(std::make_pair(dwBuffID, pBuffObject)); return TRUE; } BOOL CSceneObject::UpdateBuff(UINT64 dwTick) { for(std::map<UINT32, CBuffObject*>::iterator itor = m_mapBuff.begin(); itor != m_mapBuff.end();) { CBuffObject* pBuffObject = itor->second; ERROR_CONTINUE_EX(pBuffObject != NULL); pBuffObject->OnUpdate(dwTick); if(pBuffObject->IsOver()) { delete pBuffObject; itor = m_mapBuff.erase(itor); } else { itor++; } } return TRUE; } BOOL CSceneObject::StartSkill(const ActionReqItem& Item) { ERROR_RETURN_FALSE(m_pScene != NULL); m_x = Item.hostx(); m_y = Item.hosty(); m_z = Item.hostz(); m_ft = Item.hostft(); ActionNtyItem* pSvrItem = m_pScene->m_ObjectActionNty.add_actionlist(); ERROR_RETURN_TRUE(pSvrItem != NULL); pSvrItem->set_objectguid(Item.objectguid()); pSvrItem->set_objstatue(m_dwObjState); //实例状态 pSvrItem->set_actorid(m_dwActorID); //类型ID pSvrItem->set_controlerid(m_uControlerID); //AI控制人的GUID pSvrItem->set_actionid(Item.actionid()); pSvrItem->set_actiontime(0); pSvrItem->set_x(m_x); pSvrItem->set_y(m_y); pSvrItem->set_z(m_z); pSvrItem->set_ft(m_ft); pSvrItem->set_hp(GetHp()); pSvrItem->set_mp(GetMp()); pSvrItem->set_hpmax(1000); pSvrItem->set_mpmax(1000); m_bDataChange = FALSE; return TRUE; } BOOL CSceneObject::StartAction(const ActionReqItem& Item) { ERROR_RETURN_FALSE(m_pScene != NULL); m_x = Item.hostx(); m_y = Item.hosty(); m_z = Item.hostz(); m_ft = Item.hostft(); m_bDataChange = TRUE; return TRUE; }
9165effb45e791a2e3f7245f5ab0b4827daf0d40
5ff233c4002e05e6a61fd0ca42eae1b265ce8ac8
/strings/finding-borders.cpp
a2c7af23e3be94df9842cf426ffe0ad0e8e34034
[]
no_license
oscarburga/cses-solutions
88d8aa3b4f2b2445c3a4e0e0bc685b0972f3c9d5
3912900017c29b03208d867c4de3b123e8b68f49
refs/heads/master
2023-03-25T21:04:42.506801
2021-03-26T03:29:04
2021-03-26T03:29:04
283,669,978
2
0
null
null
null
null
UTF-8
C++
false
false
492
cpp
finding-borders.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; const int maxn = 1e6+5; char s[maxn]; int n, b[maxn]; int main(){ scanf("%s", s); n = strlen(s); for(int i = 1, j = 0; i<n; i++) { while(j > 0 && s[i] != s[j]) j = b[j-1]; b[i] = (j += s[i] == s[j]); } vector<int> ans; for(int j = b[n-1]-1; j >= 0; j = b[j]-1) ans.push_back(j+1); reverse(ans.begin(), ans.end()); for(int i = 0; i<ans.size(); i++) printf("%d%c", ans[i], " \n"[i+1==ans.size()]); return 0; }
2a940d1ada0f7e8cf585d774888e228f74484c1d
225b9a9ce807b669f5da0224b374bbf496d0bc70
/其他/搜索/折半搜索/lg3067.cpp
4ccd02256c7e20d915e068f31dd9160bb2aec941
[]
no_license
Kewth/OJStudy
2ed55f9802d430fc65647d8931c028b974935c03
153708467133338a19d5537408750b4732d6a976
refs/heads/master
2022-08-15T06:18:48.271942
2022-07-25T02:18:20
2022-07-25T02:18:20
172,679,963
6
2
null
null
null
null
UTF-8
C++
false
false
19
cpp
lg3067.cpp
../../../lg3067.cpp
c926f19a73b992fd63b18de662bfb01042d6e702
011c2301acc7dd74e49a053f1917398363220024
/Using_CPP/Graphics/project1.main.cpp
06e5e6c1fe2d0c8658ebc0cf1c65129e415920a4
[]
no_license
KaushalPrajapat/Programming_CPP
23bc572a7d7683e02306183d0b5b5d2b62e1539b
3e60d12b16ba79645772845ab13bd474fb4cb306
refs/heads/master
2023-04-20T08:41:20.354171
2021-05-19T17:58:02
2021-05-19T17:58:02
368,956,892
0
0
null
null
null
null
UTF-8
C++
false
false
169
cpp
project1.main.cpp
#include<stdio.h> #include<graphics.h> int main() { int gd = DETECT, gm; initgraph(&gd,&gm,""); circle(100,100,20); //fillcolor(12); getch(); closegraph(); }
321f2d6881949e12a4fe16853b63fdd25451a679
8743613cdbf89c3457d2ddd65ecbb48959ef1585
/MenuActions.h
355264a1ea2cc6128676f7e4bb764e33f1bda326
[]
no_license
tcolussi/Cambrian-src
e17334730d6cc38fb44d9d8a3db0c35fc1e05853
ecc61a5f4748be4cf97533313f7cb017f7c52f26
refs/heads/master
2021-01-09T07:18:40.883883
2014-10-31T18:46:12
2014-10-31T18:46:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,481
h
MenuActions.h
#ifndef MENUACTIONS_H #define MENUACTIONS_H #ifndef PRECOMPILEDHEADERS_H #include "PreCompiledHeaders.h" #endif enum EMenuAction // Must be in sync with c_mapepszmMenuActions[] { eMenuActionSeparator = 0xFF, // Add a separator when adding menu actions to a menu (the separator is usually to separate group of menu items) ezMenuActionNone = 0, // No action to be taken (this is also the zero-terminator in an array rgze[]) // The following eMenuAction_Presence* must be at the beginning of this enumeration because they are serialized eMenuAction_PresenceAway, // Your status automatically changes to away when your computer is idle for more than 20 minutes eMenuAction_PresenceAwayExtended, eMenuAction_PresenceBusy, eMenuAction_PresenceInvisible, // The account is connected, however invisible to others (others will see the contact as offline) eMenuAction_PresenceAccountDisabled, // The account has been disabled by the user and therefore will not attempt to connect unless explicitly enabled // The following presences are not serialized because they are dynamic and depends on the network condition eMenuAction_PresenceAccountOnline, // The account is ready to chat (connected to the server) eMenuAction_PresenceAccountOffline, // The account offline, however will become online next time the application starts, or the global status changes eMenuAction_PresenceAccountConnecting, eMenuAction_PresenceAccountDisconnected, // The account is not connected to the server (probably there is no Internet connection or the server is down) eMenuAction_PresenceLast = eMenuAction_PresenceAccountDisconnected, eMenuAction_MessageNew, // There is a new message available to read eMenuAction_ProfileDelete, eMenuAction_ProfileProperties, eMenuAction_ProfileMyRecommendations, // Display all the recommendations I made eMenuAction_ProfileShowDeletedObjects, // Display all hidden objects such as contacts and groups eMenuAction_ProfilePermanentlyDeleteObject, // Permanently delete a hidden object eMenuAction_ApplicationHide, // Hide the application from the Navigation Tree (the application will keep running in memory) eMenuAction_ApplicationDelete, // Permanently delete the application eMenuAction_ApplicationProperties, eMenuAction_AccountAcceptInvitation, // Accept the invitation sent by a friend (the invitation is typically sent by email or by another messaging system) eMenuAction_AccountRegister, // Register (create a new account) eMenuAction_AccountLogin, // Login (add an existing account) eMenuAction_AccountRename, // Change the display name of the selected account eMenuAction_AccountDelete, // Delete/remove the selected account eMenuAction_AccountProperties, // Display the properties of the selected account eMenuAction_AccountReconnect, // Reconnect to the server //eMenuAction_AccountEnable, //eMenuAction_AccountDisable, // Prevent the account to reconned eMenuAction_Contact, // Generic icon for a contact eMenuAction_ContactAdd, // Add a new contact to the selected account eMenuAction_ContactAddToGroup, // Add the selected contact to an existing group eMenuAction_ContactRename, eMenuAction_ContactRemove, // Delete/remove the selected contact eMenuAction_ContactUndelete, // Undelete a removed/deleted contact eMenuAction_ContactSendFile, // Send a file to a contact eMenuAction_ContactInvite, // Create an invitation for a new contact eMenuAction_ContactApprove, // Add the selected contact to your list of approved contacts eMenuAction_ContactSubscribe, eMenuAction_ContactUnsubscribe, eMenuAction_ContactProperties, // Display the properties of the selected contact eMenuAction_ContactPing, // Ping to the contact eMenuAction_Contact_SubMenuView, eMenuAction_Contact_SubMenuView_Recommendations, // View the recommendations made by the contact eMenuAction_Contact_SubMenuView_Transactions, // Display the (Bitcoin) transactions related to the contact eMenuAction_SynchronizeWithContact, eMenuAction_SynchronizeWithGroup, eMenuAction_Group, eMenuAction_GroupNew, eMenuAction_GroupCreate, eMenuAction_GroupDelete, eMenuAction_GroupUndelete, eMenuAction_GroupRename, eMenuAction_GroupAddContacts, eMenuAction_GroupRemoveContact, eMenuAction_GroupProperties, // Display the properties of the group eMenuAction_GroupLaunchBallot, // Lanuch the ballotmaster eMenuAction_GroupSetPurpose, // Set the topic/purpose eMenuAction_GroupUpgradeService, // Upgrade the service to speed up message delivery eMenuAction_GroupUpgradeToCorporation, // Make this group a corporation eMenuAction_GroupChannelInviteOthers, // Invite others to join the channel eMenuAction_GroupChannelLeave, // Stop receiving messages from this channel eMenuAction_TreeItemRecommended, // Generic menu action to recommend an item in the Navigation Tree eMenuAction_TreeItemRename, // Generic menu action to rename an item in the Navigation Tree eMenuAction_MessageEdit, eMenuAction_Copy, eMenuAction_CopyHyperlink, eMenuAction_SelectAll, eMenuAction_DisplayProfileInfo, // Show the node displaying the profile(s) info eMenuAction_DisplayCertificates, // Display the certificates securing (encrypting) the communication eMenuAction_DisplayBallotMaster, // Manage ballots to create polls eMenuAction_DisplayGroupManager, // Manage groups eMenuAction_WikiSubMenu, //eMenuAction_WikiNavShellContacts, //eMenuAction_WikiNavShellSideBar, //eMenuAction_WikiNavShellHeader, eMenuAction_WikiOfficeKingpin, eMenuAction_WikiPomodoro, eMenuAction_WikiJapiTests, eMenuAction_WikiScratch, //eMenuAction_WikiHtml5Xik, //eMenuAction_WikiGroupManager, //eMenuAction_WikiBallotMaster, eMenuAction_AppDefaultNewTab, eMenuAction_AppUnderconstruction, //eMenuAction_AppHome, eMenuAction_AppConfiguration, eMenuAction_DisplayWallet, // Ccreate a new wallet eMenuAction_DisplaySecureWebBrowsing, // New instance of a web browser eMenuAction_WalletGenerateDummyTransactions, eMenuAction_WalletClose, eMenuAction_BallotSend, // Send a ballot to poll votes from the group eMenuAction_BallotReSend, // Resend an existing ballot eMenuAction_BallotAddToBallotmaster, // Make a copy of the selected ballot and add it to the Ballotmaster as a future template eMenuAction_ShowLogMessages, // Show the MessageLog eMenuAction_ShowLogErrors, // Show the ErrorLog (aka Recent Errors) eMenuAction_FindText, // Search text in the message log eMenuAction_DebugSendChatLog, // Send the Chat Log to the Cambrian developer for debugging purpose eMenuAction_PlaySound, eMenuAction_ConfigurationSaveAsXmlFile, // The user may save the configuration under a different file name. Useful to perform a backup. eMenuAction_ConfigurationOpenFromXmlFile, // Open a configuration file #ifdef COMPILE_WITH_OPEN_TRANSACTIONS eMenuAction_OpenOTServerContrat, // OT Server Contract management #endif eMenuAction_Close, // Close the window eMenuAction_Quit, // Quit the chat application /////////////////////////////////// // The following are no longer menu actions, but icons. Since most menu actions have an associated icon, it is convenient to have the icons in the same enumeration. eMenuIcon_PresenceInsecureOnline, // The user is online using a non-Cambrian insecure client. eMenuIconQuestion, eMenuIconWarning, eMenuIconAdd, eMenuIconRemove, eMenuIconPencil_10x10, eMenuIconPencil_16x16, eMenuIconOverflow, eMenuIconBitcoin, eMenuIconMarketplace, eMenuIconMarketplaceArbitration, eMenuIconMarketplaceMediation, eMenuIconMarketplaceLawyers, eMenuIconJurisdiction, eMenuIconCorporations, eMenuIconProfile, eMenuIconSettings, eMenuIconCommunicate, eMenuIconBanking, eMenuIconBank, eMenuIconBankNew, eMenuIconExchange, eMenuIconReputation, eMenuIconHealthcare, eMenuIconSecurityGuard, eMenuIconSecurityOptions, eMenuIconJobs, eMenuIconSell, eMenuIconServices, eMenuIconPersonals, eMenuIconIssue, eMenuIconIssueAsset, eMenuIconIssueCurrency, eMenuIconIssueFuture, eMenuIconIssueDividends, eMenuIconMarket, eMenuIconVote, eMenuIconBroadcast, eMenuIconListen, eMenuIconRipple, eMenuIconComponent, eMenuIconCommunity, eMenuIconFacebook, eMenuIconGoogleHangout, eMenuIconBitstamp, eMenuIconCoinbase, eMenuIconCoffeeExchange, eMenuIconCoffeeBuy, eMenuIconCoffeeSell, eMenuIconHome, eMenuIconGoBack, eMenuIconGoForward, eMenuActionMax, // Last menu action to be defined in c_mapepszmMenuActions[] // The following 'special actions' do not appear on menus, however they are actions for the virtual method TreeItem_EDoMenuAction(). eMenuSpecialAction_ITreeItemRenamed, // Notification message the display name of a ITreeItem was changed. This is an opportunity to validate the new name, or if the new name is empty, set it to the default value. eMenuSpecialAction_GroupFirst, eMenuSpecialAction_GroupLast = eMenuSpecialAction_GroupFirst + 100, // The following menu actions are for sharing icons with other menu actions eMenuIconXmpp = eMenuAction_AccountLogin, eMenuIconAccept = eMenuAction_ContactApprove, // At the moment the "Accept" icon is the same as the "Approve Peer" }; // EMenuAction typedef BYTE EMenuActionByte; // A menu action stored wihin a single byte (as long as we have less than ~250 menu actions) // Wrapper to the QMenu to add our own methods class WMenu : public QMenu { public: WMenu(); WMenu(PSZAC pszName); ~WMenu(); void ActionAdd(EMenuAction eMenuAction); void ActionAdd(EMenuAction eMenuAction, PSZAC pszText); void ActionAddWithSeparator(EMenuAction eMenuAction); void ActionsAdd(const EMenuActionByte rgzeMenuActions[]); void ActionsAddSubMenu(EMenuAction eMenuActionSubMenuName, const EMenuActionByte rgzeActionsSubMenuItems[]); void ActionAddFromText(PSZUC pszText, int idAction, EMenuIcon eMenuIcon); void ActionSetCheck(EMenuAction eMenuAction, BOOL fuChecked); WMenu * PMenuAdd(PSZAC pszText, EMenuIcon eMenuIcon); void InitAsDymanicMenu(); void _ConnectActionsToMainWindow(); QAction * _PExec(); void DisplayContextMenuAndSendActionsToMainWindow(); EMenuAction EDisplayContextMenu(); public: static BOOL s_fActionReservedForContextMenu; // TRUE => Do not let the WMainWindow process the menu action because the action is reserved by the context menu and will be returned by EDisplayContextMenu(). FALSE => The action shall be processed by the WMainWindow. static QAction * s_pActionCurrentlyProcessedByMainWindow; // Pointer to the action currently being processed by the WMainWindow }; // WMenu class WMenuWithIndicator : public QMenu { protected: QToolButton * m_pwIndicator; // Widget where the indicator should point to. This is typically the 'parent' of the menu QPolygon m_oPolygon; public: WMenuWithIndicator(QToolButton * pwIndicator); virtual QSize sizeHint() const; virtual void moveEvent(QMoveEvent *); virtual void paintEvent(QPaintEvent *); QSize InitPolygon(BOOL fInitForPainting = FALSE); }; extern QMenuBar * g_pwMenuBar; extern WMenu * g_pwMenuStatus; extern WMenu * g_pwMenuCambrian; extern WMenu * g_pwMenuContacts; extern WMenu * g_pwMenuTools; extern WMenu * g_pwMenuAdvanced; void ConnectMenuActions(WMenu * pMenuSignal, QObject * pObjectSlots); QAction * PGetMenuAction(EMenuAction eMenuAction); PSZAC PszGetMenuActionText(EMenuAction eMenuAction); void DisplayDialogAccountNew(EMenuAction eMenuAction); #endif // MENUACTIONS_H
cdc0f25d04023ddcceea88fd8e8f443a0162d19a
72214f65c9c49de93d9e8413e538d1538a8e2eb3
/Source/Old/Core/external/fbx/fbx_animation_curve_node.cpp
674b626fff070b7300c6a560f150e21cdfdeaacc
[]
no_license
MegaMilkX/Aurora2
f62a52eadba6a82ad9dfa9e83f551972e424e161
23702d16f6074e8b5cfbd1330dac2ab71534f5ae
refs/heads/master
2020-03-22T14:39:34.358212
2018-12-25T21:21:33
2018-12-25T21:21:33
140,195,187
3
0
null
null
null
null
UTF-8
C++
false
false
1,046
cpp
fbx_animation_curve_node.cpp
#include "fbx_animation_curve_node.h" #include "fbx_scene.h" bool FbxAnimationCurveNode::Make(FbxNode& node) { if(node.GetName() != Type()) { return false; } uid = node.GetProperty(0).GetInt64(); name = node.GetProperty(1).GetString(); size_t child_count = scene->Connections().CountChildren(FBX_OBJECT_PROPERTY, uid); for(size_t i = 0; i < child_count; ++i) { FbxConnection* conn = scene->Connections().GetChildConnection(FBX_OBJECT_PROPERTY, uid, i); int64_t child_uid = conn->child_uid; FbxAnimationCurve* curve = scene->GetByUid<FbxAnimationCurve>(child_uid); if(!curve) continue; curve->SetName(conn->name); curves.emplace_back(curve); } int64_t propOwner = scene->Connections().GetParent(FBX_OBJECT_PROPERTY, uid, 0); if(propOwner < 0) { return false; } FbxModel* model = scene->GetByUid<FbxModel>(propOwner); if(!model) return false; ownerName = model->GetName(); return true; }
55c48e0fbd7e19e08718436fe9e374feb19da657
365fdd982afe7e2a381afebcd7cee7a410265375
/mountainprocess/src/mpdaemon.cpp
2e85e0ab099b80594e8b3fae88babd60decb38b7
[]
no_license
DupretLab/mountainlab
e413fc8c24111cf70f799697aae13ce16eb3e93c
baa9a70d0860f29515538682a4bb7f55208514f7
refs/heads/master
2021-01-20T13:49:59.878154
2017-02-21T14:33:55
2017-02-21T14:33:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
43,732
cpp
mpdaemon.cpp
/****************************************************** ** See the accompanying README and LICENSE files ** Author(s): Jeremy Magland, Witold Wysota ** Created: 5/2/2016 *******************************************************/ #include "mpdaemon.h" #include <QEventLoop> #include <QCoreApplication> #include <QTimer> #include <QDir> #include <QJsonDocument> #include <QJsonObject> #include <QFileSystemWatcher> #include <QJsonArray> #include <QProcess> #include <QDebug> #include "cachemanager.h" #include "unistd.h" //for usleep #include <sys/stat.h> //for mkfifo #include "processmanager.h" #include "mlcommon.h" #include <QSettings> #include <QSharedMemory> #include <signal.h> static bool stopDaemon = false; void sighandler(int num) { if (num == SIGINT || num == SIGTERM) { stopDaemon = true; qApp->quit(); } } class MountainProcessServerClient : public LocalServer::Client { public: MountainProcessServerClient(QLocalSocket* sock, LocalServer::Server* parent) : LocalServer::Client(sock, parent) { } ~MountainProcessServerClient() { } void close(); protected: bool handleMessage(const QByteArray& ba) Q_DECL_OVERRIDE; bool getState(); }; void append_line_to_file(QString fname, QString line) { QFile ff(fname); if (ff.open(QFile::Append | QFile::WriteOnly)) { ff.write(line.toLatin1()); ff.write(QByteArray("\n")); ff.close(); } else { static bool reported = false; if (!reported) { reported = true; qCritical() << "Unable to write to log file" << fname; } } } void debug_log(const char* function, const char* file, int line) { QString fname = CacheManager::globalInstance()->localTempPath() + QString("/mpdaemon_debug_%1.log").arg(QString(qgetenv("USER"))); QString line0 = QString("%1: %2 %3:%4").arg(QDateTime::currentDateTime().toString("yy-MM-dd:hh:mm:ss.zzz")).arg(function).arg(file).arg(line); line0 += " ARGS: "; foreach (QString arg, qApp->arguments()) { line0 += arg + " "; } append_line_to_file(fname, line0); } #if 0 MPDaemon::MPDaemon() { debug_log(__FUNCTION__, __FILE__, __LINE__); d = new MPDaemonPrivate; d->q = this; d->m_is_running = false; d->m_total_resources_available.num_threads = 12; d->m_total_resources_available.memory_gb = 8; } #endif void kill_process_and_children(QProcess* P) { /// Witold, do we need to worry about making this cross-platform? int pid = P->processId(); QString cmd = QString("CPIDS=$(pgrep -P %1); (sleep 33 && kill -KILL $CPIDS &); kill -TERM $CPIDS").arg(pid); int ret = system(cmd.toUtf8().data()); Q_UNUSED(ret); } #include "signal.h" bool pidExists(qint64 pid) { // check whether process exists (works on Linux) //return (kill(pid, 0) == 0); // the following is supposed to work even when the process is owned by a different user return (getpgid(pid) >= 0); } QStringList json_array_to_stringlist(QJsonArray X) { QStringList ret; for (int i = 0; i < X.count(); i++) { ret << X[i].toString(); } return ret; } QJsonObject variantmap_to_json_obj(QVariantMap map) { return QJsonObject::fromVariantMap(map); } QStringList paths_to_file_names(const QStringList& paths) { QStringList ret; foreach (QString path, paths) { ret << QFileInfo(path).fileName(); } return ret; } QJsonObject pript_struct_to_obj(MPDaemonPript S, RecordType rt) { QJsonObject ret; ret["is_finished"] = S.is_finished; ret["is_running"] = S.is_running; if (rt != AbbreviatedRecord) { ret["parameters"] = variantmap_to_json_obj(S.parameters); ret["output_fname"] = S.output_fname; ret["preserve_tempdir"] = S.preserve_tempdir; ret["stdout_fname"] = S.stdout_fname; ret["parent_pid"] = QString("%1").arg(S.parent_pid); } ret["force_run"] = S.force_run; ret["working_path"] = S.working_path; ret["id"] = S.id; ret["success"] = S.success; ret["error"] = S.error; ret["timestamp_queued"] = S.timestamp_queued.toString("yyyy-MM-dd|hh:mm:ss.zzz"); ret["timestamp_started"] = S.timestamp_started.toString("yyyy-MM-dd|hh:mm:ss.zzz"); ret["timestamp_finished"] = S.timestamp_finished.toString("yyyy-MM-dd|hh:mm:ss.zzz"); ret["request_num_threads"] = S.RPR.request_num_threads; if (S.prtype == ScriptType) { ret["prtype"] = "script"; if (rt != AbbreviatedRecord) { ret["script_paths"] = QJsonArray::fromStringList(S.script_paths); ret["script_path_checksums"] = QJsonArray::fromStringList(S.script_path_checksums); } else { ret["script_names"] = QJsonArray::fromStringList(paths_to_file_names(S.script_paths)); } } else { ret["prtype"] = "process"; ret["processor_name"] = S.processor_name; ret["processor_spec"] = S.processor_spec; } if (rt == RuntimeRecord) { ret["runtime_opts"] = runtime_opts_struct_to_obj(S.runtime_opts); ret["runtime_results"] = S.runtime_results; } return ret; } MPDaemonPript pript_obj_to_struct(QJsonObject obj) { MPDaemonPript ret; ret.is_finished = obj.value("is_finished").toBool(); ret.is_running = obj.value("is_running").toBool(); ret.parameters = obj.value("parameters").toObject().toVariantMap(); ret.id = obj.value("id").toString(); ret.output_fname = obj.value("output_fname").toString(); ret.preserve_tempdir = obj.value("preserve_tempdir").toBool(); ret.stdout_fname = obj.value("stdout_fname").toString(); ret.success = obj.value("success").toBool(); ret.error = obj.value("error").toString(); ret.parent_pid = obj.value("parent_pid").toString().toLongLong(); ret.force_run = obj.value("force_run").toBool(); ret.working_path = obj.value("working_path").toString(); ret.timestamp_queued = QDateTime::fromString(obj.value("timestamp_queued").toString(), "yyyy-MM-dd|hh:mm:ss.zzz"); ret.timestamp_started = QDateTime::fromString(obj.value("timestamp_started").toString(), "yyyy-MM-dd|hh:mm:ss.zzz"); ret.timestamp_finished = QDateTime::fromString(obj.value("timestamp_finished").toString(), "yyyy-MM-dd|hh:mm:ss.zzz"); ret.RPR.request_num_threads = obj.value("request_num_threads").toInt(); if (obj.value("prtype").toString() == "script") { ret.prtype = ScriptType; ret.script_paths = json_array_to_stringlist(obj.value("script_paths").toArray()); ret.script_path_checksums = json_array_to_stringlist(obj.value("script_path_checksums").toArray()); } else { ret.prtype = ProcessType; ret.processor_name = obj.value("processor_name").toString(); ret.processor_spec = obj.value("processor_spec").toObject(); } return ret; } bool is_at_most(ProcessResources PR1, ProcessResources PR2, ProcessResources total_available) { if (total_available.memory_gb != 0) { if (PR1.memory_gb > PR2.memory_gb) return false; } if (total_available.num_threads != 0) { if (PR1.num_threads > PR2.num_threads) return false; } if (total_available.num_processes != 0) { if (PR1.num_processes > PR2.num_processes) return false; } return true; } QJsonObject runtime_opts_struct_to_obj(ProcessRuntimeOpts opts) { QJsonObject ret; ret["memory_gb_allotted"] = opts.memory_gb_allotted; ret["num_threads_allotted"] = opts.num_threads_allotted; return ret; } bool MountainProcessServerClient::getState() { MountainProcessServer* s = static_cast<MountainProcessServer*>(server()); writeMessage(QJsonDocument(s->state()).toJson()); return true; } void MountainProcessServerClient::close() { MountainProcessServer* srvr = static_cast<MountainProcessServer*>(server()); srvr->unregisterLogListener(this); LocalServer::Client::close(); } bool MountainProcessServerClient::handleMessage(const QByteArray& ba) { QJsonParseError error; QJsonObject obj = QJsonDocument::fromJson(ba, &error).object(); if (error.error != QJsonParseError::NoError) { qCritical() << "Error in slot_commands_directory_changed parsing json file"; } printf("Received commmand: %s\n", obj["command"].toString().toUtf8().constData()); if (obj["command"] == "stop") { MountainProcessServer* s = static_cast<MountainProcessServer*>(server()); s->stop(); } if (obj["command"] == "get-daemon-state") { return getState(); } if (obj["command"] == "get-log") { MountainProcessServer* s = static_cast<MountainProcessServer*>(server()); QJsonArray log = s->log(); writeMessage(QJsonDocument(log).toJson()); return true; } if (obj["command"] == "log-listener") { MountainProcessServer* srvr = static_cast<MountainProcessServer*>(server()); srvr->registerLogListener(this); writeMessage(QJsonDocument(srvr->log()).toJson()); return true; } if (obj["command"] == "queue-script") { MountainProcessServer* srvr = static_cast<MountainProcessServer*>(server()); MPDaemonPript S = pript_obj_to_struct(obj); S.prtype = ScriptType; S.timestamp_queued = QDateTime::currentDateTime(); if (!srvr->queueScript(S)) { // TODO: Send back info to the client? } return true; } if (obj["command"] == "queue-process") { MountainProcessServer* srvr = static_cast<MountainProcessServer*>(server()); MPDaemonPript P = pript_obj_to_struct(obj); P.prtype = ProcessType; P.timestamp_queued = QDateTime::currentDateTime(); if (!srvr->queueProcess(P)) { // TODO: Send back info to the client? } return true; } if (obj["command"] == "clear-processing") { MountainProcessServer* srvr = static_cast<MountainProcessServer*>(server()); srvr->clearProcessing(); return true; } writeMessage("BAD COMMAND"); return true; } MountainProcessServer::MountainProcessServer(QObject* parent) : LocalServer::Server(parent) { } MountainProcessServer::~MountainProcessServer() { } void MountainProcessServer::distributeLogMessage(const QJsonObject& msg) { foreach (LocalServer::Client* client, m_listeners) { client->writeMessage(QJsonDocument(msg).toJson()); } } void MountainProcessServer::registerLogListener(LocalServer::Client* listener) { m_listeners.append(listener); } void MountainProcessServer::unregisterLogListener(LocalServer::Client* listener) { m_listeners.removeOne(listener); } QJsonObject MountainProcessServer::state() { QJsonObject ret; ret["is_running"] = m_is_running; QJsonObject scripts; QJsonObject processes; QStringList keys = m_pripts.keys(); foreach (QString key, keys) { if (m_pripts[key].prtype == ScriptType) scripts[key] = pript_struct_to_obj(m_pripts[key], AbbreviatedRecord); else processes[key] = pript_struct_to_obj(m_pripts[key], AbbreviatedRecord); } ret["scripts"] = scripts; ret["processes"] = processes; return ret; } QJsonArray MountainProcessServer::log() { return m_log; } void MountainProcessServer::contignousLog() { } bool MountainProcessServer::queueScript(const MPDaemonPript& script) { if (m_pripts.contains(script.id)) { writeLogRecord("error", "message", QString("Unable to queue script. " "Process or script with id %1 already exists: ").arg(script.id)); return false; } writeLogRecord("queue-script", "pript_id", script.id); m_pripts[script.id] = script; write_pript_file(script); return true; } bool MountainProcessServer::queueProcess(const MPDaemonPript& process) { if (m_pripts.contains(process.id)) { writeLogRecord("error", "message", QString("Unable to queue process. " "Process or script with id %1 already exists: ").arg(process.id)); return false; } writeLogRecord("queue-process", process.id); m_pripts[process.id] = process; write_pript_file(process); return true; } bool MountainProcessServer::clearProcessing() { QStringList keys = m_pripts.keys(); foreach (QString key, keys) { stop_or_remove_pript(key); } return true; } bool MountainProcessServer::start() { if (m_is_running) return false; if (!startServer()) return false; signal(SIGINT, sighandler); signal(SIGTERM, sighandler); m_is_running = true; writeLogRecord("start-daemon"); QTimer timer; connect(&timer, &QTimer::timeout, [this]() { iterate(); }); timer.start(100); qApp->exec(); m_is_running = false; writeLogRecord("stop-daemon"); signal(SIGINT, SIG_DFL); signal(SIGTERM, SIG_DFL); stopServer(); return true; } bool MountainProcessServer::stop() { m_is_running = false; qApp->quit(); return true; } void MountainProcessServer::setLogPath(const QString& lp) { if (m_logPath == lp) return; m_logPath = lp; } void MountainProcessServer::setTotalResourcesAvailable(ProcessResources PR) { m_total_resources_available = PR; } LocalServer::Client* MountainProcessServer::createClient(QLocalSocket* sock) { MountainProcessServerClient* client = new MountainProcessServerClient(sock, this); return client; } void MountainProcessServer::clientAboutToBeDestroyed(LocalServer::Client* client) { unregisterLogListener(client); } bool MountainProcessServer::startServer() { if (!acquireServer()) { printf("Another daemon seems to be running. Closing.\n"); return false; } return true; } void MountainProcessServer::stopServer() { releaseServer(); } bool MountainProcessServer::acquireServer() { if (!shm) shm = new QSharedMemory(shmName(), this); else if (shm->isAttached()) shm->detach(); // algorithm: // create a shared memory segment // if successful, there is no active server, so we become one // - write your own PID into the segment // otherwise try to attach to the segment // - check the pid stored in the segment // - see if process with that pid exists // - if yes, bail out // - if not, overwrite the pid with your own // repeat the process until either create or attach is successfull while (true) { if (shm->create(sizeof(MountainProcessDescriptor))) { shm->lock(); // there is potentially a race condition here -> someone might have locked the segment // before we did and written its own pid there // we assume that by default memory is zeroed (it seems to be on Linux) // so we can check the version MountainProcessDescriptor* desc = reinterpret_cast<MountainProcessDescriptor*>(shm->data()); // on Linux the memory seems to be zeroed by default if (desc->version != 0) { // someone has hijacked our segment shm->unlock(); shm->detach(); continue; // try again } desc->version = 1; desc->pid = (pid_t)QCoreApplication::applicationPid(); acquireSocket(); shm->unlock(); return true; } if (shm->attach()) { shm->lock(); MountainProcessDescriptor* desc = reinterpret_cast<MountainProcessDescriptor*>(shm->data()); // on Linux the memory seems to be zeroed by default if (desc->version != 0) { if (kill(desc->pid, 0) == 0) { // pid exists, server is likely active shm->unlock(); shm->detach(); return false; } } // server has crashed or we have hijacked the segment desc->version = 1; desc->pid = (pid_t)QCoreApplication::applicationPid(); acquireSocket(); shm->unlock(); return true; } } } bool MountainProcessServer::releaseServer() { if (shm && shm->isAttached()) { shm->lock(); MountainProcessDescriptor* desc = reinterpret_cast<MountainProcessDescriptor*>(shm->data()); // just to be sure we're the reigning server: if (desc->pid == (pid_t)QCoreApplication::applicationPid()) { // to avoid a race condition (released the server but not ended the process just yet), empty the block desc->version = 0; desc->pid = 0; releaseSocket(); } shm->unlock(); shm->detach(); return true; } return false; } bool MountainProcessServer::acquireSocket() { return listen(socketName()); } bool MountainProcessServer::releaseSocket() { shutdown(); return true; } void MountainProcessServer::iterate() { // hack by jfm to temporarily implement mp-list-daemons { QString daemon_id = qgetenv("MP_DAEMON_ID"); QSettings settings(QSettings::UserScope, "Magland", "MountainLab"); QStringList list = settings.value("mp-list-daemons-candidates").toStringList(); if (!list.contains(daemon_id)) { list.append(daemon_id); settings.setValue("mp-list-daemons-candidates", list); } } stop_orphan_processes_and_scripts(); handle_scripts(); handle_processes(); } void MountainProcessServer::writeLogRecord(QString record_type, QString key1, QVariant val1, QString key2, QVariant val2, QString key3, QVariant val3) { QVariantMap map; if (!key1.isEmpty()) { map[key1] = val1; } if (!key2.isEmpty()) { map[key2] = val2; } if (!key3.isEmpty()) { map[key3] = val3; } QJsonObject obj = variantmap_to_json_obj(map); writeLogRecord(record_type, obj); } void MountainProcessServer::writeLogRecord(QString record_type, const QJsonObject& obj) { QJsonObject X; X["record_type"] = record_type; X["timestamp"] = QDateTime::currentDateTime().toString("yyyy-MM-dd|hh:mm:ss.zzz"); X["data"] = obj; QString line = QJsonDocument(X).toJson(QJsonDocument::Compact); while (m_log.size() >= 10) m_log.pop_front(); m_log.push_back(X); distributeLogMessage(X); } void MountainProcessServer::write_pript_file(const MPDaemonPript& P) { if (m_logPath.isEmpty()) return; if (P.id.isEmpty()) return; QString fname; if (P.prtype == ScriptType) { fname = QString("%1/scripts/%2.json").arg(m_logPath).arg(P.id); } else if (P.prtype == ProcessType) { fname = QString("%1/processes/%2.json").arg(m_logPath).arg(P.id); } QJsonObject obj = pript_struct_to_obj(P, RuntimeRecord); QString json = QJsonDocument(obj).toJson(); TextFile::write(fname, json); } bool MountainProcessServer::stop_or_remove_pript(const QString& key) { if (!m_pripts.contains(key)) return false; MPDaemonPript* PP = &m_pripts[key]; if ((PP->is_running)) { if (PP->qprocess) { qWarning() << "Terminating qprocess: " + key; //PP->qprocess->terminate(); // I think it's okay to terminate a process. It won't cause this program to crash. kill_process_and_children(PP->qprocess); delete PP->qprocess; } finish_and_finalize(*PP); m_pripts.remove(key); if (PP->prtype == ScriptType) writeLogRecord("stop-script", "pript_id", key, "reason", "requested"); else writeLogRecord("stop-process", "pript_id", key, "reason", "requested"); } else { m_pripts.remove(key); if (PP->prtype == ScriptType) writeLogRecord("unqueue-script", "pript_id", key, "reason", "requested"); else writeLogRecord("unqueue-process", "pript_id", key, "reason", "requested"); } return true; } void MountainProcessServer::finish_and_finalize(MPDaemonPript& P) { P.is_finished = true; P.is_running = false; P.timestamp_finished = QDateTime::currentDateTime(); if (!P.stdout_fname.isEmpty()) { P.runtime_results["stdout"] = TextFile::read(P.stdout_fname); } write_pript_file(P); } void MountainProcessServer::stop_orphan_processes_and_scripts() { QStringList keys = m_pripts.keys(); foreach (QString key, keys) { if (!m_pripts[key].is_finished) { if ((m_pripts[key].parent_pid) && (!pidExists(m_pripts[key].parent_pid))) { debug_log(__FUNCTION__, __FILE__, __LINE__); if (m_pripts[key].qprocess) { if (m_pripts[key].prtype == ScriptType) { writeLogRecord("stop-script", "pript_id", key, "reason", "orphan", "parent_pid", m_pripts[key].parent_pid); qWarning() << "Terminating orphan script qprocess: " + key; } else { writeLogRecord("stop-process", "pript_id", key, "reason", "orphan", "parent_pid", m_pripts[key].parent_pid); qWarning() << "Terminating orphan process qprocess: " + key; } m_pripts[key].qprocess->disconnect(); //so we don't go into the finished slot //m_pripts[key].qprocess->terminate(); kill_process_and_children(m_pripts[key].qprocess); delete m_pripts[key].qprocess; finish_and_finalize(m_pripts[key]); m_pripts.remove(key); } else { if (m_pripts[key].prtype == ScriptType) { writeLogRecord("unqueue-script", "pript_id", key, "reason", "orphan", "parent_pid", m_pripts[key].parent_pid); qWarning() << "Removing orphan script: " + key + " " + m_pripts[key].script_paths.value(0); } else { writeLogRecord("unqueue-process", "pript_id", key, "reason", "orphan", "parent_pid", m_pripts[key].parent_pid); qWarning() << "Removing orphan process: " + key + " " + m_pripts[key].processor_name; } finish_and_finalize(m_pripts[key]); m_pripts.remove(key); } } } } } bool MountainProcessServer::handle_scripts() { int max_simultaneous_scripts = 100; if (num_running_scripts() < max_simultaneous_scripts) { int old_num_pending_scripts = num_pending_scripts(); if (num_pending_scripts() > 0) { if (launch_next_script()) { printf("%d scripts running.\n", num_running_scripts()); } else { if (num_pending_scripts() == old_num_pending_scripts) { qCritical() << "Failed to launch_next_script and the number of pending scripts has not decreased (unexpected). This has potential for infinite loop. So we are aborting."; abort(); } } } } return true; } bool MountainProcessServer::handle_processes() { ProcessResources pr_available = compute_process_resources_available(); QStringList keys = m_pripts.keys(); foreach (QString key, keys) { if (m_pripts[key].prtype == ProcessType) { if ((!m_pripts[key].is_running) && (!m_pripts[key].is_finished)) { ProcessResources pr_needed = compute_process_resources_needed(m_pripts[key]); if (is_at_most(pr_needed, pr_available, m_total_resources_available)) { if (process_parameters_are_okay(key)) { if (okay_to_run_process(key)) { //check whether there are io file conflicts at the moment if (launch_pript(key)) { pr_available.num_threads -= m_pripts[key].runtime_opts.num_threads_allotted; pr_available.memory_gb -= m_pripts[key].runtime_opts.memory_gb_allotted; pr_available.num_processes -= 1; } } } else { writeLogRecord("unqueue-process", "pript_id", key, "reason", "processor not found or parameters are incorrect."); m_pripts.remove(key); } } } } } return true; } int MountainProcessServer::num_running_pripts(PriptType prtype) const { int ret = 0; QStringList keys = m_pripts.keys(); foreach (QString key, keys) { if (m_pripts[key].is_running) { if (m_pripts[key].prtype == prtype) ret++; } } return ret; } int MountainProcessServer::num_pending_pripts(PriptType prtype) const { int ret = 0; QStringList keys = m_pripts.keys(); foreach (QString key, keys) { if ((!m_pripts[key].is_running) && (!m_pripts[key].is_finished)) { if (m_pripts[key].prtype == prtype) ret++; } } return ret; } bool MountainProcessServer::launch_next_script() { QStringList keys = m_pripts.keys(); foreach (QString key, keys) { if (m_pripts[key].prtype == ScriptType) { if ((!m_pripts[key].is_running) && (!m_pripts[key].is_finished)) { if (launch_pript(key)) { return true; } } } } return false; } bool MountainProcessServer::launch_pript(QString pript_id) { MPDaemonPript* S; if (!m_pripts.contains(pript_id)) { qCritical() << "Unexpected problem. No pript exists with id: " + pript_id; abort(); return false; } S = &m_pripts[pript_id]; if (S->is_running) { qCritical() << "Unexpected problem. Pript is already running: " + pript_id; abort(); return false; } if (S->is_finished) { qCritical() << "Unexpected problem. Pript is already finished: " + pript_id; abort(); return false; } QString exe = qApp->applicationFilePath(); QStringList args; if (S->prtype == ScriptType) { debug_log(__FUNCTION__, __FILE__, __LINE__); args << "run-script"; if (!S->output_fname.isEmpty()) { args << "--_script_output=" + S->output_fname; } for (int ii = 0; ii < S->script_paths.count(); ii++) { QString fname = S->script_paths[ii]; if (!QFile::exists(fname)) { QString message = "Script file does not exist: " + fname; qWarning() << message; writeLogRecord("error", "message", message); writeLogRecord("unqueue-script", "pript_id", pript_id, "reason", message); m_pripts.remove(pript_id); return false; } if (MLUtil::computeSha1SumOfFile(fname) != S->script_path_checksums.value(ii)) { QString message = "Script checksums do not match. Script file has changed since queueing: " + fname + " Not launching process: " + pript_id; qWarning() << message; qWarning() << MLUtil::computeSha1SumOfFile(fname) << "<>" << S->script_path_checksums.value(ii); writeLogRecord("error", "message", message); writeLogRecord("unqueue-script", "pript_id", pript_id, "reason", "Script file has changed: " + fname); m_pripts.remove(pript_id); return false; } args << fname; } QJsonObject parameters = variantmap_to_json_obj(S->parameters); QString parameters_json = QJsonDocument(parameters).toJson(); QString par_fname = CacheManager::globalInstance()->makeLocalFile(S->id + ".par", CacheManager::ShortTerm); TextFile::write(par_fname, parameters_json); args << par_fname; } else if (S->prtype == ProcessType) { debug_log(__FUNCTION__, __FILE__, __LINE__); args << "run-process"; args << S->processor_name; if (!S->output_fname.isEmpty()) args << "--_process_output=" + S->output_fname; if (S->preserve_tempdir) args << "--_preserve_tempdir"; QStringList pkeys = S->parameters.keys(); foreach (QString pkey, pkeys) { QStringList list = MLUtil::toStringList(S->parameters[pkey]); foreach (QString str, list) { args << QString("--%1=%2").arg(pkey).arg(str); } } if (S->RPR.request_num_threads) { args << QString("--_request_num_threads=%1").arg(S->RPR.request_num_threads); } //S->runtime_opts.num_threads_allotted = S->num_threads_requested; //S->runtime_opts.memory_gb_allotted = S->memory_gb_requested; } if (S->force_run) { args << "--_force_run"; } args << "--_working_path=" + S->working_path; debug_log(__FUNCTION__, __FILE__, __LINE__); QProcess* qprocess = new QProcess; qprocess->setProperty("pript_id", pript_id); qprocess->setProcessChannelMode(QProcess::MergedChannels); QObject::connect(qprocess, SIGNAL(readyRead()), this, SLOT(slot_qprocess_output())); if (S->prtype == ScriptType) { printf(" Launching script %s: ", pript_id.toLatin1().data()); writeLogRecord("start-script", "pript_id", pript_id); foreach (QString fname, S->script_paths) { QString str = QFileInfo(fname).fileName(); printf("%s ", str.toLatin1().data()); } printf("\n"); } else { printf(" Launching process %s %s: ", S->processor_name.toLatin1().data(), pript_id.toLatin1().data()); writeLogRecord("start-process", "pript_id", pript_id); QString cmd = args.join(" "); printf("%s\n", cmd.toLatin1().data()); } QObject::connect(qprocess, SIGNAL(finished(int)), this, SLOT(slot_pript_qprocess_finished())); debug_log(__FUNCTION__, __FILE__, __LINE__); qprocess->start(exe, args); if (qprocess->waitForStarted()) { if (S->prtype == ScriptType) { writeLogRecord("started-script", "pript_id", pript_id, "pid", (long long)qprocess->processId()); } else { writeLogRecord("started-process", "pript_id", pript_id, "pid", (long long)qprocess->processId()); } S->qprocess = qprocess; if (!S->stdout_fname.isEmpty()) { S->stdout_file = new QFile(S->stdout_fname); if (!S->stdout_file->open(QFile::WriteOnly)) { qCritical() << "Unable to open stdout file for writing: " + S->stdout_fname; writeLogRecord("error", "message", "Unable to open stdout file for writing: " + S->stdout_fname); delete S->stdout_file; S->stdout_file = 0; } } S->is_running = true; S->timestamp_started = QDateTime::currentDateTime(); write_pript_file(*S); return true; } else { debug_log(__FUNCTION__, __FILE__, __LINE__); if (S->prtype == ScriptType) { writeLogRecord("stop-script", "pript_id", pript_id, "reason", "Unable to start script."); qCritical() << "Unable to start script: " + S->id; } else { writeLogRecord("stop-process", "pript_id", pript_id, "reason", "Unable to start process."); qCritical() << "Unable to start process: " + S->processor_name + " " + S->id; } qprocess->disconnect(); delete qprocess; write_pript_file(*S); m_pripts.remove(pript_id); return false; } } ProcessResources MountainProcessServer::compute_process_resources_available() const { ProcessResources ret = m_total_resources_available; QStringList keys = m_pripts.keys(); foreach (QString key, keys) { if (m_pripts[key].prtype == ProcessType) { if (m_pripts[key].is_running) { ProcessRuntimeOpts rtopts = m_pripts[key].runtime_opts; ret.num_threads -= rtopts.num_threads_allotted; ret.memory_gb -= rtopts.memory_gb_allotted; ret.num_processes -= 1; } } } return ret; } ProcessResources MountainProcessServer::compute_process_resources_needed(MPDaemonPript P) const { ProcessResources ret; ret.num_threads = P.RPR.request_num_threads; if (ret.num_threads < 1) ret.num_threads = 1; //ret.memory_gb = P.memory_gb_requested; ret.memory_gb = 1; ret.num_processes = 1; return ret; } bool MountainProcessServer::process_parameters_are_okay(const QString& key) const { //check that the processor is registered and that the parameters are okay ProcessManager* PM = ProcessManager::globalInstance(); if (!m_pripts.contains(key)) return false; MPDaemonPript P0 = m_pripts[key]; MLProcessor MLP = PM->processor(P0.processor_name); if (QJsonDocument(MLP.spec).toJson() != QJsonDocument(P0.processor_spec).toJson()) { qWarning() << "Processor spec does not match. Perhaps the processor has changed and the daemon needs to be restarted."; return false; } if (MLP.name != P0.processor_name) { qWarning() << "Unable to find processor **: " + P0.processor_name; return false; } if (!PM->checkParameters(P0.processor_name, P0.parameters)) { qWarning() << "Failure in checkParameters: " + P0.processor_name; return false; } return true; } bool MountainProcessServer::okay_to_run_process(const QString& key) const { //next we check that there are no running processes where the input or output files conflict with the proposed input or output files //but note that it is okay for the same input file to be used in more than one simultaneous process QSet<QString> pending_input_paths; QSet<QString> pending_output_paths; QStringList pripts_keys = m_pripts.keys(); foreach (QString key0, pripts_keys) { if (m_pripts[key0].prtype == ProcessType) { if (m_pripts[key0].is_running) { QStringList input_paths = get_input_paths(m_pripts[key0]); foreach (QString path0, input_paths) { pending_input_paths.insert(path0); } QStringList output_paths = get_output_paths(m_pripts[key0]); foreach (QString path0, output_paths) { pending_output_paths.insert(path0); } } } } { QStringList proposed_input_paths = get_input_paths(m_pripts[key]); QStringList proposed_output_paths = get_output_paths(m_pripts[key]); foreach (QString path0, proposed_input_paths) { if (pending_output_paths.contains(path0)) return false; } foreach (QString path0, proposed_output_paths) { if (pending_input_paths.contains(path0)) return false; if (pending_output_paths.contains(path0)) return false; } } return true; } QStringList MountainProcessServer::get_input_paths(MPDaemonPript P) const { QStringList ret; if (P.prtype != ProcessType) return ret; ProcessManager* PM = ProcessManager::globalInstance(); MLProcessor MLP = PM->processor(P.processor_name); QStringList pnames = MLP.inputs.keys(); foreach (QString pname, pnames) { QStringList paths0 = MLUtil::toStringList(P.parameters[pname]); //is this right? foreach (QString path0, paths0) { if (!path0.isEmpty()) { ret << path0; } } } return ret; } QStringList MountainProcessServer::get_output_paths(MPDaemonPript P) const { QStringList ret; if (P.prtype != ProcessType) return ret; ProcessManager* PM = ProcessManager::globalInstance(); MLProcessor MLP = PM->processor(P.processor_name); QStringList pnames = MLP.outputs.keys(); foreach (QString pname, pnames) { QStringList paths0 = MLUtil::toStringList(P.parameters[pname]); //is this right? foreach (QString path0, paths0) { if (!path0.isEmpty()) { ret << path0; } } } return ret; } void MountainProcessServer::slot_pript_qprocess_finished() { debug_log(__FUNCTION__, __FILE__, __LINE__); QProcess* P = qobject_cast<QProcess*>(sender()); if (!P) return; QString pript_id = P->property("pript_id").toString(); MPDaemonPript* S; if (m_pripts.contains(pript_id)) { S = &m_pripts[pript_id]; } else { writeLogRecord("error", "message", "Unexpected problem in slot_pript_qprocess_finished. Unable to find script or process with id: " + pript_id); qCritical() << "Unexpected problem in slot_pript_qprocess_finished. Unable to find script or process with id: " + pript_id; return; } if (!S->output_fname.isEmpty()) { debug_log(__FUNCTION__, __FILE__, __LINE__); QString runtime_results_json = TextFile::read(S->output_fname); if (runtime_results_json.isEmpty()) { S->success = false; S->error = "Could not read results file ****: " + S->output_fname; } else { QJsonParseError error; S->runtime_results = QJsonDocument::fromJson(runtime_results_json.toLatin1(), &error).object(); if (error.error != QJsonParseError::NoError) { S->success = false; S->error = "Error parsing json of runtime results."; } else { S->success = S->runtime_results["success"].toBool(); S->error = S->runtime_results["error"].toString(); } } } else { S->success = true; } finish_and_finalize(*S); QJsonObject obj0; obj0["pript_id"] = pript_id; obj0["reason"] = "finished"; obj0["success"] = S->success; obj0["error"] = S->error; if (S->prtype == ScriptType) { writeLogRecord("stop-script", obj0); printf(" Script %s finished ", pript_id.toLatin1().data()); } else { writeLogRecord("stop-process", obj0); printf(" Process %s %s finished ", S->processor_name.toLatin1().data(), pript_id.toLatin1().data()); } if (S->success) printf("successfully\n"); else printf("with error: %s\n", S->error.toLatin1().data()); if (S->qprocess) { if (S->qprocess->state() == QProcess::Running) { if (S->qprocess->waitForFinished(1000)) { delete S->qprocess; } else { writeLogRecord("error", "pript_id", pript_id, "message", "Process did not finish after waiting even though we are in the slot for finished!!"); qCritical() << "Process did not finish after waiting even though we are in the slot for finished!!"; } } S->qprocess = 0; } if (S->stdout_file) { if (S->stdout_file->isOpen()) { S->stdout_file->close(); } delete S->stdout_file; S->stdout_file = 0; } } void MountainProcessServer::slot_qprocess_output() { QProcess* P = qobject_cast<QProcess*>(sender()); if (!P) return; QByteArray str = P->readAll(); QString pript_id = P->property("pript_id").toString(); if ((m_pripts.contains(pript_id)) && (m_pripts[pript_id].stdout_file)) { if (m_pripts[pript_id].stdout_file->isOpen()) { m_pripts[pript_id].stdout_file->write(str); m_pripts[pript_id].stdout_file->flush(); } } else { printf("%s", str.data()); } } void MPDaemon::wait(qint64 msec) { usleep(msec * 1000); } bool MPDaemon::waitForFileToAppear(QString fname, qint64 timeout_ms, bool remove_on_appear, qint64 parent_pid, QString stdout_fname) { debug_log(__FUNCTION__, __FILE__, __LINE__); QTime timer; timer.start(); QFile stdout_file(stdout_fname); bool failed_to_open_stdout_file = false; /* QString i_am_alive_fname; if (parent_pid) { i_am_alive_fname=CacheManager::globalInstance()->makeLocalFile(QString("i_am_alive.%1.txt").arg(parent_pid)); } QTime timer_i_am_alive; timer_i_am_alive.start(); */ QTime debug_timer; debug_timer.start(); while (1) { wait(200); bool terminate_file_exists = QFile::exists(fname); //do this before we check other things, like the stdout if ((timeout_ms >= 0) && (timer.elapsed() > timeout_ms)) return false; if ((parent_pid) && (!MPDaemon::pidExists(parent_pid))) { qWarning() << "Exiting waitForFileToAppear because parent process is gone."; break; } if ((!stdout_fname.isEmpty()) && (!failed_to_open_stdout_file)) { if (QFile::exists(stdout_fname)) { if (!stdout_file.isOpen()) { if (!stdout_file.open(QFile::ReadOnly)) { qCritical() << "Unable to open stdout file for reading: " + stdout_fname; failed_to_open_stdout_file = true; } } if (stdout_file.isOpen()) { QByteArray str = stdout_file.readAll(); if (!str.isEmpty()) { printf("%s", str.data()); } } } } if (terminate_file_exists) break; /* if (debug_timer.elapsed() > 20000) { qWarning() << QString("Still waiting for file to appear after %1 sec: %2").arg(timer.elapsed() * 1.0 / 1000).arg(fname); debug_timer.restart(); } */ } if (stdout_file.isOpen()) stdout_file.close(); if (remove_on_appear) { QFile::remove(fname); } return true; } QString MPDaemon::daemonPath() { // Witold, it turns out we don't want a separate path for each daemon id. This causes problems. QString ret = CacheManager::globalInstance()->localTempPath() + "/mpdaemon"; MLUtil::mkdirIfNeeded(ret); MLUtil::mkdirIfNeeded(ret + "/completed_processes"); QFile::Permissions perm = QFileDevice::ReadUser | QFileDevice::WriteUser | QFileDevice::ExeUser | QFileDevice::ReadGroup | QFileDevice::WriteGroup | QFileDevice::ExeGroup | QFileDevice::ReadOther | QFileDevice::WriteOther | QFileDevice::ExeOther; QFile::setPermissions(ret, perm); QFile::setPermissions(ret + "/completed_processes", perm); return ret; } bool MPDaemon::waitForFinishedAndWriteOutput(QProcess* P) { debug_log(__FUNCTION__, __FILE__, __LINE__); P->waitForStarted(); while (P->state() == QProcess::Running) { P->waitForReadyRead(100); QByteArray str = P->readAll(); if (str.count() > 0) { printf("%s", str.data()); } qApp->processEvents(); } { P->waitForReadyRead(); QByteArray str = P->readAll(); if (str.count() > 0) { printf("%s", str.data()); } } return (P->state() != QProcess::Running); } bool MPDaemon::pidExists(qint64 pid) { return (kill(pid, 0) == 0); }
e587bc13c142d79c8c1d42e3db70925a1556e031
9bef8ffc3e9a65e49a24ed595b76e6bd5e8d34cd
/src/scaling_limiter.cpp
2ff3df4cd961bac6f0024aa4ea001815e970db46
[]
no_license
JunmingDuan/TRT
0f62e9b9abd52ebb708b06c5fe228165b7f16987
029a9809dac5f0dcf5e5ac861a872ec371446769
refs/heads/master
2021-04-28T09:38:39.193538
2018-03-15T12:32:14
2018-03-15T12:32:14
122,044,590
0
0
null
null
null
null
UTF-8
C++
false
false
523
cpp
scaling_limiter.cpp
#include "scaling_limiter.h" void scaling_limiter::run(const VEC<double>& val, EVEC& sol) { if(sol.size() == 1) { std::cout << "P1, wrong scaling_limiter choice!" << std::endl; return; } u_int ng = val.size(); double t, min_val(EPS); for(u_int j = 0; j < ng; ++j) { min_val = std::min(min_val, val[j]); } if(sol[0] < 0) { std::cout << "average < 0! " << sol[0] << std::endl; abort(); } t = (sol[0] - EPS) / (sol[0] - min_val); for(u_int k = 1; k < K; ++k) { sol[k] *= t; } }
d38c2ced58d3b8d8d5386697c58e4d28c2cc4ce9
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5766201229705216_1/C++/lnzsy/full-tree.cpp
78ee14225bd782ba0e124d7f068c1bbbbbf9a8c0
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
C++
false
false
2,051
cpp
full-tree.cpp
#include <cstdio> #include <cstdlib> #include <climits> #include <cstdint> #include <cmath> #include <utility> #include <iostream> #include <sstream> #include <algorithm> #include <stack> #include <queue> #include <vector> #include <set> #include <map> #include <unordered_map> #include <unordered_set> #include <string> #include <string.h> using namespace std; #define REP(i, p, n) for (int i=p; i<n; ++i) #define FOR(i, c) for (__typeof ((c).begin()) i=(c).begin(); i!=(c).end(); ++i) int dp[1005][1005]; int trim (vector<vector<int> > &e, int pre, int root, vector<int> &mark) { if (dp[pre][root] != -1) { return dp[pre][root]; } if (e[root].size() == 0) return 0; if (e[root].size()==1) { dp[pre][root] = 1; return 1; } if (e[root].size()==2) { if (e[root][0]==pre || e[root][1]==pre) { dp[pre][root] = 1; return 1; } } vector<int> tmp; REP (i, 0, e[root].size()) { if (e[root][i] == pre) continue; int next = trim (e, root, e[root][i], mark); tmp.push_back (next); } sort(tmp.begin(), tmp.end()); int size = tmp.size(); if (size < 2) { dp[pre][root] = 1; return 1; } if (tmp[size-1] == 0) { dp[pre][root] = 1; return 1; } if (tmp[size-2] == 0) { dp[pre][root] = 1; return 1; } dp[pre][root] = tmp[size-1]+tmp[size-2]+1; return dp[pre][root]; } int main (int argc, char **argv) { FILE *fin = fopen(argv[1], "r"); FILE *fout = fopen (argv[2], "w"); if (fin==NULL || fout==NULL) exit(1); int num_cases; fscanf (fin, "%d", &num_cases); REP (i, 0, num_cases) { int N; fscanf (fin, "%d", &N); vector<vector<int> > e (N+1, vector<int>()); REP (j, 0, N-1) { int A, B; fscanf (fin, "%d%d", &A, &B); e[A].push_back (B); e[B].push_back (A); } int ans=N-1; memset(dp, -1, sizeof (dp)); REP (j, 1, N+1) { // root vector<int> mark (N+1, 0); int num_nodes = trim (e, 0, j, mark); ans = min(ans, N-num_nodes); } fprintf (fout, "Case #%d: %d\n", i+1, ans); printf ("Case #%d: %d\n", i+1, ans); } fclose(fin); fclose(fout); return 0; }
f076ff2d3738e1c64d3e96e1d87e6138ca6da697
3bf6ac9ead93f9823b656548dcb41db86505fd98
/Src/ARsf-simple/Common/etc/BufferedSerial.h
70a4b5e4208d08178b19a69e2acb0060a11ebb58
[ "MIT" ]
permissive
jjuiddong/ARStarCraft
b7cba2384805b80f35b7c6157773611d341e2d25
421e4171af69d122a6e911506b3e8456e0ac3d3d
refs/heads/master
2020-04-17T13:21:49.227824
2016-09-19T23:49:54
2016-09-19T23:49:54
67,312,882
0
1
null
null
null
null
UHC
C++
false
false
1,734
h
BufferedSerial.h
// // author: jjuiddong // 2015-04-04 // // CSerial 클래스를 상속 받아, ReadStringUntil() 함수를 구현한 클래스다. // 특정 문자 (개행문자) 단위로 정보를 읽어 올 때, 고속으로 동작하는 CSerial 클래스를 // 오버헤드 없이, 버퍼를 효율적으로 관리하면서, 원하는 기능을 제공하는 역할을 한다. // // 링버퍼로 구현되어서, 버퍼 재할당, 복사가 일어나지 않게 했다. // // 이 클래스를 사용할 경우, ReadData()함수 대신, ReadStringUntil() 함수를 써야 한다. // // // 2015-08-25 // 일정 시간 이상동안 ch문자가 들어오지 않으면, 버퍼를 리턴한다. // #pragma once #include "Serial.h" namespace common { class CBufferedSerial : public cSerial { public: CBufferedSerial(); virtual ~CBufferedSerial(); //bool ReadStringUntil(const char ch, OUT string &out); bool ReadStringUntil(const char ch, OUT char *out, OUT int &outLen, const int maxSize); void SetMaxWaitTime(const int milliseconds); void ClearBuffer(); protected: enum { MAX_BUFFERSIZE = 2048 }; char m_ringBuffer[MAX_BUFFERSIZE]; // 정보는 head 에서 tail 로 저장된다. 새로 들어온 정보는 tail 부터 저장된다. // headIndex == tailIndex 조건이 성립하면, 버퍼가 비었다는 뜻이다. int m_headIndex = 0; // 저장된 정보가 시작되는 index를 가르킨다. int m_tailIndex = 0; // 정보를 쓰기 시작할 index를 가르킨다. int m_checkIndex = 0; // 특정문자를 찾기 시작하는 index를 가르킨다. int m_maxWaitTime; // default = 500 int m_lastReturnTime; // m_maxWaitTime 시간이 지나도록 문자 ch가 오지 않는다면, 리턴한다. }; }
44bca9dca09da1ffd34263414eb3eee6091b3cf9
fe2389a3df34566d15de5d84d01edc382850eef1
/src/test/regionmakertest.cpp
8f5a9f7b243f63dfa42a2cb19fcdba9fea30a4eb
[ "MIT" ]
permissive
dhasegan/Fractalmaker
9e766465362e2372b0067dd86d42274a3e2bf855
c4d2c68b86f839939c3039b6b98565a6ed4f7eef
refs/heads/master
2021-01-23T20:18:49.742672
2013-11-03T19:22:32
2013-11-03T19:22:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,127
cpp
regionmakertest.cpp
#include <complex> #include <fstream> #include <iostream> #include "regionmaker.hpp" #include "region.hpp" #include "regionvariable.hpp" using namespace std; int main() { string regionFilename = "regionmakertestoutput.regionvar"; // Print values in a file: complex<double> alu,arl,blu,brl; cout << "Print 2 complex numbers as corners of A" << endl; cin >> alu; cin >> arl; Region a(alu,arl); cout << "Print 2 complex numbers as corners of B" << endl; cin >> blu; cin >> brl; Region b(blu,brl); int it; cout << "Print nr of it: " << endl; cin >> it; makeRegionFile(a,b,it,regionFilename); // Handle the values from the file created: RegionVariable regV(regionFilename); Region curr = regV.beginRegion(); cout << "Left up corner " << curr.getLeftUpCorner() << " "; cout << "Right down corner " << curr.getRightLowerCorner() << endl; for(int i=1;i<it;++i) { Region curr = regV.nextRegion(); cout << "At " << i << ": Left up corner " << curr.getLeftUpCorner() << " "; cout << "Right down corner " << curr.getRightLowerCorner() << endl; } return 0; }
b1e91bba8ac567bb071da5e921a01d5afa4159dc
c9850082dcd4ec4580bb06a7fa3f5d6394a72dbe
/srcs/enclave/ra_enclave.cpp
d4b73b7c8f2bd818584d65ed816c1c5e27f6b7d5
[ "MIT" ]
permissive
jianlinjiang/SAR
41205227608a825c10326c4e9e36d63eac500d64
1087e8b4253f6dfd73fcb7cc584cf0c3f022276d
refs/heads/main
2023-02-24T02:54:34.685138
2021-02-02T07:37:41
2021-02-02T07:37:41
310,586,917
0
0
null
null
null
null
UTF-8
C++
false
false
2,773
cpp
ra_enclave.cpp
// MIT License // Copyright (c) 2020 jianlinjiang #include <assert.h> #include "enclave_t.h" #include "enclave_util.h" #include "sgx_tkey_exchange.h" #include "sgx_tcrypto.h" #include "string.h" // static const sgx_ec256_public_t g_sp_pub_key = { {0x72, 0x12, 0x8a, 0x7a, 0x17, 0x52, 0x6e, 0xbf, 0x85, 0xd0, 0x3a, 0x62, 0x37, 0x30, 0xae, 0xad, 0x3e, 0x3d, 0xaa, 0xee, 0x9c, 0x60, 0x73, 0x1d, 0xb0, 0x5b, 0xe8, 0x62, 0x1c, 0x4b, 0xeb, 0x38}, {0xd4, 0x81, 0x40, 0xd9, 0x50, 0xe2, 0x57, 0x7b, 0x26, 0xee, 0xb7, 0x41, 0xe7, 0xc6, 0x14, 0xe2, 0x24, 0xb7, 0xbd, 0xc9, 0x03, 0xf2, 0x9a, 0x28, 0xa8, 0x3c, 0xc8, 0x10, 0x11, 0x14, 0x5e, 0x06}}; ////////////////////////////////////////////////////////// // global variable sgx_ecc_state_handle_t g_ecc_handle; sgx_ec256_public_t g_sar_server_public_key; sgx_ec256_private_t g_sar_server_private_key; ////////////////////////////////////////////////////////// // This ecall to generate the key pair inside the enclave. // TODO: the key should be loaded in a trusted way. // NOTE: don't generate the enclave key in this way. sgx_status_t ecall_enclave_ecc_init() { sgx_status_t ret; ret = sgx_ecc256_open_context(&g_ecc_handle); if (ret != SGX_SUCCESS) { LOG(ERROR, __FILE__, __LINE__, "sgx ecc 256 open context failed!"); } ret = sgx_ecc256_create_key_pair(&g_sar_server_private_key, &g_sar_server_public_key, g_ecc_handle); if (ret != SGX_SUCCESS) { LOG(ERROR, __FILE__, __LINE__, "sgx ecc 256 create key pair failed!"); } return ret; } // This ecall to close the context inside the enclave. // TODO: the key should be loaded in a trusted way. // NOTE: don't generate the enclave key in this way. sgx_status_t ecall_enclave_ecc_shutdown() { sgx_status_t ret; ret = sgx_ecc256_close_context(g_ecc_handle); if (ret != SGX_SUCCESS) { LOG(ERROR, __FILE__, __LINE__, "sgx ecc 256 close context failed!"); } return ret; } // This ecall is a wrapper of sgx_ra_init to create the trusted // KE exchange key context needed for the remote attestation // SIGMA API's. sgx_status_t ecall_enclave_ra_init(int b_pse, sgx_ra_context_t *p_context, sgx_ec256_public_t *p_client_pub) { sgx_status_t ret; ret = sgx_ra_init(p_client_pub, b_pse, p_context); if (ret != SGX_SUCCESS) { LOG(ERROR, __FILE__, __LINE__, "enclave ra context init failed!"); } return ret; } // This ecall is a wrapper of sgx_ra_close to create the trusted // KE exchange key context needed for the remote attestation // SIGMA API's. sgx_status_t ecall_enclave_ra_close(sgx_ra_context_t* context) { sgx_status_t ret; ret = sgx_ra_close(*context); if (ret != SGX_SUCCESS) { LOG(ERROR, __FILE__, __LINE__, "enclave ra context init failed!"); } return ret; }
33aac5daaafcedf61ec287ce4e22e369484eae15
e1d76663bb020dc27abb53c8f8bb979b4738373f
/source/support/support/scopepointer.cc
0d3eaf31355950499833e0d0ccf50356f1b52d5a
[]
no_license
fanopi/autoFloderSync
97e29f9aa24bc8bf78aa8325996e176572f46f8a
5232e01f43c9cc31df349a8b474c5d35a1e92ac5
refs/heads/master
2020-06-03T15:28:13.583695
2011-09-19T13:52:25
2011-09-19T13:52:25
2,338,869
0
0
null
null
null
null
UTF-8
C++
false
false
490
cc
scopepointer.cc
/* * autoPtr.cc * * Created on: 2011-4-18 * Author: Administrator */ #include"scopepointer.h" #include <stdio.h> #include "stdlib.h" #include "../library/stdlib.h" #include "datastruct/stlsupport.hpp" namespace YF{ class TestMe{ public: explicit TestMe(int i): i_(i){ printf("TestMe init %d\n",this->i_); } ~TestMe(){ printf("TestMe Deinit %d\n",i_); } int I_() const{ return i_; } private: int i_; }; } /// namespace YF
02c863c96443d348f75fed1501462b837c07cbcc
4eabe60e811298986a77b61b255c7826aad9b4e1
/src/controller/page_controller.cpp
f1032749d2fef08acf08054f243a62bfa6c5d6b2
[]
no_license
phoxicle/pheide-cpp
ed05a219856535e63a1d4dbaf98b5cef1ab36ea4
4d8e26a58df08c72807e1157d9bd75616083637c
refs/heads/master
2021-01-13T14:19:47.508822
2017-03-17T08:42:13
2017-03-17T08:42:13
79,050,607
0
0
null
null
null
null
UTF-8
C++
false
false
1,095
cpp
page_controller.cpp
#include <map> #include "page_controller.h" #include "../repository/page_repository.h" #include "../repository/tab_repository.h" #include "../controller/tab_controller.h" #include "../model/page_model.h" #include "../model/tab_model.h" namespace pheide { namespace controller { void PageController::doAction(std::string action, std::map<std::string,std::string> params, bool is_authenticated) { if (action == "show") { if (params["page_id"].empty()) { show(is_authenticated); } else { show(std::stoi(params["page_id"]), is_authenticated); } } } void PageController::show(bool is_authenticated) { repository::PageRepository page_repository; model::PageModel page_model = page_repository.selectByDefault(); show(page_model.uid, is_authenticated); } void PageController::show(int page_id, bool is_authenticated) { repository::TabRepository tab_repository; model::TabModel tab_model = tab_repository.selectByDefault(page_id); TabController tab_controller; tab_controller.show(page_id, tab_model.uid, is_authenticated); } } // namespace controller } // namespace pheide
d8dd41bd863b478e7650b1752392eada923ba2cb
062f73b7e41f6a3a9f6a33845e60788638bcadb5
/src/SteenX/LLVM/FunctionTable.cpp
b56f844ef2fce744321719b1ef33bfecc29a2c94
[ "MIT" ]
permissive
cherusker/racehog
7a75d98391b98f1c9d76d1d7f13c19c635fd7d0b
30f6285866f528fae0e05a8e8f2c354b1e171b1f
refs/heads/master
2020-05-22T14:10:14.931131
2019-05-13T08:35:56
2019-05-28T20:13:52
186,378,936
0
0
null
null
null
null
UTF-8
C++
false
false
626
cpp
FunctionTable.cpp
#include "SteenX/LLVM/FunctionTable.h" racehog::FunctionTable:: FunctionTable(Program& prog) : prog(prog) { entry = prog.createFunction(); (void) prog.setEntryPoint(entry); } racehog::FunctionReference racehog::FunctionTable:: get(const llvm::Function* llvm_func) { // std::iterator<llvm::Function*, Stream::FunctionId> auto find = lookup.find(llvm_func); if (find != lookup.end()) return prog.getFunctionReference(find->second); // TODO: Verify copy elision here. auto func = prog.createFunction(); (void) lookup.insert(std::make_pair(llvm_func, func.getId())); return func; }
6354a6dd611e00f497c3c121cc729ba2d5c07a78
3dd917982015664f204b77cda502600b92a084de
/LEDTableEngine/include/LEDTableEngine/controllers/matrixController.hpp
f4e3317adadacddf271afcecd28f39884bd33112
[ "Apache-2.0" ]
permissive
michaelbarbera/LEDTableEngine
9b6bbd6d2c11138fe501a00d430f4144aa195622
d7f5fd1e3030c0833086269a6c462954c0fe4d18
refs/heads/master
2021-07-03T13:32:41.955302
2021-05-05T10:36:48
2021-05-05T10:36:48
222,204,688
0
0
Apache-2.0
2019-11-17T06:02:37
2019-11-17T06:02:36
null
UTF-8
C++
false
false
802
hpp
matrixController.hpp
#ifndef _H_MATRIX_CONTROLLER_ #define _H_MATRIX_CONTROLLER_ #include <LEDTableEngine/core/baseController.hpp> #include <LEDTableEngine/controllers/TMP2.hpp> /** * @brief Matrix controller implementation that renders the generated image * onto the LED matrix hardware. */ class MatrixController : public led::BaseController { public: MatrixController(); ~MatrixController(); bool initialize(size_t width, size_t height, std::shared_ptr<led::BaseInput>input, bool debug = false); private: void showFrame(const led::Image& frame); void shutdown(); void copyImageToBuffer(const led::Image& frame); TMP2::Packet m_frameDataPacket; std::shared_ptr<TMP2> m_TMP2; }; #endif // ifndef _H_MATRIX_CONTROLLER_
1e7dab2a9a87e1b7ff7f15056b7df9033919ef00
187f6bb6b568e8bb42bafab8f81133d4ad5f383b
/Siv3D/include/Siv3D/AssetHandle.hpp
d152f23aaca892d4200a42171ab0ca7c714582c5
[ "MIT" ]
permissive
Reputeless/OpenSiv3D
f2938ea8f5c8de2e6e3b200046943f3e5398a2a1
7d02aa0f4824d1ecbd50ea1c00737cc932332b0a
refs/heads/main
2023-07-29T06:57:44.541422
2023-07-13T03:41:37
2023-07-13T03:41:37
306,929,779
0
0
MIT
2021-09-02T10:37:00
2020-10-24T16:55:13
C++
UTF-8
C++
false
false
2,477
hpp
AssetHandle.hpp
//----------------------------------------------- // // This file is part of the Siv3D Engine. // // Copyright (c) 2008-2023 Ryo Suzuki // Copyright (c) 2016-2023 OpenSiv3D Project // // Licensed under the MIT License. // //----------------------------------------------- # pragma once # include <memory> # include "Common.hpp" # include "AssetIDWrapper.hpp" namespace s3d { /// @brief アセットハンドル /// @tparam AssetType アセットのタグ template <class AssetType> class AssetHandle { public: /// @brief アセット ID ラッパー型 using AssetIDWrapperType = AssetIDWrapper<AssetHandle>; /// @brief アセット ID 型 using IDType = typename AssetIDWrapperType::IDType; SIV3D_NODISCARD_CXX20 AssetHandle(); SIV3D_NODISCARD_CXX20 explicit AssetHandle(std::shared_ptr<AssetIDWrapperType>&& id); /// @brief アセットの内部管理 ID を返します。 /// @remark アセットが作成されるときに割り当てられる(同じ種類のアセット内で)一意の値です。 /// @return アセットの内部管理 ID [[nodiscard]] IDType id() const noexcept; /// @brief アセットが空であるかを返します。 /// @return アセットが空の場合 true, それ以外の場合は false [[nodiscard]] bool isEmpty() const noexcept; /// @brief アセットが空でないかを返します。 /// @return アセットが空でない場合 true, それ以外の場合は false [[nodiscard]] explicit operator bool() const noexcept; /// @brief 2 つのアセットが同じオブジェクトであるかを返します。 /// @param other 比較するオブジェクト /// @return 2 つのアセットが同じオブジェクトである場合 true, それ以外の場合は false [[nodiscard]] bool operator ==(const AssetHandle& other) const noexcept; /// @brief 2 つのアセットが異なるオブジェクトであるかを返します。 /// @param other 比較するオブジェクト /// @return 2 つのアセットが異なるオブジェクトである場合 true, それ以外の場合は false [[nodiscard]] bool operator !=(const AssetHandle& other) const noexcept; /// @brief このハンドルが管理するアセットを解放します。 /// @remark 解放されたアセットは空になります。 void release(); protected: std::shared_ptr<AssetIDWrapperType> m_handle; }; } # include "detail/AssetHandle.ipp"
6b9089947d339dacda0c3e40a3f01932ee57bd91
590334eabc56115c000ac598160e170aa77c7c55
/lista revisao/primos.cpp
6b24da5152391faa7dda7fb8fe85bb9de83c4db1
[]
no_license
arthur-es/aed1
f72deabdee4b58c6cae1673f29714b9fc352f9e0
86df5401a3b53e292355d4b4fcb191566a5a48d0
refs/heads/master
2020-07-17T17:00:57.720424
2019-09-03T14:32:20
2019-09-03T14:32:20
206,059,438
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
685
cpp
primos.cpp
#include<iostream> using namespace std; int main(){ int qtdEntrada, numeros[101]; cin >> qtdEntrada; for(int i=0; i < qtdEntrada; i++){ cin >> numeros[i]; } /// [2, 3, 11, 16, 60] for(int i = 0; i < qtdEntrada; i++){ if(numeros[i] == 2){ cout << "primo\n"; continue; } if(numeros[i] % 2 == 0){ cout << "composto\n"; continue; } for(int j = 2; j < numeros[i]; j++){ if(numeros[i] % j == 0){ /// é divisivel => nao é primo cout << "composto\n"; } } cout << "primo\n"; } return 0; }
ce2c00dca5341e07ae380f4ca2d9c6a8914da056
724475e028ff39a9384a4f4a14d3b770138f7ece
/SWIGFiles/DMPlugInMenu.h
fc1e5ed46d6efb7af64fc1fcecbadf1eda39d8ce
[]
no_license
JJPPeters/Dimpy
caa19fe87222a20be96ee29c5742124402b7127c
57d0440a3b4bada97f1554e144c1b0e079ff56ea
refs/heads/master
2021-05-30T06:19:18.506016
2015-10-29T20:44:17
2015-10-29T20:44:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,984
h
DMPlugInMenu.h
#ifndef __PLUGINMENU__ #define __PLUGINMENU__ // // Changes needed for second version: // // 1 - plug-ins should not "register" or "unregister" menu anymore. // 2 - the Adjust() function should not have a (void) argument list. // 3 - DoMenuAction now should return a bool // 4 - plug-ins should prefer the AddAction() and AddBar() methods // 5 - menu constructor no longer takes a count. // 6 - StaticPlugInMenu class has been renamed to PlugInMenu // #include <vector> // // The plugin menu manager class keeps track of a list of menus. Since we implemented // the custom menu stuff on the Mac in such a way as to allow us to register only a single // menu handler component per plug-in, we use the plug-in menu manager to manage dispatching // to multiple "pluginmenu" objects. // namespace Gatan { namespace PlugIn { class ActionSpec { public: typedef long id_type; typedef long index_type; public: ActionSpec( id_type action, index_type index = 0 ) : action( action ), index( index ) { } bool operator==( const ActionSpec &as ) const { return ( action == as.action ) && ( index == as.index ); } id_type action; index_type index; }; class PlugInMenuEntry { public: PlugInMenuEntry(); Gatan::DM::String fMenu; Gatan::DM::String fSubMenu; // // These two fields determine the item's text (or bar) // bool fIsBar; Gatan::DM::String fName; // // These fields determine the appearance of the menu item. // bool fEnabled; bool fChecked; Gatan::uint8 fStyle; Gatan::uint8 fIconIndex; long fAccessPos; char fCmdKeyEquivalent; // This is the command. ActionSpec fAction; }; class PlugInMenu { public: typedef unsigned long index_type; typedef ActionSpec::id_type CommandID; typedef ActionSpec::index_type CommandIndex; public: PlugInMenu(); ~PlugInMenu(); virtual void Adjust(); // Override this method to "adjust" your menu items. virtual index_type CountItems() const = 0; virtual bool DoMenuAction( CommandID action, CommandIndex index ) = 0; // Override this method to carry out your actions. virtual void GetMenuItemEntry( index_type itemIndex, PlugInMenuEntry &menuEntry, CommandID &cmdNumber, CommandIndex &cmdIndex ) const = 0; }; class StandardPlugInMenu : public PlugInMenu { public: StandardPlugInMenu( const Gatan::DM::String &title ); StandardPlugInMenu( const Gatan::DM::String &title, const Gatan::DM::String &subMenu ); ~StandardPlugInMenu(); virtual index_type CountItems() const; virtual void GetMenuItemEntry( index_type itemIndex, PlugInMenuEntry &menuEntry, CommandID &cmdNumber, CommandIndex &cmdIndex ) const; void SetAction( index_type menuItem, const ActionSpec &action ); void SetAction( index_type menuItem, CommandID action, CommandIndex index ) { SetAction( menuItem, ActionSpec( action, index ) ); } void SetBar( index_type menuItem, const Gatan::DM::String &subMenu ); void AddAction( const ActionSpec &action ); void AddAction( CommandID action, CommandIndex index ) { AddAction( ActionSpec( action, index ) ); } void AddBar(); void AddBar( const Gatan::DM::String &subMenu ); void RemoveAction( const ActionSpec &action ); void SetChecked( const ActionSpec &action, bool checked ); void SetKeyEquivalent( const ActionSpec &action, char c ); void SetEnabled( const ActionSpec &action, bool enabled ); void SetName( const ActionSpec &action, const Gatan::DM::String &name ); void SetSubMenu( const ActionSpec &action, const Gatan::DM::String &subMenu ); void SetAccessPos( const ActionSpec &action, long pos ); private: typedef std::vector<PlugInMenuEntry> PlugInMenuEntryVector; PlugInMenuEntryVector fPlugInMenuEntryVector; Gatan::DM::String fTitle; Gatan::DM::String fSubMenu; PlugInMenuEntryVector::iterator ActionToMenuItem( const ActionSpec &action ); }; typedef StandardPlugInMenu StaticPlugInMenu; } } // namespace Gatan::PlugIn #endif
5b1a536c7c2f95405fb2c1130af5be52cd645cb6
f430993fe4c46836aabef1fb8a650ea5a465b00a
/test_interrupts/rov3rTimer.cpp
fc0889f6a5ab0147a90e9ee671451a79fa834f07
[ "MIT" ]
permissive
okeltw/Rov3r
6c3bb516603f15e67b086cc82db89029d845330d
14c4056f92040433be82c1986b799405734cf05a
refs/heads/master
2021-01-10T05:50:46.629452
2015-11-29T23:56:43
2015-11-29T23:56:43
46,578,115
0
0
null
2016-02-21T15:30:42
2015-11-20T17:59:16
C++
UTF-8
C++
false
false
297
cpp
rov3rTimer.cpp
#include "Arduino.h" #include "rov3rTimer.h" rov3rTimer::Setup(){ noInterrupts(); TCCR1A = 0; TCCR1B = 0; TCNT1 = 0; // preload timer @ 0-16MHz/256/2Hz TCCR1B |= (1 << CS12); // 256 prescaler TIMSK1 |= (1 << TOIE1); // enable timer overflow interrupt interrupts(); }
b99046085a3f232ed5bc20902e5c8034d13d3a1a
64874bd1010548c7f5a6e3e8902efa63baaff785
/src/frontends/lean/tokens.h
2134e3e2ae6dbd82d61aff4cc1efac868ec8fa48
[ "Apache-2.0" ]
permissive
tjiaqi/lean
4634d729795c164664d10d093f3545287c76628f
d0ce4cf62f4246b0600c07e074d86e51f2195e30
refs/heads/master
2021-05-29T21:29:56.480934
2015-01-30T18:37:49
2015-01-30T18:37:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,178
h
tokens.h
/* Copyright (c) 2014 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura */ #include "util/name.h" namespace lean { void initialize_tokens(); void finalize_tokens(); name const & get_period_tk(); name const & get_placeholder_tk(); name const & get_colon_tk(); name const & get_dcolon_tk(); name const & get_lparen_tk(); name const & get_rparen_tk(); name const & get_llevel_curly_tk(); name const & get_lcurly_tk(); name const & get_rcurly_tk(); name const & get_ldcurly_tk(); name const & get_rdcurly_tk(); name const & get_lcurlybar_tk(); name const & get_rcurlybar_tk(); name const & get_lbracket_tk(); name const & get_rbracket_tk(); name const & get_bar_tk(); name const & get_comma_tk(); name const & get_add_tk(); name const & get_max_tk(); name const & get_imax_tk(); name const & get_cup_tk(); name const & get_import_tk(); name const & get_prelude_tk(); name const & get_show_tk(); name const & get_have_tk(); name const & get_assume_tk(); name const & get_take_tk(); name const & get_fun_tk(); name const & get_ellipsis_tk(); name const & get_raw_tk(); name const & get_true_tk(); name const & get_false_tk(); name const & get_options_tk(); name const & get_instances_tk(); name const & get_classes_tk(); name const & get_coercions_tk(); name const & get_arrow_tk(); name const & get_declarations_tk(); name const & get_decls_tk(); name const & get_hiding_tk(); name const & get_exposing_tk(); name const & get_renaming_tk(); name const & get_extends_tk(); name const & get_as_tk(); name const & get_on_tk(); name const & get_off_tk(); name const & get_none_tk(); name const & get_whnf_tk(); name const & get_wf_tk(); name const & get_strict_tk(); name const & get_in_tk(); name const & get_assign_tk(); name const & get_visible_tk(); name const & get_from_tk(); name const & get_using_tk(); name const & get_then_tk(); name const & get_else_tk(); name const & get_by_tk(); name const & get_proof_tk(); name const & get_begin_tk(); name const & get_qed_tk(); name const & get_end_tk(); name const & get_private_tk(); name const & get_definition_tk(); name const & get_theorem_tk(); name const & get_axiom_tk(); name const & get_axioms_tk(); name const & get_variable_tk(); name const & get_variables_tk(); name const & get_opaque_tk(); name const & get_instance_tk(); name const & get_priority_tk(); name const & get_coercion_tk(); name const & get_reducible_tk(); name const & get_irreducible_tk(); name const & get_multiple_instances_tk(); name const & get_attribute_tk(); name const & get_parsing_only_tk(); name const & get_class_tk(); name const & get_with_tk(); name const & get_prev_tk(); name const & get_scoped_tk(); name const & get_foldr_tk(); name const & get_foldl_tk(); name const & get_binder_tk(); name const & get_binders_tk(); name const & get_infix_tk(); name const & get_infixl_tk(); name const & get_infixr_tk(); name const & get_postfix_tk(); name const & get_prefix_tk(); name const & get_notation_tk(); name const & get_call_tk(); name const & get_persistent_tk(); name const & get_root_tk(); name const & get_fields_tk(); name const & get_trust_tk(); }
74f18fafa71b38cd7438446e1f540638caf30d89
11372f47584ed7154697ac3b139bf298cdc10675
/刷题比赛/图论/POJ2631.cpp
876d0a286cc19b0c9842546bd335b73ad85f6295
[]
no_license
strategist614/ACM-Code
b5d893103e4d2ea0134fbaeb0cbd18c0fec06d12
d1e0f36dab47f649e2fade5e7ff23cfd0e8c8e56
refs/heads/master
2020-12-20T04:21:50.750182
2020-01-24T07:43:50
2020-01-24T07:45:08
235,958,679
0
0
null
null
null
null
UTF-8
C++
false
false
1,511
cpp
POJ2631.cpp
/* 独立思考 一个题不会做,收获5%,写了代码10%,提交对了30%,总结吃透了这个题才是100%. */ #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; template <typename T> void read(T &x) { x = 0; char c = getchar(); int sgn = 1; while (c < '0' || c > '9') {if (c == '-')sgn = -1; c = getchar();} while (c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar(); x *= sgn; } template <typename T> void out(T x) { if (x < 0) {putchar('-'); x = -x;} if (x >= 10)out(x / 10); putchar(x % 10 + '0'); } typedef long long ll; typedef unsigned long long ull; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} const int N = 1e4 + 4; int head[N], ver[N * 2], edge[N * 2], Next[N * 2]; int tot, ans = 0, start = 0; int vis[N], dis[N], n; void init() { memset(dis, 0, sizeof(dis)); memset(vis, 0, sizeof(vis)); } void add(int x, int y, int z) { ver[++tot] = y, edge[tot] = z, Next[tot] = head[x], head[x] = tot; } void dfs(int x) { for (int i = head[x]; i; i = Next[i]) { int y = ver[i]; int z = edge[i]; if (vis[y]) continue; vis[y] = 1; dis[y] = dis[x] + z; if (dis[y] > ans) { ans = dis[y]; start = y; } dfs(y); } } int main () { tot = 0; memset(head, 0, sizeof(head)); int u, v, w; while (scanf("%d %d %d", &u, &v, &w) == 3) {add(u, v, w), add(v, u, w);} init(); vis[1] = 1; dis[1] = 0; dfs(1); init(); vis[start] = 1; ans = 0; dis[start] = 0; dfs(start); printf("%d\n", ans); return 0 ; }
d29d1be35745bfb2dd70ada36d6a52073b0d416b
d446ed18144ac191377c2a5e0585fb61317b96c2
/src/eepp/ui/uiloader.cpp
c5e5ba52fc09d72e130a61cd0a7fe7514c543b6e
[ "MIT" ]
permissive
thyrdmc/eepp
6f8ee84f048efaf1b3aca931ea612e61136e15c4
93b72b1bcab794a43706658e7978c5e852c3b65a
refs/heads/master
2023-06-25T11:18:16.371330
2019-05-22T04:26:41
2019-05-22T04:26:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,426
cpp
uiloader.cpp
#include <eepp/ui/uiloader.hpp> #include <eepp/graphics/renderer/renderer.hpp> #include <eepp/scene/scenenode.hpp> #include <pugixml/pugixml.hpp> namespace EE { namespace UI { UILoader * UILoader::New() { return eeNew( UILoader, () ); } UILoader::UILoader() : UIWidget( "loader" ), mRadius(0), mOutlineThickness( PixelDensity::dpToPx(8) ), mColor( Color::Green ), mArcAngle(0), mArcStartAngle(0), mProgress(0), mMaxProgress(100), mAnimationSpeed(0.5f), mOp(1), mIndeterminate(true) { subscribeScheduledUpdate(); mArc.setFillMode( DRAW_FILL ); mCircle.setFillMode( DRAW_FILL ); setFillColor( mColor ); } UILoader::~UILoader() { } Uint32 UILoader::getType() const { return UI_TYPE_LOADER; } bool UILoader::isType( const Uint32& type ) const { return UILoader::getType() == type ? true : UIWidget::isType( type ); } void UILoader::draw() { UIWidget::draw(); Rectf rect( Vector2f( mScreenPosi.x, mScreenPosi.y ), Sizef( (int)mSize.x, (int)mSize.y ) ); mArc.setPosition( rect.getCenter() ); mCircle.setPosition( rect.getCenter() ); ClippingMask * clippingMask = Renderer::instance()->getClippingMask(); clippingMask->setMaskMode( ClippingMask::Exclusive ); clippingMask->clearMasks(); clippingMask->appendMask( mCircle ); clippingMask->stencilMaskEnable(); mArc.draw(); clippingMask->stencilMaskDisable(); } void UILoader::scheduledUpdate( const Time& time ) { invalidateDraw(); if ( mIndeterminate ) { mArcAngle += time.asMilliseconds() * mAnimationSpeed * mOp; mArcStartAngle += time.asMilliseconds() * (mAnimationSpeed*1.5f); if ( mOp == 1 && mArcAngle > 340 ) { mOp = -1; mArcAngle = 340; } else if ( mOp == -1 && mArcAngle < 20 ) { mOp = 1; mArcAngle = 20; } mArc.setArcAngle( mArcAngle ); mArc.setArcStartAngle( mArcStartAngle ); } else { mArcStartAngle += time.asMilliseconds() * (mAnimationSpeed*1.5f); mArc.setArcStartAngle( mArcStartAngle ); } } UILoader * UILoader::setOutlineThickness( const Float& thickness ) { mOutlineThickness = thickness; mCircle.setRadius( PixelDensity::dpToPx( mRadius ) - PixelDensity::dpToPx( mOutlineThickness ) ); return this; } const Float& UILoader::getOutlineThickness() const { return mOutlineThickness; } UILoader * UILoader::setRadius( const Float& radius ) { mRadius = radius; Float rRadius = PixelDensity::dpToPx( radius ); mCircle.setRadius( rRadius - PixelDensity::dpToPx( mOutlineThickness ) ); mArc.setRadius( rRadius ); return this; } const Float& UILoader::getRadius() const { return mRadius; } UILoader * UILoader::setFillColor( const Color& color ) { mColor = color; mArc.setColor( mColor ); mCircle.setColor( mColor ); return this; } const Color& UILoader::getFillColor() const { return mColor; } void UILoader::onSizeChange() { UIWidget::onSizeChange(); updateRadius(); } void UILoader::onPaddingChange() { mRadius = 0; onSizeChange(); UIWidget::onPaddingChange(); } void UILoader::updateRadius() { if ( mRadius == 0 ) { setRadius( eemin( mDpSize.x - mPadding.Left - mPadding.Right, mDpSize.y - mPadding.Top - mPadding.Bottom ) / 2.f ); } } void UILoader::onAutoSize() { if ( mLayoutWidthRules == WRAP_CONTENT || mLayoutHeightRules == WRAP_CONTENT ) { Sizef minSize( mDpSize ); if ( mLayoutWidthRules == WRAP_CONTENT ) { minSize.x = eemax( minSize.x, 64.f ); } if ( mLayoutHeightRules == WRAP_CONTENT ) { minSize.y = eemax( minSize.y, 64.f ); } setInternalSize( minSize ); updateRadius(); } } const bool& UILoader::isIndeterminate() const { return mIndeterminate; } UILoader * UILoader::setIndeterminate( const bool& indeterminate ) { mIndeterminate = indeterminate; return this; } UILoader * UILoader::setProgress( const Float& progress ) { mProgress = eemax( 0.f, eemin( progress, mMaxProgress ) ); if ( !mIndeterminate ) { mArcAngle = progress / mMaxProgress * 360.f; mArc.setArcAngle( mArcAngle ); } return this; } const Float& UILoader::getProgress() const { return mProgress; } const Float& UILoader::getMaxProgress() const { return mMaxProgress; } UILoader * UILoader::setMaxProgress( const Float& maxProgress ) { mMaxProgress = maxProgress; return this; } const Float& UILoader::getAnimationSpeed() const { return mAnimationSpeed; } UILoader * UILoader::setAnimationSpeed( const Float& animationSpeed ) { mAnimationSpeed = animationSpeed; return this; } bool UILoader::setAttribute( const NodeAttribute& attribute, const Uint32& state ) { std::string name = attribute.getName(); if ( "indeterminate" == name ) { setIndeterminate( attribute.asBool() ); } else if ( "maxprogress" == name ) { setMaxProgress( attribute.asFloat() ); } else if ( "progress" == name ) { setProgress( attribute.asFloat() ); } else if ( "fillcolor" == name ) { setFillColor( attribute.asColor() ); } else if ( "radius" == name ) { setRadius( attribute.asFloat() ); } else if ( "outlinethickness" == name ) { setOutlineThickness( attribute.asFloat() ); } else if ( "animationspeed" == name ) { setAnimationSpeed( attribute.asFloat() ); } else if ( "arcstartangle" == name ) { setArcStartAngle( attribute.asFloat() ); } else { return UIWidget::setAttribute( attribute, state ); } return true; } Float UILoader::getArcStartAngle() const { return mArcStartAngle; } UILoader * UILoader::setArcStartAngle( const Float& arcStartAngle ) { mArcStartAngle = arcStartAngle; return this; } }}
a2e0aa709955f6ec558e7ef9fa95f0b7ac8cee15
1621f37d257c909f055d7d8065cee1a838014cb3
/12月9校内练习赛/J.cpp
9cb268ec195ff18f070d615d8aacf1f5623f4bc4
[]
no_license
xiaohejun/ACM
a92ced7eca2c161f8cabb22043bf6b76272efe4d
72b647db914b1cfa9d48921532c347d862447222
refs/heads/master
2021-08-28T07:10:11.824807
2017-12-11T14:39:17
2017-12-11T14:39:17
113,869,837
4
0
null
null
null
null
UTF-8
C++
false
false
820
cpp
J.cpp
using namespace std; typedef pair<int, int> P; // pair自己百度 P p[55]; int main(int argc, char const *argv[]) { //freopen("in.txt", "r", stdin); int t,N; int a,b; cin >> t; while(t--) { // 输入测试组数 cin >> N; // 输入N for (int i = 0; i < N; ++i) { cin >> p[i].first >> p[i].second; } sort(p, p+N); /// 排序 for (int i = 0; i < N; ++i) // 输出 { a = p[i].first; b = p[i].second; for (int j = 0; j < b; ++j) { printf(">+"); for (int k = 0; k < a-2; ++k) { printf("-"); } printf("+>\n"); } printf("\n"); } } return 0; }
0062fd4e3fc9bc996f13de9c70eb8344e045d3d0
3f3a42f429f8bcd769644148b24c3b0e6e2589ed
/U2_3D/Src/dx9/U2Dx9FrameSection.cpp
519f7177e668fc5021cd3e1ab514916c967c105a
[]
no_license
DanielNeander/my-3d-engine
d10ad3e57a205f6148357f47467b550c7e0e0f33
7f0babbfdf0b719ea4b114a89997d3e52bcb2b6c
refs/heads/master
2021-01-10T17:58:25.691360
2013-04-24T07:37:31
2013-04-24T07:37:31
53,236,587
3
0
null
null
null
null
UTF-8
C++
false
false
1,017
cpp
U2Dx9FrameSection.cpp
#include <U2_3D/Src/U23DLibPCH.h> #include "U2Dx9FrameSection.h" //------------------------------------------------------------------------------------------------- U2FrameSection::U2FrameSection() :m_bFrameInBegin(false), m_pOwnerFrame(0) { } //------------------------------------------------------------------------------------------------- U2FrameSection::~U2FrameSection() { } //------------------------------------------------------------------------------ /** Validate the section object. This will invoke Validate() on all owned pass objects. */ void U2FrameSection::Validate() { U2ASSERT(m_pOwnerFrame); uint32 i; uint32 numPass = m_framePasses.FilledSize(); for(i=0; i < numPass; ++i) { m_framePasses[i]->SetFrame(m_pOwnerFrame); m_framePasses[i]->Validate(); } } void U2FrameSection::RecreateScreenQuads() { uint32 i; uint32 numPass = m_framePasses.FilledSize(); for(i=0; i < numPass; ++i) { m_framePasses[i]->RecreateScreenQuad(); } }
cca6ad39b6735a9d67b0cfc6b0b048b787ea1626
f1d322d0fbd53c9fd1ea9968480682aa6b7f9dd0
/Graphs/Kruskal.cpp
ef9a068ef9bbf104447e4a8f7a07281226f5427b
[]
no_license
JoseJuanSE/Reference
bfe8f4426bf9c1d046298dbff26cae2addef264e
6083e12f1d4fc2fe0125d7ee5a535e6bf3c0ce4f
refs/heads/master
2023-06-09T04:21:05.693716
2023-05-29T20:17:56
2023-05-29T20:17:56
253,330,637
2
0
null
null
null
null
UTF-8
C++
false
false
1,320
cpp
Kruskal.cpp
#include<bits/stdc++.h> using namespace std; struct UFDS{ vector<int>p,r; int ns; UFDS(int n){ ns=n; n++; p.assign(n,0); r.assign(n,1); for(int i=0;i<n;i++)p[i]=i; } int FindSet(int i){return p[i]==i?i:p[i]=FindSet(p[i]);} bool IsSameSet(int i,int j){return FindSet(i)==FindSet(j);} int NumSet(){return ns;} bool UnionSet(int i,int j){ int x=FindSet(i),y=FindSet(j); if(x==y) return false; ns--; if(r[x]<r[y]) swap(x,y); if(r[x]==r[y]) r[x]++; p[y]=x; return true; } }; struct edge{ int x,y,w; edge(int a,int b,int g):x(a),y(b),w(g){}; }; bool cmp(edge &a,edge &b){return a.w<b.w;} int kruskal(int &n,vector<edge> &arr){ UFDS uf(n); sort(begin(arr),end(arr),cmp); int mini=0; for(edge e:arr){ if(!uf.IsSameSet(e.y,e.x)){ mini+=e.w; uf.UnionSet(e.y,e.x); } if(uf.NumSet()==1)break; } return mini; } void read(){ int n;//number of vertex cin>>n; int m; cin>>m;//number of edges vector<edge>arr; for(int i=0;i<m;i++){ int a,b,w; cin>>a>>b>>w; arr.push_back(edge(a,b,w)); } int minimumweith = kruskal(n,arr); cout<<minimumweith<<endl; } int main(){ read(); return 0; } /* 6 7 1 2 3 1 3 2 2 4 3 3 4 2 3 5 1 4 6 4 5 6 5 */
c7cc4a0df7b3b2ff4091ed6edead7de2ea9c4521
23a90914cf22932f841b470397c8ab47b84f1e70
/chapter7/ex7_32.cpp
fc498767e5f7ae9650613ac34aa722d23826b33c
[]
no_license
suisuihan/cpp-primer
e5debbf3f74063fc8450d9e5fa6a071a3b9bf6b5
402754e7af5aaa7219b7dea5649bffe073406431
refs/heads/master
2020-04-12T05:40:12.803413
2016-10-11T17:08:22
2016-10-11T17:08:22
61,215,946
0
0
null
null
null
null
UTF-8
C++
false
false
100
cpp
ex7_32.cpp
#include <string> #include <iostream> #include "ex7_32.h" using namespace std; int main(){ }
dfdaea3847c7ba44cf36bee65e79afbbccca68d5
89273186f1772c05fc716125e9a4e96e42507d1d
/CN/SocketProgramming/Raw Sockets/Learn/server.cpp
9544a7db3afbdad4f8b9100b58b2ca184898fe99
[]
no_license
Avi-ab007/Semester
10aa5e4f60280598ddcccb4d9a17237f2c4ca778
289eed63367b6da6919c7fa396efb389d6012dbc
refs/heads/master
2020-03-12T11:14:51.418401
2019-04-02T15:54:39
2019-04-02T15:54:39
130,591,866
0
0
null
null
null
null
UTF-8
C++
false
false
1,691
cpp
server.cpp
#include <bits/stdc++.h> #include <stdio.h> //For standard things #include <stdlib.h> //malloc #include <unistd.h> #include <sys/socket.h> #include <string.h> //memset #include <netinet/ip_icmp.h> //Provides declarations for icmp header #include <netinet/udp.h> //Provides declarations for udp header #include <netinet/tcp.h> //Provides declarations for tcp header #include <netinet/ip.h> //Provides declarations for ip header #include <sys/socket.h> #include <linux/if_ether.h> #include <arpa/inet.h> using namespace std; #define len 65536 void errexit(string err) { perror(err.c_str()); exit(EXIT_FAILURE); } void print_iphdr(struct iphdr *ip) { cout<<"IP header len: "<<(unsigned int)(ip->ihl)<<endl; cout<<"IP header version: "<<(unsigned int)(ip->version)<<endl; cout<<"IP header ttl: "<<(unsigned int)(ip->ttl)<<endl; cout<<"Type of Service: "<<(unsigned int)(ip->tos)<<endl; cout<<"Packet ID: "<<ntohs(ip->id)<<endl; cout<<"IP Packet len: "<<ntohs(ip->tot_len)<<endl; cout<<"Protocol: "<<(unsigned int)(ip->protocol)<<endl; cout<<"Check: "<<ip->check<<endl; cout<<"Source IP: "<<inet_ntoa(*(in_addr*)&ip->saddr)<<endl; cout<<"Destination IP: "<<inet_ntoa(*(in_addr*)&ip->daddr)<<endl; } int main(int argc, char *argv[]) { int rsfd; rsfd = socket(AF_INET, SOCK_RAW, atoi(argv[1])); if (rsfd == -1) errexit("socket failed"); char buff[65536]; struct sockaddr cliaddr; socklen_t addrlen = sizeof cliaddr; if (recvfrom(rsfd, buff, len, 0, (sockaddr*)&cliaddr, &addrlen) == -1) errexit("recvfrom failed."); struct iphdr *ip; ip = (struct iphdr*)buff; print_iphdr(ip); printf("Data received: %s\n", (buff + (ip->ihl)*4)); return 0; }
57132f2c3b1f7970fb2b851fbfbb089d849b5706
fb71c08b1c1e7ea4d7abc82e65b36272069993e1
/src/CMouseObserver.cpp
04680fe6a73aecbaa66238b2a1a4ac33a800b030
[]
no_license
cezarygerard/fpteacher
1bb4ea61bc86cbadcf47a810c8bb441f598d278a
7bdfcf7c047caa9382e22a9d26a2d381ce2d9166
refs/heads/master
2021-01-23T03:47:54.994165
2010-03-25T01:12:04
2010-03-25T01:12:04
39,897,391
0
0
null
null
null
null
UTF-8
C++
false
false
1,069
cpp
CMouseObserver.cpp
/** @file CMouseObserver.cpp * @author Rafal Malinowski * @date 2009.01.07 * @version 0.6 * @brief klasa CMouseObserver jest abstrakcyjna klasa po ktorej beda dziedziczyc wszystkie klasy zainteresowane obsluga myszy * * */ #include "CMouseObserver.hpp" using namespace logging; int CMouseObserver::obsCounter_=0; void CMouseObserver::setMoveObserver (bool x) { if(x) moveObserver_=true; else moveObserver_=false; } bool CMouseObserver::getMoveObserver() { return moveObserver_; } void CMouseObserver::setId() { id_=obsCounter_; obsCounter_++; } int CMouseObserver::getId() { return id_; } int CMouseObserver::getCounter() { return obsCounter_; } void CMouseObserver::setMoveIsOver (bool x) { mouseIsOver_= x; } bool CMouseObserver::getMoveIsOver() { return mouseIsOver_; } /// destruktor wirutalny CMouseObserver::~CMouseObserver() { CLog::getInstance()->sss<<"CMouseObserver::~CMouseObserver: niszczenie"<<std::endl; logs(CLog::getInstance()->sss.str(), INFO); } //~~CMouseObserver.cpp
8ac2740e9e5dda5e743eb7d0c8d5fe94ace861da
f43f87177952e6f9dec6ec87e9293a03d9878972
/ament3/ament3.cpp
2cab2c2e5575d6a4a0283378abbaf9a0e7d85313
[]
no_license
abrunette/CS211
28e02a622525903319b2f1b97beb09516a08e1fb
e3c168a8840a59feeb1b8624f1f050636aaef06d
refs/heads/master
2021-07-04T07:36:53.596860
2017-09-23T20:04:59
2017-09-23T20:04:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
358
cpp
ament3.cpp
//Purpose: Read in family members to a linked list //Input: Input file //Output: Requested information on input file //Date: 2016.05.05 //Author: Aaron Brunette //Email: brune010@cougars.csusm.edu #include<iostream> #include<string> #include"Family.h" using namespace std; int main() { Family USAFamilies; USAFamilies.ReadTransactionFile(); return 0; }
48f5303a8081acb4ba84aa02abdc1190f4feb484
6b37a2f346bf3da546c39ce8582fda3df3a23f4d
/src/include/godec/channel.h
dcaf724675d875be51b79af54eae93867970cbb6
[ "MIT" ]
permissive
raytheonbbn/Godec
c0dbb0d21cc720b43b5216eb06b0fded2766b86e
d70b3034284f2f275e7e8a4169080fb63e20a4e7
refs/heads/master
2023-07-20T01:32:02.913156
2022-12-20T15:32:37
2022-12-20T15:32:37
170,737,675
10
4
MIT
2023-06-13T22:55:05
2019-02-14T18:21:06
C++
UTF-8
C++
false
false
4,276
h
channel.h
#pragma once #include <list> #include <float.h> #include <boost/thread/mutex.hpp> namespace Godec { enum ChannelReturnResult { ChannelNewItem, ChannelClosed, ChannelTimeout }; // This is the channel that contains a list of types items. This is overall a very useful class, as you can use it somewhat like Go channels, or "futures" template<class item> class channel { private: std::list<item> mQueue; boost::mutex m; boost::condition_variable putCv; boost::condition_variable getCv; std::string mId; bool mVerbose; int maxItems; int mRefCounter; public: channel() : maxItems(INT_MAX), mRefCounter(0) { } void checkIn(std::string who) { boost::unique_lock<boost::mutex> lock(m); mRefCounter++; //if (mVerbose) std::cout << "Channel " << mId << ": " << who << " checked in. New ref count = " << mRefCounter << std::endl << std::flush; } void checkOut(std::string who) { boost::unique_lock<boost::mutex> lock(m); mRefCounter--; //if (mVerbose) std::cout << "Channel " << mId << ": " << who << " checked out. New ref count = " << mRefCounter << std::endl << std::flush; putCv.notify_all(); getCv.notify_all(); } void setIdVerbose(std::string id, bool verbose) { mId = id; mVerbose = verbose; } std::string getId() { return mId; } int getRefCount() { return mRefCounter; } void setMaxItems(int _maxItems) { maxItems = _maxItems; } bool seenItAll() { return mRefCounter == 0 && mQueue.size() == 0; } void put(const item i) { boost::unique_lock<boost::mutex> lock(m); if (mRefCounter == 0) GODEC_ERR << "Channel " << mId << ": Somebody is trying push even though ref counter is 0!"; putCv.wait(lock, [&]() { return mQueue.size() < maxItems; }); mQueue.push_back(i); //if (mVerbose) std::cout << "Channel " << mId << ": Put item, notifying" << std::endl; getCv.notify_all(); } int32_t getNumItems() { return (int32_t)mQueue.size(); } ChannelReturnResult get(item& out) { return get(out, FLT_MAX); } ChannelReturnResult get(item& out, float maxTimeout) { boost::unique_lock<boost::mutex> lock(m); if (seenItAll()) return ChannelClosed; if (mQueue.size() == 0 && maxTimeout > 0.0f) { bool waitResult = false; if (maxTimeout == FLT_MAX) { getCv.wait(lock, [&]() { return seenItAll() || !mQueue.empty(); }); waitResult = true; } else { const boost::system_time timeLong = boost::get_system_time() + boost::posix_time::milliseconds((long)(1000.0f*maxTimeout)); waitResult = getCv.timed_wait(lock, timeLong, [&]() { return seenItAll() || !mQueue.empty(); }); } if (!waitResult) return ChannelTimeout; } if (seenItAll()) return ChannelClosed; out = mQueue.front(); mQueue.pop_front(); putCv.notify_all(); return ChannelNewItem; } ChannelReturnResult getAll(std::vector<item>& out, float maxTimeout) { boost::unique_lock<boost::mutex> lock(m); if (seenItAll()) return ChannelClosed; if (mQueue.size() == 0 && maxTimeout > 0.0f) { maxTimeout = std::min(maxTimeout, 60.0f * 60 * 24); const boost::system_time timeLong = boost::get_system_time() + boost::posix_time::milliseconds((long)(1000.0f*maxTimeout)); bool waitResult = getCv.timed_wait(lock, timeLong, [&]() { //if (mVerbose) std::cout << "Channel " << mId << ": Woke up, queue size " << mQueue.size() << std::endl; return seenItAll() || !mQueue.empty(); }); //if (mVerbose) std::cout << "Channel " << mId << ": Wait result = " << b2s(waitResult) << std::endl; if (!waitResult) return ChannelTimeout; } if (seenItAll()) return ChannelClosed; out = std::vector<item>(mQueue.begin(), mQueue.end()); mQueue.clear(); putCv.notify_all(); return ChannelNewItem; } }; } // namespace Godec
9b6947d29332378b3153668b5c091854f0c05402
b86f9b27178268065fc56e75af47356bb3c73bea
/Implementering/SW PC/RS232IF/rs232IF/rs232IF/rs232IF.cpp
5816c5ee7f28904ac9f29ba4112dbb531fac79a0
[]
no_license
mickkn/E2PRJ2
5b585957333aa6577785557455164fe94863f4e5
3d81a7ce6ee45d73293da281fdad8fef132a4b6e
refs/heads/master
2021-01-13T02:16:27.548333
2014-05-27T15:38:50
2014-05-27T15:38:50
null
0
0
null
null
null
null
ISO-8859-15
C++
false
false
1,561
cpp
rs232IF.cpp
#include "rs232IF.h" #include <string> #include <iostream> using namespace std; RS232IF::RS232IF() { serial.Open(port, 9600); } RS232IF::~RS232IF() { // forsøger at lukke serie port. serial.Close(); } bool RS232IF::validLogin() { string start = "SL"; string data = "9999"; char slut = '\r'; string message = start + data + slut; const char * c = message.c_str(); serial.SendData( c, commandSize); return true; } bool RS232IF::aktiver(int a) { string start = "SA"; string data = to_string(a); char slut = '\r'; string message = start + data + slut; const char * c = message.c_str(); serial.SendData( c, commandSize); return true; } bool RS232IF::deaktiver(int b) { string start = "SD"; string data = to_string(b); char slut = '\r'; string message = start + data + slut; const char * c = message.c_str(); serial.SendData( c, commandSize); return true; } int RS232IF::read() { char *ipBuffer = new char[commandSize+1]; if(serial.ReadDataWaiting() >= 7) { serial.ReadData(ipBuffer, commandSize+1); } string reading(ipBuffer, commandSize); cout << "bufferen read message :" << reading << endl; delete []ipBuffer; if(reading[1] == 'b' || reading[1] == 'B') // Lyd detekteret return 3; if(reading[1] == 't' || reading[1] == 'T') // Login return 1; if(reading[1] == 'f' || reading[1] == 'F') // Login udløbet return 2; return 0; } bool RS232IF::tester(string a) { char slut = '\r'; string message = a + slut; const char * c = message.c_str(); serial.SendData( c, commandSize); return true; }
e6c40ce7b21a8b3ff89ee237231da7f8def950c7
202b96b76fc7e3270b7a4eec77d6e1fd7d080b12
/modules/hardcore/opera/opera_template.inc
0510a1ffb5dff21255592c44659fb18e7be2e75e
[]
no_license
prestocore/browser
4a28dc7521137475a1be72a6fbb19bbe15ca9763
8c5977d18f4ed8aea10547829127d52bc612a725
refs/heads/master
2016-08-09T12:55:21.058966
1995-06-22T00:00:00
1995-06-22T00:00:00
51,481,663
98
66
null
null
null
null
UTF-8
C++
false
false
663
inc
opera_template.inc
// <-*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-> // <copyright header> // <autogenerated opera.py> /* This file is included by modules/hardcore/opera/hardcore_opera.cpp. */ CoreComponent::CoreComponent(const OpMessageAddress& address, OpComponentType type) : OpComponent(address, type) , failed_module_index(-1) , running(FALSE) , m_entropy_collect_count(0) , m_is_alive(true) { SET_INIT_MESSAGE("Core component constructed"); int i=0; // <modules assignment> OP_ASSERT(i == OPERA_MODULE_COUNT); #ifdef INIT_BLACKLIST op_memset(black_list, 0, sizeof(black_list)); // <blacklist assignment> #endif // INIT_BLACKLIST }
12b676a1b8aeebee4be78e7b33d55292271c8912
9ecfba5fa380058962cf654d46d2de320f071abb
/swap_nodes_in_pairs.cpp
94a901611605b2b91bb6f61a100d4d81cd1e090f
[]
no_license
fighter007/LeetCodeInCpp
b427b8f22e69b5d886dd420b8308e6569dea0568
ee8a49e68122866fa6e80271970c326ffa37892a
refs/heads/master
2021-01-11T13:34:08.630970
2014-09-29T11:18:59
2014-09-29T11:18:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
927
cpp
swap_nodes_in_pairs.cpp
class Solution { public: void insert_two_nodes(ListNode *node_1, ListNode *node_2, ListNode *&head, ListNode *&tail) { if (NULL == head) { head = node_2; tail = node_2; } else { if (node_2 != NULL) { tail->next = node_2; tail = node_2; } } if (NULL == head) { head = node_1; tail = node_1; } else { tail->next = node_1; tail = node_1; } } ListNode *swapPairs(ListNode *head) { ListNode *swapped_head = NULL; ListNode *swapped_tail = NULL; while (head != NULL) { ListNode *node_1 = head; ListNode *node_2 = node_1 ? node_1->next : NULL; head = head->next; head = head ? head->next : NULL; insert_two_nodes(node_1, node_2, swapped_head, swapped_tail); } if (NULL != swapped_tail) { swapped_tail->next = NULL; } return swapped_head; } };
65cec92e0c50935ea5c46f0640486b389baf0749
a017544e321047dc0fc2478807eaca5a584588b3
/Detectron2/Utils/Timer.h
e1d59229a453ff4dd46043fbaa36a453014dc483
[]
no_license
ttanzhiqiang/Detectron2_Project
d461c95ede6ed3a4affb182abf330c002ac119e8
91bf05ab3b0be0a8e20a244b2729f576160d6953
refs/heads/main
2023-07-02T08:22:52.736982
2021-08-06T10:13:00
2021-08-06T10:13:00
381,316,589
11
2
null
null
null
null
UTF-8
C++
false
false
401
h
Timer.h
#pragma once #include <Detectron2/Base.h> namespace Detectron2 { /** * ms-level timing of blocks. In Python, this is equivalent to: * * import time * t0 = time.time() * ... * print(">>>>>>> {}: {:.2f}ms".format("some name", (time.time() - t0) * 1000)) */ class Timer { public: Timer(const std::string &name); ~Timer(); private: std::string m_name; int m_t0; }; }
71033dff6ce562ae12c5bfd54486f003b539e8b7
108c35f55f35f887fd01958ea95d0baa7c3e0034
/zybooks/8 - Objects and Classes/8.12 Vector ADT/8.12.1.cpp
6dd4d27d0ab76e7a5cc735c14ffada6a9a58050f
[]
no_license
jcrantek/CPPPlayground
24e391bc1e16f069fa3c162cf884e954eab9354b
9b45a75030cf304e5fb306b045a47962b7d895b6
refs/heads/master
2022-09-04T02:14:01.749761
2019-08-13T14:41:22
2019-08-13T14:41:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,109
cpp
8.12.1.cpp
// Modify the existing vector's contents, by erasing the element at index 1 (initially 200), // then inserting 100 and 102 in the shown locations. // Use Vector ADT's erase() and insert() only, and remember that // the first argument of those functions is special, involving an iterator and not just an // integer. Sample output of below program: // 100 101 102 103 #include <iostream> #include <vector> using namespace std; void PrintVectors(vector<int> numsList) { int i; for (i = 0; i < numsList.size(); ++i) { cout << numsList.at(i) << " "; } cout << endl; } int main() { vector<int> numsList; numsList.push_back(101); numsList.push_back(200); numsList.push_back(103); /* Your solution goes here */ // vector (0)101 (1)200 (2)103 numsList.erase(numsList.begin() + 1); // becomes (0)101 (2)103 numsList.insert(numsList.begin() + 0, 100); // becomes (0)100 (1)101 (2)103 numsList.insert(numsList.begin() + 2, 102); // becomes (0)100 (1)101 (2)102 (3)103 PrintVectors(numsList); return 0; }
535be87d99a35245b2eb698dc2a369ed79508e16
a91796ab826878e54d91c32249f45bb919e0c149
/modules/gapi/include/opencv2/gapi/video.hpp
4dcc1d4182410b1e8ba3d672652ad5a3be31ced6
[ "Apache-2.0" ]
permissive
opencv/opencv
8f1c8b5a16980f78de7c6e73a4340d302d1211cc
a308dfca9856574d37abe7628b965e29861fb105
refs/heads/4.x
2023-09-01T12:37:49.132527
2023-08-30T06:53:59
2023-08-30T06:53:59
5,108,051
68,495
62,910
Apache-2.0
2023-09-14T17:37:48
2012-07-19T09:40:17
C++
UTF-8
C++
false
false
16,534
hpp
video.hpp
// This file is part of OpenCV project. // It is subject to the license terms in the LICENSE file found in the top-level directory // of this distribution and at http://opencv.org/license.html. // // Copyright (C) 2020 Intel Corporation #ifndef OPENCV_GAPI_VIDEO_HPP #define OPENCV_GAPI_VIDEO_HPP #include <utility> // std::tuple #include <opencv2/gapi/gkernel.hpp> /** \defgroup gapi_video G-API Video processing functionality */ namespace cv { namespace gapi { /** @brief Structure for the Kalman filter's initialization parameters.*/ struct GAPI_EXPORTS KalmanParams { // initial state //! corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k)) Mat state; //! posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k) Mat errorCov; // dynamic system description //! state transition matrix (A) Mat transitionMatrix; //! measurement matrix (H) Mat measurementMatrix; //! process noise covariance matrix (Q) Mat processNoiseCov; //! measurement noise covariance matrix (R) Mat measurementNoiseCov; //! control matrix (B) (Optional: not used if there's no control) Mat controlMatrix; }; /** * @brief This namespace contains G-API Operations and functions for * video-oriented algorithms, like optical flow and background subtraction. */ namespace video { using GBuildPyrOutput = std::tuple<GArray<GMat>, GScalar>; using GOptFlowLKOutput = std::tuple<cv::GArray<cv::Point2f>, cv::GArray<uchar>, cv::GArray<float>>; G_TYPED_KERNEL(GBuildOptFlowPyramid, <GBuildPyrOutput(GMat,Size,GScalar,bool,int,int,bool)>, "org.opencv.video.buildOpticalFlowPyramid") { static std::tuple<GArrayDesc,GScalarDesc> outMeta(GMatDesc,const Size&,GScalarDesc,bool,int,int,bool) { return std::make_tuple(empty_array_desc(), empty_scalar_desc()); } }; G_TYPED_KERNEL(GCalcOptFlowLK, <GOptFlowLKOutput(GMat,GMat,cv::GArray<cv::Point2f>,cv::GArray<cv::Point2f>,Size, GScalar,TermCriteria,int,double)>, "org.opencv.video.calcOpticalFlowPyrLK") { static std::tuple<GArrayDesc,GArrayDesc,GArrayDesc> outMeta(GMatDesc,GMatDesc,GArrayDesc, GArrayDesc,const Size&,GScalarDesc, const TermCriteria&,int,double) { return std::make_tuple(empty_array_desc(), empty_array_desc(), empty_array_desc()); } }; G_TYPED_KERNEL(GCalcOptFlowLKForPyr, <GOptFlowLKOutput(cv::GArray<cv::GMat>,cv::GArray<cv::GMat>, cv::GArray<cv::Point2f>,cv::GArray<cv::Point2f>,Size,GScalar, TermCriteria,int,double)>, "org.opencv.video.calcOpticalFlowPyrLKForPyr") { static std::tuple<GArrayDesc,GArrayDesc,GArrayDesc> outMeta(GArrayDesc,GArrayDesc, GArrayDesc,GArrayDesc, const Size&,GScalarDesc, const TermCriteria&,int,double) { return std::make_tuple(empty_array_desc(), empty_array_desc(), empty_array_desc()); } }; enum BackgroundSubtractorType { TYPE_BS_MOG2, TYPE_BS_KNN }; /** @brief Structure for the Background Subtractor operation's initialization parameters.*/ struct BackgroundSubtractorParams { //! Type of the Background Subtractor operation. BackgroundSubtractorType operation = TYPE_BS_MOG2; //! Length of the history. int history = 500; //! For MOG2: Threshold on the squared Mahalanobis distance between the pixel //! and the model to decide whether a pixel is well described by //! the background model. //! For KNN: Threshold on the squared distance between the pixel and the sample //! to decide whether a pixel is close to that sample. double threshold = 16; //! If true, the algorithm will detect shadows and mark them. bool detectShadows = true; //! The value between 0 and 1 that indicates how fast //! the background model is learnt. //! Negative parameter value makes the algorithm use some automatically //! chosen learning rate. double learningRate = -1; //! default constructor BackgroundSubtractorParams() {} /** Full constructor @param op MOG2/KNN Background Subtractor type. @param histLength Length of the history. @param thrshld For MOG2: Threshold on the squared Mahalanobis distance between the pixel and the model to decide whether a pixel is well described by the background model. For KNN: Threshold on the squared distance between the pixel and the sample to decide whether a pixel is close to that sample. @param detect If true, the algorithm will detect shadows and mark them. It decreases the speed a bit, so if you do not need this feature, set the parameter to false. @param lRate The value between 0 and 1 that indicates how fast the background model is learnt. Negative parameter value makes the algorithm to use some automatically chosen learning rate. */ BackgroundSubtractorParams(BackgroundSubtractorType op, int histLength, double thrshld, bool detect, double lRate) : operation(op), history(histLength), threshold(thrshld), detectShadows(detect), learningRate(lRate){} }; G_TYPED_KERNEL(GBackgroundSubtractor, <GMat(GMat, BackgroundSubtractorParams)>, "org.opencv.video.BackgroundSubtractor") { static GMatDesc outMeta(const GMatDesc& in, const BackgroundSubtractorParams& bsParams) { GAPI_Assert(bsParams.history >= 0); GAPI_Assert(bsParams.learningRate <= 1); return in.withType(CV_8U, 1); } }; void checkParams(const cv::gapi::KalmanParams& kfParams, const cv::GMatDesc& measurement, const cv::GMatDesc& control = {}); G_TYPED_KERNEL(GKalmanFilter, <GMat(GMat, GOpaque<bool>, GMat, KalmanParams)>, "org.opencv.video.KalmanFilter") { static GMatDesc outMeta(const GMatDesc& measurement, const GOpaqueDesc&, const GMatDesc& control, const KalmanParams& kfParams) { checkParams(kfParams, measurement, control); return measurement.withSize(Size(1, kfParams.transitionMatrix.rows)); } }; G_TYPED_KERNEL(GKalmanFilterNoControl, <GMat(GMat, GOpaque<bool>, KalmanParams)>, "org.opencv.video.KalmanFilterNoControl") { static GMatDesc outMeta(const GMatDesc& measurement, const GOpaqueDesc&, const KalmanParams& kfParams) { checkParams(kfParams, measurement); return measurement.withSize(Size(1, kfParams.transitionMatrix.rows)); } }; } //namespace video //! @addtogroup gapi_video //! @{ /** @brief Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK. @note Function textual ID is "org.opencv.video.buildOpticalFlowPyramid" @param img 8-bit input image. @param winSize window size of optical flow algorithm. Must be not less than winSize argument of calcOpticalFlowPyrLK. It is needed to calculate required padding for pyramid levels. @param maxLevel 0-based maximal pyramid level number. @param withDerivatives set to precompute gradients for the every pyramid level. If pyramid is constructed without the gradients then calcOpticalFlowPyrLK will calculate them internally. @param pyrBorder the border mode for pyramid layers. @param derivBorder the border mode for gradients. @param tryReuseInputImage put ROI of input image into the pyramid if possible. You can pass false to force data copying. @return - output pyramid. - number of levels in constructed pyramid. Can be less than maxLevel. */ GAPI_EXPORTS std::tuple<GArray<GMat>, GScalar> buildOpticalFlowPyramid(const GMat &img, const Size &winSize, const GScalar &maxLevel, bool withDerivatives = true, int pyrBorder = BORDER_REFLECT_101, int derivBorder = BORDER_CONSTANT, bool tryReuseInputImage = true); /** @brief Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids. See @cite Bouguet00 . @note Function textual ID is "org.opencv.video.calcOpticalFlowPyrLK" @param prevImg first 8-bit input image (GMat) or pyramid (GArray<GMat>) constructed by buildOpticalFlowPyramid. @param nextImg second input image (GMat) or pyramid (GArray<GMat>) of the same size and the same type as prevImg. @param prevPts GArray of 2D points for which the flow needs to be found; point coordinates must be single-precision floating-point numbers. @param predPts GArray of 2D points initial for the flow search; make sense only when OPTFLOW_USE_INITIAL_FLOW flag is passed; in that case the vector must have the same size as in the input. @param winSize size of the search window at each pyramid level. @param maxLevel 0-based maximal pyramid level number; if set to 0, pyramids are not used (single level), if set to 1, two levels are used, and so on; if pyramids are passed to input then algorithm will use as many levels as pyramids have but no more than maxLevel. @param criteria parameter, specifying the termination criteria of the iterative search algorithm (after the specified maximum number of iterations criteria.maxCount or when the search window moves by less than criteria.epsilon). @param flags operation flags: - **OPTFLOW_USE_INITIAL_FLOW** uses initial estimations, stored in nextPts; if the flag is not set, then prevPts is copied to nextPts and is considered the initial estimate. - **OPTFLOW_LK_GET_MIN_EIGENVALS** use minimum eigen values as an error measure (see minEigThreshold description); if the flag is not set, then L1 distance between patches around the original and a moved point, divided by number of pixels in a window, is used as a error measure. @param minEigThresh the algorithm calculates the minimum eigen value of a 2x2 normal matrix of optical flow equations (this matrix is called a spatial gradient matrix in @cite Bouguet00), divided by number of pixels in a window; if this value is less than minEigThreshold, then a corresponding feature is filtered out and its flow is not processed, so it allows to remove bad points and get a performance boost. @return - GArray of 2D points (with single-precision floating-point coordinates) containing the calculated new positions of input features in the second image. - status GArray (of unsigned chars); each element of the vector is set to 1 if the flow for the corresponding features has been found, otherwise, it is set to 0. - GArray of errors (doubles); each element of the vector is set to an error for the corresponding feature, type of the error measure can be set in flags parameter; if the flow wasn't found then the error is not defined (use the status parameter to find such cases). */ GAPI_EXPORTS std::tuple<GArray<Point2f>, GArray<uchar>, GArray<float>> calcOpticalFlowPyrLK(const GMat &prevImg, const GMat &nextImg, const GArray<Point2f> &prevPts, const GArray<Point2f> &predPts, const Size &winSize = Size(21, 21), const GScalar &maxLevel = 3, const TermCriteria &criteria = TermCriteria(TermCriteria::COUNT | TermCriteria::EPS, 30, 0.01), int flags = 0, double minEigThresh = 1e-4); /** @overload @note Function textual ID is "org.opencv.video.calcOpticalFlowPyrLKForPyr" */ GAPI_EXPORTS std::tuple<GArray<Point2f>, GArray<uchar>, GArray<float>> calcOpticalFlowPyrLK(const GArray<GMat> &prevPyr, const GArray<GMat> &nextPyr, const GArray<Point2f> &prevPts, const GArray<Point2f> &predPts, const Size &winSize = Size(21, 21), const GScalar &maxLevel = 3, const TermCriteria &criteria = TermCriteria(TermCriteria::COUNT | TermCriteria::EPS, 30, 0.01), int flags = 0, double minEigThresh = 1e-4); /** @brief Gaussian Mixture-based or K-nearest neighbours-based Background/Foreground Segmentation Algorithm. The operation generates a foreground mask. @return Output image is foreground mask, i.e. 8-bit unsigned 1-channel (binary) matrix @ref CV_8UC1. @note Functional textual ID is "org.opencv.video.BackgroundSubtractor" @param src input image: Floating point frame is used without scaling and should be in range [0,255]. @param bsParams Set of initialization parameters for Background Subtractor kernel. */ GAPI_EXPORTS GMat BackgroundSubtractor(const GMat& src, const cv::gapi::video::BackgroundSubtractorParams& bsParams); /** @brief Standard Kalman filter algorithm <http://en.wikipedia.org/wiki/Kalman_filter>. @note Functional textual ID is "org.opencv.video.KalmanFilter" @param measurement input matrix: 32-bit or 64-bit float 1-channel matrix containing measurements. @param haveMeasurement dynamic input flag that indicates whether we get measurements at a particular iteration . @param control input matrix: 32-bit or 64-bit float 1-channel matrix contains control data for changing dynamic system. @param kfParams Set of initialization parameters for Kalman filter kernel. @return Output matrix is predicted or corrected state. They can be 32-bit or 64-bit float 1-channel matrix @ref CV_32FC1 or @ref CV_64FC1. @details If measurement matrix is given (haveMeasurements == true), corrected state will be returned which corresponds to the pipeline cv::KalmanFilter::predict(control) -> cv::KalmanFilter::correct(measurement). Otherwise, predicted state will be returned which corresponds to the call of cv::KalmanFilter::predict(control). @sa cv::KalmanFilter */ GAPI_EXPORTS GMat KalmanFilter(const GMat& measurement, const GOpaque<bool>& haveMeasurement, const GMat& control, const cv::gapi::KalmanParams& kfParams); /** @overload The case of Standard Kalman filter algorithm when there is no control in a dynamic system. In this case the controlMatrix is empty and control vector is absent. @note Function textual ID is "org.opencv.video.KalmanFilterNoControl" @param measurement input matrix: 32-bit or 64-bit float 1-channel matrix containing measurements. @param haveMeasurement dynamic input flag that indicates whether we get measurements at a particular iteration. @param kfParams Set of initialization parameters for Kalman filter kernel. @return Output matrix is predicted or corrected state. They can be 32-bit or 64-bit float 1-channel matrix @ref CV_32FC1 or @ref CV_64FC1. @sa cv::KalmanFilter */ GAPI_EXPORTS GMat KalmanFilter(const GMat& measurement, const GOpaque<bool>& haveMeasurement, const cv::gapi::KalmanParams& kfParams); //! @} gapi_video } //namespace gapi } //namespace cv namespace cv { namespace detail { template<> struct CompileArgTag<cv::gapi::video::BackgroundSubtractorParams> { static const char* tag() { return "org.opencv.video.background_substractor_params"; } }; } // namespace detail } // namespace cv #endif // OPENCV_GAPI_VIDEO_HPP
72ce4fc29539fd8baccb89bab9ac049623bc2f75
9dd7633fd0625e5b5858a3d7a2fd9791d39bd137
/IntroD3D9/Ch10Mesh1/Mesh1/RenderMesh1.h
b5bbab4ec3243f5132295cd8651766d8ddd255ff
[]
no_license
breaker/studies
9f47846f8e8fbe7330a3fab5dd7d4ab711d44b60
015050ee892587ad0b5af4f2ac235134190fbe59
refs/heads/master
2022-12-04T16:31:04.104470
2022-11-24T10:23:27
2022-11-24T10:23:27
6,194,386
9
5
null
null
null
null
GB18030
C++
false
false
2,245
h
RenderMesh1.h
// RenderMesh1.h // #ifndef __RENDERMESH1_H__ #define __RENDERMESH1_H__ //////////////////////////////////////////////////////////////////////////////// // FVF 顶点类型 //////////////////////////////////////////////////////////////////////////////// struct Vertex { Vertex(float x0, float y0, float z0, float nx0, float ny0, float nz0, float u0, float v0) : x(x0), y(y0), z(z0), nx(nx0), ny(ny0), nz(nz0), u(u0), v(v0) {} float x, y, z; float nx, ny, nz; float u, v; static const DWORD FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1; }; //////////////////////////////////////////////////////////////////////////////// // 渲染类 RenderMesh1 //////////////////////////////////////////////////////////////////////////////// class RenderMesh1 : public SGL::Render { public: RenderMesh1() {} BOOL Init(UINT width, UINT height, HWND hwnd, BOOL windowed, D3DDEVTYPE devType); BOOL InitFont(); virtual void Draw(float timeDelta); private: CComPtr<ID3DXFont> m_Font; static const int NumSubsets = 3; CComPtr<IDirect3DTexture9> m_CubeTex[NumSubsets]; // texture for each subset CComPtr<ID3DXMesh> m_CubeMesh; static LPCTSTR TEXTURE_FILE[NumSubsets]; }; //////////////////////////////////////////////////////////////////////////////// // class MeshDump //////////////////////////////////////////////////////////////////////////////// class MeshDump { public: MeshDump() : m_DumpStream(NULL) {} ~MeshDump() { Clean(); } BOOL Init(LPCTSTR fname); void Clean(); void DumpVertex(ID3DXMesh* mesh); void DumpIndex(ID3DXMesh* mesh); void DumpAttributeBuffer(ID3DXMesh* mesh); void DumpAdjacencyBuffer(ID3DXMesh* mesh); void DumpAttributeTable(ID3DXMesh* mesh); private: FILE* m_DumpStream; }; //////////////////////////////////////////////////////////////////////////////// // 输入处理类 Mesh1Input //////////////////////////////////////////////////////////////////////////////// class Mesh1Input : public SGL::Input { public: virtual void ProcessInput(float timeDelta); }; #endif // __RENDERMESH1_H__
4c867ea1ebd9d75e5a84e99699619741676db09d
b771b54b2186263770066aab1ab474b945640033
/src/libs/sources_handling/ut/test_split_data.cpp
4841a06c4394b22eeb72ce318e1890bdf181ffa6
[ "MIT" ]
permissive
boazsade/machine_learinig_models
d13228ac64ab5547c312505be6147d41a81e6523
eb1f9eda0e4e25a6d028b25682dfb20628a20624
refs/heads/master
2020-04-13T01:36:08.251215
2018-12-23T12:37:55
2018-12-23T12:37:55
162,878,744
2
3
null
null
null
null
UTF-8
C++
false
false
4,340
cpp
test_split_data.cpp
#define BOOST_TEST_MODULE TEST_SOURCE_HANDLING #include <boost/test/unit_test.hpp> #include "ut_details/disable_log.h" #include "interp_tests.h" #include "helper_operations.hpp" #include "libs/sources_handling/source_data.h" namespace { const unsigned int missing[] = { 1, 4, 6, 10 }; } // end of local namespace BOOST_AUTO_TEST_CASE(test_parsing_scheme_simple) { do_disable_log(); auto data = from_double_array(std::begin(values), std::end(values), "foo"); BOOST_TEST_REQUIRE(size(data) > 0u); auto sliced = slice(data, std::begin(missing)+1, 1); // we need to ignore value 4 BOOST_TEST_REQUIRE(sliced.size() == 2u); BOOST_TEST_REQUIRE(sliced[0].row == 3u); BOOST_TEST_REQUIRE(sliced[1].row == 5u); BOOST_TEST_REQUIRE(sliced[0].value == values[3]); BOOST_TEST_REQUIRE(sliced[1].value == values[5]); } BOOST_AUTO_TEST_CASE(test_parsing_scheme_skip) { auto data = from_double_array(std::begin(values), std::end(values), "foo"); BOOST_TEST_REQUIRE(size(data) > 0u); const unsigned int missing_local[] = { 1, 4, 5, 6, 10 }; auto sliced = slice(data, std::begin(missing_local)+1, 1); // we need to ignore value 4, but we would skip as a result on 5 and 6 as well BOOST_TEST_REQUIRE(sliced.size() == 2u); BOOST_TEST_REQUIRE(sliced[0].row == 3u); BOOST_TEST_REQUIRE(sliced[1].row == 7u); BOOST_TEST_REQUIRE(sliced[0].value == values[3]); BOOST_TEST_REQUIRE(sliced[1].value == values[7]); } BOOST_AUTO_TEST_CASE(test_parsing_scheme_skip_begin) { auto data = from_double_array(std::begin(values), std::end(values), "foo"); BOOST_TEST_REQUIRE(size(data) > 0u); const unsigned int missing_local[] = { 1, 3, 4, 6, 10 }; auto sliced = slice(data, std::begin(missing_local)+1, 1); // we need to ignore value 4, but we would skip as a result on 3 BOOST_TEST_REQUIRE(sliced.size() == 2u); BOOST_TEST_REQUIRE(sliced[0].row == 2u); BOOST_TEST_REQUIRE(sliced[1].row == 5u); BOOST_TEST_REQUIRE(sliced[0].value == values[2]); BOOST_TEST_REQUIRE(sliced[1].value == values[5]); } BOOST_AUTO_TEST_CASE(test_parsing_scheme_skip_some) { auto data = from_double_array(std::begin(values), std::end(values), "foo"); BOOST_TEST_REQUIRE(size(data) > 0u); auto sliced = slice(data, std::begin(missing)+2, 3); // we need to ignore value 6, and we need to ignore some values along the way BOOST_TEST_REQUIRE(sliced.size() == 6u); // for (auto v : sliced) { // std::cout<<"["<<v.row<<", "<<v.value<<"]"; // } // std::cout<<std::endl; BOOST_TEST_REQUIRE(sliced[0].row == 2u); BOOST_TEST_REQUIRE(sliced[1].row == 3u); BOOST_TEST_REQUIRE(sliced[2].row == 5u); BOOST_TEST_REQUIRE(sliced[3].row == 7u); BOOST_TEST_REQUIRE(sliced[4].row == 8u); BOOST_TEST_REQUIRE(sliced[5].row == 9u); BOOST_TEST_REQUIRE(sliced[0].value == values[2]); BOOST_TEST_REQUIRE(sliced[1].value == values[3]); BOOST_TEST_REQUIRE(sliced[2].value == values[5]); BOOST_TEST_REQUIRE(sliced[3].value == values[7]); BOOST_TEST_REQUIRE(sliced[4].value == values[8]); BOOST_TEST_REQUIRE(sliced[5].value == values[9]); } BOOST_AUTO_TEST_CASE(test_transfrom_slice) { auto data = from_double_array(std::begin(values), std::end(values), "foo"); BOOST_TEST_REQUIRE(size(data) > 0u); auto sliced = slice(data, std::begin(missing)+2, 3); // we need to ignore value 6, and we need to ignore some values along the way BOOST_TEST_REQUIRE(sliced.size() == 6u); // now check that we extracting the data from this range auto v = transform_slice(std::make_pair(std::begin(sliced), std::end(sliced))); BOOST_TEST_REQUIRE(v.size() == sliced.size()); BOOST_TEST_REQUIRE(v[0] == values[2]); BOOST_TEST_REQUIRE(v[1] == values[3]); BOOST_TEST_REQUIRE(v[2] == values[5]); BOOST_TEST_REQUIRE(v[3] == values[7]); BOOST_TEST_REQUIRE(v[4] == values[8]); BOOST_TEST_REQUIRE(v[5] == values[9]); auto r = row_nums_transform(std::make_pair(std::begin(sliced), std::end(sliced))); BOOST_TEST_REQUIRE(r.size() == sliced.size()); BOOST_TEST_REQUIRE(r[0] == 2); BOOST_TEST_REQUIRE(r[1] == 3); BOOST_TEST_REQUIRE(r[2] == 5); BOOST_TEST_REQUIRE(r[3] == 7); BOOST_TEST_REQUIRE(r[4] == 8); BOOST_TEST_REQUIRE(r[5] == 9); }
37ecf330849fad3ef4eaf2a61a4e981307659a32
6a914e7ddbd18878dc6a86dac2979f1653f60386
/conclusionpage.cpp
1f4271a7f799e2b95f81aec6a6d891a28494bf44
[]
no_license
zy-sunshine/magic_first_wizard
1aa4e58b9b0c3f6a00a7ba685910ded29771802e
ce2258b8a4704044becae053842e8c46198944b6
refs/heads/master
2021-01-02T22:39:33.765216
2013-09-24T17:13:43
2013-09-24T17:13:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,839
cpp
conclusionpage.cpp
#include <locale.h> #include <libintl.h> #define gtr(string) gettext(string) #include <QWizardPage> #include <QVBoxLayout> #include <QLabel> #include <QString> #include <QVariant> #include <QMap> #include <QFile> #include <QTextStream> #include "conclusionpage.h" #include "wizard.h" ConclusionPage::ConclusionPage( QWidget* parent ) : QWizardPage( parent ) { setTitle( tr(gtr( "ConclusionPage" )) ); // setPixmap( QWizard::WatermarkPixmap, QPixmap( "magic.png" ) );//TODO QVBoxLayout* layout = new QVBoxLayout; setLayout( layout ); label = new QLabel; label->setWordWrap( true ); layout->addWidget( label ); } void ConclusionPage::initializePage() { QString str; if( field("dhcpbutton"+QString::number(Wizard::currentNetcard)).toBool() == true){ //dhcp option config str = QString( tr(gtr( "No. %1 card use dhcp mode\n" "Device: %2\n\n")) ) .arg(QString::number(Wizard::currentNetcard+1)) .arg(Wizard::netcardDeviceMap[Wizard::currentNetcard]); } if( field("manualbutton"+QString::number(Wizard::currentNetcard)).toBool() == true){ //manual ip option config QString ip = field( "ip"+QString::number(Wizard::currentNetcard) ).toString(); QString netmask = field( "netmask"+QString::number(Wizard::currentNetcard) ).toString(); QString gateway = field( "gateway"+QString::number(Wizard::currentNetcard) ).toString(); str = QString( tr(gtr( "No. %1 card use manual mode\n" "Device: %2\n\n" "IP :%3\n" "Netmask :%4\n" "Gateway :%5\n")) ) .arg(QString::number(Wizard::currentNetcard+1)) .arg(Wizard::netcardDeviceMap[Wizard::currentNetcard]) .arg(ip, netmask, gateway ); } str += tr(gtr("Allow rootless: %1\n")).arg( field( "allowrootless"+QString::number(Wizard::currentNetcard) ).toString() ); str += tr(gtr("Boot activate : %1\n")).arg( field( "bootactivate"+QString::number(Wizard::currentNetcard) ).toString() ); label->setText( str ); } bool ConclusionPage::validatePage() { QStringList lines; lines << "# Created by MagicLinux First Wizard"; lines << "DEVICE="+Wizard::netcardDeviceMap[Wizard::currentNetcard]; if( field("dhcpbutton"+QString::number(Wizard::currentNetcard)).toBool() == true ){ //dhcp option config lines << "BOOTPROTO=dhcp"; } if( field("manualbutton"+QString::number(Wizard::currentNetcard)).toBool() == true ){ //manual ip option config lines << "BOOTPROTO=static"; //lines << "BROADCAST="+192.168.1.255"; lines << "IPADDR="+field( "ip"+QString::number(Wizard::currentNetcard) ).toString(); lines << "NETMASK="+field( "netmask"+QString::number(Wizard::currentNetcard) ).toString(); lines << "GATEWAY="+field( "gateway"+QString::number(Wizard::currentNetcard) ).toString(); } if( field( "allowrootless"+QString::number(Wizard::currentNetcard) ).toBool() == true ){ lines << "USERCTL=yes"; }else{ lines << "USERCTL=no"; } if( field( "bootactivate"+QString::number(Wizard::currentNetcard) ).toBool() == true ){ lines << "ONBOOT=yes"; }else{ lines << "ONBOOT=no"; } //qDebug() << lines.join("\n"); QFile ifcfg("/etc/sysconfig/network-scripts/ifcfg-"+Wizard::netcardDeviceMap[Wizard::currentNetcard]); if(!ifcfg.open(QIODevice::WriteOnly)){ return false; }else{ QTextStream stream( &ifcfg ); stream << lines.join("\n"); ifcfg.close(); } return true; } /* DEVICE=eth0 BOOTPROTO=static(dhcp) #BROADCAST=192.168.1.255 IPADDR=192.168.1.101 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 #HWADDR=00:0C:29:69:76:CA USERCTL=yes ONBOOT=yes #TYPE=Ethernet */
c6611b02f138de46c3bead4331458950905be405
85f5ecdbd05f279631fca70303582ad39b466846
/Segment.h
b91d388e2e719c35748b15fad4a653462818e2f5
[]
no_license
zohairhadi/Centipede-Game
86ab25c25fbb1949a9142c241bcf05587ddbf211
12c6023bc581bc5f06e6a278449c99661d128141
refs/heads/master
2022-02-06T10:45:47.291380
2022-01-16T08:48:31
2022-01-16T08:48:31
251,394,005
0
0
null
null
null
null
UTF-8
C++
false
false
705
h
Segment.h
/* * Segment.h * * Created on: Apr 29, 2019 * Author: zohair */ #ifndef SEGMENT_H_ #define SEGMENT_H_ #include"MoveableObject.h" class Segment :public MoveableObject{ protected: bool inPlayerArea; public: char verticalDirection; Segment(); virtual void draw()=0; virtual void move()=0; virtual int getObjectPositionX()=0; virtual int getObjectPositionY()=0; virtual void changeDirection(); void changeVerticle(){ if(verticalDirection=='d'){ this->objectPosition.setObjY(objectPosition.getObjY()-1); } else{ this->objectPosition.setObjY(objectPosition.getObjY()+1); } } void setVDrirection(char c){verticalDirection=c;} virtual ~Segment(); }; #endif /* SEGMENT_H_ */
7f7d577ea0abfa497c5685dbcd305049d264311b
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.cc
5f48907027911978c6059a44a1e56c8a68d2a832
[ "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause", "MIT", "Apache-2.0" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
4,822
cc
prepopulated_computed_style_property_map.cc
// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.h" #include "third_party/blink/renderer/core/css/computed_style_css_value_mapping.h" #include "third_party/blink/renderer/core/css/css_custom_property_declaration.h" #include "third_party/blink/renderer/core/css/css_variable_data.h" #include "third_party/blink/renderer/core/css/cssom/computed_style_property_map.h" #include "third_party/blink/renderer/core/css/cssom/css_unparsed_value.h" #include "third_party/blink/renderer/core/css/properties/css_property_ref.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { PrepopulatedComputedStylePropertyMap::PrepopulatedComputedStylePropertyMap( const Document& document, const ComputedStyle& style, const Vector<CSSPropertyID>& native_properties, const Vector<AtomicString>& custom_properties) { // NOTE: This may over-reserve as shorthand properties will get dropped from // being in the map. native_values_.ReserveCapacityForSize(native_properties.size()); custom_values_.ReserveCapacityForSize(custom_properties.size()); for (const auto& property_id : native_properties) { // Silently drop shorthand properties. DCHECK_NE(property_id, CSSPropertyID::kInvalid); if (CSSProperty::Get(property_id).IsShorthand()) { continue; } UpdateNativeProperty(style, property_id); } for (const auto& property_name : custom_properties) { UpdateCustomProperty(document, style, property_name); } } unsigned PrepopulatedComputedStylePropertyMap::size() const { return native_values_.size() + custom_values_.size(); } void PrepopulatedComputedStylePropertyMap::UpdateStyle( const Document& document, const ComputedStyle& style) { for (const auto& property_id : native_values_.Keys()) { DCHECK_NE(property_id, CSSPropertyID::kInvalid); UpdateNativeProperty(style, property_id); } for (const auto& property_name : custom_values_.Keys()) { UpdateCustomProperty(document, style, property_name); } } void PrepopulatedComputedStylePropertyMap::UpdateNativeProperty( const ComputedStyle& style, CSSPropertyID property_id) { native_values_.Set(property_id, CSSProperty::Get(property_id) .CSSValueFromComputedStyle( style, /*layout_object=*/nullptr, /*allow_visited_style=*/false)); } void PrepopulatedComputedStylePropertyMap::UpdateCustomProperty( const Document& document, const ComputedStyle& style, const AtomicString& property_name) { CSSPropertyRef ref(property_name, document); const CSSValue* value = ref.GetProperty().CSSValueFromComputedStyle( style, /*layout_object=*/nullptr, /*allow_visited_style=*/false); if (!value) { value = CSSUnparsedValue::Create()->ToCSSValue(); } custom_values_.Set(property_name, value); } const CSSValue* PrepopulatedComputedStylePropertyMap::GetProperty( CSSPropertyID property_id) const { auto it = native_values_.find(property_id); return it != native_values_.end() ? it->value : nullptr; } const CSSValue* PrepopulatedComputedStylePropertyMap::GetCustomProperty( const AtomicString& property_name) const { auto it = custom_values_.find(property_name); return it != custom_values_.end() ? it->value : nullptr; } void PrepopulatedComputedStylePropertyMap::ForEachProperty( IterationFunction visitor) { // Have to sort by all properties by code point, so we have to store // them in a buffer first. HeapVector<std::pair<CSSPropertyName, Member<const CSSValue>>> values; for (const auto& entry : native_values_) { DCHECK(entry.value); values.emplace_back(CSSPropertyName(entry.key), entry.value); } for (const auto& entry : custom_values_) { DCHECK(entry.value); values.emplace_back(CSSPropertyName(entry.key), entry.value); } std::sort(values.begin(), values.end(), [](const auto& a, const auto& b) { return ComputedStylePropertyMap::ComparePropertyNames(a.first, b.first); }); for (const auto& value : values) { visitor(value.first, *value.second); } } String PrepopulatedComputedStylePropertyMap::SerializationForShorthand( const CSSProperty&) const { // TODO(816722): Shorthands not yet supported for this style map. NOTREACHED(); return ""; } void PrepopulatedComputedStylePropertyMap::Trace(Visitor* visitor) const { visitor->Trace(native_values_); visitor->Trace(custom_values_); StylePropertyMapReadOnlyMainThread::Trace(visitor); } } // namespace blink
73d9584913f8603b91f85c909926cd697b710820
ef9505fb4b8a55157f0c499e7d1dcbdc0e4de514
/hotel/service/rental/Computer.cpp
b409d5c4fd43034073f9e0fa93a048883f598f47
[]
no_license
corentingosselin/HotelManagementSystem
e85df2b894fd9cbac309477429dff5c16931739d
6d21cc130b7556e5e2c58940e1d877f9c8d39598
refs/heads/master
2023-03-04T19:46:45.653454
2021-02-13T15:39:26
2021-02-13T15:39:26
338,606,189
0
0
null
null
null
null
UTF-8
C++
false
false
147
cpp
Computer.cpp
// // Created by prodigy on 16/12/2020. // #include "Computer.h" Computer::Computer() { displayName = "Ordinateur portable"; price = 50; }
1061e890cbfccdec763c94ef789c42a7944b9604
227ee941caeee1e3776a480a430118b289aa83e7
/MinionsVsZombies/include/MainMenu.h
f2cd4c8179612847b8de7ef7a22003df75da329b
[ "MIT" ]
permissive
Matthias4/gba-sprite-engine
c37b9b9b4d886cb0979fff1bf8e36ebadf2e31a2
cc96561bfaf52358af31ea0e2d102619f0bd827d
refs/heads/master
2020-08-27T05:41:06.290382
2020-01-15T15:46:09
2020-01-15T15:46:09
217,258,915
0
0
MIT
2019-10-24T09:14:33
2019-10-24T09:14:25
null
UTF-8
C++
false
false
970
h
MainMenu.h
// // Created by matthias on 11/21/19. // #ifndef GBA_SPRITE_ENGINE_PROJECT_MAINMENU_H #define GBA_SPRITE_ENGINE_PROJECT_MAINMENU_H #include <libgba-sprite-engine/scene.h> #define MAINMENU_ENTRIES 2 // Number of menu entries, don't forget to update this or options will become unselectable class MainMenu : public Scene { private: std::unique_ptr<Background> background; std::unique_ptr<Sprite> minion; uint8_t selectedMenuEntry = 0; u16 lastKeys = 0; bool firstTick = true; void updateSelectMinion(); public: explicit MainMenu(const std::shared_ptr<GBAEngine> &engine);// explicit: no implicit conversion for the engine parameter allowed. ref: https://stackoverflow.com/questions/121162/what-does-the-explicit-keyword-mean std::vector<Sprite *> sprites() override; std::vector<Background *> backgrounds() override; void load() override; void tick(u16 keys) override; }; #endif //GBA_SPRITE_ENGINE_PROJECT_MAINMENU_H
f0d4e6b148f0e61b3d568cbafcccc1ce0f523103
458eea1b41c9eae73146a1668af6bb6a3362a14c
/libraries/pbes/include/mcrl2/pbes/pbessolve_attractors.h
800582e02b314357a326709bd0c0042b73d3da07
[ "BSL-1.0" ]
permissive
mCRL2org/mCRL2
91fb459f26087ac50036150cd77c7e8a16b5ec42
33d77f5ef994381e03a0d3b0693c1014e4e12d41
refs/heads/master
2023-09-01T13:54:28.982994
2023-09-01T12:54:35
2023-09-01T12:54:35
128,542,478
90
42
BSL-1.0
2023-08-10T15:12:42
2018-04-07T15:35:53
C++
UTF-8
C++
false
false
5,369
h
pbessolve_attractors.h
// Author(s): Wieger Wesselink // Copyright: see the accompanying file COPYING or copy at // https://github.com/mCRL2org/mCRL2/blob/master/COPYING // // 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) // /// \file mcrl2/pbes/pbessolve_attractors.h /// \brief add your file description here. #ifndef MCRL2_PBES_PBESSOLVE_ATTRACTORS_H #define MCRL2_PBES_PBESSOLVE_ATTRACTORS_H #include "mcrl2/pbes/pbessolve_vertex_set.h" namespace mcrl2 { namespace pbes_system { // Does not set a strategy struct no_strategy { static void set_strategy(structure_graph::index_type /* u */, structure_graph::index_type /* v */) {} }; // Puts strategy annotations in the strategy attributes of the nodes of graph G template <typename StructureGraph> struct global_strategy { const StructureGraph& G; explicit global_strategy(const StructureGraph& G_) : G(G_) {} void set_strategy(structure_graph::index_type u, structure_graph::index_type v) { if (v == undefined_vertex()) { mCRL2log(log::debug) << "Error: undefined strategy for node " << u << std::endl; } mCRL2log(log::debug) << " set tau[" << u << "] = " << v << std::endl; G.find_vertex(u).strategy = v; } }; // Puts strategy annotations in tau[alpha] struct local_strategy { std::array<strategy_vector, 2>& tau; std::size_t alpha; local_strategy(std::array<strategy_vector, 2>& tau_, std::size_t alpha_) : tau(tau_), alpha(alpha_) {} void set_strategy(structure_graph::index_type u, structure_graph::index_type v) { if (v == undefined_vertex()) { mCRL2log(log::debug) << "Error: undefined strategy for node " << u << std::endl; } mCRL2log(log::debug) << " set tau" << alpha << "[" << u << "] = " << v << std::endl; tau[alpha][u] = v; } }; // Combination of global and local strategy template <typename StructureGraph> struct global_local_strategy { global_strategy<StructureGraph> global; local_strategy local; global_local_strategy(const StructureGraph& G, std::array<strategy_vector, 2>& tau, std::size_t alpha) : global(G), local(tau, alpha) {} void set_strategy(structure_graph::index_type u, structure_graph::index_type v) { global.set_strategy(u, v); local.set_strategy(u, v); } }; // Returns true if succ(u) \subseteq A template <typename StructureGraph, typename VertexSet> bool includes_successors(const StructureGraph& G, typename StructureGraph::index_type u, const VertexSet& A) { for (auto v: G.successors(u)) { if (!A.contains(v)) { return false; } } return true; } // Returns pred(A) \ A template <typename StructureGraph> deque_vertex_set exclusive_predecessors(const StructureGraph& G, const vertex_set& A) { // put all predecessors of elements in A in todo deque_vertex_set todo(G.all_vertices().size()); for (auto u: A.vertices()) { for (auto v: G.predecessors(u)) { if (!A.contains(v)) { todo.insert(v); } } } return todo; } // Inserts pred(u) \ A into todo template <typename StructureGraph> void insert_predecessors(const StructureGraph& G, structure_graph::index_type u, const vertex_set& A, deque_vertex_set& todo) { for (auto v: G.predecessors(u)) { if (!A.contains(v)) { todo.insert(v); } } } // Computes an attractor set, by extending A. // alpha = 0: disjunctive // alpha = 1: conjunctive // StructureGraph is either structure_graph or simple_structure_graph // Strategy is either no_strategy, global_strategy, local_strategy or global_local_strategy template <typename StructureGraph, typename Strategy> vertex_set attr_default_generic(const StructureGraph& G, vertex_set A, std::size_t alpha, Strategy tau) { deque_vertex_set todo = exclusive_predecessors(G, A); while (!todo.is_empty()) { // N.B. Use a breadth first search, to minimize counter examples auto u = todo.pop_front(); if (G.decoration(u) == alpha || includes_successors(G, u, A)) { tau.set_strategy(u, find_successor_in(G, u, A)); A.insert(u); insert_predecessors(G, u, A, todo); } } return A; } // Computes an attractor set, by extending A. // alpha = 0: disjunctive // alpha = 1: conjunctive // StructureGraph is either structure_graph or simple_structure_graph template <typename StructureGraph> vertex_set attr_default(const StructureGraph& G, vertex_set A, std::size_t alpha) { return attr_default_generic(G, A, alpha, global_strategy<StructureGraph>(G)); } // Variant of attr_default that does not set any strategies. template <typename StructureGraph> vertex_set attr_default_no_strategy(const StructureGraph& G, vertex_set A, std::size_t alpha) { return attr_default_generic(G, A, alpha, no_strategy()); } // Computes an attractor set, by extending A. // alpha = 0: disjunctive // alpha = 1: conjunctive // StructureGraph is either structure_graph or simple_structure_graph template <typename StructureGraph> vertex_set attr_default_with_tau(const StructureGraph& G, vertex_set A, std::size_t alpha, std::array<strategy_vector, 2>& tau) { return attr_default_generic(G, A, alpha, global_local_strategy<StructureGraph>(G, tau, alpha)); } } // namespace pbes_system } // namespace mcrl2 #endif // MCRL2_PBES_PBESSOLVE_ATTRACTORS_H
23fe5facbb8e131cb8690d183450663c6be67d86
84c3201da572f30304e971da2791c74b30da83a7
/include/dukat/renderstage2.h
8835d10f36ea6707cc6a1937167cb12e5ed00633
[ "MIT" ]
permissive
bdamer/dukat
655de8b4c7e6db54a47f33611123d1886fac9ff5
003614cf2adf9cf96838a61a55794bc325030593
refs/heads/master
2023-08-03T20:10:57.885846
2023-07-26T06:07:46
2023-07-26T06:07:46
69,406,791
4
2
null
null
null
null
UTF-8
C++
false
false
682
h
renderstage2.h
#pragma once #include <string> #include "renderlayer2.h" namespace dukat { // A render stage represents one or more layers rendering // to the same screen buffer. struct RenderStage2 { const int id; // list of layers ordered by priority std::list<std::unique_ptr<RenderLayer2>> layers; // composite program to render to intermediate target // before compositing to screen buffer. ShaderProgram* composite_program; std::function<void(ShaderProgram*)> composite_binder; std::unique_ptr<FrameBuffer> frame_buffer; RenderStage2(int id) : id(id), composite_program(nullptr), composite_binder(nullptr), frame_buffer(nullptr) { } ~RenderStage2(void) { } }; }
3e52b3e28b3fb623c97cdb830fd5cc6f15b06c9d
ddb3206b6d0cb1007c644be7bb72b1460a302626
/Terrain Generator/TechBase.h
31aa5f27e265e676997db235da39687250a320df
[]
no_license
Aftnet/Terrain-Generator
3ccd2beac7978cb4f3ce2be709c358c5d575608e
4d145ce459a1a973e62ac3ba2fe8a9953e19af7e
refs/heads/master
2021-05-27T08:56:22.314829
2014-09-11T15:38:47
2014-09-11T15:38:47
23,796,735
8
0
null
null
null
null
UTF-8
C++
false
false
3,678
h
TechBase.h
/* TechBase class: as the name suggest, the class encapsulates the operations required to create an OpenglARB program with corresponding vertex and pixel shaders techniques and to compile them using GLSL code specified in two plaintext files. The class is meant never to be instantiated, existing only as a basis for technique specific derived classes; needless to say, all technique specific data (materials, textures, etc.) is to be part of the derived classes. A note on shaders: Most of the shaders have been built upon basic GLSL samples (Phong shading) I found on the internet. */ #pragma once #include <windows.h> #include <fstream> #include <gl/gl.h> #include <gl/glu.h> #include "Glext.h" class TechBase { public: virtual void Set(); protected: TechBase(char * VScode, char * PScode); ~TechBase(); bool IsExtensionSupported(GLcharARB* szTargetExtension); void BindTex2DToTextureUnit(GLuint hTexture, GLenum TextureUnitID); void BindTexUnitToSampler(GLint TextureUnitNumber, GLcharARB * SamplerName); void SetUniform1f(GLfloat Value, GLcharARB *UniformName); void SetUniform1i(GLint Value, GLcharARB *UniformName); //Status flags bool m_bExtensionSupport; bool m_bStatusOK; //ARB Program Object handle GLenum m_hProgram; //ARB Vertex Shader Object handle GLenum m_hVertexShader; //ARB Pixel Shader Object handle GLenum m_hPixelShader; //Number of available texture units GLint m_iMaxTexUnits; //Pointers to source code strings GLcharARB *m_pVertexShaderSrc; GLcharARB *m_pPixelShaderSrc; //Pointers to log strings and log length variables GLcharARB *m_pVertexShaderLog; GLint m_iVSCompileFlag; GLcharARB *m_pPixelShaderLog; GLint m_iPSCompileFlag; GLcharARB *m_pProgramLog; GLint m_iProgramLinkFlag; //Text handling functions char * TextFileRead(char *fn); bool TextFileWrite(char *fn, char *s); //OpenGL extensions Function Pointers //Shader related functions PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; PFNGLSHADERSOURCEARBPROC glShaderSourceARB; PFNGLCOMPILESHADERARBPROC glCompileShaderARB; PFNGLATTACHOBJECTARBPROC glAttachObjectARB; PFNGLLINKPROGRAMARBPROC glLinkProgramARB; PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; PFNGLGETINFOLOGARBPROC glGetInfoLogARB; PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB; PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; PFNGLUNIFORM1FARBPROC glUniform1fARB; PFNGLUNIFORM2FARBPROC glUniform2fARB; PFNGLUNIFORM3FARBPROC glUniform3fARB; PFNGLUNIFORM4FARBPROC glUniform4fARB; PFNGLUNIFORM1IARBPROC glUniform1iARB; PFNGLUNIFORM2IARBPROC glUniform2iARB; PFNGLUNIFORM3IARBPROC glUniform3iARB; PFNGLUNIFORM4IARBPROC glUniform4iARB; PFNGLUNIFORM1FVARBPROC glUniform1fvARB; PFNGLUNIFORM2FVARBPROC glUniform2fvARB; PFNGLUNIFORM3FVARBPROC glUniform3fvARB; PFNGLUNIFORM4FVARBPROC glUniform4fvARB; PFNGLUNIFORM1IVARBPROC glUniform1ivARB; PFNGLUNIFORM2IVARBPROC glUniform2ivARB; PFNGLUNIFORM3IVARBPROC glUniform3ivARB; PFNGLUNIFORM4IVARBPROC glUniform4ivARB; PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB; PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB; PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB; //Multitexturing related functions PFNGLACTIVETEXTUREARBPROC glActiveTextureARB; PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB; PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARB; PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB; PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB; PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB; };
1c9bd99633c1a977cf3ada2384aae4d9132d3952
77861deda8b3046bdda221d3cb80b77e84b14523
/swar-utf8-length/benchmark.cpp
90c81b55eb6a9a76f77cc7029f250ec6f5e4adca
[ "BSD-2-Clause" ]
permissive
WojciechMula/toys
b73f09212ca19f1e76bbf2afaa5ad2efcea95175
6110b59de45dc1ce44388b21c6437eff49a7655c
refs/heads/master
2023-08-18T12:54:25.919406
2023-08-05T09:20:14
2023-08-05T09:20:14
14,905,115
302
44
BSD-2-Clause
2020-04-17T17:10:42
2013-12-03T20:35:37
C++
UTF-8
C++
false
false
708
cpp
benchmark.cpp
#include <cstdio> #include <cstdlib> #include "benchmark.h" #include "all.h" class Benchmark { char buffer[1024]; public: Benchmark() { srand(0); for (size_t i=0; i < sizeof(buffer); i++) buffer[i] = rand(); } public: void run() { test("scalar", count_code_points); test("swar", swar_count_code_points); } private: template <typename FUN> void test(const char* name, FUN utf8_code_points) { const size_t repeat = 1000000; const size_t size = 1; BEST_TIME(/**/, utf8_code_points(buffer, sizeof(buffer)), name, repeat, size); } }; int main() { Benchmark bench; bench.run(); return 0; }
eab4fd8549e4eead5acf23fbeb9a5972d24f0412
eee4e1d7e3bd56bd0c24da12f727017d509f919d
/Case/case9/play/case0/Case/case1/2800/k
ee08b78b2bf8a4ff6e0d9419571b6391edbbb65c
[]
no_license
mamitsu2/aircond5_play5
35ea72345d23c5217564bf191921fbbe412b90f2
f1974714161f5f6dad9ae6d9a77d74b6a19d5579
refs/heads/master
2021-10-30T08:59:18.692891
2019-04-26T01:48:44
2019-04-26T01:48:44
183,529,942
0
0
null
null
null
null
UTF-8
C++
false
false
8,486
k
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "2800"; object k; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField nonuniform List<scalar> 458 ( 0.00269702 0.00327115 0.00344908 0.00381493 0.00418113 0.0045581 0.00495675 0.00525892 0.00541345 0.00538469 0.0051604 0.00474388 0.00412634 0.00299336 0.00198788 0.000552135 0.000798674 0.00109459 0.0012325 0.00121142 0.00106475 0.000911232 0.00078349 0.000680504 0.000596958 0.000528523 0.000471795 0.000424224 0.000382954 0.000345411 0.00030865 0.000273486 0.000220059 0.00479673 0.00893931 0.00555781 0.00598042 0.00663764 0.0074123 0.00823179 0.00898453 0.00949753 0.00966008 0.00943572 0.00885078 0.0079649 0.00673748 0.005317 0.00354088 0.00247624 0.00157265 0.000538934 0.00131081 0.00183522 0.00210285 0.00213537 0.00181356 0.00146858 0.00119311 0.000983872 0.000823986 0.000700185 0.000602311 0.000521072 0.000451726 0.00040034 0.000368046 0.000460909 0.000297162 0.00696814 0.0157765 0.00683365 0.00673237 0.00738234 0.00829828 0.00932077 0.010204 0.0107663 0.0109605 0.0107723 0.0102225 0.00933626 0.00825757 0.00706646 0.00583081 0.00468812 0.00258571 0.00144006 0.00196261 0.00236818 0.00259757 0.00258607 0.0019781 0.00148071 0.00112769 0.000880103 0.000704368 0.000577318 0.000483923 0.000415792 0.00036857 0.000342556 0.000340649 0.000586707 0.000359984 0.00940496 0.0250519 0.00857555 0.00713255 0.00770346 0.00885594 0.0101267 0.0110266 0.0115149 0.0116748 0.0114888 0.010927 0.0100681 0.00901642 0.00789489 0.00684713 0.00581924 0.00437231 0.00355117 0.00323699 0.00329364 0.00341399 0.00342855 0.00324498 0.00251963 0.00205818 0.00175873 0.00154574 0.00137734 0.00123292 0.00110473 0.000980378 0.000849052 0.000629992 0.000485687 0.000740274 0.000443964 0.0122689 0.0372377 0.0126185 0.0081837 0.0085723 0.0103068 0.0116279 0.0122704 0.0125447 0.0125876 0.0123376 0.0117108 0.0107158 0.00948077 0.00821439 0.0070996 0.00616481 0.00541971 0.00521327 0.00498961 0.00481942 0.00463155 0.00434543 0.00393692 0.00345012 0.00307072 0.00280484 0.00259088 0.00238794 0.00216635 0.00191433 0.00163679 0.00134507 0.00103001 0.000763486 0.000748486 0.000665125 0.000633688 0.00069658 0.000726242 0.0157306 0.0501917 0.0220649 0.0123551 0.0121721 0.0139387 0.0142692 0.014197 0.0141035 0.0139723 0.0136028 0.0128046 0.0115435 0.009984 0.00842399 0.00713029 0.00625447 0.0058535 0.00585828 0.00587496 0.00572674 0.00538498 0.00489145 0.00431876 0.00379546 0.00343681 0.00319614 0.00299793 0.00280087 0.00258166 0.00231485 0.00201279 0.00169428 0.00137245 0.00109162 0.000907967 0.000796418 0.000950613 0.00226642 0.00130883 0.0190739 0.0580678 0.0366869 0.0246086 0.0219833 0.0195986 0.0178312 0.0167579 0.0162326 0.015905 0.0153498 0.0142648 0.0126032 0.0105987 0.0086863 0.00723194 0.00642879 0.00623802 0.00635109 0.00634672 0.00607174 0.00557075 0.00494755 0.00431556 0.00380212 0.00347406 0.00326972 0.00311519 0.00297454 0.00283054 0.00266417 0.00244436 0.00218833 0.00191545 0.00167832 0.00151013 0.00143335 0.00162863 0.00325891 0.00201595 0.0196312 0.0540022 0.0404011 0.0326263 0.0269559 0.0228627 0.0203877 0.0192194 0.0188102 0.0184874 0.0176566 0.0160379 0.0137012 0.0110325 0.00873568 0.00720558 0.006513 0.00638738 0.00639535 0.00621939 0.00577875 0.00517655 0.00453552 0.00396436 0.00354195 0.00327906 0.00312405 0.00303181 0.00298589 0.00298549 0.00303336 0.00311661 0.00316995 0.00319293 0.00331484 0.00371868 0.00458122 0.0055954 0.0110526 0.00368292 0.018532 0.0253879 0.0237721 0.021329 0.0200345 0.0200448 0.0208651 0.021951 0.0226338 0.0222195 0.0203867 0.0174158 0.0137949 0.0100882 0.00786627 0.00672413 0.00621508 0.00600446 0.00580875 0.00547282 0.00499131 0.00443001 0.00388726 0.00343551 0.0031097 0.00290065 0.00277675 0.00271634 0.0027134 0.00276864 0.00288144 0.00304606 0.00327188 0.00357496 0.0039911 0.00451607 0.00506026 0.00548432 0.00578693 0.0035049 0.00556883 0.0176675 0.0256489 0.0294514 0.0309515 0.030457 0.0277477 0.0230687 0.0176674 0.0132304 0.00995205 0.00775431 0.00649723 0.00582251 0.00544856 0.00517186 0.00485754 0.00446257 0.00402212 0.00359214 0.00321314 0.00290742 0.00267142 0.00248881 0.00234825 0.00225087 0.002206 0.00222491 0.00231714 0.00249073 0.00274532 0.00307472 0.0034668 0.00386832 0.00415522 0.00417227 0.00389732 0.00244463 0.00847377 0.0285773 0.0299846 0.0276875 0.0250745 0.0218635 0.0182234 0.0144523 0.0110727 0.0085315 0.00683116 0.00579189 0.00520059 0.00486851 0.00466638 0.00450708 0.00434002 0.00415109 0.00395197 0.00375853 0.00357638 0.00340068 0.00322278 0.00303843 0.00285384 0.00268497 0.00255274 0.00247687 0.00247241 0.00255174 0.00272274 0.00298738 0.00332665 0.00367596 0.00396559 0.0041333 0.00417887 0.00256141 0.00630537 0.00740491 0.00825994 0.00979655 0.00911782 0.00864597 0.00804398 0.0071284 0.0060484 0.00495898 0.00400602 0.00329815 0.00282799 0.00252762 0.00233051 0.00218926 0.00207218 0.00195975 0.00184479 0.00173073 0.00162499 0.00153227 0.00145336 0.00138726 0.00133319 0.00129367 0.001273 0.00127576 0.00130533 0.0013635 0.00145103 0.00156763 0.00171524 0.00189671 0.00211304 0.00235221 0.00259063 0.00249453 0.0021386 0.00184542 ) ; boundaryField { floor { type kqRWallFunction; value nonuniform List<scalar> 36 ( 0.00198788 0.000552135 0.000798674 0.00109459 0.0012325 0.00121142 0.00106475 0.000911232 0.00078349 0.000680504 0.000596958 0.000528523 0.000471795 0.000424224 0.000382954 0.000345411 0.00030865 0.000273486 0.000220059 0.000220059 0.000297162 0.000359984 0.000443964 0.000633688 0.00069658 0.000726242 0.00198788 0.00354088 0.00247624 0.00157265 0.000552135 0.00157265 0.000538934 0.00258571 0.00144006 0.00355117 ) ; } ceiling { type kqRWallFunction; value nonuniform List<scalar> 43 ( 0.00630537 0.00740491 0.00825994 0.00979655 0.00911782 0.00864597 0.00804398 0.0071284 0.0060484 0.00495898 0.00400602 0.00329815 0.00282799 0.00252762 0.00233051 0.00218926 0.00207218 0.00195975 0.00184479 0.00173073 0.00162499 0.00153227 0.00145336 0.00138726 0.00133319 0.00129367 0.001273 0.00127576 0.00130533 0.0013635 0.00145103 0.00156763 0.00171524 0.00189671 0.00211304 0.00235221 0.00259063 0.00249453 0.0021386 0.00184542 0.018532 0.0253879 0.00847377 ) ; } sWall { type kqRWallFunction; value uniform 0.00630537; } nWall { type kqRWallFunction; value nonuniform List<scalar> 6(0.000726242 0.00130883 0.00201595 0.00244463 0.00256141 0.00184542); } sideWalls { type empty; } glass1 { type kqRWallFunction; value nonuniform List<scalar> 9(0.00269702 0.00479673 0.00696814 0.00940496 0.0122689 0.0157306 0.0190739 0.0196312 0.018532); } glass2 { type kqRWallFunction; value nonuniform List<scalar> 2(0.00368292 0.0035049); } sun { type kqRWallFunction; value nonuniform List<scalar> 14 ( 0.00269702 0.00327115 0.00344908 0.00381493 0.00418113 0.0045581 0.00495675 0.00525892 0.00541345 0.00538469 0.0051604 0.00474388 0.00412634 0.00299336 ) ; } Table_master { type kqRWallFunction; value nonuniform List<scalar> 9(0.0019781 0.00148071 0.00112769 0.000880103 0.000704368 0.000577318 0.000483923 0.000415792 0.00036857); } Table_slave { type kqRWallFunction; value nonuniform List<scalar> 9(0.00251963 0.00205818 0.00175873 0.00154574 0.00137734 0.00123292 0.00110473 0.000980378 0.000849052); } inlet { type turbulentIntensityKineticEnergyInlet; intensity 0.05; value uniform 0.0003375; } outlet { type zeroGradient; } } // ************************************************************************* //