hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
108
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
b0c60a92576ffb67eda375efc157b70405f09a4a
517
hh
C++
ACAP_linux/3rd/CoMISo/Config/GmmTypes.hh
shubhMaheshwari/Automatic-Unpaired-Shape-Deformation-Transfer
8c9afe017769f9554706bcd267b6861c4c144999
[ "MIT" ]
216
2018-09-09T11:53:56.000Z
2022-03-19T13:41:35.000Z
ACAP_linux/3rd/CoMISo/Config/GmmTypes.hh
gaolinorange/Automatic-Unpaired-Shape-Deformation-Transfer
8c9afe017769f9554706bcd267b6861c4c144999
[ "MIT" ]
13
2018-10-23T08:29:09.000Z
2021-09-08T06:45:34.000Z
ACAP_linux/3rd/CoMISo/Config/GmmTypes.hh
shubhMaheshwari/Automatic-Unpaired-Shape-Deformation-Transfer
8c9afe017769f9554706bcd267b6861c4c144999
[ "MIT" ]
41
2018-09-13T08:50:41.000Z
2022-02-23T00:33:54.000Z
// (C) Copyright 2014 by Autodesk, Inc. #ifndef GMMTYPES_HH_INCLUDED #define GMMTYPES_HH_INCLUDED #include <gmm/gmm_matrix.h> namespace COMISO_GMM { // Matrix Types typedef gmm::col_matrix< gmm::wsvector<double> > WSColMatrix; typedef gmm::row_matrix< gmm::wsvector<double> > WSRowMatrix; typedef gmm::col_matrix< gmm::rsvector<double> > RSColMatrix; typedef gmm::row_matrix< gmm::rsvector<double> > RSRowMatrix; typedef gmm::csc_matrix<double> CSCMatrix; }//namespace COMISO_GMM #endif//GMMTYPES_HH_INCLUDED
24.619048
61
0.775629
shubhMaheshwari
b0c660c512a6f2da10b75c3025468a19d9e1952e
4,461
cpp
C++
library/src/blas2/rocblas_syr.cpp
zjunweihit/rocBLAS
c8bda2d15a7772d810810492ebed616eec0959a5
[ "MIT" ]
null
null
null
library/src/blas2/rocblas_syr.cpp
zjunweihit/rocBLAS
c8bda2d15a7772d810810492ebed616eec0959a5
[ "MIT" ]
null
null
null
library/src/blas2/rocblas_syr.cpp
zjunweihit/rocBLAS
c8bda2d15a7772d810810492ebed616eec0959a5
[ "MIT" ]
null
null
null
/* ************************************************************************ * Copyright 2016-2019 Advanced Micro Devices, Inc. * ************************************************************************ */ #include "rocblas_syr.hpp" #include "logging.h" #include "utility.h" namespace { template <typename> constexpr char rocblas_syr_name[] = "unknown"; template <> constexpr char rocblas_syr_name<float>[] = "rocblas_ssyr"; template <> constexpr char rocblas_syr_name<double>[] = "rocblas_dsyr"; template <typename T> rocblas_status rocblas_syr_impl(rocblas_handle handle, rocblas_fill uplo, rocblas_int n, const T* alpha, const T* x, rocblas_int incx, T* A, rocblas_int lda) { if(!handle) return rocblas_status_invalid_handle; RETURN_ZERO_DEVICE_MEMORY_SIZE_IF_QUERIED(handle); if(!alpha) return rocblas_status_invalid_pointer; auto layer_mode = handle->layer_mode; if(layer_mode & (rocblas_layer_mode_log_trace | rocblas_layer_mode_log_bench | rocblas_layer_mode_log_profile)) { auto uplo_letter = rocblas_fill_letter(uplo); if(handle->pointer_mode == rocblas_pointer_mode_host) { if(layer_mode & rocblas_layer_mode_log_trace) log_trace(handle, rocblas_syr_name<T>, uplo, n, *alpha, x, incx, A, lda); if(layer_mode & rocblas_layer_mode_log_bench) log_bench(handle, "./rocblas-bench -f syr -r", rocblas_precision_string<T>, "--uplo", uplo_letter, "-n", n, "--alpha", *alpha, "--incx", incx, "--lda", lda); } else { if(layer_mode & rocblas_layer_mode_log_trace) log_trace(handle, rocblas_syr_name<T>, uplo, n, alpha, x, incx, A, lda); } if(layer_mode & rocblas_layer_mode_log_profile) log_profile(handle, rocblas_syr_name<T>, "uplo", uplo_letter, "N", n, "incx", incx, "lda", lda); } if(uplo != rocblas_fill_lower && uplo != rocblas_fill_upper) return rocblas_status_not_implemented; if(!x || !A) return rocblas_status_invalid_pointer; if(n < 0 || !incx || lda < n || lda < 1) return rocblas_status_invalid_size; return rocblas_syr_template(handle, uplo, n, alpha, x, incx, A, lda); } } /* * =========================================================================== * C wrapper * =========================================================================== */ extern "C" { rocblas_status rocblas_ssyr(rocblas_handle handle, rocblas_fill uplo, rocblas_int n, const float* alpha, const float* x, rocblas_int incx, float* A, rocblas_int lda) { return rocblas_syr_impl(handle, uplo, n, alpha, x, incx, A, lda); } rocblas_status rocblas_dsyr(rocblas_handle handle, rocblas_fill uplo, rocblas_int n, const double* alpha, const double* x, rocblas_int incx, double* A, rocblas_int lda) { return rocblas_syr_impl(handle, uplo, n, alpha, x, incx, A, lda); } } // extern "C"
36.565574
93
0.401479
zjunweihit
37cef196e666250313bf06deb14449c4f2d79e8f
2,001
hpp
C++
Math/include/Math/Vector3.hpp
Samahu/RayTracer
d5229ccc83944ec694c1601394c757f33d38a010
[ "MIT" ]
1
2019-05-16T12:25:46.000Z
2019-05-16T12:25:46.000Z
Math/include/Math/Vector3.hpp
Samahu/RayTracer
d5229ccc83944ec694c1601394c757f33d38a010
[ "MIT" ]
null
null
null
Math/include/Math/Vector3.hpp
Samahu/RayTracer
d5229ccc83944ec694c1601394c757f33d38a010
[ "MIT" ]
null
null
null
#pragma once template <typename T> class Vector3 { template <typename G> friend Vector3<G> operator*(G t, const Vector3<G> v); template <typename G> friend Vector3<G> operator-(const Vector3<G> v); public: Vector3() {} Vector3(T x, T y, T z) { e[0] = x; e[1] = y; e[2] = z; } // Data Accessors T x() const { return e[0]; } T y() const { return e[1]; } T z() const { return e[2]; } Vector3<T> operator+(const Vector3<T> v) const { return Vector3<T>(e[0] + v.e[0], e[1] + v.e[1], e[2] + v.e[2]); } Vector3<T> operator-(const Vector3<T> v) const { return Vector3<T>(e[0] - v.e[0], e[1] - v.e[1], e[2] - v.e[2]); } Vector3<T> operator*(const Vector3<T> v) const { return Vector3<T>(e[0] * v.e[0], e[1] * v.e[1], e[2] * v.e[2]); } Vector3<T> operator/(const Vector3<T> v) const { return Vector3<T>(e[0] / v.e[0], e[1] / v.e[1], e[2] / v.e[2]); } Vector3 operator*(T t) const { return Vector3<T>(e[0] * t, e[1] * t, e[2] * t); } Vector3 operator/(T t) const { return Vector3<T>(e[0] / t, e[1] / t, e[2] / t); } Vector3 operator+=(const Vector3 v) { e[0] += v.e[0]; e[1] += v.e[1]; e[2] += v.e[2]; return *this; } Vector3 operator-=(const Vector3 v) { e[0] -= v.e[0]; e[1] -= v.e[1]; e[2] -= v.e[2]; return *this; } Vector3 operator*=(const Vector3 v) { e[0] *= v.e[0]; e[1] *= v.e[1]; e[2] *= v.e[2]; return *this; } Vector3 operator/=(const Vector3 v) { e[0] /= v.e[0]; e[1] /= v.e[1]; e[2] /= v.e[2]; return *this; } Vector3 operator*=(T t) { e[0] *= t; e[1] *= t; e[2] *= t; return *this; } Vector3 operator/=(T t) { e[0] /= t; e[1] /= t; e[2] /= t; return *this; } T SquaredLength() const; T Length() const; void Normalize(); static T dot(const Vector3<T> v1, const Vector3<T> v2); static Vector3<T> cross(const Vector3<T> v1, const Vector3<T> v2); static const Vector3<T> Zero; static const Vector3<T> One; private: T e[3]; }; typedef Vector3<int> Vector3i; typedef Vector3<float> Vector3f; typedef Vector3<double> Vector3d; #include "Vector3.inl"
31.761905
115
0.577211
Samahu
37d0898a0b90fa8fa52aec17ed16dc1e2ccb95dc
19,831
cpp
C++
trace_server/mainwindow.cpp
mojmir-svoboda/DbgToolkit
590887987d0856032be906068a3103b6ce31d21c
[ "MIT" ]
null
null
null
trace_server/mainwindow.cpp
mojmir-svoboda/DbgToolkit
590887987d0856032be906068a3103b6ce31d21c
[ "MIT" ]
null
null
null
trace_server/mainwindow.cpp
mojmir-svoboda/DbgToolkit
590887987d0856032be906068a3103b6ce31d21c
[ "MIT" ]
null
null
null
#include "mainwindow.h" #include "ui_mainwindow.h" #include "ui_settings.h" #include "ui_mixer.h" #include "ui_help.h" #include <server/server.h> #include "connection.h" #include <QTime> #include <QShortcut> #include <QFileDialog> #include <QMessageBox> #include <QTimer> #include <QLabel> #include <QDropEvent> #include <QMimeData> #include <QStatusBar> #include <widgets/help.h> #include <widgets/mixer.h> #include <trace_version/trace_version.h> #include "constants.h" #include <dock/dockwidget.h> #include <widgets/setupdialogcsv.h> #include <widgets/controlbar/controlbardockmanager.h> #include <widgets/quickstringwidget.h> #include <widgets/findwidget.h> #include <ui_controlbardockmanager.h> #include "ui_setupdialogcsv.h" #include <ui_controlbarcommon.h> #include <utils/utils.h> #include <utils/utils_qstandarditem.h> #include <utils/utils_qsettings.h> #include <utils/utils_history.h> #include "qt_plugins.h" #include "platform.h" MainWindow::MainWindow (QWidget * parent, QString const & iface, unsigned short port, bool no_quit_msg_box, bool dump_mode, QString const & log_name, int level) : QMainWindow(parent) , ui(new Ui::MainWindow) , m_help(new Ui::HelpDialog) , m_timer(new QTimer(this)) , m_dock_mgr(this, QStringList(QString(g_traceServerName))) , m_docked_name(g_traceServerName) , m_log_name(log_name) , m_appdir(QDir::homePath() + "/" + g_traceServerDirName) , m_start_level(level) , m_no_quit_msg_box(no_quit_msg_box) { qDebug("================================================================================"); qDebug("%s this=0x%08x", __FUNCTION__, this); setWindowTitle(g_traceServerName); setObjectName(g_traceServerName); ui->setupUi(this); setStyleSheet( "QMainWindow::separator { background: rgb(150, 150, 150); width: 1px; height: 1px; }"); qApp->setStyleSheet("QToolTip { color: #efc090; background-color: #000066; border: 1px solid #efc090; }"); m_settings_dialog = new QDialog(this); m_settings_dialog->setWindowFlags(Qt::Sheet); m_settings_ui = new Ui::SettingsDialog(); m_settings_ui->setupUi(m_settings_dialog); m_setup_dialog_csv = new SetupDialogCSV(this); m_setup_dialog_csv->ui->preView->setModel(new QStandardItemModel()); m_setup_dialog_csv->ui->columnList->setModel(new QStandardItemModel()); //m_mixer = new Mixer(nullptr, m_dock_mgr.controlUI()->mixerButton, sizeof(context_t) * CHAR_BIT, sizeof(level_t) * CHAR_BIT); //Ui::Mixer * ui_mixer = new Ui::Mixer(); //m_mixer->setupMixer(m_config.m_mixer); m_config.m_appdir = m_appdir; m_config.m_dump_mode = dump_mode; m_config.m_trace_addr = iface; m_config.m_trace_port = port; loadConfig(); // only host:port really needed from config right now. the rest is loaded from loadState // tray stuff createTrayActions(); createTrayIcon(); QIcon icon(":images/Icon.ico"); setWindowIcon(icon); m_tray_icon->setVisible(true); m_tray_icon->show(); setAcceptDrops(true); setDockNestingEnabled(true); setAnimated(false); bool const on_top = m_config.m_on_top; if (on_top) { onOnTop(on_top); } startServer(); m_timer->setInterval(5000); connect(m_timer, SIGNAL(timeout()) , this, SLOT(onTimerHit())); m_timer->start(); /// status widget m_status_widget = new QLabel(m_server->getRunningStatus()); m_status_widget->setAlignment(Qt::AlignRight); m_status_widget->setMinimumWidth(256); if (statusBar()) statusBar()->hide(); m_find_widget = new FindWidget(this, this); m_find_widget->setActionAbleWidget(&m_dock_mgr); m_find_widget->setBroadcasting(); m_find_widget->setParent(this); m_quick_string_widget = new QuickStringWidget(this, this); m_quick_string_widget->setActionAbleWidget(&m_dock_mgr); m_quick_string_widget->setBroadcasting(); m_quick_string_widget->setParent(this); setupMenuBar(); //connect(m_dock_mgr.controlUI()->levelSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onLevelValueChanged(int))); connect(m_dock_mgr.controlUI()->buffCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onBufferingStateChanged(int))); connect(m_dock_mgr.controlUI()->clrDataButton, SIGNAL(clicked()), this, SLOT(onClearAllData())); connect(m_dock_mgr.controlUI()->presetComboBox, SIGNAL(activated(int)), this, SLOT(onPresetChanged(int))); connect(m_dock_mgr.controlUI()->presetComboBox->lineEdit(), SIGNAL(returnPressed()), this, SLOT(onPresetAdd())); connect(m_dock_mgr.controlUI()->activatePresetButton, SIGNAL(clicked()), this, SLOT(onPresetApply())); connect(m_dock_mgr.controlUI()->presetSaveButton, SIGNAL(clicked()), this, SLOT(onPresetSave())); connect(m_dock_mgr.controlUI()->presetAddButton, SIGNAL(clicked()), this, SLOT(onPresetAdd())); connect(m_dock_mgr.controlUI()->presetRmButton, SIGNAL(clicked()), this, SLOT(onPresetRm())); //connect(m_dock_mgr.controlUI()->presetResetButton, SIGNAL(clicked()), this, SLOT(onPresetReset())); loadState(); } MainWindow::~MainWindow() { qDebug("%s this=0x%08x", __FUNCTION__, this); #ifdef WIN32 UnregisterHotKey(getHWNDForWidget(this), 0); #endif m_server->setParent(0); delete m_server; delete m_tray_icon; delete m_tray_menu; delete m_help; delete ui; delete m_settings_ui; } void MainWindow::startServer () { qDebug("%s this=0x%08x addr=%s port=%i", __FUNCTION__, this, m_config.m_trace_addr.toLatin1().data(), m_config.m_trace_port); m_server = new Server(m_config.m_trace_addr, m_config.m_trace_port, this, m_no_quit_msg_box); connect(m_server, SIGNAL(newConnection(Connection *)), this, SLOT(newConnection(Connection *))); connect(m_server, SIGNAL(statusChanged(QString const &)), this, SLOT(onStatusChanged(QString const &))); } void MainWindow::stopServer() { qDebug("%s this=0x%08x addr=%s port=%i", __FUNCTION__, this, m_config.m_trace_addr.toLatin1().data(), m_config.m_trace_port); m_server->stop(); disconnect(m_server, SIGNAL(newConnection(Connection *)), this, SLOT(newConnection(Connection *))); disconnect(m_server, SIGNAL(statusChanged(QString const &)), this, SLOT(onStatusChanged(QString const &))); delete m_server; m_server = nullptr; } void MainWindow::hide () { qDebug("%s", __FUNCTION__); m_config.m_hidden = true; QMainWindow::hide(); } void MainWindow::showNormal () { qDebug("%s", __FUNCTION__); m_config.m_hidden = false; QMainWindow::showNormal(); } void MainWindow::showMaximized () { qDebug("%s", __FUNCTION__); m_config.m_hidden = false; QMainWindow::showMaximized(); } void MainWindow::createTrayActions () { m_minimize_action = new QAction(tr("Mi&nimize"), this); connect(m_minimize_action, SIGNAL(triggered()), this, SLOT(hide())); m_maximize_action = new QAction(tr("Ma&ximize"), this); connect(m_maximize_action, SIGNAL(triggered()), this, SLOT(showMaximized())); m_restore_action = new QAction(tr("&Restore"), this); connect(m_restore_action, SIGNAL(triggered()), this, SLOT(showNormal())); m_quit_action = new QAction(tr("&Quit"), this); connect(m_quit_action, SIGNAL(triggered()), this, SLOT(onQuit())); } void MainWindow::createTrayIcon () { m_tray_menu = new QMenu(this); m_tray_menu->addAction(m_minimize_action); m_tray_menu->addAction(m_maximize_action); m_tray_menu->addAction(m_restore_action); m_tray_menu->addSeparator(); m_tray_menu->addAction(m_quit_action); QIcon icon(":/images/Icon.ico"); m_tray_icon = new QSystemTrayIcon(icon, this); m_tray_icon->setContextMenu(m_tray_menu); //connect(m_tray_icon, SIGNAL(messageClicked()), this, SLOT(messageClicked())); connect(m_tray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); } void MainWindow::registerHotKey () { #ifdef WIN32 DWORD const hotkey = m_config.m_hotkey; int mod = 0; UnregisterHotKey(getHWNDForWidget(this), 0); RegisterHotKey(getHWNDForWidget(this), 0, mod, LOBYTE(hotkey)); #endif } void MainWindow::dropEvent (QDropEvent * event) { QMimeData const * mimeData = event->mimeData(); if (mimeData->hasUrls()) { QStringList pathList; QList<QUrl> urlList = mimeData->urls(); for (int i = 0; i < urlList.size() && i < 32; ++i) pathList.append(urlList.at(i).toLocalFile()); openFiles(pathList); } event->acceptProposedAction(); } void MainWindow::dragEnterEvent (QDragEnterEvent *event) { event->acceptProposedAction(); } void MainWindow::onStatusChanged (QString const & status) { m_status_widget->setText(status); m_timer->start(5000); } void MainWindow::showServerStatus () { m_status_widget->setText(m_server->getRunningStatus()); } void MainWindow::onTimerHit () { showServerStatus(); } void MainWindow::onQuit () { qDebug("onQuit: hide systray, store state, qApp->quit"); m_server->stop(); m_tray_icon->setVisible(false); m_tray_icon->hide(); while (!m_connections.empty()) { Connection * c = m_connections.back(); m_connections.pop_back(); delete c; } QTimer::singleShot(0, this, SLOT(onQuitReally())); // trigger lazy quit } void MainWindow::onQuitReally () { qDebug("%s", __FUNCTION__); qApp->quit(); } void MainWindow::onDockManagerButton () { if (m_dock_mgr_button->isChecked()) { m_dock_mgr.show(); m_dock_mgr.m_dockwidget->show(); m_dock_mgr.m_config.m_show = true; restoreDockWidget(m_dock_mgr.m_dockwidget); } else { m_dock_mgr.hide(); m_dock_mgr.m_dockwidget->hide(); m_dock_mgr.m_config.m_show = false; } } void MainWindow::onDockManagerClosed () { m_dock_mgr_button->setChecked(false); } void MainWindow::onReloadFile () { for (size_t i = 0, ie = m_reload_fnames.size(); i < ie; ++i) { QString const fname = m_reload_fnames[i]; if (!fname.isEmpty()) createTailDataStream(fname); } m_reload_fnames.clear(); } void MainWindow::tailFiles (QStringList const & files) { for (int i = 0, ie = files.size(); i < ie; ++i) { QString const fname = files.at(i); if (!fname.isEmpty()) createTailDataStream(fname); } } void MainWindow::onFileTail () { QString fname = QFileDialog::getOpenFileName(this, tr("Open File"), "", tr("*.*")); QStringList files; files << fname; tailFiles(files); } void MainWindow::onFileLoadCSV () { QString fname = QFileDialog::getOpenFileName(this, tr("Open File"), "", tr("CSV File(s) (*.%1)").arg(g_traceFileExtCSV)); QStringList files; files << fname; tailFiles(files); // spunt, @TODO } void MainWindow::onLogTail () { createTailLogStream(m_log_name, "|"); } void MainWindow::openFiles (QStringList const & files) { for (int i = 0, ie = files.size(); i < ie; ++i) { QString fname = files.at(i); if (fname != "") { importDataStream(fname); } } } void MainWindow::onFileLoad () { // @TODO: multi-selection? QString fname = QFileDialog::getOpenFileName(this, tr("Open File"), "", tr("Trace File(s) (*.%1)").arg(g_traceFileExtTLV)); QStringList files; files << fname; openFiles(files); } void MainWindow::onSaveData () { QString const dir = QFileDialog::getExistingDirectory(this, tr("Save data to directory"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dir.isEmpty()) return; if (mkPath(dir)) { for (connections_t::iterator it = m_connections.begin(), ite = m_connections.end(); it != ite; ++it) (*it)->onSaveData(dir); } } void MainWindow::onExportDataToCSV () { QString const dir = QFileDialog::getExistingDirectory(this, tr("Export csv to directory"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dir.isEmpty()) return; if (mkPath(dir)) { for (connections_t::iterator it = m_connections.begin(), ite = m_connections.end(); it != ite; ++it) (*it)->onExportDataToCSV(dir); } } void MainWindow::onOnTop (int const state) { if (state == 0) { Qt::WindowFlags const old = windowFlags(); Qt::WindowFlags const newflags = Qt::Window | (old & ~(Qt::WindowStaysOnTopHint)); setWindowFlags(newflags); show(); } else { //setWindowFlags(Qt::WindowStaysOnTopHint); //@NOTE: win users lacks the min and max buttons. sigh. setWindowFlags(Qt::WindowStaysOnTopHint); show(); } } void MainWindow::onHotkeyShowOrHide () { bool const not_on_top = !isActiveWindow(); qDebug("onHotkeyShowOrHide() isActive=%u", not_on_top); m_config.m_hidden = !m_config.m_hidden; if (m_config.m_hidden) { m_config.m_was_maximized = isMaximized(); hide(); } else { if (m_config.m_was_maximized) showMaximized(); else showNormal(); raise(); activateWindow(); } } void MainWindow::onShowHelp () { QDialog dialog(this); dialog.setWindowFlags(Qt::Sheet); m_help->setupUi(&dialog); m_help->helpTextEdit->clear(); m_help->helpTextEdit->setHtml(QString(html_help)); m_help->helpTextEdit->setReadOnly(true); dialog.exec(); } void MainWindow::onOptionsAction() { setConfigValuesToUI(m_config); // set signal and slot for "Buttons" connect(m_settings_ui->okSaveButton, SIGNAL(clicked()), m_settings_dialog, SLOT(accept())); connect(m_settings_ui->cancelButton, SIGNAL(clicked()), m_settings_dialog, SLOT(reject())); int const retval = m_settings_dialog->exec(); if (retval == QDialog::Rejected) return; setUIValuesToConfig(m_config); saveConfig(); } void MainWindow::applyCachedLayout () { qDebug("%s", __FUNCTION__); if (m_geo_data.size()) restoreGeometry(m_geo_data); if (m_layout_data.size()) restoreState(m_layout_data); } void MainWindow::onRecentFile () { QAction * action = qobject_cast<QAction *>(sender()); if (action) { QString const fname = action->data().toString(); QString const ext = QFileInfo(fname).suffix(); bool const is_tlv = (0 == QString::compare(ext, g_traceFileExtTLV, Qt::CaseInsensitive)); bool const is_csv = (0 == QString::compare(ext, g_traceFileExtCSV, Qt::CaseInsensitive)); if (is_tlv) importDataStream(fname); else if (is_csv) createTailDataStream(fname); else createTailDataStream(fname); } } void MainWindow::setupMenuBar () { qDebug("%s", __FUNCTION__); m_dock_mgr_button = new QToolButton(0); m_dock_mgr_button->setObjectName(QStringLiteral("dockManagerButton")); m_dock_mgr_button->setMinimumSize(QSize(0, 0)); //m_dock_mgr_button->setFont(font); m_dock_mgr_button->setCheckable(true); m_dock_mgr_button->setChecked(false); m_dock_mgr_button->setToolTip(QApplication::translate("MainWindow", "Central management of docked data widgets", 0)); m_dock_mgr_button->setText(QApplication::translate("MainWindow", "Widget Manager", 0)); menuBar()->setCornerWidget(m_dock_mgr_button, Qt::TopLeftCorner); connect(m_dock_mgr_button, SIGNAL(clicked()), this, SLOT(onDockManagerButton())); m_dock_mgr_button->setStyleSheet("\ QToolButton { border: 1px solid #8f8f91; border-radius: 4px; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e6e7fa, stop: 1 #dadbff); } \ QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbdd, stop: 1 #d6d7da); }"); menuBar()->setCornerWidget(m_status_widget, Qt::TopRightCorner); connect(m_status_widget, SIGNAL(clicked()), this, SLOT(onDockManagerButton())); // File m_file_menu = menuBar()->addMenu(tr("&File")); m_file_menu->addAction(tr("Data file &Load..."), this, SLOT(onFileLoad()), QKeySequence(Qt::ControlModifier + Qt::Key_O)); m_file_menu->addAction(tr("&Save raw client data as..."), this, SLOT(onSaveData())); m_file_menu->addAction(tr("&Export data as CSV format..."), this, SLOT(onExportDataToCSV())); m_file_menu->addSeparator(); m_file_menu->addAction(tr("Load &CSV file..."), this, SLOT(onFileLoadCSV())); m_file_menu->addAction(tr("&Follow text file..."), this, SLOT(onFileTail()), QKeySequence(Qt::ControlModifier + Qt::Key_T)); m_file_menu->addSeparator(); syncHistoryToRecent(m_config.m_recent_history); m_before_action = m_file_menu->addSeparator(); m_file_menu->addAction(tr("Quit program"), this, SLOT(onQuit())); // View QMenu * viewMenu = menuBar()->addMenu(tr("&View")); viewMenu->addAction(tr("&Save preset"), this, SLOT(onSave()), Qt::Key_F5); viewMenu->addAction(tr("&Apply preset"), this, SLOT(onApply()), Qt::Key_F9); viewMenu->addAction(tr("Save preset &as..."), this, SLOT(onSaveAs()), QKeySequence(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_F5)); viewMenu->addSeparator(); // View QMenu * actionMenu = menuBar()->addMenu(tr("Actions")); QKeySequence all_undo(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_Z); actionMenu->addAction(tr("All widgets - Undo action (if lucky)"), this, SLOT(onAllPopAction()), all_undo); QKeySequence all_deldata(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_D); actionMenu->addAction(tr("All widgets - Clear Data"), this, SLOT(onClearAllData()), all_deldata); QKeySequence all_colorlast(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_E); actionMenu->addAction(tr("All widgets - Color last line "), this, SLOT(onColorAllLastLine()), all_colorlast); QKeySequence all_scrolllast(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_S); actionMenu->addAction(tr("All widgets - Scroll to last "), this, SLOT(onAllScrollToLast()), all_scrolllast); QKeySequence quick_string(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_Q); actionMenu->addAction(tr("All widgets - Quick String filter"), this, SLOT(onAllQuickString()), quick_string); QKeySequence all_find(Qt::CTRL + Qt::Key_S, Qt::CTRL + Qt::Key_F); actionMenu->addAction(tr("All widgets - All Find"), this, SLOT(onAllFind()), all_find); // widget's tool dockable widgets. m_windows_menu = menuBar()->addMenu(tr("&Windows")); // Tools QMenu * tools = menuBar()->addMenu(tr("&Tools")); tools->addAction(tr("&Options"), this, SLOT(onOptionsAction())); // Help QMenu * helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addSeparator(); helpMenu->addAction(tr("&Remove configuration files"), this, SLOT(onRemoveConfigurationFiles())); helpMenu->addAction(tr("Show server log"), this, SLOT(onLogTail()), QKeySequence(Qt::ControlModifier + Qt::AltModifier + Qt::Key_L)); QAction * ver = helpMenu->addAction(tr("Version %1").arg(g_Version)); ver->setEnabled(false); // Help //QMenu * helpMenu = menuBar()->addMenu(tr("&Help")); //helpMenu->addAction(tr("Help"), this, SLOT(onShowHelp())); } void MainWindow::addWindowAction (QAction * action) { m_windows_menu->addAction(action); } void MainWindow::rmWindowAction (QAction * action) { m_windows_menu->removeAction(action); } void MainWindow::iconActivated (QSystemTrayIcon::ActivationReason reason) { switch (reason) { case QSystemTrayIcon::Trigger: break; case QSystemTrayIcon::DoubleClick: onHotkeyShowOrHide(); break; case QSystemTrayIcon::MiddleClick: break; default: break; } } void MainWindow::closeEvent (QCloseEvent * event) { m_config.m_hidden = true; saveConfig(); hide(); event->ignore(); } void MainWindow::changeEvent (QEvent * e) { QMainWindow::changeEvent(e); } bool MainWindow::eventFilter (QObject * target, QEvent * e) { /*if (e->type() == QEvent::Shortcut) { QShortcutEvent * se = static_cast<QShortcutEvent *>(e); if (se->key() == QKeySequence(Qt::ControlModifier + Qt::Key_Insert)) { //onCopyToClipboard(); return true; } }*/ return false; } void MainWindow::keyPressEvent (QKeyEvent * e) { if (e->type() == QKeyEvent::KeyPress) { /*if (e->matches(QKeySequence::Copy)) e->accept(); else if (e->key() == Qt::Key_Escape) if (m_find_widget && m_find_widget->isVisible()) { m_find_widget->onCancel(); e->accept(); }*/ } QMainWindow::keyPressEvent(e); } void MainWindow::onRemoveConfigurationFiles () { //QString const path = m_appdir; // @NOTE: rather not.. will not risk deletion of other files than mine QString const path = QDir::homePath() + "/" + g_traceServerDirName; if (path.isEmpty()) return; QMessageBox msg_box; QPushButton * b_del = msg_box.addButton(tr("Yes, Delete"), QMessageBox::ActionRole); QPushButton * b_abort = msg_box.addButton(QMessageBox::Abort); msg_box.exec(); if (msg_box.clickedButton() == b_abort) return; QDir d_out(path); d_out.removeRecursively(); QDir d_new; d_new.mkpath(path); }
30.415644
164
0.719984
mojmir-svoboda
37d3af49c4ddafa65c0d4e884152fee7ed8ff8f5
531
hpp
C++
data_structures/binary_indexed_tree.hpp
takata-daiki/algorithms
299f7379a2acf8a3e14bc3e3de6509e821eec115
[ "MIT" ]
null
null
null
data_structures/binary_indexed_tree.hpp
takata-daiki/algorithms
299f7379a2acf8a3e14bc3e3de6509e821eec115
[ "MIT" ]
null
null
null
data_structures/binary_indexed_tree.hpp
takata-daiki/algorithms
299f7379a2acf8a3e14bc3e3de6509e821eec115
[ "MIT" ]
1
2019-12-11T06:45:30.000Z
2019-12-11T06:45:30.000Z
#pragma once #include <bits/stdc++.h> using namespace std; // 0-indexed template <typename T> struct BinaryIndexedTree { int n; vector<T> data; BinaryIndexedTree(int _n) : n(_n) { data.assign(n + 1, 0); } inline void add(int k, T x) { assert(0 <= k && k < n); for (int i = k + 1; i <= n; i += i & -i) data[i] += x; } // [0, k) inline T sum(int k) { assert(0 <= k && k <= n); T s = 0; for (int i = k; i > 0; i -= i & -i) s += data[i]; return s; } };
22.125
64
0.467043
takata-daiki
37d5fc55409c387b14f1801f5564ab0d9e1c7583
3,119
cpp
C++
src/110106 Interpreter.cpp
Lyken17/CMPT-409
f65f15d8fecd5a0ca37868265ee28879e4c79d0b
[ "Apache-2.0" ]
null
null
null
src/110106 Interpreter.cpp
Lyken17/CMPT-409
f65f15d8fecd5a0ca37868265ee28879e4c79d0b
[ "Apache-2.0" ]
null
null
null
src/110106 Interpreter.cpp
Lyken17/CMPT-409
f65f15d8fecd5a0ca37868265ee28879e4c79d0b
[ "Apache-2.0" ]
null
null
null
#include <iostream> #include <sstream> #include <cmath> #include <string> #include <cassert> using namespace std; #ifndef BUFSIZ #define BUFSIZ 1024 #endif int StoI(string s) { int R; R = (s[0] - '0')*100; R += (s[1]- '0')*10; R += (s[2]- '0'); return R; } string ItoS(int I) { string R = "000"; R[2] = I % 10 + '0'; I /= 10; R[1] = I % 10 + '0'; I /= 10; R[0] = I % 10 + '0'; return R; } int main() { std::ios::sync_with_stdio(false); int n, runCommand; char lineBuffer[BUFSIZ]; cin >> n; cin.getline(lineBuffer, BUFSIZ); cin.getline(lineBuffer, BUFSIZ); bool halt = false; string instructions[1000] ; int pc = 0; while(n--) { for (int i = 0; i < 1000; i++) instructions[i] = "000"; // int RAM[1000]; int instIdx = 0; while(cin.getline(lineBuffer, BUFSIZ) && cin.gcount() > 1) { stringstream stream(lineBuffer); stream >> instructions[instIdx++]; // RAM[instIdx - 1] = std::stoi(instructions[instIdx - 1]); } int reg[10]; for (int i = 0; i < 10; i++) reg[i] = 0; runCommand = 0; halt = false; pc = 0; // int cmd[3], d,s,a; while (!halt) { // for (int pc = 0; pc < instIdx && !halt; pc++) { runCommand++; // cout << "RAM[" << pc << "] :" << instructions[pc] << " ==> "; int op1 = int(instructions[pc][1] - '0'); int op2 = int(instructions[pc][2] - '0'); switch (instructions[pc][0]) { case '1': halt = true; pc++; break; case '2': reg[op1] = op2; pc++; break; case '3': reg[op1] = (reg[op1] + op2) % 1000; pc++; break; case '4': reg[op1] = (reg[op1] * op2) % 1000; pc++; break; case '5': reg[op1] = reg[op2]; pc++; break; case '6': reg[op1] = (reg[op1] + reg[op2]) % 1000; pc++; break; case '7': reg[op1] = (reg[op1] * reg[op2]) % 1000; pc++; break; case '8': reg[op1] = std::stoi(instructions[reg[op2]]); pc++; break; case '9': instructions[reg[op2]] = ItoS(reg[op1]); pc++; break; case '0': if (reg[op2] != 0) pc = reg[op1]; else pc++; break; } // cout << op1 << " , " << op2 << " ||| ["; // cout << "]" << endl; } cout << runCommand << endl; if(n != 0) cout << endl; } return 0; }
23.992308
76
0.361975
Lyken17
37d72bddaa07451aef4b61788ddf7c4a3d36c5c6
4,397
cpp
C++
velox/experimental/codegen/ast/BinaryExpressions.cpp
vancexu/velox
fa076fd9eab6ae4090ed9b9b91c4e7658d4ee1e4
[ "Apache-2.0" ]
672
2021-09-22T16:45:58.000Z
2022-03-31T13:42:31.000Z
velox/experimental/codegen/ast/BinaryExpressions.cpp
vancexu/velox
fa076fd9eab6ae4090ed9b9b91c4e7658d4ee1e4
[ "Apache-2.0" ]
986
2021-09-22T17:02:52.000Z
2022-03-31T23:57:25.000Z
velox/experimental/codegen/ast/BinaryExpressions.cpp
vancexu/velox
fa076fd9eab6ae4090ed9b9b91c4e7658d4ee1e4
[ "Apache-2.0" ]
178
2021-09-22T17:27:47.000Z
2022-03-31T03:18:37.000Z
/* * Copyright (c) Facebook, Inc. and its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "velox/experimental/codegen/ast/BinaryExpressions.h" #include "velox/experimental/codegen/ast/CodegenUtils.h" namespace facebook { namespace velox { namespace codegen { // Presto reference semantics // Reference semantics https://prestodb.io/docs/current/functions/logical.html CodeSnippet LogicalAnd::generateCode( CodegenCtx& exprCodegenCtx, const std::string& outputVarName) const { std::stringstream code; // Execute lhs auto lhsResultVar = exprCodegenCtx.getUniqueTemp("lhsAnd"); code << codegenUtils::codegenTempVarDecl(lhs()->type(), lhsResultVar); auto lhsCodeSnippet = lhs()->generateCode(exprCodegenCtx, lhsResultVar); // Execute rhs auto rhsResultVar = exprCodegenCtx.getUniqueTemp("rhsAnd"); code << codegenUtils::codegenTempVarDecl(rhs()->type(), rhsResultVar); auto rhsCodeSnippet = rhs()->generateCode(exprCodegenCtx, rhsResultVar); // Turn off dynamic check for nullability when we can std::string rhsHasValue = codegenUtils::codegenHasValueCheck(rhsResultVar, rhs()->maybeNull()); std::string lhsHasValue = codegenUtils::codegenHasValueCheck(lhsResultVar, lhs()->maybeNull()); code << fmt::format( "{lhsCode} {rhsCode}" "" // Both true return true "if({lhsHasValue} && *{lhs} && {rhsHasValue} && *{rhs}) {{" " {outVar} = true; " "}}" "" // Any false return false "else if({lhsHasValue} && !*{lhs}) {{" " {outVar} = false;" "}}" "" "else if({rhsHasValue} && !*{rhs}) {{" " {outVar} = false;" "}}" "" // Return null "else {{" " {outVar} = std::nullopt;" "}}", fmt::arg("lhsCode", lhsCodeSnippet.code()), fmt::arg("rhsCode", rhsCodeSnippet.code()), fmt::arg("lhs", lhsResultVar), fmt::arg("rhs", rhsResultVar), fmt::arg("rhsHasValue", rhsHasValue), fmt::arg("lhsHasValue", lhsHasValue), fmt::arg("outVar", outputVarName)); return CodeSnippet(outputVarName, code.str()); } CodeSnippet LogicalOr::generateCode( CodegenCtx& exprCodegenCtx, const std::string& outputVarName) const { std::stringstream code; // Execute lhs auto lhsResultVar = exprCodegenCtx.getUniqueTemp("lhsOr"); code << codegenUtils::codegenTempVarDecl(lhs()->type(), lhsResultVar); auto lhsCodeSnippet = lhs()->generateCode(exprCodegenCtx, lhsResultVar); // Execute rhs auto rhsResultVar = exprCodegenCtx.getUniqueTemp("rhsOr"); code << codegenUtils::codegenTempVarDecl(rhs()->type(), rhsResultVar); auto rhsCodeSnippet = rhs()->generateCode(exprCodegenCtx, rhsResultVar); // Turn off dynamic check for nullability when we can std::string rhsHasValue = codegenUtils::codegenHasValueCheck(rhsResultVar, rhs()->maybeNull()); std::string lhsHasValue = codegenUtils::codegenHasValueCheck(lhsResultVar, lhs()->maybeNull()); code << fmt::format( "{lhsCode} {rhsCode}" "" // Both false return false "if({lhsHasValue} && !*{lhs} && {rhsHasValue} && !*{rhs}) {{" " {outVar} = false; " "}}" "" // Any true return true "else if({lhsHasValue} && *{lhs}) {{" " {outVar} = true;" "}}" "" "else if({rhsHasValue} && *{rhs}) {{" " {outVar} = true;" "}}" "" // Return null "else {{" " {outVar} = std::nullopt;" "}}", fmt::arg("lhsCode", lhsCodeSnippet.code()), fmt::arg("rhsCode", rhsCodeSnippet.code()), fmt::arg("lhs", lhsResultVar), fmt::arg("rhs", rhsResultVar), fmt::arg("rhsHasValue", rhsHasValue), fmt::arg("lhsHasValue", lhsHasValue), fmt::arg("outVar", outputVarName)); return CodeSnippet(outputVarName, code.str()); } } // namespace codegen } // namespace velox } // namespace facebook
34.085271
78
0.649079
vancexu
37d8580822150dd4c9d38b6fd0e9dfe833bd5f81
347
cpp
C++
Cpp_Programs/races/20180828T/rectangle.cpp
xiazeyu/OI_Resource
1de0ab9a84ee22ae4edb612ddeddc712c3c38e56
[ "Apache-2.0" ]
2
2018-10-01T09:03:35.000Z
2019-05-24T08:53:06.000Z
Cpp_Programs/races/20180828T/rectangle.cpp
xiazeyu/OI_Resource
1de0ab9a84ee22ae4edb612ddeddc712c3c38e56
[ "Apache-2.0" ]
null
null
null
Cpp_Programs/races/20180828T/rectangle.cpp
xiazeyu/OI_Resource
1de0ab9a84ee22ae4edb612ddeddc712c3c38e56
[ "Apache-2.0" ]
null
null
null
#include <bits/stdc++.h> using namespace std; long dp[50][50][2500], n, m, k; int main(){ // freopen("rectangle.in", "r", stdin); // freopen("rectangle.out", "w", stdout); scanf("%ld%ld%ld", &n, &m, &k); dp[2][2][4] = 1; for(long i = 3; i <= n; i++) for(long j = 3; j <= m; j++) for(long l = 4; l <= k, l++) return 0; }
18.263158
43
0.489914
xiazeyu
37d88105fde9b11c78ff54e67d93ee7bdaeff2a4
786
cc
C++
emu-tun/model/epoll_thread.cc
SoonyangZhang/ns3-emu-tun
c7b1ba1612d2a859c433471e3d4a913c9c6940a2
[ "MIT" ]
null
null
null
emu-tun/model/epoll_thread.cc
SoonyangZhang/ns3-emu-tun
c7b1ba1612d2a859c433471e3d4a913c9c6940a2
[ "MIT" ]
null
null
null
emu-tun/model/epoll_thread.cc
SoonyangZhang/ns3-emu-tun
c7b1ba1612d2a859c433471e3d4a913c9c6940a2
[ "MIT" ]
null
null
null
#include "epoll_thread.h" namespace ns3{ EpollThread::~EpollThread(){ if(running_){ Stop(); } } void EpollThread::Run(){ while(running_){ ExecuteTask(); epoll_server_.WaitForEventsAndExecuteCallbacks(); } ExecuteTask(); } EpollServer *EpollThread::epoll_server(){ return &epoll_server_; } void EpollThread::PostInnerTask(std::unique_ptr<QueuedTask> task){ MutexLock lock(&task_mutex_); queued_tasks_.push_back(std::move(task)); } void EpollThread::ExecuteTask(){ std::deque<std::unique_ptr<QueuedTask>> tasks; { MutexLock lock(&task_mutex_); tasks.swap(queued_tasks_); } while(!tasks.empty()){ tasks.front()->Run(); tasks.pop_front(); } } }
23.117647
67
0.611959
SoonyangZhang
37d9245748144b5c539b3f9489bd9a2a2cba8505
2,754
cpp
C++
src/xtd.core/src/xtd/diagnostics/stack_trace.cpp
ExternalRepositories/xtd
5889d69900ad22a00fcb640d7850a1d599cf593a
[ "MIT" ]
251
2019-04-20T02:02:24.000Z
2022-03-31T09:52:08.000Z
src/xtd.core/src/xtd/diagnostics/stack_trace.cpp
leanid/xtd
2e1ea6537218788ca08901faf8915d4100990b53
[ "MIT" ]
29
2021-01-07T12:52:12.000Z
2022-03-29T08:42:14.000Z
src/xtd.core/src/xtd/diagnostics/stack_trace.cpp
leanid/xtd
2e1ea6537218788ca08901faf8915d4100990b53
[ "MIT" ]
27
2019-11-21T02:37:44.000Z
2022-03-30T22:59:14.000Z
#include "../../../include/xtd/environment.h" #include "../../../include/xtd/diagnostics/stack_trace.h" #include <call_stack.h> using namespace xtd; using namespace xtd::diagnostics; stack_trace::stack_trace() : stack_trace("", METHODS_TO_SKIP, false) { } stack_trace::stack_trace(bool need_file_info) : stack_trace("", METHODS_TO_SKIP, need_file_info) { } stack_trace::stack_trace(const stack_frame& frame) { frames_.push_back(frame); } stack_trace::stack_trace(const ustring& str, size_t skip_frames, bool need_file_info) { frames_ = stack_frame::get_stack_frames(str, skip_frames + METHODS_TO_SKIP + 1, need_file_info); } stack_trace::stack_trace(size_t skip_frames) : stack_trace("", skip_frames, false) { } stack_trace::stack_trace(size_t skip_frames, bool need_file_info) : stack_trace("", skip_frames, need_file_info) { } stack_trace::stack_trace(const std::exception& exception) : stack_trace(ustring::full_class_name(exception), METHODS_TO_SKIP, false) { } stack_trace::stack_trace(const std::exception& exception, bool need_file_info) : stack_trace(ustring::full_class_name(exception), METHODS_TO_SKIP, need_file_info) { } stack_trace::stack_trace(const std::exception& exception, size_t skip_frames) : stack_trace(ustring::full_class_name(exception), skip_frames, false) { } stack_trace::stack_trace(const std::exception& exception, size_t skip_frames, bool need_file_info) : stack_trace(ustring::full_class_name(exception), skip_frames, need_file_info) { } size_t stack_trace::frame_count() const { return frames_.size(); } const xtd::diagnostics::stack_frame& stack_trace::get_frame(size_t index) { return frames_[index]; } const stack_trace::stack_frame_collection& stack_trace::get_frames() const { return frames_; } ustring stack_trace::to_string() const noexcept { return to_string(0); } ustring stack_trace::to_string(size_t skip_frames, const stack_frame& stack_frame) const noexcept { ustring str; for (size_t index = skip_frames; index < frames_.size(); ++index) { if (index > skip_frames) str += xtd::environment::new_line(); str += " at " + frames_[index].get_method(); if (index == skip_frames && stack_frame != stack_frame::empty()) str += ustring::format(" {}in {}:line {}", frames_[index].get_offset() != stack_frame::OFFSET_UNKNOWN ? ustring::format("[0x{:X8}] ", frames_[index].get_offset()) : "", stack_frame.get_file_name(), stack_frame.get_file_line_number()); else if (!frames_[index].get_file_name().empty()) str += ustring::format(" {}in {}:line {}", frames_[index].get_offset() != stack_frame::OFFSET_UNKNOWN ? ustring::format("[0x{:X8}] ", frames_[index].get_offset()) : "", frames_[index].get_file_name(), frames_[index].get_file_line_number()); } return str; }
41.727273
303
0.743646
ExternalRepositories
37da12953d7e3f15254dea73a9fd24e120b5be98
516
cpp
C++
Ejercicios/Ejercicio_40 Punto-De-Venta-Parte 1/Menu.cpp
Olioliver98/C-
f47db3c3aab37387b9e4f227c910e9cc8359729e
[ "MIT" ]
null
null
null
Ejercicios/Ejercicio_40 Punto-De-Venta-Parte 1/Menu.cpp
Olioliver98/C-
f47db3c3aab37387b9e4f227c910e9cc8359729e
[ "MIT" ]
null
null
null
Ejercicios/Ejercicio_40 Punto-De-Venta-Parte 1/Menu.cpp
Olioliver98/C-
f47db3c3aab37387b9e4f227c910e9cc8359729e
[ "MIT" ]
null
null
null
#include <iostream> using namespace std; void menu() { int opciones = 0; while (true) { system("cls"); cout<<"********"; cout<<" MENU "; cout<<"********"; cout<<"\n"; cout<<"1 - Bebidas calientes "<< endl; cout<<"2 - Bebidas frias"<< endl; cout<<"3 - Reposteria"<< endl; cout<<"0 - Salir "<< endl; cin>> opciones; if (opciones == 0) { break; } } }
15.176471
46
0.381783
Olioliver98
37dac42d78cbb9c2ae16f49539785ffd0079d3f2
806
cpp
C++
src/testing/pi-puck/front_camera_tags_leds/controller.cpp
dcat52/argos3
16b1e1e36e33b01aa58154ef4cdda5f341dcd158
[ "MIT" ]
null
null
null
src/testing/pi-puck/front_camera_tags_leds/controller.cpp
dcat52/argos3
16b1e1e36e33b01aa58154ef4cdda5f341dcd158
[ "MIT" ]
null
null
null
src/testing/pi-puck/front_camera_tags_leds/controller.cpp
dcat52/argos3
16b1e1e36e33b01aa58154ef4cdda5f341dcd158
[ "MIT" ]
null
null
null
/** * * @author Michael Allwright <mallwright@learnrobotics.io> */ #include "controller.h" #include <argos3/plugins/robots/pi-puck/control_interface/ci_pipuck_front_camera_sensor.h> namespace argos { /****************************************/ /****************************************/ void CTestController::Init(TConfigurationNode& t_tree) { m_pcFrontCameraSensor = GetSensor<CCI_PiPuckFrontCameraSensor>("pipuck_front_camera"); Reset(); } /****************************************/ /****************************************/ void CTestController::Reset() { m_pcFrontCameraSensor->Enable(); } /****************************************/ /****************************************/ REGISTER_CONTROLLER(CTestController, "test_controller"); }
22.388889
92
0.478908
dcat52
37e0f2bdc0d6a7444ca760b5d884c0fe454046f8
51,754
cc
C++
components/ntp_snippets/breaking_news/breaking_news_gcm_app_handler_unittest.cc
zipated/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
2,151
2020-04-18T07:31:17.000Z
2022-03-31T08:39:18.000Z
components/ntp_snippets/breaking_news/breaking_news_gcm_app_handler_unittest.cc
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
395
2020-04-18T08:22:18.000Z
2021-12-08T13:04:49.000Z
components/ntp_snippets/breaking_news/breaking_news_gcm_app_handler_unittest.cc
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
338
2020-04-18T08:03:10.000Z
2022-03-29T12:33:22.000Z
// Copyright 2017 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. #include "components/ntp_snippets/breaking_news/breaking_news_gcm_app_handler.h" #include <memory> #include <string> #include "base/bind_helpers.h" #include "base/json/json_reader.h" #include "base/message_loop/message_loop.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/mock_callback.h" #include "base/test/simple_test_clock.h" #include "base/test/test_mock_time_task_runner.h" #include "base/time/clock.h" #include "base/time/tick_clock.h" #include "base/timer/timer.h" #include "build/build_config.h" #include "components/gcm_driver/gcm_driver.h" #include "components/gcm_driver/instance_id/instance_id.h" #include "components/gcm_driver/instance_id/instance_id_driver.h" #include "components/ntp_snippets/breaking_news/breaking_news_metrics.h" #include "components/ntp_snippets/breaking_news/subscription_manager.h" #include "components/ntp_snippets/features.h" #include "components/ntp_snippets/pref_names.h" #include "components/ntp_snippets/remote/test_utils.h" #include "components/ntp_snippets/time_serialization.h" #include "components/prefs/testing_pref_service.h" #include "components/variations/variations_params_manager.h" #include "google_apis/gcm/engine/account_mapping.h" #include "testing/gmock/include/gmock/gmock.h" using base::Clock; using base::TestMockTimeTaskRunner; using base::TickClock; using base::TimeTicks; using gcm::InstanceIDHandler; using instance_id::InstanceID; using instance_id::InstanceIDDriver; using testing::_; using testing::AnyNumber; using testing::AtMost; using testing::ElementsAre; using testing::IsEmpty; using testing::NiceMock; using testing::SaveArg; using testing::StrictMock; namespace ntp_snippets { namespace { // The action key in pushed GCM message. const char kPushedActionKey[] = "action"; class MockSubscriptionManager : public SubscriptionManager { public: MockSubscriptionManager() = default; ~MockSubscriptionManager() override = default; MOCK_METHOD1(Subscribe, void(const std::string& token)); MOCK_METHOD0(Unsubscribe, void()); MOCK_METHOD0(IsSubscribed, bool()); MOCK_METHOD1(Resubscribe, void(const std::string& new_token)); MOCK_METHOD0(NeedsToResubscribe, bool()); private: DISALLOW_COPY_AND_ASSIGN(MockSubscriptionManager); }; class MockInstanceIDDriver : public InstanceIDDriver { public: MockInstanceIDDriver() : InstanceIDDriver(/*gcm_driver=*/nullptr){}; ~MockInstanceIDDriver() override = default; MOCK_METHOD1(GetInstanceID, InstanceID*(const std::string& app_id)); MOCK_METHOD1(RemoveInstanceID, void(const std::string& app_id)); MOCK_CONST_METHOD1(ExistsInstanceID, bool(const std::string& app_id)); private: DISALLOW_COPY_AND_ASSIGN(MockInstanceIDDriver); }; class MockInstanceID : public InstanceID { public: MockInstanceID() : InstanceID("app_id", /*gcm_driver=*/nullptr) {} ~MockInstanceID() override = default; MOCK_METHOD1(GetID, void(const GetIDCallback& callback)); MOCK_METHOD1(GetCreationTime, void(const GetCreationTimeCallback& callback)); MOCK_METHOD4(GetToken, void(const std::string& authorized_entity, const std::string& scope, const std::map<std::string, std::string>& options, const GetTokenCallback& callback)); MOCK_METHOD4(ValidateToken, void(const std::string& authorized_entity, const std::string& scope, const std::string& token, const ValidateTokenCallback& callback)); protected: MOCK_METHOD3(DeleteTokenImpl, void(const std::string& authorized_entity, const std::string& scope, const DeleteTokenCallback& callback)); MOCK_METHOD1(DeleteIDImpl, void(const DeleteIDCallback& callback)); private: DISALLOW_COPY_AND_ASSIGN(MockInstanceID); }; class MockGCMDriver : public gcm::GCMDriver { public: MockGCMDriver() : GCMDriver(/*store_path=*/base::FilePath(), /*blocking_task_runner=*/nullptr) {} ~MockGCMDriver() override = default; MOCK_METHOD4(ValidateRegistration, void(const std::string& app_id, const std::vector<std::string>& sender_ids, const std::string& registration_id, const ValidateRegistrationCallback& callback)); MOCK_METHOD0(OnSignedIn, void()); MOCK_METHOD0(OnSignedOut, void()); MOCK_METHOD1(AddConnectionObserver, void(gcm::GCMConnectionObserver* observer)); MOCK_METHOD1(RemoveConnectionObserver, void(gcm::GCMConnectionObserver* observer)); MOCK_METHOD0(Enable, void()); MOCK_METHOD0(Disable, void()); MOCK_CONST_METHOD0(GetGCMClientForTesting, gcm::GCMClient*()); MOCK_CONST_METHOD0(IsStarted, bool()); MOCK_CONST_METHOD0(IsConnected, bool()); MOCK_METHOD2(GetGCMStatistics, void(const GetGCMStatisticsCallback& callback, ClearActivityLogs clear_logs)); MOCK_METHOD2(SetGCMRecording, void(const GetGCMStatisticsCallback& callback, bool recording)); MOCK_METHOD1(SetAccountTokens, void(const std::vector<gcm::GCMClient::AccountTokenInfo>& account_tokens)); MOCK_METHOD1(UpdateAccountMapping, void(const gcm::AccountMapping& account_mapping)); MOCK_METHOD1(RemoveAccountMapping, void(const std::string& account_id)); MOCK_METHOD0(GetLastTokenFetchTime, base::Time()); MOCK_METHOD1(SetLastTokenFetchTime, void(const base::Time& time)); MOCK_METHOD1(WakeFromSuspendForHeartbeat, void(bool wake)); MOCK_METHOD0(GetInstanceIDHandlerInternal, InstanceIDHandler*()); MOCK_METHOD2(AddHeartbeatInterval, void(const std::string& scope, int interval_ms)); MOCK_METHOD1(RemoveHeartbeatInterval, void(const std::string& scope)); protected: MOCK_METHOD1(EnsureStarted, gcm::GCMClient::Result(gcm::GCMClient::StartMode start_mode)); MOCK_METHOD2(RegisterImpl, void(const std::string& app_id, const std::vector<std::string>& sender_ids)); MOCK_METHOD1(UnregisterImpl, void(const std::string& app_id)); MOCK_METHOD3(SendImpl, void(const std::string& app_id, const std::string& receiver_id, const gcm::OutgoingMessage& message)); MOCK_METHOD2(RecordDecryptionFailure, void(const std::string& app_id, gcm::GCMDecryptionResult result)); private: DISALLOW_COPY_AND_ASSIGN(MockGCMDriver); }; class MockOnNewRemoteSuggestionCallback { public: // Workaround for gMock's lack of support for movable-only arguments. void WrappedRun(std::unique_ptr<RemoteSuggestion> remote_suggestion) { Run(remote_suggestion.get()); } BreakingNewsListener::OnNewRemoteSuggestionCallback Get() { return base::Bind(&MockOnNewRemoteSuggestionCallback::WrappedRun, base::Unretained(this)); } MOCK_METHOD1(Run, void(RemoteSuggestion* remote_suggestion)); }; void ParseJson( const std::string& json, const BreakingNewsGCMAppHandler::SuccessCallback& success_callback, const BreakingNewsGCMAppHandler::ErrorCallback& error_callback) { base::JSONReader json_reader; std::unique_ptr<base::Value> value = json_reader.ReadToValue(json); if (value) { success_callback.Run(std::move(value)); } else { error_callback.Run(json_reader.GetErrorMessage()); } } ACTION_TEMPLATE(InvokeCallbackArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(p0)) { std::get<k>(args).Run(p0); } ACTION_TEMPLATE(InvokeCallbackArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_2_VALUE_PARAMS(p0, p1)) { std::get<k>(args).Run(p0, p1); } base::Time GetDummyNow() { base::Time out_time; EXPECT_TRUE(base::Time::FromUTCString("2017-01-02T00:00:01Z", &out_time)); return out_time; } base::TimeDelta GetTokenValidationPeriod() { return base::TimeDelta::FromHours(24); } base::TimeDelta GetForcedSubscriptionPeriod() { return base::TimeDelta::FromDays(7); } const char kBreakingNewsGCMAppID[] = "com.google.breakingnews.gcm"; std::string BoolToString(bool value) { return value ? "true" : "false"; } } // namespace class BreakingNewsGCMAppHandlerTest : public testing::Test { public: void SetUp() override { // Our app handler obtains InstanceID through InstanceIDDriver. We mock // InstanceIDDriver and return MockInstanceID through it. mock_instance_id_driver_ = std::make_unique<StrictMock<MockInstanceIDDriver>>(); mock_instance_id_ = std::make_unique<StrictMock<MockInstanceID>>(); mock_gcm_driver_ = std::make_unique<StrictMock<MockGCMDriver>>(); BreakingNewsGCMAppHandler::RegisterProfilePrefs( utils_.pref_service()->registry()); // This is called in BreakingNewsGCMAppHandler. EXPECT_CALL(*mock_instance_id_driver_, GetInstanceID(kBreakingNewsGCMAppID)) .WillRepeatedly(Return(mock_instance_id_.get())); } std::unique_ptr<BreakingNewsGCMAppHandler> MakeHandler( scoped_refptr<TestMockTimeTaskRunner> timer_mock_task_runner) { message_loop_.SetTaskRunner(timer_mock_task_runner); // TODO(vitaliii): Initialize MockSubscriptionManager in the constructor, so // that one could set up expectations before creating the handler. auto wrapped_mock_subscription_manager = std::make_unique<NiceMock<MockSubscriptionManager>>(); mock_subscription_manager_ = wrapped_mock_subscription_manager.get(); auto token_validation_timer = std::make_unique<base::OneShotTimer>( timer_mock_task_runner->GetMockTickClock()); token_validation_timer->SetTaskRunner(timer_mock_task_runner); auto forced_subscription_timer = std::make_unique<base::OneShotTimer>( timer_mock_task_runner->GetMockTickClock()); forced_subscription_timer->SetTaskRunner(timer_mock_task_runner); return std::make_unique<BreakingNewsGCMAppHandler>( mock_gcm_driver_.get(), mock_instance_id_driver_.get(), pref_service(), std::move(wrapped_mock_subscription_manager), base::Bind(&ParseJson), timer_mock_task_runner->GetMockClock(), std::move(token_validation_timer), std::move(forced_subscription_timer)); } void SetFeatureParams(bool enable_token_validation, bool enable_forced_subscription) { // VariationParamsManager supports only one // |SetVariationParamsWithFeatureAssociations| at a time, so we clear // previous settings first to make this explicit. params_manager_.ClearAllVariationParams(); params_manager_.SetVariationParamsWithFeatureAssociations( kBreakingNewsPushFeature.name, { {"enable_token_validation", BoolToString(enable_token_validation)}, {"enable_forced_subscription", BoolToString(enable_forced_subscription)}, }, {kBreakingNewsPushFeature.name}); } PrefService* pref_service() { return utils_.pref_service(); } NiceMock<MockSubscriptionManager>* mock_subscription_manager() { return mock_subscription_manager_; } StrictMock<MockInstanceID>* mock_instance_id() { return mock_instance_id_.get(); } private: variations::testing::VariationParamsManager params_manager_; base::MessageLoop message_loop_; test::RemoteSuggestionsTestUtils utils_; NiceMock<MockSubscriptionManager>* mock_subscription_manager_; std::unique_ptr<StrictMock<MockGCMDriver>> mock_gcm_driver_; std::unique_ptr<StrictMock<MockInstanceIDDriver>> mock_instance_id_driver_; std::unique_ptr<StrictMock<MockInstanceID>> mock_instance_id_; }; TEST_F(BreakingNewsGCMAppHandlerTest, ShouldValidateTokenImmediatelyIfValidationIsDue) { SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // Last validation was long time ago. const base::Time last_validation = GetDummyNow() - 10 * GetTokenValidationPeriod(); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); // Check that the handler validates the token through GetToken. ValidateToken // always returns true on Android, so it's not useful. Instead, the handler // must check that the result from GetToken is unchanged. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); EXPECT_CALL(*mock_instance_id(), ValidateToken(_, _, _, _)).Times(0); handler->StartListening(base::DoNothing(), base::DoNothing()); task_runner->RunUntilIdle(); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldScheduleTokenValidationIfNotYetDue) { SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // The next validation will be soon. const base::TimeDelta time_to_validation = base::TimeDelta::FromHours(1); const base::Time last_validation = GetDummyNow() - (GetTokenValidationPeriod() - time_to_validation); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); // Check that handler does not validate the token yet. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)).Times(0); EXPECT_CALL(*mock_instance_id(), ValidateToken(_, _, _, _)).Times(0); handler->StartListening(base::DoNothing(), base::DoNothing()); task_runner->FastForwardBy(time_to_validation - base::TimeDelta::FromSeconds(1)); // But when it is time, validation happens. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldNotValidateTokenBeforeListening) { SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // Last validation was long time ago. const base::Time last_validation = GetDummyNow() - 10 * GetTokenValidationPeriod(); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); // Check that handler does not validate the token before StartListening even // though a validation is due. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)).Times(0); EXPECT_CALL(*mock_instance_id(), ValidateToken(_, _, _, _)).Times(0); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); task_runner->FastForwardBy(10 * GetTokenValidationPeriod()); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldNotValidateTokenAfterStopListening) { SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // The next validation will be soon. const base::TimeDelta time_to_validation = base::TimeDelta::FromHours(1); const base::Time last_validation = GetDummyNow() - (GetTokenValidationPeriod() - time_to_validation); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); // Check that handler does not validate the token after StopListening even // though a validation is due. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)).Times(0); EXPECT_CALL(*mock_instance_id(), ValidateToken(_, _, _, _)).Times(0); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); handler->StopListening(); task_runner->FastForwardBy(10 * GetTokenValidationPeriod()); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldRescheduleTokenValidationWhenRetrievingToken) { SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // The next validation will be soon. const base::TimeDelta time_to_validation = base::TimeDelta::FromHours(1); const base::Time last_validation = GetDummyNow() - (GetTokenValidationPeriod() - time_to_validation); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); // There is no token yet, thus, handler retrieves it on StartListening. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); handler->StartListening(base::DoNothing(), base::DoNothing()); // Check that the validation schedule has changed. "Old validation" should not // happen because the token was retrieved recently. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)).Times(0); task_runner->FastForwardBy(GetTokenValidationPeriod() - base::TimeDelta::FromSeconds(1)); // The new validation should happen. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldScheduleNewTokenValidationAfterValidation) { SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // The next validation will be soon. const base::TimeDelta time_to_validation = base::TimeDelta::FromHours(1); const base::Time last_validation = GetDummyNow() - (GetTokenValidationPeriod() - time_to_validation); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); // Handler validates the token. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); EXPECT_CALL(*mock_instance_id(), ValidateToken(_, _, _, _)).Times(0); task_runner->FastForwardBy(time_to_validation); // Check that the next validation is scheduled in time. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)).Times(0); task_runner->FastForwardBy(GetTokenValidationPeriod() - base::TimeDelta::FromSeconds(1)); EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldResubscribeWithNewTokenIfOldIsInvalidAfterValidation) { SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // Last validation was long time ago. const base::Time last_validation = GetDummyNow() - 10 * GetTokenValidationPeriod(); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "old_token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); // Check that handler resubscribes with the new token after a validation, if // old is invalid. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce( InvokeCallbackArgument<3>("new_token", InstanceID::Result::SUCCESS)); EXPECT_CALL(*mock_instance_id(), ValidateToken(_, _, _, _)).Times(0); EXPECT_CALL(*mock_subscription_manager(), Resubscribe("new_token")); EXPECT_CALL(*mock_subscription_manager(), Subscribe(_)).Times(0); task_runner->RunUntilIdle(); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldDoNothingIfOldTokenIsValidAfterValidation) { SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // Last validation was long time ago. const base::Time last_validation = GetDummyNow() - 10 * GetTokenValidationPeriod(); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); // Check that provider does not resubscribe if the old token is still valid // after validation. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); EXPECT_CALL(*mock_instance_id(), ValidateToken(_, _, _, _)).Times(0); EXPECT_CALL(*mock_subscription_manager(), Subscribe(_)).Times(0); EXPECT_CALL(*mock_subscription_manager(), Resubscribe(_)).Times(0); task_runner->RunUntilIdle(); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldIgnoreTokenReceivedAfterStopListening) { // The last validation time is used to ensure that GetToken callback is // ignored. Thus, enable validation. SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // The next validation won't be soon. const base::TimeDelta time_to_validation = base::TimeDelta::FromDays(5); const base::Time last_validation = GetDummyNow() - (GetTokenValidationPeriod() - time_to_validation); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); // Save the GetToken callback during the subscription. base::RepeatingCallback<void(const std::string&, InstanceID::Result)> get_token_callback; EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce(SaveArg<3>(&get_token_callback)); handler->StartListening( base::BindRepeating( [](std::unique_ptr<RemoteSuggestion> remote_suggestion) {}), base::DoNothing()); // The client stops listening for the push updates. handler->StopListening(); // The GCM returns the new token (it does not know that we are not interested // anymore). Imitate an asynchronous call via time delay. task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); get_token_callback.Run("new_token", InstanceID::Result::SUCCESS); // The new token must be completely ignored. It should not be saved. EXPECT_EQ("", pref_service()->GetString( prefs::kBreakingNewsGCMSubscriptionTokenCache)); // The validation should not be rescheduled. EXPECT_EQ(last_validation, DeserializeTime(pref_service()->GetInt64( prefs::kBreakingNewsGCMLastTokenValidationTime))); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldIgnoreTokenReceivedForValidationAfterStopListening) { SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // The next validation will be soon. const base::TimeDelta time_to_validation = base::TimeDelta::FromHours(1); const base::Time last_validation = GetDummyNow() - (GetTokenValidationPeriod() - time_to_validation); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "old_token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening( base::BindRepeating( [](std::unique_ptr<RemoteSuggestion> remote_suggestion) {}), base::DoNothing()); task_runner->FastForwardBy(time_to_validation - base::TimeDelta::FromSeconds(1)); // Save the GetToken callback during the validation. base::RepeatingCallback<void(const std::string&, InstanceID::Result)> get_token_callback; EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce(SaveArg<3>(&get_token_callback)); task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); // The client stops listening for the push updates. handler->StopListening(); // The GCM returns the new token (it does not know that we are not interested // anymore). task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); get_token_callback.Run("new_token", InstanceID::Result::SUCCESS); // The new token must be completely ignored. It should not be saved. EXPECT_EQ("old_token", pref_service()->GetString( prefs::kBreakingNewsGCMSubscriptionTokenCache)); // The validation should not occur. EXPECT_EQ(last_validation, DeserializeTime(pref_service()->GetInt64( prefs::kBreakingNewsGCMLastTokenValidationTime))); } TEST_F(BreakingNewsGCMAppHandlerTest, IsListeningShouldReturnFalseBeforeListening) { SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/false); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); EXPECT_FALSE(handler->IsListening()); } TEST_F(BreakingNewsGCMAppHandlerTest, IsListeningShouldReturnTrueAfterStartListening) { SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/false); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); ASSERT_FALSE(handler->IsListening()); EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillRepeatedly( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); handler->StartListening(base::DoNothing(), base::DoNothing()); EXPECT_TRUE(handler->IsListening()); } TEST_F(BreakingNewsGCMAppHandlerTest, IsListeningShouldReturnFalseAfterStopListening) { SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/false); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); ASSERT_FALSE(handler->IsListening()); EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillRepeatedly( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); handler->StartListening(base::DoNothing(), base::DoNothing()); ASSERT_TRUE(handler->IsListening()); handler->StopListening(); EXPECT_FALSE(handler->IsListening()); } TEST_F(BreakingNewsGCMAppHandlerTest, IsListeningShouldReturnTrueAfterSecondStartListening) { SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/false); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); ASSERT_FALSE(handler->IsListening()); EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillRepeatedly( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); handler->StartListening(base::DoNothing(), base::DoNothing()); ASSERT_TRUE(handler->IsListening()); handler->StopListening(); ASSERT_FALSE(handler->IsListening()); handler->StartListening(base::DoNothing(), base::DoNothing()); EXPECT_TRUE(handler->IsListening()); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldForceSubscribeImmediatelyIfDue) { SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/true); // Last subscription was long time ago. const base::Time last_subscription = GetDummyNow() - 10 * GetForcedSubscriptionPeriod(); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastForcedSubscriptionTime, SerializeTime(last_subscription)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); EXPECT_CALL(*mock_subscription_manager(), Subscribe("token")); task_runner->RunUntilIdle(); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldScheduleForcedSubscribtionIfNotYetDue) { SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/true); // The next forced subscription will be soon. const base::TimeDelta time_to_subscription = base::TimeDelta::FromHours(1); const base::Time last_subscription = GetDummyNow() - (GetForcedSubscriptionPeriod() - time_to_subscription); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastForcedSubscriptionTime, SerializeTime(last_subscription)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); // Check that handler does not force subscribe yet. handler->StartListening(base::DoNothing(), base::DoNothing()); // TODO(vitaliii): Consider making FakeSubscriptionManager, because // IsSubscribed() affects forced subscriptions. Currently we have to carefully // avoid the initial subscription. EXPECT_CALL(*mock_subscription_manager(), Subscribe("token")).Times(0); task_runner->FastForwardBy(time_to_subscription - base::TimeDelta::FromSeconds(1)); // But when it is time, forced subscription happens. testing::Mock::VerifyAndClearExpectations(mock_subscription_manager()); EXPECT_CALL(*mock_subscription_manager(), Subscribe("token")); task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldNotForceSubscribeBeforeListening) { SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/true); // Last subscription was long time ago. const base::Time last_subscription = GetDummyNow() - 10 * GetForcedSubscriptionPeriod(); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastForcedSubscriptionTime, SerializeTime(last_subscription)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); // Check that handler does not force subscribe before StartListening even // though a forced subscription is due. std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); EXPECT_CALL(*mock_subscription_manager(), Subscribe("token")).Times(0); task_runner->FastForwardBy(10 * GetForcedSubscriptionPeriod()); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldNotForceSubscribeAfterStopListening) { SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/true); // The next forced subscription will be soon. const base::TimeDelta time_to_subscription = base::TimeDelta::FromHours(1); const base::Time last_subscription = GetDummyNow() - (GetForcedSubscriptionPeriod() - time_to_subscription); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastForcedSubscriptionTime, SerializeTime(last_subscription)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); // Check that handler does not force subscribe after StopListening even // though a forced subscription is due. std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); handler->StopListening(); EXPECT_CALL(*mock_subscription_manager(), Subscribe("token")).Times(0); task_runner->FastForwardBy(10 * GetForcedSubscriptionPeriod()); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldScheduleNewForcedSubscriptionAfterForcedSubscription) { SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/true); // The next forced subscription will be soon. const base::TimeDelta time_to_subscription = base::TimeDelta::FromHours(1); const base::Time last_subscription = GetDummyNow() - (GetForcedSubscriptionPeriod() - time_to_subscription); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastForcedSubscriptionTime, SerializeTime(last_subscription)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); // Handler force subscribes. EXPECT_CALL(*mock_subscription_manager(), Subscribe("token")); task_runner->FastForwardBy(time_to_subscription); // Check that the next forced subscription is scheduled in time. EXPECT_CALL(*mock_subscription_manager(), Subscribe("token")).Times(0); task_runner->FastForwardBy(GetForcedSubscriptionPeriod() - base::TimeDelta::FromSeconds(1)); EXPECT_CALL(*mock_subscription_manager(), Subscribe("token")); task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); } TEST_F(BreakingNewsGCMAppHandlerTest, TokenValidationAndForcedSubscriptionShouldNotAffectEachOther) { SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/true); // The next forced subscription will be soon. const base::TimeDelta time_to_subscription = base::TimeDelta::FromHours(1); const base::Time last_subscription = GetDummyNow() - (GetForcedSubscriptionPeriod() - time_to_subscription); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastForcedSubscriptionTime, SerializeTime(last_subscription)); // The next validation will be sooner. const base::TimeDelta time_to_validation = base::TimeDelta::FromMinutes(30); const base::Time last_validation = GetDummyNow() - (GetTokenValidationPeriod() - time_to_validation); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); // Check that the next validation is scheduled in time. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)).Times(0); task_runner->FastForwardBy(time_to_validation - base::TimeDelta::FromSeconds(1)); EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); // Check that the next forced subscription is scheduled in time. EXPECT_CALL(*mock_subscription_manager(), Subscribe("token")).Times(0); task_runner->FastForwardBy((time_to_subscription - time_to_validation) - base::TimeDelta::FromSeconds(1)); EXPECT_CALL(*mock_subscription_manager(), Subscribe("token")); task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldReportMissingAction) { base::HistogramTester histogram_tester; SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/false); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); handler->OnMessage("com.google.breakingnews.gcm", gcm::IncomingMessage()); EXPECT_THAT( histogram_tester.GetAllSamples( "NewTabPage.ContentSuggestions.BreakingNews.ReceivedMessageAction"), ElementsAre(base::Bucket( /*min=*/static_cast<int>(metrics::ReceivedMessageAction::NO_ACTION), /*count=*/1))); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldReportInvalidAction) { base::HistogramTester histogram_tester; SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/false); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); gcm::IncomingMessage message; message.data[kPushedActionKey] = "invalid_action"; handler->OnMessage("com.google.breakingnews.gcm", message); EXPECT_THAT( histogram_tester.GetAllSamples( "NewTabPage.ContentSuggestions.BreakingNews.ReceivedMessageAction"), ElementsAre( base::Bucket(/*min=*/static_cast<int>( metrics::ReceivedMessageAction::INVALID_ACTION), /*count=*/1))); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldReportPushToRefreshAction) { base::HistogramTester histogram_tester; SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/false); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); gcm::IncomingMessage message; message.data[kPushedActionKey] = "push-to-refresh"; handler->OnMessage("com.google.breakingnews.gcm", message); EXPECT_THAT( histogram_tester.GetAllSamples( "NewTabPage.ContentSuggestions.BreakingNews.ReceivedMessageAction"), ElementsAre( base::Bucket(/*min=*/static_cast<int>( metrics::ReceivedMessageAction::PUSH_TO_REFRESH), /*count=*/1))); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldReportPushByValueAction) { base::HistogramTester histogram_tester; SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/false); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); gcm::IncomingMessage message; message.data[kPushedActionKey] = "push-by-value"; message.data["payload"] = "news"; handler->OnMessage("com.google.breakingnews.gcm", message); EXPECT_THAT( histogram_tester.GetAllSamples( "NewTabPage.ContentSuggestions.BreakingNews.ReceivedMessageAction"), ElementsAre(base::Bucket( /*min=*/static_cast<int>( metrics::ReceivedMessageAction::PUSH_BY_VALUE), /*count=*/1))); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldCallOnNewRemoteSuggestionCallbackOnPushByValueMessage) { SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/false); std::string json = R"( {"categories" : [{ "id": 1, "localizedTitle": "section title", "suggestions" : [{ "ids" : ["http://url.com"], "title" : "Pushed Dummy Title", "snippet" : "Pushed Dummy Snippet", "fullPageUrl" : "http://url.com", "creationTime" : "2017-01-01T00:00:01.000Z", "expirationTime" : "2100-01-01T00:00:01.000Z", "attribution" : "Pushed Dummy Publisher", "imageUrl" : "https://www.google.com/favicon.ico" }] }]} )"; // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); MockOnNewRemoteSuggestionCallback mock_on_new_remote_suggestion_callback; handler->StartListening(mock_on_new_remote_suggestion_callback.Get(), base::DoNothing()); gcm::IncomingMessage message; message.data[kPushedActionKey] = "push-by-value"; message.data["payload"] = json; EXPECT_CALL(mock_on_new_remote_suggestion_callback, Run(_)).Times(1); handler->OnMessage("com.google.breakingnews.gcm", message); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldCallOnRefreshRequestedCallbackOnPushToRefreshMessage) { SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/false); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); base::MockCallback<BreakingNewsListener::OnRefreshRequestedCallback> on_refresh_requested_callback; handler->StartListening(base::DoNothing(), on_refresh_requested_callback.Get()); gcm::IncomingMessage message; message.data[kPushedActionKey] = "push-to-refresh"; EXPECT_CALL(on_refresh_requested_callback, Run()).Times(1); handler->OnMessage("com.google.breakingnews.gcm", message); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldReportTokenRetrievalResult) { base::HistogramTester histogram_tester; SetFeatureParams(/*enable_token_validation=*/false, /*enable_forced_subscription=*/false); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce(InvokeCallbackArgument<3>(/*token=*/"", InstanceID::Result::NETWORK_ERROR)); handler->StartListening(base::DoNothing(), base::DoNothing()); EXPECT_THAT( histogram_tester.GetAllSamples( "NewTabPage.ContentSuggestions.BreakingNews.TokenRetrievalResult"), ElementsAre(base::Bucket( /*min=*/static_cast<int>(InstanceID::Result::NETWORK_ERROR), /*count=*/1))); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldReportTimeSinceLastTokenValidation) { base::HistogramTester histogram_tester; SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // The next validation will be soon. const base::TimeDelta time_to_validation = base::TimeDelta::FromHours(1); const base::Time last_validation = GetDummyNow() - (GetTokenValidationPeriod() - time_to_validation); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); // Check that handler does not report the metric before the validation. task_runner->FastForwardBy(time_to_validation - base::TimeDelta::FromSeconds(1)); EXPECT_THAT( histogram_tester.GetAllSamples( "NewTabPage.ContentSuggestions.BreakingNews.TokenRetrievalResult"), IsEmpty()); // But when the validation happens, the time is reported. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); histogram_tester.ExpectTimeBucketCount( "NewTabPage.ContentSuggestions.BreakingNews.TimeSinceLastTokenValidation", GetTokenValidationPeriod(), /*count=*/1); // |ExpectTimeBucketCount| allows other buckets. Let's ensure that there are // none. histogram_tester.ExpectTotalCount( "NewTabPage.ContentSuggestions.BreakingNews.TimeSinceLastTokenValidation", /*count=*/1); } TEST_F(BreakingNewsGCMAppHandlerTest, ShouldReportWhetherTokenWasValidBeforeValidation) { base::HistogramTester histogram_tester; SetFeatureParams(/*enable_token_validation=*/true, /*enable_forced_subscription=*/false); // The next validation will be soon. const base::TimeDelta time_to_validation = base::TimeDelta::FromHours(1); const base::Time last_validation = GetDummyNow() - (GetTokenValidationPeriod() - time_to_validation); pref_service()->SetInt64(prefs::kBreakingNewsGCMLastTokenValidationTime, SerializeTime(last_validation)); // Omit receiving the token by putting it there directly. pref_service()->SetString(prefs::kBreakingNewsGCMSubscriptionTokenCache, "token"); scoped_refptr<TestMockTimeTaskRunner> task_runner( new TestMockTimeTaskRunner(GetDummyNow(), TimeTicks::Now())); std::unique_ptr<BreakingNewsGCMAppHandler> handler = MakeHandler(task_runner); handler->StartListening(base::DoNothing(), base::DoNothing()); // Check that handler does not report the metric before the validation. task_runner->FastForwardBy(time_to_validation - base::TimeDelta::FromSeconds(1)); EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.ContentSuggestions." "BreakingNews." "WasTokenValidBeforeValidation"), IsEmpty()); // But when the validation happens, the old token validness is reported. EXPECT_CALL(*mock_instance_id(), GetToken(_, _, _, _)) .WillOnce( InvokeCallbackArgument<3>("token", InstanceID::Result::SUCCESS)); task_runner->FastForwardBy(base::TimeDelta::FromSeconds(1)); EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.ContentSuggestions." "BreakingNews." "WasTokenValidBeforeValidation"), ElementsAre(base::Bucket( /*min=*/1, /*count=*/1))); } } // namespace ntp_snippets
43.164304
80
0.719075
zipated
37e1931190d64244ff3d28aa080814216cb300aa
675
cpp
C++
source/+test-geometry/Line.cpp
brettonw/Two
5cd121c94388f4465157c770bde7ec369f1f5f97
[ "MIT" ]
null
null
null
source/+test-geometry/Line.cpp
brettonw/Two
5cd121c94388f4465157c770bde7ec369f1f5f97
[ "MIT" ]
null
null
null
source/+test-geometry/Line.cpp
brettonw/Two
5cd121c94388f4465157c770bde7ec369f1f5f97
[ "MIT" ]
null
null
null
#include "Test.h" #include "Line.h" TEST_MODULE_DEPENDENCIES (Line2, "Tuple") TEST_CASE(Line2) { //Log::Scope scope (Log::TRACE); Vector2 a (0, 2); Vector2 b (1, 1); auto line = Line<f8, 2>::fromTwoPoints (a, b); Vector2 pt = line.pointAt (2); TEST_TRUE(line.isOnLine (a)); TEST_TRUE(line.isOnLine (b)); TEST_TRUE(line.isOnLine (pt)); TEST_EQUALS_EPS(line.distance (Vector2 ()), sqrt (2), 1e-6); } TEST_CASE(Line3) { //Log::Scope scope (Log::TRACE); Vector3 a; Vector3 b (1, 1, 1); Vector3 c (0, 0, 1); auto line = Line<f8, 3>::fromTwoPoints (a, b); TEST_EQUALS_EPS(line.distance (c), 0.816497, 1e-6); }
21.09375
64
0.601481
brettonw
37e34ac82766584c4a6e24d9d06ce78a71321a68
1,571
cpp
C++
Source/FactoryGame/FGCrashSiteDebris.cpp
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
Source/FactoryGame/FGCrashSiteDebris.cpp
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
Source/FactoryGame/FGCrashSiteDebris.cpp
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
// This file has been automatically generated by the Unreal Header Implementation tool #include "FGCrashSiteDebris.h" FDebrisMesh::FDebrisMesh(){ } FDebrisActor::FDebrisActor(){ } FDebrisItemDrop::FDebrisItemDrop(){ } TSubclassOf< class UFGItemDescriptor > FDebrisItemDrop::GetItemClass() const{ return TSubclassOf<class UFGItemDescriptor>(); } bool FDebrisItemDrop::IsValid() const{ return bool(); } FSimulatedMeshTransform::FSimulatedMeshTransform(){ } FSimulatedMeshTransform::FSimulatedMeshTransform( UStaticMesh* mesh, const FTransform& transform){ } FSimulatedActorTransform::FSimulatedActorTransform(){ } FSimulatedActorTransform::FSimulatedActorTransform( TSubclassOf< AFGCrashSiteDebrisActor > actor, const FTransform& transform){ } FSimulatedItemDropTransform::FSimulatedItemDropTransform(){ } #if WITH_EDITOR void AFGCrashSiteDebris::OnConstruction( const FTransform& transform){ } void AFGCrashSiteDebris::BeginPlay(){ } void AFGCrashSiteDebris::Tick( float dt){ } void AFGCrashSiteDebris::PostEditChangeChainProperty( FPropertyChangedChainEvent& PropertyChangedEvent){ } #endif #if WITH_EDITOR void AFGCrashSiteDebris::OnPreBeginPIE( bool isSimulating){ } void AFGCrashSiteDebris::OnEndPIE( bool wasSimulatingInEditor){ } void AFGCrashSiteDebris::SpawnSimulation(){ } void AFGCrashSiteDebris::ResetSavedSimulation(){ } void AFGCrashSiteDebris::DestroySavedSimulation(){ } void AFGCrashSiteDebris::SpawnSavedSimulation(){ } #endif #if WITH_EDITORONLY_DATA #endif AFGCrashSiteDebris::AFGCrashSiteDebris(){ } AFGCrashSiteDebris::~AFGCrashSiteDebris(){ }
47.606061
129
0.819223
iam-Legend
37e61a50af20180e06b1d1104cf6b94ecbcdc8a0
1,130
cc
C++
iridium/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
behemoth3663/ports_local
ad57042ae62c907f9340ee696f468fdfeb562a8b
[ "BSD-3-Clause" ]
1
2022-02-08T02:24:08.000Z
2022-02-08T02:24:08.000Z
iridium/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
behemoth3663/ports_local
ad57042ae62c907f9340ee696f468fdfeb562a8b
[ "BSD-3-Clause" ]
null
null
null
iridium/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
behemoth3663/ports_local
ad57042ae62c907f9340ee696f468fdfeb562a8b
[ "BSD-3-Clause" ]
null
null
null
--- content/utility/utility_blink_platform_with_sandbox_support_impl.cc.orig 2019-12-16 21:50:48 UTC +++ content/utility/utility_blink_platform_with_sandbox_support_impl.cc @@ -9,7 +9,7 @@ #if defined(OS_MACOSX) #include "content/child/child_process_sandbox_support_impl_mac.h" -#elif defined(OS_LINUX) +#elif defined(OS_LINUX) || defined(OS_BSD) #include "content/child/child_process_sandbox_support_impl_linux.h" #endif @@ -17,7 +17,7 @@ namespace content { UtilityBlinkPlatformWithSandboxSupportImpl:: UtilityBlinkPlatformWithSandboxSupportImpl() { -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_BSD) mojo::PendingRemote<font_service::mojom::FontService> font_service; UtilityThread::Get()->BindHostReceiver( font_service.InitWithNewPipeAndPassReceiver()); @@ -34,7 +34,7 @@ UtilityBlinkPlatformWithSandboxSupportImpl:: blink::WebSandboxSupport* UtilityBlinkPlatformWithSandboxSupportImpl::GetSandboxSupport() { -#if defined(OS_LINUX) || defined(OS_MACOSX) +#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) return sandbox_support_.get(); #else return nullptr;
37.666667
100
0.777876
behemoth3663
37e79a1c3f67ac628512d20dd1cb1f2f75528b12
12,305
cxx
C++
PWGHF/hfe/AliHFEtofPIDqa.cxx
maroozm/AliPhysics
22ec256928cfdf8f800e05bfc1a6e124d90b6eaf
[ "BSD-3-Clause" ]
114
2017-03-03T09:12:23.000Z
2022-03-03T20:29:42.000Z
PWGHF/hfe/AliHFEtofPIDqa.cxx
maroozm/AliPhysics
22ec256928cfdf8f800e05bfc1a6e124d90b6eaf
[ "BSD-3-Clause" ]
19,637
2017-01-16T12:34:41.000Z
2022-03-31T22:02:40.000Z
PWGHF/hfe/AliHFEtofPIDqa.cxx
maroozm/AliPhysics
22ec256928cfdf8f800e05bfc1a6e124d90b6eaf
[ "BSD-3-Clause" ]
1,021
2016-07-14T22:41:16.000Z
2022-03-31T05:15:51.000Z
/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ // // Class AliHFEtofPIDqa // // Monitoring TOF PID in the HFE PID montioring framework. The following // quantities are monitored: // TOF time distance to electron hypothesis (Number of sigmas) // TOF time distance to the pion hypothesis (Absolute value) // TPC dE/dx (Number of sigmas, as control histogram) // (Always as function of momentum, particle species and centrality // before and after cut) // More information about the PID monitoring framework can be found in // AliHFEpidQAmanager.cxx and AliHFEdetPIDqa.cxx // // Author: // // Markus Fasel <M.Fasel@gsi.de> #include <TClass.h> #include <TArrayD.h> #include <TH2.h> #include <THnSparse.h> #include <TString.h> #include "AliLog.h" #include "AliPID.h" #include "AliPIDResponse.h" #include "AliVParticle.h" #include "AliHFEcollection.h" #include "AliHFEpid.h" #include "AliHFEpidBase.h" #include "AliHFEpidQAmanager.h" #include "AliHFEpidTPC.h" #include "AliHFEpidTRD.h" #include "AliHFEpidTOF.h" #include "AliHFEtools.h" #include "AliHFEtofPIDqa.h" ClassImp(AliHFEpidTOF) //_________________________________________________________ AliHFEtofPIDqa::AliHFEtofPIDqa(): AliHFEdetPIDqa() , fHistos(NULL) { // // Dummy constructor // } //_________________________________________________________ AliHFEtofPIDqa::AliHFEtofPIDqa(const char* name): AliHFEdetPIDqa(name, "QA for TOF") , fHistos(NULL) { // // Default constructor // } //_________________________________________________________ AliHFEtofPIDqa::AliHFEtofPIDqa(const AliHFEtofPIDqa &o): AliHFEdetPIDqa(o) , fHistos() { // // Copy constructor // o.Copy(*this); } //_________________________________________________________ AliHFEtofPIDqa &AliHFEtofPIDqa::operator=(const AliHFEtofPIDqa &o){ // // Do assignment // AliHFEdetPIDqa::operator=(o); if(&o != this) o.Copy(*this); return *this; } //_________________________________________________________ AliHFEtofPIDqa::~AliHFEtofPIDqa(){ // // Destructor // if(fHistos) delete fHistos; } //_________________________________________________________ void AliHFEtofPIDqa::Copy(TObject &o) const { // // Make copy // AliHFEtofPIDqa &target = dynamic_cast<AliHFEtofPIDqa &>(o); if(target.fHistos){ delete target.fHistos; target.fHistos = NULL; } if(fHistos) target.fHistos = new AliHFEcollection(*fHistos); } //_________________________________________________________ Long64_t AliHFEtofPIDqa::Merge(TCollection *coll){ // // Merge with other objects // if(!coll) return 0; if(coll->IsEmpty()) return 1; TIter it(coll); AliHFEtofPIDqa *refQA = NULL; TObject *o = NULL; Long64_t count = 0; TList listHistos; while((o = it())){ refQA = dynamic_cast<AliHFEtofPIDqa *>(o); if(!refQA) continue; listHistos.Add(refQA->fHistos); count++; } fHistos->Merge(&listHistos); return count + 1; } //_________________________________________________________ void AliHFEtofPIDqa::Initialize(){ // // Define Histograms // fHistos = new AliHFEcollection("tofqahistos", "Collection of TOF QA histograms"); // Make common binning const Int_t kPIDbins = AliPID::kSPECIES + 1; const Int_t kSteps = 2; const Int_t kCentralityBins = 11; const Double_t kMinPID = -1; const Double_t kMinP = 0.; const Double_t kMaxPID = (Double_t)AliPID::kSPECIES; const Double_t kMaxP = 20.; // Quantities where one can switch between low and high resolution Int_t kPbins = fQAmanager->HasHighResolutionHistos() ? 1000 : 100; Int_t kSigmaBins = fQAmanager->HasHighResolutionHistos() ? 1400 : 140; // 1st histogram: TOF sigmas: (species, p nsigma, step) Int_t nBinsSigma[5] = {kPIDbins, kPbins, kSigmaBins, kSteps, kCentralityBins}; Double_t minSigma[5] = {kMinPID, kMinP, -12., 0, 0}; Double_t maxSigma[5] = {kMaxPID, kMaxP, 12., 2., 11.}; fHistos->CreateTHnSparse("tofnSigma", "TOF signal; species; p [GeV/c]; TOF signal [a.u.]; Selection Step; Centrality", 5, nBinsSigma, minSigma, maxSigma); // 3rd histogram: TPC sigmas to the electron line: (species, p nsigma, step - only filled if apriori PID information available) fHistos->CreateTHnSparse("tofMonitorTPC", "TPC signal; species; p [GeV/c]; TPC signal [a.u.]; Selection Step; Centrality", 5, nBinsSigma, minSigma, maxSigma); // 4th histogram: TOF mismatch template AliHFEpidTOF *tofpid = dynamic_cast<AliHFEpidTOF *>(fQAmanager->GetDetectorPID(AliHFEpid::kTOFpid)); if(!tofpid) AliDebug(1, "TOF PID not available"); if(tofpid && tofpid->IsGenerateTOFmismatch()){ AliDebug(1, "Prepare histogram for TOF mismatch tracks"); fHistos->CreateTHnSparse("tofMismatch", "TOF signal; species; p [GeV/c]; TOF signal [a.u.]; Selection Step; Centrality", 5, nBinsSigma, minSigma, maxSigma); } } //_________________________________________________________ void AliHFEtofPIDqa::ProcessTrack(const AliHFEpidObject *track, AliHFEdetPIDqa::EStep_t step){ // // Fill TPC histograms // //AliHFEpidObject::AnalysisType_t anatype = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis; //AliHFEpidObject::AnalysisType_t anatype = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis; Float_t centrality = track->GetCentrality(); Int_t species = track->GetAbInitioPID(); if(species >= AliPID::kSPECIES) species = -1; AliDebug(1, Form("Monitoring particle of type %d for step %d", species, step)); AliHFEpidTOF *tofpid= dynamic_cast<AliHFEpidTOF *>(fQAmanager->GetDetectorPID(AliHFEpid::kTOFpid)); const AliPIDResponse *pidResponse = tofpid ? tofpid->GetPIDResponse() : NULL; Double_t contentSignal[5]; contentSignal[0] = species; contentSignal[1] = track->GetRecTrack()->P(); contentSignal[2] = pidResponse ? pidResponse->NumberOfSigmasTOF(track->GetRecTrack(), AliPID::kElectron): 0.; contentSignal[3] = step; contentSignal[4] = centrality; fHistos->Fill("tofnSigma", contentSignal); contentSignal[2] = pidResponse ? pidResponse->NumberOfSigmasTPC(track->GetRecTrack(), AliPID::kElectron) : 0.; fHistos->Fill("tofMonitorTPC", contentSignal); if(tofpid && tofpid->IsGenerateTOFmismatch()){ AliDebug(1,"Filling TOF mismatch histos"); TArrayD nsigmismatch(tofpid->GetNmismatchTracks()); tofpid->GenerateTOFmismatch(track->GetRecTrack(),tofpid->GetNmismatchTracks(), nsigmismatch); for(int itrk = 0; itrk < tofpid->GetNmismatchTracks(); itrk++){ contentSignal[2] = nsigmismatch[itrk]; fHistos->Fill("tofMismatch",contentSignal); } } } //_________________________________________________________ TH2 *AliHFEtofPIDqa::MakeTPCspectrumNsigma(AliHFEdetPIDqa::EStep_t step, Int_t species, Int_t centralityClass){ // // Get the TPC control histogram for the TRD selection step (either before or after PID) // THnSparseF *histo = dynamic_cast<THnSparseF *>(fHistos->Get("tofMonitorTPC")); if(!histo){ AliError("QA histogram monitoring TPC nSigma not available"); return NULL; } if(species > -1 && species < AliPID::kSPECIES){ // cut on species (if available) histo->GetAxis(0)->SetRange(species + 2, species + 2); // undef + underflow } TString centname, centtitle; Bool_t hasCentralityInfo = kTRUE; if(centralityClass > -1){ if(histo->GetNdimensions() < 5){ AliError("Centrality Information not available"); centname = centtitle = "MinBias"; hasCentralityInfo = kFALSE; } else { // Project centrality classes // -1 is Min. Bias histo->GetAxis(4)->SetRange(centralityClass+1, centralityClass+1); centname = Form("Cent%d", centralityClass); centtitle = Form("Centrality %d", centralityClass); } } else { histo->GetAxis(4)->SetRange(1, histo->GetAxis(4)->GetNbins()-1); centname = centtitle = "MinBias"; hasCentralityInfo = kTRUE; } histo->GetAxis(3)->SetRange(step + 1, step + 1); TH2 *hSpec = histo->Projection(2, 1); // construct title and name TString stepname = step == AliHFEdetPIDqa::kBeforePID ? "before" : "after"; TString speciesname = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "all Particles"; TString specID = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "unid"; TString histname = Form("hSigmaTPC%s%s%s", specID.Data(), stepname.Data(), centname.Data()); TString histtitle = Form("TPC Sigma for %s %s PID %s", speciesname.Data(), stepname.Data(), centtitle.Data()); hSpec->SetName(histname.Data()); hSpec->SetTitle(histtitle.Data()); // Unset range on the original histogram histo->GetAxis(0)->SetRange(0, histo->GetAxis(0)->GetNbins()); histo->GetAxis(3)->SetRange(0, histo->GetAxis(3)->GetNbins()); if(hasCentralityInfo)histo->GetAxis(4)->SetRange(0, histo->GetAxis(4)->GetNbins()); return hSpec; } //_________________________________________________________ TH2 *AliHFEtofPIDqa::MakeSpectrumNSigma(AliHFEdetPIDqa::EStep_t istep, Int_t species, Int_t centralityClass){ // // Plot the Spectrum // THnSparseF *hSignal = dynamic_cast<THnSparseF *>(fHistos->Get("tofnSigma")); if(!hSignal) return NULL; hSignal->GetAxis(3)->SetRange(istep + 1, istep + 1); if(species >= 0 && species < AliPID::kSPECIES) hSignal->GetAxis(0)->SetRange(2 + species, 2 + species); TString centname, centtitle; Bool_t hasCentralityInfo = kTRUE; if(centralityClass > -1){ if(hSignal->GetNdimensions() < 5){ AliError("Centrality Information not available"); centname = centtitle = "MinBias"; hasCentralityInfo = kFALSE; } else { // Project centrality classes // -1 is Min. Bias AliInfo(Form("Centrality Class: %d", centralityClass)); hSignal->GetAxis(4)->SetRange(centralityClass+1, centralityClass+1); centname = Form("Cent%d", centralityClass); centtitle = Form("Centrality %d", centralityClass); } } else { hSignal->GetAxis(4)->SetRange(1, hSignal->GetAxis(4)->GetNbins()-1); centname = centtitle = "MinBias"; hasCentralityInfo = kTRUE; } TH2 *hTmp = hSignal->Projection(2,1); TString hname = Form("hTOFsigma%s%s", istep == AliHFEdetPIDqa::kBeforePID ? "before" : "after", centname.Data()), htitle = Form("Time-of-flight spectrum[#sigma] %s selection %s", istep == AliHFEdetPIDqa::kBeforePID ? "before" : "after", centtitle.Data()); if(species > -1){ hname += AliPID::ParticleName(species); htitle += Form(" for %ss", AliPID::ParticleName(species)); } hTmp->SetName(hname.Data()); hTmp->SetTitle(htitle.Data()); hTmp->SetStats(kFALSE); hTmp->GetXaxis()->SetTitle("p [GeV/c]"); hTmp->GetYaxis()->SetTitle("TOF time|_{el} - expected time|_{el} [#sigma]"); hSignal->GetAxis(3)->SetRange(0, hSignal->GetAxis(3)->GetNbins()); hSignal->GetAxis(0)->SetRange(0, hSignal->GetAxis(0)->GetNbins()); if(hasCentralityInfo)hSignal->GetAxis(4)->SetRange(0, hSignal->GetAxis(4)->GetNbins()); return hTmp; } //_________________________________________________________ TH1 *AliHFEtofPIDqa::GetHistogram(const char *name){ // // Get the histogram // if(!fHistos) return NULL; TObject *histo = fHistos->Get(name); if(!histo->InheritsFrom("TH1")) return NULL; return dynamic_cast<TH1 *>(histo); }
37.745399
160
0.689395
maroozm
37e7ba8bf91e9d9b672453a70efbb0f2ad541322
15,792
cpp
C++
src/c++/main/blocksplit.cpp
nh13/hap.py
fd67904f7a68981e76c12301aa2add2718b30120
[ "BSL-1.0" ]
315
2015-07-21T13:53:30.000Z
2022-03-17T02:01:19.000Z
src/c++/main/blocksplit.cpp
nh13/hap.py
fd67904f7a68981e76c12301aa2add2718b30120
[ "BSL-1.0" ]
147
2015-11-26T03:06:24.000Z
2022-03-28T18:22:33.000Z
src/c++/main/blocksplit.cpp
nh13/hap.py
fd67904f7a68981e76c12301aa2add2718b30120
[ "BSL-1.0" ]
124
2015-07-21T13:55:14.000Z
2022-03-23T17:34:31.000Z
// -*- mode: c++; indent-tabs-mode: nil; -*- // // Copyright (c) 2010-2015 Illumina, Inc. // All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // 1. Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // 2. 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. // 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 HOLDER 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. /** * \brief Split a set of VCFs into blocks with variants not closer than a given window length * * \file blocksplit.cpp * \author Peter Krusche * \email pkrusche@illumina.com * */ #include <boost/program_options.hpp> #include "Version.hh" #include "Variant.hh" #include "helpers/StringUtil.hh" #include "helpers/GraphUtil.hh" #include <fstream> #include <limits> #include <htslib/synced_bcf_reader.h> #include <htslib/vcf.h> // error needs to come after program_options. #include "Error.hh" using namespace variant; int main(int argc, char* argv[]) { namespace po = boost::program_options; std::vector<std::string> files, samples; std::string regions_bed = ""; std::string targets_bed = ""; std::string out_bed = ""; // limits std::string chr = ""; int64_t start = -1; int64_t end = -1; int64_t rlimit = -1; int64_t message = -1; int64_t window = 30; bool apply_filters = false; int nblocks = 32; int nvars = 100; bool verbose = false; try { // Declare the supported options. po::options_description desc("Allowed options"); desc.add_options() ("help,h", "produce help message") ("version", "Show version") ("input-file", po::value<std::vector<std::string> >(), "The input VCF/BCF file(s) (use file:sample to specify a sample)") ("output,o", po::value<std::string>(), "Write a bed file giving the locations of overlapping blocks (use - for stdout).") ("regions,R", po::value<std::string>(), "Use a bed file for getting a subset of regions (traversal via tabix).") ("targets,T", po::value<std::string>(), "Use a bed file for getting a subset of targets (streaming the whole file, ignoring things outside the bed regions).") ("location,l", po::value<std::string>(), "The location / subset.") ("limit-records,L", po::value<int64_t>(), "Maximum number of records to process") ("message-every,m", po::value<int64_t>(), "Print a message every N records.") ("window,w", po::value<int64_t>(), "Overlap window length.") ("nblocks,b", po::value<int>(), "Maximum number of blocks to break into (32).") ("nvars,v", po::value<int>(), "Minimum number of variants per block (100).") ("apply-filters,f", po::value<bool>(), "Apply filtering in VCF.") ("verbose", po::value<bool>(), "Verbose output.") ; po::positional_options_description popts; popts.add("input-file", -1); po::options_description cmdline_options; cmdline_options .add(desc) ; po::variables_map vm; po::store(po::command_line_parser(argc, argv). options(cmdline_options).positional(popts).run(), vm); po::notify(vm); if (vm.count("version")) { std::cout << "blocksplit version " << HAPLOTYPES_VERSION << "\n"; return 0; } if (vm.count("help")) { std::cout << desc << "\n"; return 1; } if (vm.count("input-file")) { std::vector<std::string> fs = vm["input-file"].as< std::vector<std::string> >(); for(std::string const & s : fs) { std::vector<std::string> v; stringutil::split(s, v, ":"); std::string filename, sample = ""; // in case someone passes a ":" assert(v.size() > 0); filename = v[0]; if(v.size() > 1) { sample = v[1]; } files.push_back(filename); samples.push_back(sample); } } if(files.size() == 0) { error("Please specify at least one input file."); } if (vm.count("output")) { out_bed = vm["output"].as< std::string >(); } else { out_bed = "-"; } if (vm.count("regions")) { regions_bed = vm["regions"].as< std::string >(); } if (vm.count("targets")) { targets_bed = vm["targets"].as< std::string >(); } if (vm.count("verbose")) { verbose = vm["verbose"].as<bool>(); } if (vm.count("location")) { stringutil::parsePos(vm["location"].as< std::string >(), chr, start, end); } if (vm.count("limit-records")) { rlimit = vm["limit-records"].as< int64_t >(); } if (vm.count("message-every")) { message = vm["message-every"].as< int64_t >(); } if (vm.count("apply-filters")) { apply_filters = vm["apply-filters"].as< bool >(); } if (vm.count("window")) { window = vm["window"].as< int64_t >(); } if (vm.count("nblocks")) { nblocks = vm["nblocks"].as< int >(); } if (vm.count("nvars")) { nvars = vm["nvars"].as< int >(); } } catch (po::error & e) { std::cerr << e.what() << "\n"; return 1; } catch(std::runtime_error & e) { std::cerr << e.what() << std::endl; return 1; } catch(std::logic_error & e) { std::cerr << e.what() << std::endl; return 1; } try { bcf_srs_t * reader = bcf_sr_init(); reader->require_index = 1; reader->collapse = COLLAPSE_NONE; reader->streaming = 0; if(!regions_bed.empty()) { int result = bcf_sr_set_regions(reader, regions_bed.c_str(), 1); if(result < 0) { error("Failed to set regions string %s.", regions_bed.c_str()); } } if(!targets_bed.empty()) { int result = bcf_sr_set_targets(reader, targets_bed.c_str(), 1, 1); if(result < 0) { error("Failed to set targets string %s.", targets_bed.c_str()); } } for(auto const & file : files) { if (!bcf_sr_add_reader(reader, file.c_str())) { error("Failed to open or file not indexed: %s\n", file.c_str()); } } bool stop_after_chr_change = false; if(!chr.empty()) { int success = 0; if(start < 0) { success = bcf_sr_seek(reader, chr.c_str(), 0); } else { success = bcf_sr_seek(reader, chr.c_str(), start); std::cerr << "starting at " << chr << ":" << start << "\n"; } if(success == -reader->nreaders) { // cannot seek -> return no output // write blocks if(out_bed == "-" || out_bed == "") { return 0; } else { if(verbose) { std::cerr << "Writing to " << out_bed << "\n"; } volatile std::ofstream f(out_bed.c_str()); return 0; } } stop_after_chr_change = true; } int64_t rcount = 0; int64_t last_end = -1; int64_t vars = 0, total_vars = 0; struct Breakpoint { std::string chr; int64_t pos; int64_t vars; }; std::list< Breakpoint > breakpoints; const auto add_bp = [&breakpoints, nvars, nblocks, &chr, &vars, verbose](int64_t bp) { if (vars > nvars) { if(verbose) { std::cerr << "Break point at " << chr << ":" << bp << " (" << vars << " variants)" << "\n"; } breakpoints.push_back(Breakpoint{chr, bp, vars}); vars = 0; } }; std::string firstchr; int nl = 1; while(nl) { nl = bcf_sr_next_line(reader); if (nl <= 0) { break; } if(rlimit != -1) { if(rcount >= rlimit) { break; } } std::string v_chr; int64_t v_pos = -1, v_end = -1; for(int isample = 0; isample < reader->nreaders; ++isample) { if(!bcf_sr_has_line(reader, isample)) { continue; } bcf_hdr_t * hdr = reader->readers[isample].header; bcf1_t * line = reader->readers[isample].buffer[0]; bcf_unpack(line, BCF_UN_FLT); if(apply_filters) { bool fail = false; for(int j = 0; j < line->d.n_flt; ++j) { std::string filter = "PASS"; int k = line->d.flt[j]; if(k >= 0) { filter = bcf_hdr_int2id(hdr, BCF_DT_ID, line->d.flt[j]); } if(filter != "PASS") { fail = true; break; } } // skip failing if(fail) { continue; } } bcf_unpack(line, BCF_UN_ALL); bool call_this_pos = false; for(int rsample = 0; rsample < line->n_sample; ++rsample) { int gts[MAX_GT]; int ngt = 0; bool phased = false; bcfhelpers::getGT(hdr, line, rsample, gts, ngt, phased); for(int j = 0; j < ngt; ++j) { if(gts[j] > 0) { call_this_pos = true; break; } } if(call_this_pos) { break; } } if(!call_this_pos) { continue; } v_chr = bcfhelpers::getChrom(hdr, line); // rely on synced_reader to give us records on the same chr int64_t this_v_pos = -1; int64_t this_v_end = -1; try { bcfhelpers::getLocation(hdr, line, this_v_pos, this_v_end); } catch(bcfhelpers::importexception const & e) { std::cerr << e.what() << "\n"; continue; } if(v_pos < 0) { v_pos = this_v_pos; } else { v_pos = std::min(this_v_pos, v_pos); } v_end = std::max(this_v_end, v_end); } if(v_chr.empty() || v_pos < 0 || v_end < 0) { continue; } if(end != -1 && ( (v_pos > end) || (chr != "" && v_chr != chr)) ) { break; } if(stop_after_chr_change && chr != "" && v_chr != chr) { break; } if (firstchr.size() == 0) { firstchr = v_chr; } if(chr != "" && v_chr != chr) { last_end = -1; } chr = v_chr; if(message > 0 && (rcount % message) == 0) { std::cerr << "From " << chr << ":" << last_end << " (" << breakpoints.size() << " bps, " << vars << " vars)" << " -- " << v_chr << ":" << v_pos << "-" << v_end << "\n"; } vars++; total_vars++; if(last_end >= 0 && v_pos > last_end + window) // can split here { add_bp(last_end); } last_end = std::max(last_end, v_end); ++rcount; } // write blocks std::ostream * outputfile = NULL; if(out_bed == "-" || out_bed == "") { outputfile = &std::cout; } else { if(verbose) { std::cerr << "Writing to " << out_bed << "\n"; } outputfile = new std::ofstream(out_bed.c_str()); } chr = firstchr; start = 0; int64_t vpb = 0; int64_t target_vpb = std::max(nvars, ((int)total_vars) / nblocks); if(end <= 0) { end = std::numeric_limits<int>::max(); } for (auto & b : breakpoints) { if (chr != b.chr) { *outputfile << chr << "\t" << start << "\t" << std::max(start + window + 1, end) << "\n"; chr = b.chr; start = 1; vpb = 0; } vpb += b.vars; if(vpb > target_vpb) { *outputfile << chr << "\t" << start << "\t" << b.pos + window + 1 << "\n"; start = b.pos + window + 1; vpb = 0; } } if(chr != "") { *outputfile << chr << "\t" << start << "\t" << std::max(start + window + 1, end) << "\n"; } if(out_bed != "-" && out_bed != "") { delete outputfile; } bcf_sr_destroy(reader); } catch(std::runtime_error & e) { std::cerr << e.what() << std::endl; return 1; } catch(std::logic_error & e) { std::cerr << e.what() << std::endl; return 1; } return 0; }
29.462687
170
0.43826
nh13
37e9182df25e9d343427151ede6c9cac2e904ccd
3,373
hxx
C++
admin/select/src/filtermanager.hxx
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
admin/select/src/filtermanager.hxx
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
admin/select/src/filtermanager.hxx
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
//+-------------------------------------------------------------------------- // // Microsoft Windows // Copyright (C) Microsoft Corporation, 1994 - 1998. // // File: FilterManager.hxx // // Contents: Declaration of class used to create LDAP and WinNT filters // // Classes: CFilterManager // // History: 02-24-2000 davidmun Created // //--------------------------------------------------------------------------- #ifndef __FILTER_MANAGER_HXX_ #define __FILTER_MANAGER_HXX_ #define DSOP_DOWNLEVEL_FILTER_BIT 0x80000000 enum DESCR_FOR { FOR_LOOK_FOR, FOR_CAPTION }; //+-------------------------------------------------------------------------- // // Class: CFilterManager (fm) // // Purpose: Maintain the user's filter flag selection for the current // scope by invoking the Look For dialog, provide access to // the filter flags from specified scopes, and generate // the WinNt and LDAP filters (which may invoke the internal // or external customizer). // // History: 05-24-2000 DavidMun Created // //--------------------------------------------------------------------------- class CFilterManager { public: CFilterManager( const CObjectPicker &rop); ~CFilterManager(); void DoLookForDialog( HWND hwndParent) const; void Clear(); String GetFilterDescription( HWND hwndDlg, DESCR_FOR Target) const; void HandleScopeChange( HWND hwndDlg) const; String GetLdapFilter( HWND hwnd, const CScope &Scope) const; void GetWinNtFilter( HWND hwnd, const CScope &Scope, vector<String> *pvs) const; ULONG GetCurScopeSelectedFilterFlags() const { return m_flCurFilterFlags; } HRESULT GetSelectedFilterFlags( HWND hwnd, const CScope &Scope, ULONG *pulFlags) const; void SetLookForDirty(bool bDirty)const { m_bLookForDirty = bDirty; } bool IsLookForDirty()const { return m_bLookForDirty; } private: CFilterManager & operator=(const CFilterManager &); String _GenerateGcFilter( HWND hwnd, const CGcScope &GcScope) const; String _GenerateCombinedGcFilter( VARIANT *pvarDomainSid, const String &strJoinedFilter, const String &strGcFilter) const; HRESULT _GetSelectedFilterFlags( HWND hwnd, const CScope &Scope, ULONG *pulFlags) const; String _GenerateUplevelGroupFilter( ULONG ulFlags) const; String _GenerateUplevelFilter( ULONG flFilter) const; ULONG _FlagsToGroupTypeBits( ULONG ulGroups) const; const CObjectPicker &m_rop; mutable ULONG m_flCurFilterFlags; // //This is true if Look For settings are changed by user. //Once the Look For settings are changed, we try to persist them //as user move from one scope to another, else we show default settings. // NTRAID#NTBUG9-301526-2001/03/28-hiteshr mutable bool m_bLookForDirty; }; #endif // __FILTER_MANAGER_HXX_
22.945578
78
0.546101
npocmaka
37f2405b71af9bcbca1a80d1a58f2ae5e2bdd00e
585
cpp
C++
node_modules/lzz-gyp/lzz-source/smtc_TmplFuncDefnEntity.cpp
SuperDizor/dizornator
9f57dbb3f6af80283b4d977612c95190a3d47900
[ "ISC" ]
3
2019-09-18T16:44:33.000Z
2021-03-29T13:45:27.000Z
node_modules/lzz-gyp/lzz-source/smtc_TmplFuncDefnEntity.cpp
SuperDizor/dizornator
9f57dbb3f6af80283b4d977612c95190a3d47900
[ "ISC" ]
null
null
null
node_modules/lzz-gyp/lzz-source/smtc_TmplFuncDefnEntity.cpp
SuperDizor/dizornator
9f57dbb3f6af80283b4d977612c95190a3d47900
[ "ISC" ]
2
2019-03-29T01:06:38.000Z
2019-09-18T16:44:34.000Z
// smtc_TmplFuncDefnEntity.cpp // #include "smtc_TmplFuncDefnEntity.h" #ifndef LZZ_ENABLE_INLINE #include "smtc_TmplFuncDefnEntity.inl" #endif // semantic #include "smtc_EntityVisitor.h" #define LZZ_INLINE inline namespace smtc { TmplFuncDefnEntity::TmplFuncDefnEntity (TmplFuncDefnPtr const & tmpl_func_defn) : m_tmpl_func_defn (tmpl_func_defn) {} } namespace smtc { TmplFuncDefnEntity::~ TmplFuncDefnEntity () {} } namespace smtc { void TmplFuncDefnEntity::accept (EntityVisitor const & visitor) const { visitor.visit (* this); } } #undef LZZ_INLINE
19.5
81
0.748718
SuperDizor
37f3093cb79be3be8dd4fc11c307eb79889b347e
1,870
cpp
C++
tools/qiangbao.cpp
WatorVapor/wai.native.wator
e048df159e2952c143f8832264b20da20dcd88fa
[ "MIT" ]
null
null
null
tools/qiangbao.cpp
WatorVapor/wai.native.wator
e048df159e2952c143f8832264b20da20dcd88fa
[ "MIT" ]
null
null
null
tools/qiangbao.cpp
WatorVapor/wai.native.wator
e048df159e2952c143f8832264b20da20dcd88fa
[ "MIT" ]
null
null
null
#include <algorithm> #include <iostream> #include <list> #include <map> #include <string> #include <thread> #include <vector> using namespace std; #include "ctrlclaw.hpp" #include "log.hpp" #include "qiangbaoword.hpp" #include "textpump.hpp" vector<string> parseUTF8(const string &words); void parseBytes(const vector<string> &Bytes, const string &text); static string longTxt( u8"它是由从地方到全球范围内几百万个私人的、学术界的、" u8"企业的和政府的网络所构成,通过电子," u8"无线和光纤网络技术等等一系列广泛的技术联系在一起。" u8"这种将计算机网络互相联接在一起的方法可称作“网络互联”," u8"在这基础上发展出覆盖全世界的全球性互联网络称互联网," u8"即是互相连接一起的网络。"); static string shortTxt( u8"人造卫星能够成功执行预定任务,单凭卫星本身是不行的," u8"而需要完整的卫星工程系统"); static string oneTxt(u8"它就要背负着积累于人世间的所有不快和仇恨恩怨"); static string bugTxt( u8",影片讲述了江湖三大高手之一的笑三少遭人陷害亡命天涯并" u8"追查事情真相的故事。"); int main(int ac, char *av[]) { QiangbaoWord qiangbao("./db/baidu.baike"); if (qiangbao.loadMaster(false) == false) { return 0; } auto learnQiangbao = [&](string wordStr, vector<string> word) { qiangbao.learn(word, wordStr); }; CtrlClaw claw; claw.claw(longTxt); claw.eachSentence(learnQiangbao); claw.claw(shortTxt); claw.eachSentence(learnQiangbao); claw.claw(oneTxt); claw.eachSentence(learnQiangbao); claw.claw(bugTxt); claw.eachSentence(learnQiangbao); qiangbao.unloadMaster(); return 0; } /* int main(int ac,char*av[]) { PhoenixWord phoenix("./db/baidu.baike"); if(phoenix.loadMaster()==false) { return 0; } auto learnPhoenix = [&](string wordStr, vector<string> word) { phoenix.learn(word,wordStr); }; CtrlClaw claw; auto clawText = [&](string &path,string &content) { DUMP_VAR(path); //DUMP_VAR(content); claw.claw(content); claw.eachSentence(learnPhoenix); }; TextPump txtPump; txtPump.eachTextFile("./url_crawl/textout/baike.baidu",clawText); phoenix.unloadMaster(); return 0; } */
22.261905
67
0.700535
WatorVapor
37f314c12b2a3eb0087b242bd4ce857c312b0939
668
cpp
C++
Fluid Render/Fluid Render/BilateralNormalFBO.cpp
freehyan/Graphics
a7b0f111c1012ae56a64e592489583a718eb5cfe
[ "MIT" ]
47
2017-07-05T04:03:16.000Z
2021-01-22T07:06:05.000Z
Fluid Render/Fluid Render/BilateralNormalFBO.cpp
freehyan/Graphics
a7b0f111c1012ae56a64e592489583a718eb5cfe
[ "MIT" ]
null
null
null
Fluid Render/Fluid Render/BilateralNormalFBO.cpp
freehyan/Graphics
a7b0f111c1012ae56a64e592489583a718eb5cfe
[ "MIT" ]
3
2017-08-23T12:52:16.000Z
2021-11-15T08:47:57.000Z
#include "BilateralNormalFBO.h" #include <Cooler/ProductFactory.h> Cooler::CProductFactory<CBilateralNormalFBO> theCreater("BILATERAL_NORMAL_FBO"); CBilateralNormalFBO::CBilateralNormalFBO() { } CBilateralNormalFBO::~CBilateralNormalFBO() { } //*********************************************************** //FUNCTION: void CBilateralNormalFBO::addTextureV(const std::string& vTexName, GLint vInternalFormat /* = GL_RGBA32F */, GLenum vFormat /* = GL_RGBA */) { if (vTexName == "tex_bilateral_normal") _generateTexture(m_BilateralNormalTex, vInternalFormat, vFormat); else std::cout << vTexName + " is not defined in the resource config file." << std::endl; }
29.043478
140
0.693114
freehyan
37fc8857262b0402b0b96098267c1617cb3f0a7d
221
hpp
C++
dep.hpp
imamhs/Lnect
af3e9a436ac8dad5c0f345fb2196243ad049c810
[ "Zlib", "MIT" ]
null
null
null
dep.hpp
imamhs/Lnect
af3e9a436ac8dad5c0f345fb2196243ad049c810
[ "Zlib", "MIT" ]
1
2019-03-17T17:18:31.000Z
2019-03-17T17:18:31.000Z
dep.hpp
imamhs/Lnect
af3e9a436ac8dad5c0f345fb2196243ad049c810
[ "Zlib", "MIT" ]
1
2020-12-18T10:36:41.000Z
2020-12-18T10:36:41.000Z
/* * File: dep.hpp * Author: imam * * Created on 6 January 2016, 9:16 AM */ #ifndef DEP_HPP #define DEP_HPP #define MAX_KINECTS 4 // maximum number of kinects for application to work on #endif /* DEP_HPP */
14.733333
79
0.660633
imamhs
37fc886bd3676bcf3af3a843d249e7f6e442dda0
23,799
cpp
C++
cppbwh_test.cpp
ntllct/CPPBWH
abae472ca70a5d75b0caf838a32f7c995a30e3c8
[ "MIT" ]
null
null
null
cppbwh_test.cpp
ntllct/CPPBWH
abae472ca70a5d75b0caf838a32f7c995a30e3c8
[ "MIT" ]
null
null
null
cppbwh_test.cpp
ntllct/CPPBWH
abae472ca70a5d75b0caf838a32f7c995a30e3c8
[ "MIT" ]
null
null
null
// Copyright (c) 2018 Alexander Alexeev [ntllct@protonmail.com] // g++ -std=c++14 -m64 -O2 -mavx cppbwh_test.cpp -o cppbwh_test #include <iostream> #include <cstddef> #include <iomanip> #include <cstring> #include <algorithm> #include <random> #include <chrono> #include "cppbwh.hpp" std::mt19937_64 random64; using namespace ntllct; void TEST( bool compare_result, const char* prefix ) { std::cout << prefix << ": " << "\033[1m"; if( compare_result ) std::cout << "\033[32m" << "OK!" << "\033[0m" << std::endl; else std::cout << "\033[31m" << "Failed!" << "\033[0m" << std::endl; } void test_xorswap() { size_t val1 = random64() >> 2; size_t val2 = random64() >> 2; size_t val3 = val1; size_t val4 = val2; unsigned long ul_val1 = val1; unsigned long ul_val2 = val2; unsigned long ul_val3 = val3; unsigned long ul_val4 = val4; unsigned int ui_val1 = val1; unsigned int ui_val2 = val2; unsigned int ui_val3 = val3; unsigned int ui_val4 = val4; unsigned short us_val1 = val1; unsigned short us_val2 = val2; unsigned short us_val3 = val3; unsigned short us_val4 = val4; unsigned char uc_val1 = val1; unsigned char uc_val2 = val2; unsigned char uc_val3 = val3; unsigned char uc_val4 = val4; long l_val1 = -val1; long l_val2 = val2; long l_val3 = -val3; long l_val4 = val4; int i_val1 = -val1; int i_val2 = val2; int i_val3 = -val3; int i_val4 = val4; short s_val1 = -val1; short s_val2 = val2; short s_val3 = -val3; short s_val4 = val4; char c_val1 = -val1; char c_val2 = val2; char c_val3 = -val3; char c_val4 = val4; cppbwh::xorswap( val1, val2 ); TEST( val1 == val4 && val2 == val3, "xorswap (size_t)" ); cppbwh::xorswap( ul_val1, ul_val2 ); TEST( ul_val1 == ul_val4 && ul_val2 == ul_val3, "xorswap (unsigned long)" ); cppbwh::xorswap( ui_val1, ui_val2 ); TEST( ui_val1 == ui_val4 && ui_val2 == ui_val3, "xorswap (unsigned int)" ); cppbwh::xorswap( us_val1, us_val2 ); TEST( us_val1 == us_val4 && us_val2 == us_val3, "xorswap (unsigned short)" ); cppbwh::xorswap( uc_val1, uc_val2 ); TEST( uc_val1 == uc_val4 && uc_val2 == uc_val3, "xorswap (unsigned char)" ); cppbwh::xorswap( l_val1, l_val2 ); TEST( l_val1 == l_val4 && l_val2 == l_val3, "xorswap (long)" ); cppbwh::xorswap( i_val1, i_val2 ); TEST( i_val1 == i_val4 && i_val2 == i_val3, "xorswap (int)" ); cppbwh::xorswap( s_val1, s_val2 ); TEST( s_val1 == s_val4 && s_val2 == s_val3, "xorswap (short)" ); cppbwh::xorswap( c_val1, c_val2 ); TEST( c_val1 == c_val4 && c_val2 == c_val3, "xorswap (char)" ); std::cout << std::endl; } void test_bit_reverse() { size_t val1 = random64(); unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; std::string bit_str1_; std::string bit_str2_; bit_str1_.clear(); bit_str2_.clear(); cppbwh::tobin( val1, bit_str1_ ); std::reverse( bit_str1_.begin(), bit_str1_.end() ); cppbwh::reverse( val1 ); cppbwh::tobin( val1, bit_str2_ ); TEST( bit_str1_.compare( bit_str2_ ) == 0, "reverse (size_t)" ); bit_str1_.clear(); bit_str2_.clear(); cppbwh::tobin( ul_val1, bit_str1_ ); std::reverse( bit_str1_.begin(), bit_str1_.end() ); cppbwh::reverse( ul_val1 ); cppbwh::tobin( ul_val1, bit_str2_ ); TEST( bit_str1_.compare( bit_str2_ ) == 0, "reverse (unsigned long)" ); bit_str1_.clear(); bit_str2_.clear(); cppbwh::tobin( ui_val1, bit_str1_ ); std::reverse( bit_str1_.begin(), bit_str1_.end() ); cppbwh::reverse( ui_val1 ); cppbwh::tobin( ui_val1, bit_str2_ ); TEST( bit_str1_.compare( bit_str2_ ) == 0, "reverse (unsigned int)" ); bit_str1_.clear(); bit_str2_.clear(); cppbwh::tobin( us_val1, bit_str1_ ); std::reverse( bit_str1_.begin(), bit_str1_.end() ); cppbwh::reverse( us_val1 ); cppbwh::tobin( us_val1, bit_str2_ ); TEST( bit_str1_.compare( bit_str2_ ) == 0, "reverse (unsigned short)" ); bit_str1_.clear(); bit_str2_.clear(); cppbwh::tobin( uc_val1, bit_str1_ ); std::reverse( bit_str1_.begin(), bit_str1_.end() ); cppbwh::reverse( uc_val1 ); cppbwh::tobin( uc_val1, bit_str2_ ); TEST( bit_str1_.compare( bit_str2_ ) == 0, "reverse (unsigned char)" ); std::cout << std::endl; } void test_lsb() { size_t val1 = random64(); val1 |= 1UL; val1 <<= 5; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; TEST( cppbwh::lsb( val1 ) == 1UL << 5, "lsb (size_t)" ); TEST( cppbwh::lsb( ul_val1 ) == 1UL << 5, "lsb (unsigned long)" ); TEST( cppbwh::lsb( ui_val1 ) == 1UL << 5, "lsb (unsigned int)" ); TEST( cppbwh::lsb( us_val1 ) == 1UL << 5, "lsb (unsigned short)" ); TEST( cppbwh::lsb( uc_val1 ) == 1UL << 5, "lsb (unsigned char)" ); std::cout << std::endl; } void test_tobin() { size_t val1 = 0b00000100'00000000'00000000'00001000'00000000'00000100'10000000'10010001; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; char buf_[65]{0}; cppbwh::tobin( val1, buf_, false ); TEST( strcmp( "00000100000000000000000000001000" "00000000000001001000000010010001", buf_ ) == 0, "tobin (size_t)" ); memset( buf_, 0, 65 ); cppbwh::tobin( ul_val1, buf_, false ); TEST( strcmp( "00000100000000000000000000001000" "00000000000001001000000010010001", buf_ ) == 0, "tobin (unsigned long)" ); memset( buf_, 0, 65 ); cppbwh::tobin( ui_val1, buf_, false ); TEST( strcmp( "00000000000001001000000010010001", buf_ ) == 0, "tobin (unsigned int)" ); memset( buf_, 0, 65 ); cppbwh::tobin( us_val1, buf_, false ); TEST( strcmp( "1000000010010001", buf_ ) == 0, "tobin (unsigned short)" ); memset( buf_, 0, 65 ); cppbwh::tobin( uc_val1, buf_, false ); TEST( strcmp( "10010001", buf_ ) == 0, "tobin (unsigned char)" ); memset( buf_, 0, 65 ); cppbwh::tobin( val1, buf_, true ); TEST( strcmp( "100000000000000000000001000" "00000000000001001000000010010001", buf_ ) == 0, "tobin (size_t)" ); memset( buf_, 0, 65 ); cppbwh::tobin( ul_val1, buf_, true ); TEST( strcmp( "100000000000000000000001000" "00000000000001001000000010010001", buf_ ) == 0, "tobin (unsigned long)" ); memset( buf_, 0, 65 ); cppbwh::tobin( ui_val1, buf_, true ); TEST( strcmp( "1001000000010010001", buf_ ) == 0, "tobin (unsigned int)" ); std::string bin_val_; cppbwh::tobin( val1, bin_val_, false ); TEST( strcmp( "00000100000000000000000000001000" "00000000000001001000000010010001", bin_val_.c_str() ) == 0, "tobin (size_t)" ); bin_val_.clear(); cppbwh::tobin( ul_val1, bin_val_, false ); TEST( strcmp( "00000100000000000000000000001000" "00000000000001001000000010010001", bin_val_.c_str() ) == 0, "tobin (unsigned long)" ); bin_val_.clear(); cppbwh::tobin( ui_val1, bin_val_, false ); TEST( strcmp( "00000000000001001000000010010001", bin_val_.c_str() ) == 0, "tobin (unsigned int)" ); bin_val_.clear(); cppbwh::tobin( us_val1, bin_val_, false ); TEST( strcmp( "1000000010010001", bin_val_.c_str() ) == 0, "tobin (unsigned short)" ); bin_val_.clear(); cppbwh::tobin( uc_val1, bin_val_, false ); TEST( strcmp( "10010001", bin_val_.c_str() ) == 0, "tobin (unsigned char)" ); bin_val_.clear(); cppbwh::tobin( val1, bin_val_, true ); TEST( strcmp( "100000000000000000000001000" "00000000000001001000000010010001", bin_val_.c_str() ) == 0, "tobin (size_t)" ); bin_val_.clear(); cppbwh::tobin( ul_val1, bin_val_, true ); TEST( strcmp( "100000000000000000000001000" "00000000000001001000000010010001", bin_val_.c_str() ) == 0, "tobin (unsigned long)" ); bin_val_.clear(); cppbwh::tobin( ui_val1, bin_val_, true ); TEST( strcmp( "1001000000010010001", bin_val_.c_str() ) == 0, "tobin (unsigned int)" ); std::cout << std::endl; } void test_swapn() { size_t val1 = 0b10101010'10101010'10101010'10101010'10101010'10101010'10101010'10101010; size_t val2 = 0b01010101'01010101'01010101'01010101'01010101'01010101'01010101'01010101; unsigned long ul_val1 = val1; unsigned long ul_val2 = val2; unsigned int ui_val1 = val1; unsigned int ui_val2 = val2; unsigned short us_val1 = val1; unsigned short us_val2 = val2; unsigned char uc_val1 = val1; unsigned char uc_val2 = val2; cppbwh::swapn( val1 ); TEST( val1 == val2, "swapn (size_t)" ); cppbwh::swapn( ul_val1 ); TEST( ul_val1 == ul_val2, "swapn (unsigned long)" ); cppbwh::swapn( ui_val1 ); TEST( ui_val1 == ui_val2, "swapn (unsigned int)" ); cppbwh::swapn( us_val1 ); TEST( us_val1 == us_val2, "swapn (unsigned short)" ); cppbwh::swapn( uc_val1 ); TEST( uc_val1 == uc_val2, "swapn (unsigned char)" ); val1 = 0b10101010'10101010'10101010'10101010'10101010'10101010'10101010'10011001; val2 = 0b01010101'01010101'01010101'01010101'01010101'01010101'01010101'01100110; ul_val1 = val1; ul_val2 = val2; ui_val1 = val1; ui_val2 = val2; us_val1 = val1; us_val2 = val2; uc_val1 = val1; uc_val2 = val2; cppbwh::swapn( val1 ); TEST( val1 == val2, "swapn (size_t)" ); cppbwh::swapn( ul_val1 ); TEST( ul_val1 == ul_val2, "swapn (unsigned long)" ); cppbwh::swapn( ui_val1 ); TEST( ui_val1 == ui_val2, "swapn (unsigned int)" ); cppbwh::swapn( us_val1 ); TEST( us_val1 == us_val2, "swapn (unsigned short)" ); cppbwh::swapn( uc_val1 ); TEST( uc_val1 == uc_val2, "swapn (unsigned char)" ); std::cout << std::endl; } void test_floor_log2() { for( unsigned int i = 0; i < 5; ++i ) { size_t val1 = random64(); unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; TEST( cppbwh::floor_log2( val1 ) == static_cast<size_t>( std::floor( std::log2( val1 ) ) ), "floor_log2 (size_t)" ); TEST( cppbwh::floor_log2( ul_val1 ) == static_cast<unsigned long>( std::floor( std::log2( ul_val1 ) ) ), "floor_log2 (unsigned long)" ); TEST( cppbwh::floor_log2( ui_val1 ) == static_cast<unsigned int>( std::floor( std::log2( ui_val1 ) ) ), "floor_log2 (unsigned int)" ); TEST( cppbwh::floor_log2( us_val1 ) == static_cast<unsigned short>( std::floor( std::log2( us_val1 ) ) ), "floor_log2 (unsigned short)" ); TEST( cppbwh::floor_log2( uc_val1 ) == static_cast<unsigned char>( std::floor( std::log2( uc_val1 ) ) ), "floor_log2 (unsigned char)" ); } std::cout << std::endl; } void test_mul_3_5() { for( unsigned int i = 0; i < 5; ++i ) { size_t val1 = random64() >> 2; val1 >>= 2; unsigned long ul_val1 = val1; //ul_val1 >>= 2; unsigned int ui_val1 = val1; ui_val1 >>= 2; unsigned short us_val1 = val1; us_val1 >>= 2; unsigned char uc_val1 = val1; uc_val1 >>= 2; std::cout << "Can be errors! (Round errors)" << std::endl; TEST( cppbwh::mul_3_5( val1 ) == static_cast<size_t>( std::floor( static_cast<long double>( val1 ) * 3.5 ) ), "test_mul_3_5 (size_t)" ); std::cout << cppbwh::mul_3_5( val1 ) << ", " << static_cast<size_t>( std::floor( static_cast<long double>( val1 ) * 3.5 ) ) << std::endl; TEST( cppbwh::mul_3_5( ul_val1 ) == static_cast<unsigned long>( std::floor( static_cast<long double>( ul_val1 ) * 3.5 ) ), "test_mul_3_5 (unsigned long)" ); TEST( cppbwh::mul_3_5( ui_val1 ) == static_cast<unsigned int>( std::floor( static_cast<long double>( ui_val1 ) * 3.5 ) ), "test_mul_3_5 (unsigned int)" ); TEST( cppbwh::mul_3_5( us_val1 ) == static_cast<unsigned short>( std::floor( static_cast<long double>( us_val1 ) * 3.5 ) ), "test_mul_3_5 (unsigned short)" ); TEST( cppbwh::mul_3_5( uc_val1 ) == static_cast<unsigned char>( std::floor( static_cast<long double>( uc_val1 ) * 3.5 ) ), "test_mul_3_5 (unsigned char)" ); } std::cout << std::endl; } void test_nlpo2() { size_t val1 = random64(); val1 |= 0x8000000000000000; val1 >>= 2; unsigned long ul_val1 = val1; ul_val1 |= 0x8000000000000000; ul_val1 >>= 2; unsigned int ui_val1 = val1; ui_val1 |= 0x80000000; ui_val1 >>= 2; unsigned short us_val1 = val1; us_val1 |= 0x8000; us_val1 >>= 2; unsigned char uc_val1 = val1; uc_val1 |= 0x80; uc_val1 >>= 2; TEST( cppbwh::nlpo2( val1 ) == 0x4000000000000000, "nlpo2 (size_t)" ); TEST( cppbwh::nlpo2( ul_val1 ) == 0x4000000000000000, "nlpo2 (unsigned long)" ); TEST( cppbwh::nlpo2( ui_val1 ) == 0x40000000, "nlpo2 (unsigned int)" ); TEST( cppbwh::nlpo2( us_val1 ) == 0x4000, "nlpo2 (unsigned short)" ); TEST( cppbwh::nlpo2( uc_val1 ) == 0x40, "nlpo2 (unsigned char)" ); std::cout << std::endl; } void test_msb() { size_t val1 = random64(); val1 |= 0x8000000000000000; val1 >>= 5; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; ui_val1 |= 0x80000000; ui_val1 >>= 5; unsigned short us_val1 = val1; us_val1 |= 0x8000; us_val1 >>= 5; unsigned char uc_val1 = val1; uc_val1 |= 0x80; uc_val1 >>= 5; TEST( cppbwh::msb( val1 ) == 0x8000000000000000 >> 5, "msb (size_t)" ); TEST( cppbwh::msb( ul_val1 ) == 0x8000000000000000 >> 5, "msb (unsigned long)" ); TEST( cppbwh::msb( ui_val1 ) == 0x80000000 >> 5, "msb (unsigned int)" ); TEST( cppbwh::msb( us_val1 ) == 0x8000 >> 5, "msb (unsigned short)" ); TEST( cppbwh::msb( uc_val1 ) == 0x80 >> 5, "msb (unsigned char)" ); std::cout << std::endl; } void test_rotate_left() { size_t val1 = 1UL << 6; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; std::cout << static_cast<unsigned int>( cppbwh::rotate_left( uc_val1, 7 ) ) << std::endl; TEST( cppbwh::rotate_left( val1, 7 ) == 1UL << 13, "rotate_left (size_t)" ); TEST( cppbwh::rotate_left( ul_val1, 7 ) == 1UL << 13, "rotate_left (unsigned long)" ); TEST( cppbwh::rotate_left( ui_val1, 7 ) == 1UL << 13, "rotate_left (unsigned int)" ); TEST( cppbwh::rotate_left( us_val1, 7 ) == 1UL << 13, "rotate_left (unsigned short)" ); TEST( cppbwh::rotate_left( uc_val1, 7 ) == 1UL << 5, "rotate_left (unsigned char)" ); val1 = 0b01010101'01010101'01010101'01010101'01010101'01010101'01010101'01100110; ul_val1 = val1; ui_val1 = val1; us_val1 = val1; uc_val1 = val1; std::cout << static_cast<unsigned int>( cppbwh::rotate_left( uc_val1, 7 ) ) << std::endl; TEST( cppbwh::rotate_left( val1, 7 ) == 0b1'01010101'01010101'01010101'01010101'01010101'01010101'01100110'0101010, "rotate_left (size_t)" ); TEST( cppbwh::rotate_left( ul_val1, 7 ) == 0b1'01010101'01010101'01010101'01010101'01010101'01010101'01100110'0101010, "rotate_left (unsigned long)" ); TEST( cppbwh::rotate_left( ui_val1, 7 ) == 0b1'01010101'01010101'01100110'0101010, "rotate_left (unsigned int)" ); TEST( cppbwh::rotate_left( us_val1, 7 ) == 0b1'01100110'0101010, "rotate_left (unsigned short)" ); TEST( cppbwh::rotate_left( uc_val1, 7 ) == 0b00110011, "rotate_left (unsigned char)" ); std::cout << std::endl; } void test_rotate_right() { size_t val1 = 1UL << 7; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; std::cout << static_cast<unsigned int>( cppbwh::rotate_right( uc_val1, 5 ) ) << std::endl; TEST( cppbwh::rotate_right( val1, 5 ) == 1UL << 2, "rotate_right (size_t)" ); TEST( cppbwh::rotate_right( ul_val1, 5 ) == 1UL << 2, "rotate_right (unsigned long)" ); TEST( cppbwh::rotate_right( ui_val1, 5 ) == 1UL << 2, "rotate_right (unsigned int)" ); TEST( cppbwh::rotate_right( us_val1, 5 ) == 1UL << 2, "rotate_right (unsigned short)" ); TEST( cppbwh::rotate_right( uc_val1, 5 ) == 1UL << 2, "rotate_right (unsigned char)" ); val1 = 0b01010101'01010101'01010101'01010101'01010101'01010101'01010101'01100110; ul_val1 = val1; ui_val1 = val1; us_val1 = val1; uc_val1 = val1; std::cout << static_cast<unsigned int>( cppbwh::rotate_right( uc_val1, 7 ) ) << std::endl; TEST( cppbwh::rotate_right( val1, 7 ) == 0b1100110'01010101'01010101'01010101'01010101'01010101'01010101'01010101'0, "rotate_right (size_t)" ); TEST( cppbwh::rotate_right( ul_val1, 7 ) == 0b1100110'01010101'01010101'01010101'01010101'01010101'01010101'01010101'0, "rotate_right (unsigned long)" ); TEST( cppbwh::rotate_right( ui_val1, 7 ) == 0b1100110'01010101'01010101'01010101'0, "rotate_right (unsigned int)" ); TEST( cppbwh::rotate_right( us_val1, 7 ) == 0b1100110'01010101'0, "rotate_right (unsigned short)" ); TEST( cppbwh::rotate_right( uc_val1, 7 ) == 0b11001100, "rotate_right (unsigned char)" ); std::cout << std::endl; } void test_hex_unhex() { size_t val1 = random64(); size_t val2 = 0; char buff1_[17]{0}; char buff2_[9]{0}; unsigned long ul_val1 = val1; unsigned long ul_val2 = 0; unsigned int ui_val1 = val1; unsigned int ui_val2 = 0; unsigned short us_val1 = val1; unsigned short us_val2 = 0; unsigned char uc_val1 = val1; unsigned char uc_val2 = 0; memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); const char str1_[] = "Test"; const char str2_[] = "Test!"; cppbwh::hex( str1_, strlen( str1_ ), buff1_ ); cppbwh::unhex( buff1_, strlen( buff1_ ), buff2_ ); TEST( strcmp( buff2_, str1_ ) == 0, "test_hex_unhex (str1_)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( str2_, strlen( str2_ ), buff1_ ); cppbwh::unhex( buff1_, strlen( buff1_ ), buff2_ ); TEST( strcmp( buff2_, str2_ ) == 0, "test_hex_unhex (str2_)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( val1, buff1_ ); cppbwh::unhex( buff1_, val2 ); TEST( val1 == val2, "test_hex_unhex (size_t)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( ul_val1, buff1_ ); cppbwh::unhex( buff1_, ul_val2 ); TEST( ul_val1 == ul_val2, "test_hex_unhex (unsigned long)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( ui_val1, buff1_ ); cppbwh::unhex( buff1_, ui_val2 ); TEST( ui_val1 == ui_val2, "test_hex_unhex (unsigned int)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( us_val1, buff1_ ); cppbwh::unhex( buff1_, us_val2 ); TEST( us_val1 == us_val2, "test_hex_unhex (unsigned short)" ); memset( buff1_, 0, sizeof( buff1_ ) ); memset( buff2_, 0, sizeof( buff2_ ) ); cppbwh::hex( uc_val1, buff1_ ); cppbwh::unhex( buff1_, uc_val2 ); TEST( uc_val1 == uc_val2, "test_hex_unhex (unsigned char)" ); std::string out_; memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( str1_, strlen( str1_ ), out_ ); cppbwh::unhex( out_.c_str(), out_.size(), buff2_ ); TEST( strcmp( buff2_, str1_ ) == 0, "test_hex_unhex (str1_)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( str2_, strlen( str2_ ), out_ ); cppbwh::unhex( out_.c_str(), out_.size(), buff2_ ); TEST( strcmp( buff2_, str2_ ) == 0, "test_hex_unhex (str2_)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( val1, out_ ); cppbwh::unhex( out_.c_str(), val2 ); TEST( val1 == val2, "test_hex_unhex (size_t)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( ul_val1, out_ ); cppbwh::unhex( out_.c_str(), ul_val2 ); TEST( ul_val1 == ul_val2, "test_hex_unhex (unsigned long)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( ui_val1, out_ ); cppbwh::unhex( out_.c_str(), ui_val2 ); TEST( ui_val1 == ui_val2, "test_hex_unhex (unsigned int)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( us_val1, out_ ); cppbwh::unhex( out_.c_str(), us_val2 ); TEST( us_val1 == us_val2, "test_hex_unhex (unsigned short)" ); out_.clear(); memset( buff1_, 0, sizeof( buff1_ ) ); cppbwh::hex( uc_val1, out_ ); cppbwh::unhex( out_.c_str(), uc_val2 ); TEST( uc_val1 == uc_val2, "test_hex_unhex (unsigned char)" ); std::cout << std::endl; } void test_bit_set_clear_check() { size_t val1 = 0; unsigned long ul_val1 = val1; unsigned int ui_val1 = val1; unsigned short us_val1 = val1; unsigned char uc_val1 = val1; size_t bpos_ = 0; for( unsigned int i = 0; i < 10; ++i ) { bpos_ = random64() % ( sizeof( size_t ) * 8 ); cppbwh::setbit( val1, bpos_ ); TEST( cppbwh::checkbit( val1, bpos_ ), "set and check bit (size_t)" ); cppbwh::clearbit( val1, bpos_ ); TEST( !cppbwh::checkbit( val1, bpos_ ), "clear and check bit (size_t)" ); bpos_ = random64() % ( sizeof( unsigned long ) * 8 ); cppbwh::setbit( ul_val1, bpos_ ); TEST( cppbwh::checkbit( ul_val1, bpos_ ), "set and check bit (unsigned long)" ); cppbwh::clearbit( ul_val1, bpos_ ); TEST( !cppbwh::checkbit( ul_val1, bpos_ ), "clear and check bit (unsigned long)" ); bpos_ = random64() % ( sizeof( unsigned int ) * 8 ); cppbwh::setbit( ui_val1, bpos_ ); TEST( cppbwh::checkbit( ui_val1, bpos_ ), "set and check bit (unsigned int)" ); cppbwh::clearbit( ui_val1, bpos_ ); TEST( !cppbwh::checkbit( ui_val1, bpos_ ), "clear and check bit (unsigned int)" ); bpos_ = random64() % ( sizeof( unsigned short ) * 8 ); cppbwh::setbit( us_val1, bpos_ ); TEST( cppbwh::checkbit( us_val1, bpos_ ), "set and check bit (unsigned short)" ); cppbwh::clearbit( us_val1, bpos_ ); TEST( !cppbwh::checkbit( us_val1, bpos_ ), "clear and check bit (unsigned short)" ); bpos_ = random64() % ( sizeof( unsigned char ) * 8 ); cppbwh::setbit( uc_val1, bpos_ ); TEST( cppbwh::checkbit( uc_val1, bpos_ ), "set and check bit (unsigned char)" ); cppbwh::clearbit( uc_val1, bpos_ ); TEST( !cppbwh::checkbit( uc_val1, bpos_ ), "clear and check bit (unsigned char)" ); } val1 = 0b00100010'00100100'10010000'0010000'00100100'00100001'00010000'01000000; size_t val2 = 0b00100010'00100100'10010000'0010000'00100100'00100001'00010000'01000000; ul_val1 = val1; unsigned long ul_val2 = val1; ui_val1 = val1; unsigned int ui_val2 = val1; us_val1 = val1; unsigned short us_val2 = val1; uc_val1 = val1; unsigned char uc_val2 = val1; cppbwh::setbit( val1, 62 ); TEST( cppbwh::checkbit( val1, 62 ), "set and check bit (size_t)" ); cppbwh::clearbit( val1, 62 ); TEST( val1 == val2, "clear and check bit (size_t)" ); cppbwh::setbit( ul_val1, 59 ); TEST( cppbwh::checkbit( ul_val1, 59 ), "set and check bit (unsigned long)" ); cppbwh::clearbit( ul_val1, 59 ); TEST( ul_val1 == ul_val2, "clear and check bit (unsigned long)" ); cppbwh::setbit( ui_val1, 30 ); TEST( cppbwh::checkbit( ui_val1, 30 ), "set and check bit (unsigned int)" ); cppbwh::clearbit( ui_val1, 30 ); TEST( ui_val1 == ui_val2, "clear and check bit (unsigned int)" ); cppbwh::setbit( us_val1, 13 ); TEST( cppbwh::checkbit( us_val1, 13 ), "set and check bit (unsigned short)" ); cppbwh::clearbit( us_val1, 13 ); TEST( us_val1 == us_val2, "clear and check bit (unsigned short)" ); cppbwh::setbit( uc_val1, 4 ); TEST( cppbwh::checkbit( uc_val1, 4 ), "set and check bit (unsigned char)" ); cppbwh::clearbit( uc_val1, 4 ); TEST( uc_val1 == uc_val2, "clear and check bit (unsigned char)" ); } int main() { std::chrono::high_resolution_clock::time_point d_ = std::chrono::high_resolution_clock::now(); unsigned seed_ = d_.time_since_epoch().count(); random64.seed( seed_ ); test_xorswap(); test_bit_reverse(); test_lsb(); test_tobin(); test_swapn(); test_floor_log2(); test_mul_3_5(); test_nlpo2(); test_msb(); test_rotate_left(); test_rotate_right(); test_hex_unhex(); test_bit_set_clear_check(); return( EXIT_SUCCESS ); }
32.962604
155
0.650447
ntllct
37fd30c0d1ecdcd7e9a26af19cdc641a1a2dde06
3,571
cpp
C++
2021A/DirectX/Exp_3/Draw_Index/MyD3D.cpp
Magic-Xin/Luogu
d8f1b4461f33f946c0a9ce4d36f1e5369518b7a6
[ "MIT" ]
15
2020-10-08T06:59:38.000Z
2021-11-30T11:20:22.000Z
2021A/DirectX/Exp_3/Draw_Index/MyD3D.cpp
Magic-Xin/Luogu
d8f1b4461f33f946c0a9ce4d36f1e5369518b7a6
[ "MIT" ]
1
2022-03-12T01:00:59.000Z
2022-03-12T01:00:59.000Z
2021A/DirectX/Exp_3/Draw_Index/MyD3D.cpp
Magic-Xin/Luogu
d8f1b4461f33f946c0a9ce4d36f1e5369518b7a6
[ "MIT" ]
2
2021-02-08T11:30:20.000Z
2021-05-31T06:47:34.000Z
////////////////////////////////////////////////////////////////////////////////////////////////// // // File: MyD3D.cpp // // Author: Song Wei (C) All Rights Reserved // // System: 3.20 GHz Intel® Core™ Quad CPU, a GeForce GT 770 graphics card, 4 GB RAM, Windows 7. // // Desc: Provides utility functions for simplifying common tasks. // ////////////////////////////////////////////////////////////////////////////////////////////////// #include "MyD3D.h" MyD3D::MyD3D() { } MyD3D::~MyD3D() { } bool MyD3D::CreateDevice(HINSTANCE hInstance, int _width, int _height) { d_width = _width; d_height = _height; if(!InitWindow(hInstance, _width, _height, true)) { MessageBox(0, "InitD3D() - FAILED", 0, 0); return 0; } if(!InitD3D(hInstance, _width, _height, true, D3DDEVTYPE_HAL, &p_Device)) { MessageBox(0, "InitD3D() - FAILED", 0, 0); return 0; } return true; } bool MyD3D::Initialize() { // Initialize VirtualCamera. position = D3DXVECTOR3(0.0f, -3.0f, -7.0f); target = D3DXVECTOR3(0.0f, 0.0f, 0.0f); up = D3DXVECTOR3(0.0f, 1.0f, 0.0f); this->UpdateCamera(); //create objects //d3d_square.CreateBuffer(p_Device); //d3d_square.SetTranslation(D3DXVECTOR3(-1.5f, 0.0f,0)); d3d_plane.CreateBuffer(p_Device, 20, 20, 1); //d3d_plane.SetTranslation(D3DXVECTOR3(1.5f, 0.0f,0)); d3d_cube.CreateBuffer(p_Device); return true; } void MyD3D::FrameMove(float timeDelta) { if (GetAsyncKeyState(VK_UP) & 0x8000f) { d3d_cube.v_Translate += D3DXVECTOR3(0.0f, 1.0f * timeDelta, 0.0f); d3d_cube.SetTranslation(d3d_cube.v_Translate); this->position += D3DXVECTOR3(0.0f, 1.0f * timeDelta, 0.0f); this->target += D3DXVECTOR3(0.0f, 1.0f * timeDelta, 0.0f); this->UpdateCamera(); } if (GetAsyncKeyState(VK_DOWN) & 0x8000f) { d3d_cube.v_Translate -= D3DXVECTOR3(0.0f, 1.0f * timeDelta, 0.0f); d3d_cube.SetTranslation(d3d_cube.v_Translate); this->position -= D3DXVECTOR3(0.0f, 1.0f * timeDelta, 0.0f); this->target -= D3DXVECTOR3(0.0f, 1.0f * timeDelta, 0.0f); this->UpdateCamera(); } if (GetAsyncKeyState(VK_LEFT) & 0x8000f) { d3d_cube.v_Translate -= D3DXVECTOR3(1.0f * timeDelta, 0.0f, 0.0f); d3d_cube.SetTranslation(d3d_cube.v_Translate); this->position -= D3DXVECTOR3(1.0f * timeDelta, 0.0f, 0.0f); this->target -= D3DXVECTOR3(1.0f * timeDelta, 0.0f, 0.0f); this->UpdateCamera(); } if (GetAsyncKeyState(VK_RIGHT) & 0x8000f) { d3d_cube.v_Translate += D3DXVECTOR3(1.0f * timeDelta, 0.0f, 0.0f); d3d_cube.SetTranslation(d3d_cube.v_Translate); this->position += D3DXVECTOR3(1.0f * timeDelta, 0.0f, 0.0f); this->target += D3DXVECTOR3(1.0f * timeDelta, 0.0f, 0.0f); this->UpdateCamera(); } } bool MyD3D::Render() { if( p_Device ) { // Set back buffer - 0xffffffff (white) //Set each pixel on the depth buffer to a value of 1.0. p_Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0); p_Device->BeginScene(); //drawing //d3d_square.Render(p_Device); d3d_plane.Render(p_Device); d3d_cube.Render(p_Device); p_Device->EndScene(); // Swap the back and front buffers. p_Device->Present(0, 0, 0, 0); } return true; } void MyD3D::UpdateCamera() { D3DXMatrixLookAtLH(&V, &position, &target, &up); p_Device->SetTransform(D3DTS_VIEW, &V); D3DXMATRIX proj; D3DXMatrixPerspectiveFovLH( &proj, D3DXToRadian(90), // 90 - degree (float)d_width / (float)d_height, 1.0f, 1000.0f); p_Device->SetTransform(D3DTS_PROJECTION, &proj); } void MyD3D::Release() { } IDirect3DDevice9* MyD3D::getDevice() { return p_Device; }
23.649007
99
0.640997
Magic-Xin
37fde8a751c3cdff49d8ef0ff9b6e84bb32c1d1f
242
hpp
C++
include/Pomdog/Math/PlaneIntersectionType.hpp
ValtoForks/pomdog
73798ae5f4a4c3b9b1e1e96239187c4b842c93b2
[ "MIT" ]
null
null
null
include/Pomdog/Math/PlaneIntersectionType.hpp
ValtoForks/pomdog
73798ae5f4a4c3b9b1e1e96239187c4b842c93b2
[ "MIT" ]
null
null
null
include/Pomdog/Math/PlaneIntersectionType.hpp
ValtoForks/pomdog
73798ae5f4a4c3b9b1e1e96239187c4b842c93b2
[ "MIT" ]
null
null
null
// Copyright (c) 2013-2018 mogemimi. Distributed under the MIT license. #pragma once #include <cstdint> namespace Pomdog { enum class PlaneIntersectionType : std::uint8_t { Front, Back, Intersecting, }; } // namespace Pomdog
15.125
71
0.702479
ValtoForks
53000f9a0ce22b21078b06f1b9ab11e95d0a820f
299
cpp
C++
C-Plus-Plus/Cstring/strcpy.cpp
19-1-skku-oss/2019-1-OSS-L2
40cef694a9442b983da080d23913f34641b2fa4d
[ "MIT" ]
null
null
null
C-Plus-Plus/Cstring/strcpy.cpp
19-1-skku-oss/2019-1-OSS-L2
40cef694a9442b983da080d23913f34641b2fa4d
[ "MIT" ]
25
2019-05-28T09:49:06.000Z
2019-06-07T14:27:53.000Z
C-Plus-Plus/Cstring/strcpy.cpp
19-1-skku-oss/2019-1-OSS-L2
40cef694a9442b983da080d23913f34641b2fa4d
[ "MIT" ]
1
2019-12-08T11:00:31.000Z
2019-12-08T11:00:31.000Z
#include <iostream> using namespace std; char *strcpy(char *dest, char *source) { int i; for ( i = 0; source[i]; i++) dest[i] = source[i]; dest[i] = NULL; return dest; } int main() { char input[100]; cin >> input; char dest[100]; strcpy(dest, input); cout << dest << endl; return 0; }
13.590909
38
0.602007
19-1-skku-oss
53012f959af5c2219f32f43974608addf2b5c66e
3,134
cpp
C++
prog/c-cpp/chat_software_tuto_zero/chat_client/tutoZero_chat_Network/form.cpp
gribdesbois/prog-backup
a394a392d32c550caf97119456aec1546bc8fbe1
[ "MIT" ]
null
null
null
prog/c-cpp/chat_software_tuto_zero/chat_client/tutoZero_chat_Network/form.cpp
gribdesbois/prog-backup
a394a392d32c550caf97119456aec1546bc8fbe1
[ "MIT" ]
null
null
null
prog/c-cpp/chat_software_tuto_zero/chat_client/tutoZero_chat_Network/form.cpp
gribdesbois/prog-backup
a394a392d32c550caf97119456aec1546bc8fbe1
[ "MIT" ]
null
null
null
#include "form.h" #include "ui_form.h" Form::Form(QWidget *parent) : QWidget(parent), ui(new Ui::Form) { ui->setupUi(this); socket = new QTcpSocket(this); connect(socket, SIGNAL(readyRead()), this, SLOT(donneesRecues())); connect(socket, SIGNAL(connected()), this, SLOT(connecte())); connect(socket, SIGNAL(disconnected()), this, SLOT(deconnecte())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(erreurSocket(QAbstractSocket::SocketError))); tailleMessage = 0; } Form::~Form() { delete ui; } // Tentative de connexion au serveur void FenClient::on_boutonConnexion_clicked() { // On annonce sur la fenêtre qu'on est en train de se connecter listeMessages->append(tr("<em>Tentative de connexion en cours...</em>")); boutonConnexion->setEnabled(false); socket->abort(); // On désactive les connexions précédentes s'il y en a socket->connectToHost(serveurIP->text(), serveurPort->value()); // On se connecte au serveur demandé } // Envoi d'un message au serveur void FenClient::on_boutonEnvoyer_clicked() { QByteArray paquet; QDataStream out(&paquet, QIODevice::WriteOnly); // On prépare le paquet à envoyer QString messageAEnvoyer = tr("<strong>") + pseudo->text() +tr("</strong> : ") + message->text(); out << (quint16) 0; out << messageAEnvoyer; out.device()->seek(0); out << (quint16) (paquet.size() - sizeof(quint16)); socket->write(paquet); // On envoie le paquet message->clear(); // On vide la zone d'écriture du message message->setFocus(); // Et on remet le curseur à l'intérieur } // Appuyer sur la touche Entrée a le même effet que cliquer sur le bouton "Envoyer" void FenClient::on_message_returnPressed() { on_boutonEnvoyer_clicked(); } // Ce slot est appelé lorsque la connexion au serveur a réussi void FenClient::connecte() { listeMessages->append(tr("<em>Connexion réussie !</em>")); boutonConnexion->setEnabled(true); } // Ce slot est appelé lorsqu'on est déconnecté du serveur void FenClient::deconnecte() { listeMessages->append(tr("<em>Déconnecté du serveur</em>")); } // Ce slot est appelé lorsqu'il y a une erreur void FenClient::erreurSocket(QAbstractSocket::SocketError erreur) { switch(erreur) // On affiche un message différent selon l'erreur qu'on nous indique { case QAbstractSocket::HostNotFoundError: listeMessages->append(tr("<em>ERREUR : le serveur n'a pas pu être trouvé. Vérifiez l'IP et le port.</em>")); break; case QAbstractSocket::ConnectionRefusedError: listeMessages->append(tr("<em>ERREUR : le serveur a refusé la connexion. Vérifiez si le programme \"serveur\" a bien été lancé. Vérifiez aussi l'IP et le port.</em>")); break; case QAbstractSocket::RemoteHostClosedError: listeMessages->append(tr("<em>ERREUR : le serveur a coupé la connexion.</em>")); break; default: listeMessages->append(tr("<em>ERREUR : ") + socket->errorString() + tr("</em>")); } boutonConnexion->setEnabled(true); }
31.34
180
0.671666
gribdesbois
53013599454db24ddbae543202649f4b0f74a08c
10,674
hpp
C++
Lib/Chip/Unknown/STMicro/STM32F334x/HRTIM_Master.hpp
cjsmeele/Kvasir
c8d2acd8313ae52d78259ee2d409b963925f77d7
[ "Apache-2.0" ]
376
2015-07-17T01:41:20.000Z
2022-03-26T04:02:49.000Z
Lib/Chip/Unknown/STMicro/STM32F334x/HRTIM_Master.hpp
cjsmeele/Kvasir
c8d2acd8313ae52d78259ee2d409b963925f77d7
[ "Apache-2.0" ]
59
2015-07-03T21:30:13.000Z
2021-03-05T11:30:08.000Z
Lib/Chip/Unknown/STMicro/STM32F334x/HRTIM_Master.hpp
cjsmeele/Kvasir
c8d2acd8313ae52d78259ee2d409b963925f77d7
[ "Apache-2.0" ]
53
2015-07-14T12:17:06.000Z
2021-06-04T07:28:40.000Z
#pragma once #include <Register/Utility.hpp> namespace Kvasir { //High Resolution Timer: Master Timers namespace HrtimMasterMcr{ ///<Master Timer Control Register using Addr = Register::Address<0x40017400,0x11c000c0,0x00000000,unsigned>; ///Burst DMA Update constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,30),Register::ReadWriteAccess,unsigned> brstdma{}; ///Master Timer Repetition update constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,unsigned> mrepu{}; ///Preload enable constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,unsigned> preen{}; ///AC Synchronization constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,25),Register::ReadWriteAccess,unsigned> dacsync{}; ///Timer E counter enable constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,unsigned> tecen{}; ///Timer D counter enable constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> tdcen{}; ///Timer C counter enable constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,unsigned> tccen{}; ///Timer B counter enable constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,unsigned> tbcen{}; ///Timer A counter enable constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,unsigned> tacen{}; ///Master Counter enable constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,unsigned> mcen{}; ///Synchronization source constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,14),Register::ReadWriteAccess,unsigned> syncSrc{}; ///Synchronization output constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> syncOut{}; ///Synchronization Starts Master constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,unsigned> syncstrtm{}; ///Synchronization Resets Master constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,unsigned> syncrstm{}; ///ynchronization input constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,8),Register::ReadWriteAccess,unsigned> syncIn{}; ///Half mode enable constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> half{}; ///Master Re-triggerable mode constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> retrig{}; ///Master Continuous mode constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> cont{}; ///HRTIM Master Clock prescaler constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,0),Register::ReadWriteAccess,unsigned> ckPsc{}; } namespace HrtimMasterMisr{ ///<Master Timer Interrupt Status Register using Addr = Register::Address<0x40017404,0xffffff80,0x00000000,unsigned>; ///Master Update Interrupt Flag constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,unsigned> mupd{}; ///Sync Input Interrupt Flag constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> sync{}; ///Master Repetition Interrupt Flag constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> mrep{}; ///Master Compare 4 Interrupt Flag constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> mcmp4{}; ///Master Compare 3 Interrupt Flag constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> mcmp3{}; ///Master Compare 2 Interrupt Flag constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> mcmp2{}; ///Master Compare 1 Interrupt Flag constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> mcmp1{}; } namespace HrtimMasterMicr{ ///<Master Timer Interrupt Clear Register using Addr = Register::Address<0x40017408,0xffffff80,0x00000000,unsigned>; ///Master update Interrupt flag clear constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,unsigned> mupdc{}; ///Sync Input Interrupt flag clear constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> syncc{}; ///Repetition Interrupt flag clear constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> mrepc{}; ///Master Compare 4 Interrupt flag clear constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> mcmp4c{}; ///Master Compare 3 Interrupt flag clear constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> mcmp3c{}; ///Master Compare 2 Interrupt flag clear constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> mcmp2c{}; ///Master Compare 1 Interrupt flag clear constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> mcmp1c{}; } namespace HrtimMasterMdier4{ ///<MDIER4 using Addr = Register::Address<0x4001740c,0xff80ff80,0x00000000,unsigned>; ///MUPDDE constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,unsigned> mupdde{}; ///SYNCDE constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,unsigned> syncde{}; ///MREPDE constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> mrepde{}; ///MCMP4DE constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,unsigned> mcmp4de{}; ///MCMP3DE constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,unsigned> mcmp3de{}; ///MCMP2DE constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,unsigned> mcmp2de{}; ///MCMP1DE constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,unsigned> mcmp1de{}; ///MUPDIE constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,unsigned> mupdie{}; ///SYNCIE constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> syncie{}; ///MREPIE constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> mrepie{}; ///MCMP4IE constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> mcmp4ie{}; ///MCMP3IE constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> mcmp3ie{}; ///MCMP2IE constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> mcmp2ie{}; ///MCMP1IE constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> mcmp1ie{}; } namespace HrtimMasterMcntr{ ///<Master Timer Counter Register using Addr = Register::Address<0x40017410,0xffff0000,0x00000000,unsigned>; ///Counter value constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> mcnt{}; } namespace HrtimMasterMper{ ///<Master Timer Period Register using Addr = Register::Address<0x40017414,0xffff0000,0x00000000,unsigned>; ///Master Timer Period value constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> mper{}; } namespace HrtimMasterMrep{ ///<Master Timer Repetition Register using Addr = Register::Address<0x40017418,0xffffff00,0x00000000,unsigned>; ///Master Timer Repetition counter value constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> mrep{}; } namespace HrtimMasterMcmp1r{ ///<Master Timer Compare 1 Register using Addr = Register::Address<0x4001741c,0xffff0000,0x00000000,unsigned>; ///Master Timer Compare 1 value constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> mcmp1{}; } namespace HrtimMasterMcmp2r{ ///<Master Timer Compare 2 Register using Addr = Register::Address<0x40017424,0xffff0000,0x00000000,unsigned>; ///Master Timer Compare 2 value constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> mcmp2{}; } namespace HrtimMasterMcmp3r{ ///<Master Timer Compare 3 Register using Addr = Register::Address<0x40017428,0xffff0000,0x00000000,unsigned>; ///Master Timer Compare 3 value constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> mcmp3{}; } namespace HrtimMasterMcmp4r{ ///<Master Timer Compare 4 Register using Addr = Register::Address<0x4001742c,0xffff0000,0x00000000,unsigned>; ///Master Timer Compare 4 value constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> mcmp4{}; } }
72.612245
127
0.699082
cjsmeele
530167d404dee6c84a3bb28d489f71c1f73ad6f5
934
cpp
C++
kernel/hw/pc/idt/idt.cpp
MTGos/mtgos
270f4932565eb3fe074cacc8c55c41103fa0a371
[ "BSD-2-Clause" ]
2
2018-01-04T18:11:39.000Z
2020-03-12T17:54:13.000Z
kernel/hw/pc/idt/idt.cpp
MTGos/kernel
270f4932565eb3fe074cacc8c55c41103fa0a371
[ "BSD-2-Clause" ]
10
2017-02-05T11:09:45.000Z
2017-02-08T13:42:14.000Z
kernel/hw/pc/idt/idt.cpp
MTGos/kernel
270f4932565eb3fe074cacc8c55c41103fa0a371
[ "BSD-2-Clause" ]
null
null
null
#include "idt.hpp" extern "C" void intr_stub_0(); IDT_entry entries[256]; void setIDTEntry(int i, void *entry) { uintptr_t p = (uintptr_t)entry; entries[i].offset0 = (uint16_t)p; p >>= 16; #ifndef __x86_64__ entries[i].selector = 0x8; #else entries[i].selector = 0x28; #endif entries[i].zero = 0; entries[i].type = 0b1110; entries[i].storageSeg = false; entries[i].dpl = 3; entries[i].used = true; entries[i].offset1 = (uint16_t)p; p >>= 16; #ifdef __x86_64__ entries[i].offset2 = (uint32_t)p; entries[i].zero2 = 0; #endif } void initIDT() { char *start_vectors = (char *)&intr_stub_0; for (int i = 0; i < 256; i++) setIDTEntry(i, start_vectors + 16 * i); struct { uint16_t size; IDT_entry *off; } __attribute__((packed)) idtr; idtr.size = sizeof(entries); idtr.off = (IDT_entry *)(&entries); asm volatile("lidt %0" : : "m"(idtr)); }
25.944444
73
0.605996
MTGos
5303243764d7f79279fe5347e66b77e1a5887c71
14,591
cpp
C++
core/thirdparty/ovf/src/ovf.cpp
ddkn/spirit
8e51bcdd78ee05d433d000c7e389fe1e6c3716bc
[ "MIT" ]
92
2016-10-02T16:17:27.000Z
2022-02-22T11:23:49.000Z
core/thirdparty/ovf/src/ovf.cpp
ddkn/spirit
8e51bcdd78ee05d433d000c7e389fe1e6c3716bc
[ "MIT" ]
590
2016-09-24T12:46:36.000Z
2022-03-24T18:27:18.000Z
core/thirdparty/ovf/src/ovf.cpp
ddkn/spirit
8e51bcdd78ee05d433d000c7e389fe1e6c3716bc
[ "MIT" ]
46
2016-09-26T07:20:17.000Z
2022-02-17T19:55:17.000Z
#include "ovf.h" #include <detail/helpers.hpp> #include <detail/parse.hpp> #include <detail/write.hpp> #include <fmt/format.h> void ovf_file_initialize(struct ovf_file * ovf_file_ptr, const char * filename) try { // Initialize the struct ovf_file_ptr->file_name = strdup(filename); ovf_file_ptr->version = 0, ovf_file_ptr->found = false; ovf_file_ptr->is_ovf = false; ovf_file_ptr->n_segments = 0; ovf_file_ptr->_state = new parser_state; // Check if the file exists std::fstream filestream( filename ); ovf_file_ptr->found = filestream.is_open(); filestream.close(); // Parse the overall header and do the initial parse of segments if( ovf_file_ptr->found ) ovf::detail::parse::initial(*ovf_file_ptr); } catch( ... ) { } struct ovf_file * ovf_open(const char * filename) try { // Initialize the struct struct ovf_file * ovf_file_ptr = new ovf_file; ovf_file_initialize(ovf_file_ptr, filename); return ovf_file_ptr; } catch( ... ) { return nullptr; } void ovf_segment_initialize(struct ovf_segment * ovf_segment_ptr) try { ovf_segment_ptr->title = const_cast<char *>(""); ovf_segment_ptr->comment = const_cast<char *>(""); ovf_segment_ptr->valuedim = 0; ovf_segment_ptr->valueunits = const_cast<char *>(""); ovf_segment_ptr->valuelabels = const_cast<char *>(""); ovf_segment_ptr->meshtype = const_cast<char *>(""); ovf_segment_ptr->meshunit = const_cast<char *>(""); ovf_segment_ptr->pointcount = 0; ovf_segment_ptr->n_cells[0] = 0; ovf_segment_ptr->n_cells[1] = 0; ovf_segment_ptr->n_cells[2] = 0; ovf_segment_ptr->N = 0; ovf_segment_ptr->step_size[0] = 0; ovf_segment_ptr->step_size[1] = 0; ovf_segment_ptr->step_size[2] = 0; ovf_segment_ptr->bounds_min[0] = 0; ovf_segment_ptr->bounds_min[1] = 0; ovf_segment_ptr->bounds_min[2] = 0; ovf_segment_ptr->bounds_max[0] = 0; ovf_segment_ptr->bounds_max[1] = 0; ovf_segment_ptr->bounds_max[2] = 0; ovf_segment_ptr->lattice_constant = 0; ovf_segment_ptr->origin[0] = 0; ovf_segment_ptr->origin[1] = 0; ovf_segment_ptr->origin[2] = 0; } catch( ... ) { } struct ovf_segment * ovf_segment_create() try { struct ovf_segment * ovf_segment_ptr = new ovf_segment; ovf_segment_initialize(ovf_segment_ptr); return ovf_segment_ptr; } catch( ... ) { return nullptr; } bool check_segment(const ovf_segment * segment) try { if( !segment->title ) return false; if( !segment->comment ) return false; if( !segment->title ) return false; return true; } catch( ... ) { return false; } int ovf_read_segment_header(struct ovf_file * ovf_file_ptr, int index, struct ovf_segment *segment) try { if( !ovf_file_ptr ) return OVF_ERROR; if( !segment ) { ovf_file_ptr->_state->message_latest = "libovf ovf_read_segment_header: invalid segment pointer"; return OVF_ERROR; } if( !ovf_file_ptr->found ) { ovf_file_ptr->_state->message_latest = fmt::format( "libovf ovf_read_segment_header: file \'{}\' does not exist...", ovf_file_ptr->file_name); return OVF_ERROR; } if( !ovf_file_ptr->is_ovf ) { ovf_file_ptr->_state->message_latest = fmt::format( "libovf ovf_read_segment_header: file \'{}\' is not ovf...", ovf_file_ptr->file_name); return OVF_ERROR; } if( index < 0 ) { ovf_file_ptr->_state->message_latest = fmt::format( "libovf ovf_read_segment_header: invalid index ({}) < 0...", index, ovf_file_ptr->n_segments, ovf_file_ptr->file_name); return OVF_ERROR; } if( index >= ovf_file_ptr->n_segments ) { ovf_file_ptr->_state->message_latest = fmt::format( "libovf ovf_read_segment_header: index ({}) >= n_segments ({}) of file \'{}\'...", index, ovf_file_ptr->n_segments, ovf_file_ptr->file_name); return OVF_ERROR; } int retcode = ovf::detail::parse::segment_header( *ovf_file_ptr, index, *segment ); if (retcode != OVF_OK) ovf_file_ptr->_state->message_latest += "\novf_read_segment_header failed."; return retcode; } catch( ... ) { return OVF_ERROR; } int ovf_read_segment_data_4(struct ovf_file *ovf_file_ptr, int index, const struct ovf_segment *segment, float *data) try { if( !ovf_file_ptr ) return OVF_ERROR; if( !segment ) { ovf_file_ptr->_state->message_latest = "libovf ovf_read_segment_data_4: invalid segment pointer"; return OVF_ERROR; } if( !check_segment(segment) ) { ovf_file_ptr->_state->message_latest = "libovf ovf_read_segment_data_4: segment not correctly initialized"; return OVF_ERROR; } if( !data ) { ovf_file_ptr->_state->message_latest = "libovf ovf_read_segment_data_4: invalid data pointer"; return OVF_ERROR; } if( !ovf_file_ptr->found ) { ovf_file_ptr->_state->message_latest = fmt::format( "libovf ovf_read_segment_data_4: file \'{}\' does not exist...", ovf_file_ptr->file_name); return OVF_ERROR; } if( !ovf_file_ptr->is_ovf ) { ovf_file_ptr->_state->message_latest = fmt::format( "libovf ovf_read_segment_data_4: file \'{}\' is not ovf...", ovf_file_ptr->file_name); return OVF_ERROR; } if( index >= ovf_file_ptr->n_segments ) { ovf_file_ptr->_state->message_latest = fmt::format( "libovf ovf_read_segment_data_4: index ({}) >= n_segments ({}) of file \'{}\'...", index, ovf_file_ptr->n_segments, ovf_file_ptr->file_name); return OVF_ERROR; } int retcode = ovf::detail::parse::segment_data(*ovf_file_ptr, index, *segment, data); if( retcode != OVF_OK ) ovf_file_ptr->_state->message_latest += "\novf_read_segment_data_4 failed."; return retcode; } catch( ... ) { return OVF_ERROR; } int ovf_read_segment_data_8(struct ovf_file *ovf_file_ptr, int index, const struct ovf_segment *segment, double *data) try { if( !ovf_file_ptr ) return OVF_ERROR; if( !segment ) { ovf_file_ptr->_state->message_latest = "libovf ovf_read_segment_data_8: invalid segment pointer"; return OVF_ERROR; } if( !check_segment(segment) ) { ovf_file_ptr->_state->message_latest = "libovf ovf_read_segment_data_8: segment not correctly initialized"; return OVF_ERROR; } if( !data ) { ovf_file_ptr->_state->message_latest = "libovf ovf_read_segment_data_8: invalid data pointer"; return OVF_ERROR; } if( !ovf_file_ptr->found ) { ovf_file_ptr->_state->message_latest = fmt::format( "libovf ovf_read_segment_8: file \'{}\' does not exist...", ovf_file_ptr->file_name); return OVF_ERROR; } if( !ovf_file_ptr->is_ovf ) { ovf_file_ptr->_state->message_latest = fmt::format( "libovf ovf_read_segment_8: file \'{}\' is not ovf...", ovf_file_ptr->file_name); return OVF_ERROR; } if( index >= ovf_file_ptr->n_segments ) { ovf_file_ptr->_state->message_latest = fmt::format( "libovf ovf_read_segment_8: index ({}) >= n_segments ({}) of file \'{}\'...", index, ovf_file_ptr->n_segments, ovf_file_ptr->file_name); return OVF_ERROR; } int retcode = ovf::detail::parse::segment_data(*ovf_file_ptr, index, *segment, data); if (retcode != OVF_OK) ovf_file_ptr->_state->message_latest += "\novf_read_segment_data_8 failed."; return retcode; } catch( ... ) { return OVF_ERROR; } int ovf_write_segment_4(struct ovf_file *ovf_file_ptr, const struct ovf_segment *segment, float *data, int format) try { if( !ovf_file_ptr ) return OVF_ERROR; if( !segment ) { ovf_file_ptr->_state->message_latest = "libovf ovf_write_segment_4: invalid segment pointer"; return OVF_ERROR; } if( !check_segment(segment) ) { ovf_file_ptr->_state->message_latest = "libovf ovf_write_segment_4: segment not correctly initialized"; return OVF_ERROR; } if( !data ) { ovf_file_ptr->_state->message_latest = "libovf ovf_write_segment_4: invalid data pointer"; return OVF_ERROR; } if( format == OVF_FORMAT_BIN8 || format == OVF_FORMAT_BIN4 ) format = OVF_FORMAT_BIN; if( format != OVF_FORMAT_BIN && format != OVF_FORMAT_TEXT && format != OVF_FORMAT_CSV ) { ovf_file_ptr->_state->message_latest = fmt::format("libovf ovf_write_segment_4: invalid format \'{}\'...", format); return OVF_ERROR; } int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, false, format); if (retcode != OVF_OK) ovf_file_ptr->_state->message_latest += "\novf_write_segment_4 failed."; return retcode; } catch( ... ) { return OVF_ERROR; } int ovf_write_segment_8(struct ovf_file *ovf_file_ptr, const struct ovf_segment *segment, double *data, int format) try { if( !ovf_file_ptr ) return OVF_ERROR; if( !segment ) { ovf_file_ptr->_state->message_latest = "libovf ovf_write_segment_8: invalid segment pointer"; return OVF_ERROR; } if( !check_segment(segment) ) { ovf_file_ptr->_state->message_latest = "libovf ovf_write_segment_8: segment not correctly initialized"; return OVF_ERROR; } if( !data ) { ovf_file_ptr->_state->message_latest = "libovf ovf_write_segment_8: invalid data pointer"; return OVF_ERROR; } if( format == OVF_FORMAT_BIN8 || format == OVF_FORMAT_BIN4 ) format = OVF_FORMAT_BIN; if( format != OVF_FORMAT_BIN && format != OVF_FORMAT_TEXT && format != OVF_FORMAT_CSV ) { ovf_file_ptr->_state->message_latest = fmt::format("libovf ovf_write_segment_8: invalid format \'{}\'...", format); return OVF_ERROR; } int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, false, format); if (retcode != OVF_OK) ovf_file_ptr->_state->message_latest += "\novf_write_segment_8 failed."; return retcode; } catch( ... ) { return OVF_ERROR; } int ovf_append_segment_4(struct ovf_file *ovf_file_ptr, const struct ovf_segment *segment, float *data, int format) try { if( !ovf_file_ptr ) return OVF_ERROR; if( !segment ) { ovf_file_ptr->_state->message_latest = "libovf ovf_append_segment_4: invalid segment pointer"; return OVF_ERROR; } if( !check_segment(segment) ) { ovf_file_ptr->_state->message_latest = "libovf ovf_append_segment_4: segment not correctly initialized"; return OVF_ERROR; } if( !data ) { ovf_file_ptr->_state->message_latest = "libovf ovf_append_segment_4: invalid data pointer"; return OVF_ERROR; } if( ovf_file_ptr->found && !ovf_file_ptr->is_ovf ) { ovf_file_ptr->_state->message_latest = "libovf ovf_append_segment_4: file is not ovf..."; return OVF_ERROR; } if( format == OVF_FORMAT_BIN8 || format == OVF_FORMAT_BIN4 ) format = OVF_FORMAT_BIN; if( format != OVF_FORMAT_BIN && format != OVF_FORMAT_TEXT && format != OVF_FORMAT_CSV ) { ovf_file_ptr->_state->message_latest = fmt::format("libovf ovf_append_segment_4: invalid format \'{}\'...", format); return OVF_ERROR; } bool append = ovf_file_ptr->found; int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, append, format); if (retcode != OVF_OK) ovf_file_ptr->_state->message_latest += "\novf_append_segment_4 failed."; return retcode; } catch( ... ) { return OVF_ERROR; } int ovf_append_segment_8(struct ovf_file *ovf_file_ptr, const struct ovf_segment *segment, double *data, int format) try { if( !ovf_file_ptr ) return OVF_ERROR; if( !segment ) { ovf_file_ptr->_state->message_latest = "libovf ovf_append_segment_8: invalid segment pointer"; return OVF_ERROR; } if( !check_segment(segment) ) { ovf_file_ptr->_state->message_latest = "libovf ovf_append_segment_8: segment not correctly initialized"; return OVF_ERROR; } if( !data ) { ovf_file_ptr->_state->message_latest = "libovf ovf_append_segment_8: invalid data pointer"; return OVF_ERROR; } if( format == OVF_FORMAT_BIN8 || format == OVF_FORMAT_BIN4 ) format = OVF_FORMAT_BIN; if( ovf_file_ptr->found && !ovf_file_ptr->is_ovf ) { ovf_file_ptr->_state->message_latest = "libovf ovf_append_segment_8: file is not ovf..."; return OVF_ERROR; } if( format != OVF_FORMAT_BIN && format != OVF_FORMAT_TEXT && format != OVF_FORMAT_CSV ) { ovf_file_ptr->_state->message_latest = fmt::format("libovf ovf_append_segment_8: invalid format \'{}\'...", format); return OVF_ERROR; } bool append = ovf_file_ptr->found; int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, append, format); if (retcode != OVF_OK) ovf_file_ptr->_state->message_latest += "\novf_append_segment_8 failed."; return retcode; } catch( ... ) { return OVF_ERROR; } const char * ovf_latest_message(struct ovf_file *ovf_file_ptr) try { if( !ovf_file_ptr ) return ""; ovf_file_ptr->_state->message_out = ovf_file_ptr->_state->message_latest; ovf_file_ptr->_state->message_latest = ""; return ovf_file_ptr->_state->message_out.c_str(); } catch( ... ) { return ""; } int ovf_close(struct ovf_file * ovf_file_ptr) try { if( !ovf_file_ptr ) return OVF_ERROR; if( !ovf_file_ptr->_state ) return OVF_ERROR; delete(ovf_file_ptr->_state); return OVF_OK; } catch( ... ) { return OVF_ERROR; }
27.02037
118
0.621548
ddkn
5306717d1e472a5606e6ee902bc5b09a3d079641
4,896
cpp
C++
bot-battles/src/server/StartStateServer.cpp
Sandruski/bot-battles
05ad3b5a490830b48b574d1d2bd2c3be320afd88
[ "MIT" ]
null
null
null
bot-battles/src/server/StartStateServer.cpp
Sandruski/bot-battles
05ad3b5a490830b48b574d1d2bd2c3be320afd88
[ "MIT" ]
null
null
null
bot-battles/src/server/StartStateServer.cpp
Sandruski/bot-battles
05ad3b5a490830b48b574d1d2bd2c3be320afd88
[ "MIT" ]
null
null
null
#include "StartStateServer.h" #include "FSM.h" #include "GameServer.h" #include "GameplayComponent.h" #include "ServerComponent.h" #include "WindowComponent.h" namespace sand { //---------------------------------------------------------------------------------------------------- std::string StartStateServer::GetName() const { return "Start"; } //---------------------------------------------------------------------------------------------------- bool StartStateServer::Enter() const { ILOG("Entering %s...", GetName().c_str()); return true; } //---------------------------------------------------------------------------------------------------- bool StartStateServer::RenderGui() const { ImGuiWindowFlags windowFlags = 0; windowFlags |= ImGuiWindowFlags_NoResize; windowFlags |= ImGuiWindowFlags_NoMove; windowFlags |= ImGuiWindowFlags_NoScrollbar; windowFlags |= ImGuiWindowFlags_NoCollapse; windowFlags |= ImGuiWindowFlags_NoSavedSettings; std::weak_ptr<WindowComponent> windowComponent = g_gameServer->GetWindowComponent(); ImVec2 position = ImVec2(static_cast<F32>(windowComponent.lock()->m_currentResolution.x) / 2.0f, static_cast<F32>(windowComponent.lock()->m_currentResolution.y) / 2.0f); ImGui::SetNextWindowPos(position, ImGuiCond_Always, ImVec2(0.5f, 0.5f)); ImVec2 size = ImVec2(static_cast<F32>(windowComponent.lock()->m_currentResolution.y) / 2.0f, static_cast<F32>(windowComponent.lock()->m_currentResolution.x) / 2.0f); ImGui::SetNextWindowSize(size, ImGuiCond_Always); if (ImGui::Begin(GetName().c_str(), nullptr, windowFlags)) { ImVec2 contentRegionMax = ImGui::GetWindowContentRegionMax(); ImVec2 framePadding = ImGui::GetStyle().FramePadding; ImVec2 itemSpacing = ImGui::GetStyle().ItemSpacing; std::weak_ptr<ServerComponent> serverComponent = g_gameServer->GetServerComponent(); const std::unordered_map<PlayerID, std::shared_ptr<ClientProxy>>& playerIDToClientProxy = serverComponent.lock()->GetPlayerIDToClientProxyMap(); for (const auto& pair : playerIDToClientProxy) { PlayerID playerID = pair.first; U32 playerNumber = playerID + 1; ImGui::Text("Player %u", playerNumber); } std::string mainMenuString = "Main menu"; ImVec2 mainMenuTextSize = ImGui::CalcTextSize(mainMenuString.c_str()); ImVec2 mainMenuButtonSize = ImVec2(mainMenuTextSize.x + framePadding.x * 2.0f, mainMenuTextSize.y + framePadding.y * 2.0f); ImGui::SetCursorPosX(contentRegionMax.x - mainMenuButtonSize.x); ImGui::SetCursorPosY(contentRegionMax.y - mainMenuButtonSize.y); if (ImGui::Button(mainMenuString.c_str())) { Event newEvent; newEvent.eventType = EventType::SEND_BYE; g_gameServer->GetFSM().NotifyEvent(newEvent); ChangeToMainMenu(); } ImGui::End(); } return true; } //---------------------------------------------------------------------------------------------------- bool StartStateServer::Exit() const { ILOG("Exiting %s...", GetName().c_str()); return true; } //---------------------------------------------------------------------------------------------------- void StartStateServer::OnNotify(const Event& event) { switch (event.eventType) { case EventType::PLAYER_ADDED: { OnPlayerAdded(); break; } case EventType::HELLO_RECEIVED: { Event newEvent; newEvent.eventType = EventType::SEND_WELCOME; newEvent.networking.playerID = event.networking.playerID; g_gameServer->GetFSM().NotifyEvent(newEvent); break; } case EventType::REHELLO_RECEIVED: { Event newEvent; newEvent.eventType = EventType::SEND_REWELCOME; newEvent.networking.playerID = event.networking.playerID; g_gameServer->GetFSM().NotifyEvent(newEvent); break; } default: { break; } } } //---------------------------------------------------------------------------------------------------- void StartStateServer::OnPlayerAdded() const { std::weak_ptr<ServerComponent> serverComponent = g_gameServer->GetServerComponent(); U32 entityCount = serverComponent.lock()->GetEntityCount(); if (entityCount == MAX_PLAYER_IDS) { ChangeToPlay(); } } //---------------------------------------------------------------------------------------------------- void StartStateServer::ChangeToPlay() const { std::weak_ptr<GameplayComponent> gameplayComponent = g_gameServer->GetGameplayComponent(); gameplayComponent.lock()->m_fsm.ChangeState("Play"); } //---------------------------------------------------------------------------------------------------- void StartStateServer::ChangeToMainMenu() const { g_gameServer->GetFSM().ChangeState("Main Menu"); } }
36
173
0.573734
Sandruski
530c3b4f77632b37fa7654385cfc3256f7262f22
1,963
hh
C++
block/sorted_array.hh
duynguyen-ori75/learning
903a6d9f59b2d08a237b45487ac12052123a0bd5
[ "MIT" ]
2
2021-03-27T17:11:37.000Z
2021-04-14T17:24:32.000Z
block/sorted_array.hh
duynguyen-ori75/learning
903a6d9f59b2d08a237b45487ac12052123a0bd5
[ "MIT" ]
null
null
null
block/sorted_array.hh
duynguyen-ori75/learning
903a6d9f59b2d08a237b45487ac12052123a0bd5
[ "MIT" ]
1
2021-03-27T17:11:43.000Z
2021-03-27T17:11:43.000Z
#include <algorithm> #include <vector> class SortedArray { private: std::vector<int> data_; int maxSize_, currentSize_; std::pair<int, int> cellPayload(int index) { return std::make_pair(this->data_[index * 2], this->data_[index * 2 + 1]); } int lookUp(int key) { int low = 0; int high = currentSize_ - 1; while (low <= high) { auto mid = (low + high) / 2; auto cell = cellPayload(mid); if (cell.first < key) low = mid + 1; else high = mid - 1; } return low; } public: SortedArray(int size) : maxSize_(size), currentSize_(0) { data_.resize(size * 2); } std::pair<bool, int> Search(int key) { auto index = this->lookUp(key); if (index >= this->currentSize_ || cellPayload(index).first != key) return std::make_pair(false, -1); return std::make_pair(true, cellPayload(index).second); } bool Insert(int key, int value) { auto index = this->lookUp(key); if (index < this->currentSize_ && cellPayload(index).first == key) { this->data_[index * 2 + 1] = value; return true; } if (this->currentSize_ >= this->maxSize_) return false; for (int idx = this->currentSize_; idx > index; idx--) { this->data_[idx * 2] = this->data_[(idx - 1) * 2]; this->data_[idx * 2 + 1] = this->data_[(idx - 1) * 2 + 1]; } this->data_[index * 2] = key; this->data_[index * 2 + 1] = value; this->currentSize_++; return true; } bool Remove(int key) { auto index = this->lookUp(key); if (index >= this->currentSize_ || cellPayload(index).first != key) return false; for (int idx = index; idx < this->currentSize_ - 1; idx++) { this->data_[idx * 2] = this->data_[(idx + 1) * 2]; this->data_[idx * 2 + 1] = this->data_[(idx + 1) * 2]; } this->currentSize_--; this->data_[this->currentSize_ * 2] = 0; this->data_[this->currentSize_ * 2 + 1] = 0; return true; } };
29.742424
78
0.573102
duynguyen-ori75
53135981d29773a1ed9030c17764f8eba518ec6c
185
hpp
C++
engine/core/include/debug.hpp
redstrate/prism
acb6c5306c6f60088744191f3d3d8713fc6950bd
[ "MIT" ]
18
2020-08-11T18:13:49.000Z
2022-03-08T21:42:54.000Z
engine/core/include/debug.hpp
redstrate/prism
acb6c5306c6f60088744191f3d3d8713fc6950bd
[ "MIT" ]
11
2020-08-27T12:37:48.000Z
2022-02-21T05:17:03.000Z
engine/core/include/debug.hpp
redstrate/prism
acb6c5306c6f60088744191f3d3d8713fc6950bd
[ "MIT" ]
1
2020-12-08T14:01:48.000Z
2020-12-08T14:01:48.000Z
#pragma once #include <string_view> void draw_console(); void draw_debug_ui(); void load_debug_options(); void save_debug_options(); std::string_view get_shader_source_directory();
15.416667
47
0.789189
redstrate
53162e76b695dcac0abafade96d28c6c5785ca7d
1,529
cpp
C++
lib/generator/object/trees/defaults/MegaRedwoodTree.cpp
NetherGamesMC/noiselib
56fc48ea1367e1d08b228dfa580b513fbec8ca31
[ "MIT" ]
14
2021-08-16T18:58:30.000Z
2022-02-13T01:12:31.000Z
lib/generator/object/trees/defaults/MegaRedwoodTree.cpp
NetherGamesMC/ext-vanillagenerator
56fc48ea1367e1d08b228dfa580b513fbec8ca31
[ "MIT" ]
2
2021-06-21T15:10:01.000Z
2021-07-19T01:48:00.000Z
lib/generator/object/trees/defaults/MegaRedwoodTree.cpp
NetherGamesMC/ext-vanillagenerator
56fc48ea1367e1d08b228dfa580b513fbec8ca31
[ "MIT" ]
3
2021-06-21T02:10:39.000Z
2021-08-04T01:36:08.000Z
#include "MegaRedwoodTree.h" void MegaRedwoodTree::Initialize(Random &random, BlockTransaction &txn) { MegaJungleTree::Initialize(random, txn); SetHeight(static_cast<int_fast32_t>(random.NextInt(15) + random.NextInt(3)) + 13); SetType(MAGIC_NUMBER_SPRUCE); SetLeavesHeight(static_cast<int_fast32_t>(random.NextInt(5)) + (random.NextBoolean() ? 3 : 13)); } void MegaRedwoodTree::SetLeavesHeight(int_fast32_t iLeavesHeight) { this->leavesHeight = iLeavesHeight; } bool MegaRedwoodTree::Generate(ChunkManager &world, Random &random, int_fast32_t sourceX, int_fast32_t sourceY, int_fast32_t sourceZ) { if (CannotGenerateAt(sourceX, sourceY, sourceZ, world)) { return false; } // generates the leaves int_fast32_t previousRadius = 0; for (int_fast32_t y = sourceY + height - leavesHeight; y <= sourceY + height; y++) { int_fast32_t n = sourceY + height - y; int_fast32_t radius = (int) std::floor((double) n / leavesHeight * 3.5); if (radius == previousRadius && n > 0 && y % 2 == 0) { radius++; } GenerateLeaves(sourceX, y, sourceZ, radius, false, world); previousRadius = radius; } // generates the trunk GenerateTrunk(world, sourceX, sourceY, sourceZ); // blocks below trunk are always dirt GenerateDirtBelowTrunk(sourceX, sourceY, sourceZ); return true; } void MegaRedwoodTree::GenerateDirtBelowTrunk(int_fast32_t blockX, int_fast32_t blockY, int_fast32_t blockZ) { // NOOP: MegaRedwoodTree does not replace blocks below (surely to preserves podzol) }
33.977778
135
0.725311
NetherGamesMC
53175fef90dc2da0612ef58649995f659c16ace9
1,638
cpp
C++
TransimsNet/Write_Turn.cpp
kravitz/transims4
ea0848bf3dc71440d54724bb3ecba3947b982215
[ "NASA-1.3" ]
2
2018-04-27T11:07:02.000Z
2020-04-24T06:53:21.000Z
TransimsNet/Write_Turn.cpp
idkravitz/transims4
ea0848bf3dc71440d54724bb3ecba3947b982215
[ "NASA-1.3" ]
null
null
null
TransimsNet/Write_Turn.cpp
idkravitz/transims4
ea0848bf3dc71440d54724bb3ecba3947b982215
[ "NASA-1.3" ]
null
null
null
//********************************************************* // Write_Turn.cpp - Write the Turn Prohibition File //********************************************************* #include "TransimsNet.hpp" #include "Turn_File.hpp" //--------------------------------------------------------- // Write_Turn //--------------------------------------------------------- void TransimsNet::Write_Turn (void) { int node; Turn_Data *turn_ptr; Link_Data *link_ptr; Time_Step time_step (1, "24_HOUR_CLOCK"); Turn_File *turn_file = (Turn_File *) Network_Db_Base (NEW_TURN_PROHIBITION); Show_Message ("Writing %s - Record", turn_file->File_Type ()); Set_Progress (); for (turn_ptr = turn_data.First (); turn_ptr; turn_ptr = turn_data.Next ()) { Show_Progress (); //---- get the approach link ---- link_ptr = link_data.Get (turn_ptr->In_Link ()); if (link_ptr == NULL) { Write (1, "link=%d was not found (out=%d)", turn_ptr->In_Link (), turn_ptr->Out_Link ()); continue; } node = (turn_ptr->In_Dir () == 1) ? link_ptr->Anode () : link_ptr->Bnode (); //---- write the turn record ---- turn_file->Node (node); turn_file->In_Link (turn_ptr->In_Link ()); turn_file->Out_Link (turn_ptr->Out_Link ()); turn_file->Start (time_step.Format_Step (Resolve (turn_ptr->Start ()))); turn_file->End (time_step.Format_Step (Resolve (turn_ptr->End ()))); turn_file->Use (Use_Code (turn_ptr->Use ())); turn_file->Penalty (turn_ptr->Penalty ()); turn_file->Notes ("Turn Prohibition"); if (!turn_file->Write ()) { Error ("Writing Turn Prohibition"); } nturn++; } End_Progress (); turn_file->Close (); }
26.419355
92
0.562882
kravitz
53184101cce46c77f942e454fb9b899f11155216
3,137
hpp
C++
boost/numeric/mtl/utility/make_copy_or_reference.hpp
lit-uriy/mtl4-mirror
37cf7c2847165d3537cbc3400cb5fde6f80e3d8b
[ "MTLL" ]
24
2019-03-26T15:25:45.000Z
2022-03-26T10:00:45.000Z
lib/mtl4/boost/numeric/mtl/utility/make_copy_or_reference.hpp
spraetor/amdis2
53c45c81a65752a8fafbb54f9ae6724a86639dcd
[ "MIT" ]
2
2020-04-17T12:35:32.000Z
2021-03-03T15:46:25.000Z
lib/mtl4/boost/numeric/mtl/utility/make_copy_or_reference.hpp
spraetor/amdis2
53c45c81a65752a8fafbb54f9ae6724a86639dcd
[ "MIT" ]
10
2019-12-01T13:40:30.000Z
2022-01-14T08:39:54.000Z
// Software License for MTL // // Copyright (c) 2007 The Trustees of Indiana University. // 2008 Dresden University of Technology and the Trustees of Indiana University. // 2010 SimuNova UG (haftungsbeschränkt), www.simunova.com. // All rights reserved. // Authors: Peter Gottschling and Andrew Lumsdaine // // This file is part of the Matrix Template Library // // See also license.mtl.txt in the distribution. #ifndef MTL_MAKE_COPY_OR_REFERENCE_INCLUDE #define MTL_MAKE_COPY_OR_REFERENCE_INCLUDE namespace mtl { /// Helper class to avoid avoidable copies for input parameters /** Container is referred if it has already target type, otherwise copied. Create an object of this type and pass the value member variable to the function, e.g. make_in_copy_or_reference<Tgt, Src> copy_or_ref(v); f(copy_or_ref.value); where Src is the type of v and Tgt the type of f's argument. **/ template <typename Target, typename Source> struct make_in_copy_or_reference { typedef Target type; explicit make_in_copy_or_reference(const Source& src) : value(src) {} Target value; }; template <typename Target> struct make_in_copy_or_reference<Target, Target> { typedef const Target& type; explicit make_in_copy_or_reference(const Target& src) : value(src) {} const Target& value; }; /// Helper class to avoid avoidable copies for output parameters. /** Container is referred if it has already target type, otherwise copied at destruction. Create an object of this type and pass the value member variable to the function, e.g. make_in_copy_or_reference<Tgt, Src> copy_or_ref(v); f(copy_or_ref.value); where Src is the type of v and Tgt the type of f's argument. Target must be DefaultConstructible. **/ template <typename Target, typename Source> struct make_out_copy_or_reference { explicit make_out_copy_or_reference(Source& src) : src(src) {} ~make_out_copy_or_reference() { src= value; } Target value; private: Source& src; }; template <typename Target> struct make_out_copy_or_reference<Target, Target> { explicit make_out_copy_or_reference(Target& src) : value(src) {} Target& value; }; /// Helper class to avoid avoidable copies for input-output parameters. /** Container is referred if it has already target type, otherwise copied construction and destruction. Create an object of this type and pass the value member variable to the function, e.g. make_in_copy_or_reference<Tgt, Src> copy_or_ref(v); f(copy_or_ref.value); where Src is the type of v and Tgt the type of f's argument. **/ template <typename Target, typename Source> struct make_in_out_copy_or_reference { explicit make_in_out_copy_or_reference(Source& src) : value(src), src(src) {} ~make_in_out_copy_or_reference() { src= value; } Target value; private: Source& src; }; template <typename Target> struct make_in_out_copy_or_reference<Target, Target> { explicit make_in_out_copy_or_reference(Target& src) : value(src) {} Target& value; }; } // namespace mtl #endif // MTL_MAKE_COPY_OR_REFERENCE_INCLUDE
33.021053
103
0.740198
lit-uriy
531b5e31586f0ae9a3dcbe0d23a71e2ae0338500
6,556
cxx
C++
main/oox/source/drawingml/textcharacterpropertiescontext.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
679
2015-01-06T06:34:58.000Z
2022-03-30T01:06:03.000Z
main/oox/source/drawingml/textcharacterpropertiescontext.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
102
2017-11-07T08:51:31.000Z
2022-03-17T12:13:49.000Z
main/oox/source/drawingml/textcharacterpropertiescontext.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
331
2015-01-06T11:40:55.000Z
2022-03-14T04:07:51.000Z
/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ #include "oox/drawingml/textcharacterpropertiescontext.hxx" #include "oox/helper/attributelist.hxx" #include "oox/drawingml/drawingmltypes.hxx" #include "oox/drawingml/colorchoicecontext.hxx" #include "oox/drawingml/lineproperties.hxx" #include "oox/drawingml/textparagraphproperties.hxx" #include "oox/core/relations.hxx" #include "hyperlinkcontext.hxx" using ::rtl::OUString; using namespace ::oox::core; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::awt; namespace oox { namespace drawingml { // -------------------------------------------------------------------- // CT_TextCharacterProperties TextCharacterPropertiesContext::TextCharacterPropertiesContext( ContextHandler& rParent, const Reference< XFastAttributeList >& rXAttributes, TextCharacterProperties& rTextCharacterProperties ) : ContextHandler( rParent ) , mrTextCharacterProperties( rTextCharacterProperties ) { AttributeList aAttribs( rXAttributes ); if ( aAttribs.hasAttribute( XML_lang ) ) mrTextCharacterProperties.moLang = aAttribs.getString( XML_lang ); if ( aAttribs.hasAttribute( XML_sz ) ) mrTextCharacterProperties.moHeight = aAttribs.getInteger( XML_sz ); if ( aAttribs.hasAttribute( XML_u ) ) mrTextCharacterProperties.moUnderline = aAttribs.getToken( XML_u ); if ( aAttribs.hasAttribute( XML_strike ) ) mrTextCharacterProperties.moStrikeout = aAttribs.getToken( XML_strike ); // mrTextCharacterProperties.moCaseMap = aAttribs.getToken( XML_cap ); if ( aAttribs.hasAttribute( XML_b ) ) mrTextCharacterProperties.moBold = aAttribs.getBool( XML_b ); if ( aAttribs.hasAttribute( XML_i ) ) mrTextCharacterProperties.moItalic = aAttribs.getBool( XML_i ); // TODO /* todo: we need to be able to iterate over the XFastAttributes // ST_TextNonNegativePoint const OUString sCharKerning( CREATE_OUSTRING( "CharKerning" ) ); //case A_TOKEN( kern ): // ST_TextLanguageID OUString sAltLang = rXAttributes->getOptionalValue( XML_altLang ); case A_TOKEN( kumimoji ): // xsd:boolean break; case A_TOKEN( spc ): // ST_TextPoint case A_TOKEN( normalizeH ): // xsd:boolean case A_TOKEN( baseline ): // ST_Percentage case A_TOKEN( noProof ): // xsd:boolean case A_TOKEN( dirty ): // xsd:boolean case A_TOKEN( err ): // xsd:boolean case A_TOKEN( smtClean ): // xsd:boolean case A_TOKEN( smtId ): // xsd:unsignedInt break; */ } TextCharacterPropertiesContext::~TextCharacterPropertiesContext() { } // -------------------------------------------------------------------- void TextCharacterPropertiesContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException) { } // -------------------------------------------------------------------- Reference< XFastContextHandler > TextCharacterPropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttributes ) throw (SAXException, RuntimeException) { AttributeList aAttribs( xAttributes ); Reference< XFastContextHandler > xRet; switch( aElementToken ) { // TODO unsupported yet // case A_TOKEN( ln ): // CT_LineProperties // xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maTextOutlineProperties ) ); // break; case A_TOKEN( solidFill ): // EG_FillProperties xRet.set( new ColorContext( *this, mrTextCharacterProperties.maCharColor ) ); break; // EG_EffectProperties case A_TOKEN( effectDag ): // CT_EffectContainer 5.1.10.25 case A_TOKEN( effectLst ): // CT_EffectList 5.1.10.26 break; case A_TOKEN( highlight ): // CT_Color xRet.set( new ColorContext( *this, mrTextCharacterProperties.maHighlightColor ) ); break; // EG_TextUnderlineLine case A_TOKEN( uLnTx ): // CT_TextUnderlineLineFollowText mrTextCharacterProperties.moUnderlineLineFollowText = true; break; // TODO unsupported yet // case A_TOKEN( uLn ): // CT_LineProperties // xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maUnderlineProperties ) ); // break; // EG_TextUnderlineFill case A_TOKEN( uFillTx ): // CT_TextUnderlineFillFollowText mrTextCharacterProperties.moUnderlineFillFollowText = true; break; case A_TOKEN( uFill ): // CT_TextUnderlineFillGroupWrapper->EG_FillProperties (not supported) xRet.set( new SimpleFillPropertiesContext( *this, mrTextCharacterProperties.maUnderlineColor ) ); break; // CT_FontCollection case A_TOKEN( latin ): // CT_TextFont mrTextCharacterProperties.maLatinFont.setAttributes( aAttribs ); break; case A_TOKEN( ea ): // CT_TextFont mrTextCharacterProperties.maAsianFont.setAttributes( aAttribs ); break; case A_TOKEN( cs ): // CT_TextFont mrTextCharacterProperties.maComplexFont.setAttributes( aAttribs ); break; case A_TOKEN( sym ): // CT_TextFont mrTextCharacterProperties.maSymbolFont.setAttributes( aAttribs ); break; case A_TOKEN( hlinkClick ): // CT_Hyperlink case A_TOKEN( hlinkMouseOver ): // CT_Hyperlink xRet.set( new HyperLinkContext( *this, xAttributes, mrTextCharacterProperties.maHyperlinkPropertyMap ) ); break; } if( !xRet.is() ) xRet.set( this ); return xRet; } // -------------------------------------------------------------------- } }
37.678161
205
0.663209
Grosskopf
5320a449b99a0b9b72e6eea6794928401694a678
232
cpp
C++
modules/math/source/blub/math/log/global.cpp
qwertzui11/voxelTerrain
05038fb261893dd044ae82fab96b7708ea5ed623
[ "MIT" ]
96
2015-02-02T20:01:24.000Z
2021-11-14T20:33:29.000Z
modules/math/source/blub/math/log/global.cpp
qwertzui11/voxelTerrain
05038fb261893dd044ae82fab96b7708ea5ed623
[ "MIT" ]
12
2016-06-04T15:45:30.000Z
2020-02-04T11:10:51.000Z
modules/math/source/blub/math/log/global.cpp
qwertzui11/voxelTerrain
05038fb261893dd044ae82fab96b7708ea5ed623
[ "MIT" ]
19
2015-09-22T01:21:45.000Z
2020-09-30T09:52:27.000Z
#include "global.hpp" #include "blub/core/string.hpp" using namespace blub::math::log; using namespace blub; BLUB_LOG_GLOBAL_LOGGER_INIT(global, blub::log::logger) { blub::log::logger result("math"); return result; }
13.647059
54
0.706897
qwertzui11
53231c25a00b5bd467b4a61051c9304900ecb9fa
19,304
cpp
C++
source/mclib/packet.cpp
mechasource/mechcommander2
b2c7cecf001cec1f535aa8d29c31bdc30d9aa983
[ "BSD-2-Clause" ]
38
2015-04-10T13:31:03.000Z
2021-09-03T22:34:05.000Z
source/mclib/packet.cpp
mechasource/mechcommander2
b2c7cecf001cec1f535aa8d29c31bdc30d9aa983
[ "BSD-2-Clause" ]
1
2020-07-09T09:48:44.000Z
2020-07-12T12:41:43.000Z
source/mclib/packet.cpp
mechasource/mechcommander2
b2c7cecf001cec1f535aa8d29c31bdc30d9aa983
[ "BSD-2-Clause" ]
12
2015-06-29T08:06:57.000Z
2021-10-13T13:11:41.000Z
//--------------------------------------------------------------------------- // // Packet.cpp -- File contains the actual code for the Packet File class // //---------------------------------------------------------------------------// // Copyright (C) Microsoft Corporation. All rights reserved. // //===========================================================================// //--------------------------------------------------------------------------- // Include Files #ifndef PACKET_H #include "packet.h" #endif #ifndef HEAP_H #include "heap.h" #endif #ifndef LZ_H #include "lz.h" #endif #include "zlib.h" #ifndef _MBCS //#include "gameos.hpp" #else #include <_ASSERT.h> #define gosASSERT _ASSERT #define gos_Malloc malloc #define gos_Free free #endif #include <string.h> //--------------------------------------------------------------------------- extern uint8_t* LZPacketBuffer; extern uint32_t LZPacketBufferSize; //--------------------------------------------------------------------------- // class PacketFile void PacketFile::clear(void) { currentPacket = -1; packetSize = packetBase = numPackets = 0; if (seekTable) systemHeap->Free(seekTable); seekTable = nullptr; } //--------------------------------------------------------------------------- void PacketFile::atClose(void) { if (isOpen() && fileMode != READ) // update filesize { int32_t endPtr = getLength(); // seek(sizeof(int32_t)); //Move Past Version // Marker writeLong(endPtr); //Write File // length int32_t tableEntry; currentPacket = numPackets; if (!seekTable) { while (--currentPacket >= 0) { seek(TABLE_ENTRY(currentPacket)); tableEntry = readLong(); if (GetPacketType(tableEntry) == STORAGE_TYPE_NUL) { seek(TABLE_ENTRY(currentPacket)); writeLong(SetPacketType(endPtr, STORAGE_TYPE_NUL)); } else { endPtr = GetPacketOffset(tableEntry); } } } else { while (--currentPacket >= 0) { tableEntry = seekTable[currentPacket]; if (GetPacketType(tableEntry) == STORAGE_TYPE_NUL) { seekTable[currentPacket] = SetPacketType(endPtr, STORAGE_TYPE_NUL); } else { endPtr = GetPacketOffset(tableEntry); } } } //----------------------------------------------------- // If seekTable was being used, write it back to file if (seekTable) { seek(sizeof(int32_t) * 2); // File Version & File Length write(uint8_t*(seekTable), (numPackets * sizeof(int32_t))); } //------------------------------------------------------ // Is we were using a checkSum, calc it and write it to // the beginning of the file. if (usesCheckSum) { int32_t checkSum = checkSumFile(); seek(0); writeLong(checkSum); } } clear(); } //--------------------------------------------------------------------------- int32_t PacketFile::checkSumFile(void) { //----------------------------------------- int32_t currentPosition = logicalPosition; seek(4); uint8_t* fileMap = (uint8_t*)malloc(fileSize()); read(fileMap, fileSize()); int32_t sum = 0; uint8_t* curFileByte = fileMap; for (uint32_t i = 4; i < fileSize(); i++, curFileByte++) { sum += *curFileByte; } free(fileMap); seek(currentPosition); return sum; } //--------------------------------------------------------------------------- int32_t PacketFile::afterOpen(void) { if (!numPackets && getLength() >= 12) { int32_t firstPacketOffset; int32_t firstCheck = readLong(); if (firstCheck == PACKET_FILE_VERSION && !usesCheckSum) { } else { //--------------------------------------- // This is probably a checksum. Check it int32_t checkSum = checkSumFile(); if (checkSum != firstCheck) return PACKET_OUT_OF_RANGE; } firstPacketOffset = readLong(); numPackets = (firstPacketOffset / sizeof(int32_t)) - 2; } currentPacket = -1; if (fileMode == READ || fileMode == RDWRITE) { if (numPackets && !seekTable) { seekTable = (int32_t*)systemHeap->Malloc(numPackets * sizeof(int32_t)); gosASSERT(seekTable != nullptr); seek(sizeof(int32_t) * 2); // File Version & File Length read(uint8_t*(seekTable), (numPackets * sizeof(int32_t))); } } return (NO_ERROR); } //--------------------------------------------------------------------------- PacketFile::PacketFile(void) { seekTable = nullptr; usesCheckSum = FALSE; clear(); } //--------------------------------------------------------------------------- PacketFile::~PacketFile(void) { close(); } //--------------------------------------------------------------------------- int32_t PacketFile::open(const std::wstring_view& filename, FileMode _mode, int32_t numChild) { int32_t openResult = MechFile::open(filename, _mode, numChild); if (openResult != NO_ERROR) { return (openResult); } openResult = afterOpen(); return (openResult); } //--------------------------------------------------------------------------- int32_t PacketFile::open(std::unique_ptr<File> _parent, uint32_t fileSize, int32_t numChild) { int32_t result = MechFile::open(_parent, fileSize, numChild); if (result != NO_ERROR) return (result); result = afterOpen(); return (result); } //--------------------------------------------------------------------------- int32_t PacketFile::create(const std::wstring_view& filename) { int32_t openResult = MechFile::create(filename); if (openResult != NO_ERROR) { return (openResult); } openResult = afterOpen(); return (openResult); } int32_t PacketFile::createWithCase(const std::wstring_view& filename) { int32_t openResult = MechFile::createWithCase(filename); if (openResult != NO_ERROR) { return (openResult); } openResult = afterOpen(); return (openResult); } //--------------------------------------------------------------------------- void PacketFile::close(void) { atClose(); MechFile::close(); } //--------------------------------------------------------------------------- int32_t PacketFile::readPacketOffset(int32_t packet, int32_t* lastType) { int32_t offset = -1; if (packet < numPackets) { if (seekTable) offset = seekTable[packet]; if (lastType) *lastType = GetPacketType(offset); offset = GetPacketOffset(offset); } return offset; } //--------------------------------------------------------------------------- int32_t PacketFile::readPacket(int32_t packet, uint8_t* buffer) { int32_t result = 0; if ((packet == -1) || (packet == currentPacket) || (seekPacket(packet) == NO_ERROR)) { if ((getStorageType() == STORAGE_TYPE_RAW) || (getStorageType() == STORAGE_TYPE_FWF)) { seek(packetBase); result = read(buffer, packetSize); } else { switch (getStorageType()) { case STORAGE_TYPE_LZD: { seek(packetBase + sizeof(int32_t)); if (!LZPacketBuffer) { LZPacketBuffer = (uint8_t*)malloc(LZPacketBufferSize); gosASSERT(LZPacketBuffer); } if ((int32_t)LZPacketBufferSize < packetSize) { LZPacketBufferSize = packetSize; free(LZPacketBuffer); LZPacketBuffer = (uint8_t*)malloc(LZPacketBufferSize); gosASSERT(LZPacketBuffer); } if (LZPacketBuffer) { read(LZPacketBuffer, (packetSize - sizeof(int32_t))); int32_t decompLength = LZDecomp(buffer, LZPacketBuffer, packetSize - sizeof(int32_t)); if (decompLength != packetUnpackedSize) result = 0; else result = decompLength; } } break; case STORAGE_TYPE_ZLIB: { seek(packetBase + sizeof(int32_t)); if (!LZPacketBuffer) { LZPacketBuffer = (uint8_t*)malloc(LZPacketBufferSize); gosASSERT(LZPacketBuffer); } if ((int32_t)LZPacketBufferSize < packetSize) { LZPacketBufferSize = packetSize; free(LZPacketBuffer); LZPacketBuffer = (uint8_t*)malloc(LZPacketBufferSize); gosASSERT(LZPacketBuffer); } if (LZPacketBuffer) { read(LZPacketBuffer, (packetSize - sizeof(int32_t))); uint32_t decompLength = LZPacketBufferSize; int32_t decompResult = uncompress( buffer, &decompLength, LZPacketBuffer, packetSize - sizeof(int32_t)); if ((decompResult != Z_OK) || ((int32_t)decompLength != packetUnpackedSize)) result = 0; else result = decompLength; } } break; case STORAGE_TYPE_HF: STOP(("Tried to read a Huffman Compressed Packet. No Longer " "Supported!!")); break; } } } return result; } //--------------------------------------------------------------------------- int32_t PacketFile::readPackedPacket(int32_t packet, uint8_t* buffer) { int32_t result = 0; if ((packet == -1) || (packet == currentPacket) || (seekPacket(packet) == NO_ERROR)) { if ((getStorageType() == STORAGE_TYPE_RAW) || (getStorageType() == STORAGE_TYPE_FWF)) { seek(packetBase); result = read(buffer, packetSize); } else { switch (getStorageType()) { case STORAGE_TYPE_LZD: { seek(packetBase + sizeof(int32_t)); read(buffer, packetSize); } break; case STORAGE_TYPE_ZLIB: { seek(packetBase + sizeof(int32_t)); read(buffer, packetSize); } break; } } } return result; } //--------------------------------------------------------------------------- int32_t PacketFile::seekPacket(int32_t packet) { int32_t offset, next; if (packet < 0) { return (PACKET_OUT_OF_RANGE); } offset = readPacketOffset(packet, &packetType); currentPacket = packet++; if (packet == numPackets) next = getLength(); else next = readPacketOffset(packet); packetSize = next - offset; packetBase = offset; // seek to beginning of packet seek(packetBase); switch (getStorageType()) { case STORAGE_TYPE_LZD: // the first uint32_t of a compressed packet is the unpacked length packetUnpackedSize = readLong(); break; case STORAGE_TYPE_ZLIB: // the first uint32_t of a compressed packet is the unpacked length packetUnpackedSize = readLong(); break; case STORAGE_TYPE_RAW: packetUnpackedSize = packetSize; break; case STORAGE_TYPE_NUL: packetUnpackedSize = 0; break; default: return (BAD_PACKET_VERSION); } if (offset > 0) return (NO_ERROR); return (PACKET_OUT_OF_RANGE); } //--------------------------------------------------------------------------- void PacketFile::operator++(void) { if (++currentPacket >= numPackets) { currentPacket = numPackets - 1; } seekPacket(currentPacket); } //--------------------------------------------------------------------------- void PacketFile::operator--(void) { if (currentPacket-- <= 0) { currentPacket = 0; } seekPacket(currentPacket); } //--------------------------------------------------------------------------- int32_t PacketFile::getNumPackets(void) { return numPackets; } //--------------------------------------------------------------------------- int32_t PacketFile::getCurrentPacket(void) { return currentPacket; } //--------------------------------------------------------------------------- inline int32_t PacketFile::getPacketOffset(void) { return packetBase; } //--------------------------------------------------------------------------- int32_t PacketFile::getPackedPacketSize(void) { return packetSize; } //--------------------------------------------------------------------------- int32_t PacketFile::getStorageType(void) { return packetType; } //--------------------------------------------------------------------------- void PacketFile::reserve(int32_t count, bool useCheckSum) { //--------------------------------------------------- // If we already have packets, reserve does nothing. // Otherwise, reserve sets up the file. Must be // called before any writing to a newly created file. if (numPackets) { return; } usesCheckSum = useCheckSum; numPackets = count; int32_t firstPacketOffset = TABLE_ENTRY(numPackets); writeLong(PACKET_FILE_VERSION); writeLong(firstPacketOffset); //---------------------------- // initialize the seek table while (count-- > 0) writeLong(SetPacketType(firstPacketOffset, STORAGE_TYPE_NUL)); //------------------------------------------------------------- // If we called this, chances are we are writing a packet file // from start to finish. It is MUCH faster if this table is // updated in memory and flushed when the file is closed. if (!seekTable) { seekTable = (int32_t*)systemHeap->Malloc(numPackets * sizeof(int32_t)); if (seekTable != nullptr) { seek(sizeof(int32_t) * 2); // File Version & File Length read(uint8_t*(seekTable), (numPackets * sizeof(int32_t))); } } } //--------------------------------------------------------------------------- int32_t PacketFile::writePacket(int32_t packet, uint8_t* buffer, int32_t nbytes, uint8_t pType) { //-------------------------------------------------------- // This function writes the packet to the current end // of file and stores the packet address in the seek // table. NOTE that this cannot be used to replace // a packet. That function is writePacket which takes // a packet number and a buffer. The size cannot change // and, as such, is irrelevant. You must write the // same sized packet each time, if the packet already // exists. In theory, it could be smaller but the check // right now doesn't allow anything but same size. int32_t result = 0; uint8_t* workBuffer = nullptr; if (pType == ANY_PACKET_TYPE || pType == STORAGE_TYPE_LZD || pType == STORAGE_TYPE_ZLIB) { if ((nbytes << 1) < 4096) workBuffer = (uint8_t*)malloc(4096); else workBuffer = (uint8_t*)malloc(nbytes << 1); gosASSERT(workBuffer != nullptr); } gosASSERT((packet > 0) || (packet < numPackets)); packetBase = getLength(); currentPacket = packet; packetSize = packetUnpackedSize = nbytes; //----------------------------------------------- // Code goes in here to pick the best compressed // version of the packet. Otherwise, default // to RAW. if ((pType == ANY_PACKET_TYPE) || (pType == STORAGE_TYPE_LZD) || (pType == STORAGE_TYPE_ZLIB)) { if (pType == ANY_PACKET_TYPE) pType = STORAGE_TYPE_RAW; //----------------------------- // Find best compression here. // This USED to use LZ. Use ZLib from now on. // Game will ALWAYS be able to READ LZ Packets!! uint32_t actualSize = nbytes << 1; if (actualSize < 4096) actualSize = 4096; uint32_t workBufferSize = actualSize; uint32_t oldBufferSize = nbytes; int32_t compressedResult = compress2(workBuffer, &workBufferSize, buffer, nbytes, Z_DEFAULT_COMPRESSION); if (compressedResult != Z_OK) STOP(("Unable to write packet %d to file %s. Error %d", packet, m_fileName, compressedResult)); compressedResult = uncompress(buffer, &oldBufferSize, workBuffer, nbytes); if ((int32_t)oldBufferSize != nbytes) STOP(( "Packet size changed after compression. Was %d is now %d", nbytes, oldBufferSize)); if ((pType == STORAGE_TYPE_LZD) || (pType == STORAGE_TYPE_ZLIB) || ((int32_t)workBufferSize < nbytes)) { pType = STORAGE_TYPE_ZLIB; packetSize = workBufferSize; } } packetType = pType; seek(packetBase); if (packetType == STORAGE_TYPE_ZLIB) { writeLong(packetUnpackedSize); result = write(workBuffer, packetSize); } else { result = write(buffer, packetSize); } if (!seekTable) { seek(TABLE_ENTRY(packet)); writeLong(SetPacketType(packetBase, packetType)); } else { seekTable[packet] = SetPacketType(packetBase, packetType); } int32_t* currentEntry = nullptr; if (seekTable) { packet++; currentEntry = &(seekTable[packet]); } int32_t tableData = SetPacketType(getLength(), STORAGE_TYPE_NUL); while (packet < (numPackets - 1)) { if (!seekTable) { writeLong(tableData); } else { *currentEntry = tableData; currentEntry++; } packet++; } if (workBuffer) free(workBuffer); return result; } #define DEFAULT_MAX_PACKET 65535 //--------------------------------------------------------------------------- int32_t PacketFile::insertPacket(int32_t packet, uint8_t* buffer, int32_t nbytes, uint8_t pType) { //-------------------------------------------------------- // This function writes the packet to the current end // of file and stores the packet address in the seek // table. Originally, replace was a NONO. No, we check // for the size and, if it is different, insert the new // packet into a new file and basically spend many timeparts doing it. // Necessary for the teditor. // I Love it. int32_t result = 0; if (packet < 0) { return result; } //--------------------------------------------------------------- // Only used here, so OK if regular WINDOWS(tm) malloc! uint8_t* workBuffer = (uint8_t*)malloc(DEFAULT_MAX_PACKET); //------------------------------------------------------------- // All new code here. Basically, open a new packet file, // write each of the old packets and this new one. Close all // and copy the new one over the old one. Open the new one and // set pointers accordingly. PacketFile tmpFile; result = tmpFile.create("AF3456AF.788"); if (packet >= numPackets) { numPackets++; } tmpFile.reserve(numPackets); for (size_t i = 0; i < numPackets; i++) { if (i == packet) { if (nbytes >= DEFAULT_MAX_PACKET) { //---------------------------------------------------- // Not sure what to do here. We'll try reallocating ::free(workBuffer); workBuffer = (uint8_t*)malloc(packetSize); } tmpFile.writePacket(i, buffer, nbytes, pType); } else { seekPacket(i); int32_t storageType = getStorageType(); int32_t packetSize = getPacketSize(); if (packetSize >= DEFAULT_MAX_PACKET) { //---------------------------------------------------- // Not sure what to do here. We'll try reallocating ::free(workBuffer); workBuffer = (uint8_t*)malloc(packetSize); } readPacket(i, workBuffer); tmpFile.writePacket(i, workBuffer, packetSize, storageType); } } //------------------------------------ // Now close and reassign everything. wchar_t ourFileName[250]; int32_t ourFileMode = 0; strcpy(ourFileName, m_fileName); ourFileMode = fileMode; tmpFile.close(); close(); remove(ourFileName); rename("AF3456AF.788", ourFileName); remove("AF3456AF.788"); open(ourFileName, (FileMode)ourFileMode); seekPacket(packet); return result; } //--------------------------------------------------------------------------- int32_t PacketFile::writePacket(int32_t packet, uint8_t* buffer) { //-------------------------------------------------------- // This function replaces the packet with the contents // of buffer. There are two restrictions. The first is // that the packet must be the same length as the existing // packet. If not, buffer over/under run will occur. // The second is that the packet cannot be compressed since // there is no gaurantee that the new data will compress // to exactly the same length. Returns NO_ERROR if packet // written successfully. Otherwise returns error. int32_t result = 0; if ((packet < 0) || (packet >= numPackets)) { return 0; } seekPacket(packet); if (packetType == STORAGE_TYPE_LZD || packetType == STORAGE_TYPE_HF || packetType == STORAGE_TYPE_ZLIB) { return (PACKET_WRONG_SIZE); } else { result = write(buffer, packetSize); } if (result == packetUnpackedSize) { return (NO_ERROR); } return BAD_WRITE_ERR; }
26.699862
104
0.573249
mechasource
53247f8dfcfca4171f798f44346a34220a409956
4,635
hpp
C++
src/main/resources/main/includes/MovableText.hpp
yildiz-online/module-graphic-ogre
8f45fbfd3984d3f9f3143767de5b211e9a9c525f
[ "MIT" ]
null
null
null
src/main/resources/main/includes/MovableText.hpp
yildiz-online/module-graphic-ogre
8f45fbfd3984d3f9f3143767de5b211e9a9c525f
[ "MIT" ]
8
2018-11-19T20:41:21.000Z
2021-12-03T03:03:51.000Z
src/main/resources/main/includes/MovableText.hpp
yildiz-online/module-graphic-ogre
8f45fbfd3984d3f9f3143767de5b211e9a9c525f
[ "MIT" ]
null
null
null
/** * File: MovableText.h * * description: This create create a billboarding object that display a text. * * @author 2003 by cTh see gavocanov@rambler.ru * @update 2006 by barraq see nospam@barraquand.com * @update 2012 to work with newer versions of OGRE by MindCalamity <mindcalamity@gmail.com> * - See "Notes" on: http://www.ogre3d.org/tikiwiki/tiki-editpage.php?page=MovableText */ #ifndef __include_MovableText_H__ #define __include_MovableText_H__ #define MOVABLETEXT yz::MovableText #include <Ogre.h> #include "stdafx.h" #include "Font.hpp" namespace yz { class MovableText: public Ogre::MovableObject, public Ogre::Renderable { public: enum HorizontalAlignment { H_LEFT, H_CENTER }; enum VerticalAlignment { V_BELOW, V_ABOVE, V_CENTER }; private: std::string mFontName; std::string mType; std::string mName; std::string mCaption; HorizontalAlignment mHorizontalAlignment; VerticalAlignment mVerticalAlignment; Ogre::ColourValue mColor; Ogre::RenderOperation mRenderOp; Ogre::AxisAlignedBox mAABB; Ogre::LightList mLList; Ogre::Real mCharHeight; Ogre::Real mSpaceWidth; bool mNeedUpdate; bool mUpdateColors; bool mOnTop; const Ogre::Real mTimeUntilNextToggle; Ogre::Real mRadius; Ogre::Vector3 mGlobalTranslation; Ogre::Vector3 mLocalTranslation; Ogre::Camera *mpCam; Ogre::RenderWindow *mpWin; yz::Font *mpFont; Ogre::MaterialPtr mpMaterial; Ogre::MaterialPtr mpBackgroundMaterial; /******************************** public methods ******************************/ public: MovableText( const std::string& name, const std::string& caption, yz::Font* font, const Ogre::Real charHeight, const Ogre::ColourValue &color = Ogre::ColourValue::White); virtual ~MovableText(); // Add to build on Shoggoth: virtual void visitRenderables( Ogre::Renderable::Visitor* visitor, bool debugRenderables = false); // Set settings void setFont(yz::Font* font); void setCaption(const std::string &caption); void setColor( const Ogre::Real r, const Ogre::Real g, const Ogre::Real b, const Ogre::Real a); void setCharacterHeight(const Ogre::Real height); void setSpaceWidth(const Ogre::Real width); void setTextAlignment( const HorizontalAlignment& horizontalAlignment, const VerticalAlignment& verticalAlignment); void setGlobalTranslation(Ogre::Vector3 trans); void setLocalTranslation(Ogre::Vector3 trans); void showOnTop(bool show = true); // Get settings const std::string& getFontName() const { return mFontName; } const std::string& getCaption() const { return mCaption; } const Ogre::ColourValue& getColor() const { return mColor; } const Ogre::Real getCharacterHeight() const { return mCharHeight; } const Ogre::Real getSpaceWidth() const { return mSpaceWidth; } Ogre::Vector3 getGlobalTranslation() const { return mGlobalTranslation; } Ogre::Vector3 getLocalTranslation() const { return mLocalTranslation; } bool getShowOnTop() const { return mOnTop; } Ogre::AxisAlignedBox GetAABB() { return mAABB; } /******************************** protected methods and overload **************/ protected: // from MovableText, create the object void _setupGeometry(); void _updateColors(); // from MovableObject void getWorldTransforms(Ogre::Matrix4 *xform) const; Ogre::Real getBoundingRadius() const { return mRadius; } Ogre::Real getSquaredViewDepth(const Ogre::Camera *cam) const { return 0; } const Ogre::Quaternion& getWorldOrientation(void) const; const Ogre::Vector3& getWorldPosition(void) const; const Ogre::AxisAlignedBox& getBoundingBox(void) const { return mAABB; } const std::string& getName() const { return mName; } const std::string& getMovableType() const { static Ogre::String movType = "MovableText"; return movType; } void _notifyCurrentCamera(Ogre::Camera *cam); void _updateRenderQueue(Ogre::RenderQueue* queue); // from renderable void getRenderOperation(Ogre::RenderOperation &op); const Ogre::MaterialPtr &getMaterial() const { assert(mpMaterial); return mpMaterial; } const Ogre::LightList &getLights() const { return mLList; } }; } //end namespace Ogre #endif
25.893855
94
0.650054
yildiz-online
5326794321e921c189b889ceaa47c41624e094e9
16,977
cxx
C++
ds/adsi/ldap/extension.cxx
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
ds/adsi/ldap/extension.cxx
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
ds/adsi/ldap/extension.cxx
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
//+--------------------------------------------------------------------------- // // Microsoft Windows // Copyright (C) Microsoft Corporation, 1992 - 1993. // // File: libmain.cxx // // Contents: LibMain for ADs.dll // // Functions: LibMain, DllGetClassObject // // History: 25-Oct-94 KrishnaG Created. // //---------------------------------------------------------------------------- #include "ldap.hxx" #pragma hdrstop LPCWSTR lpszTopLevel = L"SOFTWARE\\Microsoft\\ADs\\Providers\\LDAP"; LPCWSTR lpszExtensions = L"Extensions"; PCLASS_ENTRY gpClassHead = NULL; PCLASS_ENTRY BuildClassesList() { HKEY hTopLevelKey = NULL; HKEY hExtensionKey = NULL; HKEY hExtensionRootKey = NULL; HKEY hClassKey = NULL; DWORD dwIndex = 0; WCHAR lpszClassName[MAX_PATH]; DWORD dwchClassName = 0; PCLASS_ENTRY pClassHead = NULL; PCLASS_ENTRY pClassEntry = NULL; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, lpszTopLevel, 0, KEY_READ, &hTopLevelKey ) != ERROR_SUCCESS) { goto CleanupAndExit; } if (RegOpenKeyEx(hTopLevelKey, lpszExtensions, 0, KEY_READ, &hExtensionRootKey ) != ERROR_SUCCESS) { goto CleanupAndExit; } memset(lpszClassName, 0, sizeof(lpszClassName)); dwchClassName = sizeof(lpszClassName)/sizeof(WCHAR); while(RegEnumKeyEx(hExtensionRootKey, dwIndex, lpszClassName, &dwchClassName, NULL, NULL, NULL, NULL ) == ERROR_SUCCESS) { // // Read namespace // if (RegOpenKeyEx(hExtensionRootKey, lpszClassName, 0, KEY_READ, &hClassKey ) != ERROR_SUCCESS){ goto CleanupAndExit; } pClassEntry = BuildClassEntry( lpszClassName, hClassKey ); if (pClassEntry) { pClassEntry->pNext = pClassHead; pClassHead = pClassEntry; } if (hClassKey) { CloseHandle(hClassKey); } memset(lpszClassName, 0, sizeof(lpszClassName)); dwchClassName = sizeof(lpszClassName)/sizeof(WCHAR); dwIndex++; } CleanupAndExit: if (hExtensionRootKey) { RegCloseKey(hExtensionRootKey); } if (hTopLevelKey) { RegCloseKey(hTopLevelKey); } return(pClassHead); } VOID FreeClassesList( PCLASS_ENTRY pClassHead ) { PCLASS_ENTRY pDelete; while (pClassHead) { pDelete = pClassHead; pClassHead = pClassHead->pNext; FreeClassEntry(pDelete); } return; } PCLASS_ENTRY BuildClassEntry( LPWSTR lpszClassName, HKEY hClassKey ) { HKEY hTopLevelKey = NULL; HKEY hExtensionKey = NULL; DWORD dwIndex = 0; DWORD dwchExtensionCLSID = 0; WCHAR lpszExtensionCLSID[MAX_PATH]; PCLASS_ENTRY pClassEntry = NULL; PEXTENSION_ENTRY pExtensionHead = NULL; PEXTENSION_ENTRY pExtensionEntry = NULL; pClassEntry = (PCLASS_ENTRY)AllocADsMem(sizeof(CLASS_ENTRY)); if (!pClassEntry) { goto CleanupAndExit; } wcscpy(pClassEntry->szClassName, lpszClassName); memset(lpszExtensionCLSID, 0, sizeof(lpszExtensionCLSID)); dwchExtensionCLSID = sizeof(lpszExtensionCLSID)/sizeof(WCHAR); while(RegEnumKeyEx(hClassKey, dwIndex, lpszExtensionCLSID, &dwchExtensionCLSID, NULL, NULL, NULL, NULL ) == ERROR_SUCCESS) { // // Read namespace // if (RegOpenKeyEx(hClassKey, lpszExtensionCLSID, 0, KEY_READ, &hExtensionKey ) != ERROR_SUCCESS){ goto CleanupAndExit; } // // Read the Interfaces that this Extension supports // pExtensionEntry = BuildExtensionEntry( lpszExtensionCLSID, hExtensionKey ); if (pExtensionEntry) { wcscpy(pExtensionEntry->szExtensionCLSID, lpszExtensionCLSID); pExtensionEntry->pNext = pExtensionHead; pExtensionHead = pExtensionEntry; } if (hExtensionKey) { CloseHandle(hExtensionKey); } memset(lpszExtensionCLSID, 0, sizeof(lpszExtensionCLSID)); dwchExtensionCLSID = sizeof(lpszExtensionCLSID)/sizeof(WCHAR); dwIndex++; } CleanupAndExit: if (pExtensionHead) { pClassEntry->pExtensionHead = pExtensionHead; } else { // // There are no values under the key // if(pClassEntry) { FreeADsMem(pClassEntry); pClassEntry = NULL; } } return(pClassEntry); } PEXTENSION_ENTRY BuildExtensionEntry( LPWSTR lpszExtensionCLSID, HKEY hExtensionKey ) { PEXTENSION_ENTRY pExtensionEntry = NULL; PINTERFACE_ENTRY pInterfaceEntry = NULL; PINTERFACE_ENTRY pInterfaceHead = NULL; WCHAR lpszInterfaces[MAX_PATH]; DWORD dwchInterfaces = 0; LPWSTR psz = NULL; WCHAR Interface[MAX_PATH]; HRESULT hr = S_OK; DWORD dwStatus = NO_ERROR; pExtensionEntry = (PEXTENSION_ENTRY)AllocADsMem(sizeof(EXTENSION_ENTRY)); if (!pExtensionEntry) { goto CleanupAndExit; } memset(lpszInterfaces, 0, sizeof(lpszInterfaces)); dwchInterfaces = sizeof(lpszInterfaces); dwStatus = RegQueryValueEx( hExtensionKey, L"Interfaces", NULL, NULL, (LPBYTE) lpszInterfaces, &dwchInterfaces ); if(dwStatus) { // we should bail here goto CleanupAndExit; } psz = lpszInterfaces; while (psz && *psz) { wcscpy(Interface, psz); // skip (length) + 1 // lstrlen returns length sans '\0' pInterfaceEntry = (PINTERFACE_ENTRY)AllocADsMem(sizeof(INTERFACE_ENTRY)); if (pInterfaceEntry) { wcscpy(pInterfaceEntry->szInterfaceIID, Interface); hr = IIDFromString(Interface, &(pInterfaceEntry->iid)); pInterfaceEntry->pNext = pInterfaceHead; pInterfaceHead = pInterfaceEntry; } psz = psz + lstrlen(psz) + 1; } wcscpy(pExtensionEntry->szExtensionCLSID, lpszExtensionCLSID); hr = CLSIDFromString(lpszExtensionCLSID, &(pExtensionEntry->ExtCLSID)); if(FAILED(hr)) { // we should bail out since ExtCLSID is the one we use to cocreate the extensions goto CleanupAndExit; } pExtensionEntry->pIID = pInterfaceHead; return pExtensionEntry; CleanupAndExit: pInterfaceEntry = pInterfaceHead; while(pInterfaceEntry) { pInterfaceHead = pInterfaceHead->pNext; FreeADsMem(pInterfaceEntry); pInterfaceEntry = pInterfaceHead; } if(pExtensionEntry) { FreeADsMem(pExtensionEntry); pExtensionEntry = NULL; } return(pExtensionEntry); } void FreeInterfaceEntry( PINTERFACE_ENTRY pInterfaceEntry ) { if (pInterfaceEntry) { FreeADsMem(pInterfaceEntry); } } void FreeExtensionEntry( PEXTENSION_ENTRY pExtensionEntry ) { PINTERFACE_ENTRY pInterfaceEntry = NULL; PINTERFACE_ENTRY pTemp = NULL; if (pExtensionEntry) { pInterfaceEntry = pExtensionEntry->pIID; while (pInterfaceEntry) { pTemp = pInterfaceEntry->pNext; if (pInterfaceEntry) { FreeInterfaceEntry(pInterfaceEntry); } pInterfaceEntry = pTemp; } // // Now unload the Extension Object // if (pExtensionEntry->pUnknown) { // // Call non-delegating Release to release ref. count on innner // object to inner object -> inner object self destroyed. // (pExtensionEntry->pUnknown)->Release(); } FreeADsMem(pExtensionEntry); } return; } void FreeClassEntry( PCLASS_ENTRY pClassEntry ) { PEXTENSION_ENTRY pExtensionEntry = NULL; PEXTENSION_ENTRY pTemp = NULL; if (pClassEntry) { pExtensionEntry = pClassEntry->pExtensionHead; while (pExtensionEntry) { pTemp = pExtensionEntry->pNext; if (pExtensionEntry) { FreeExtensionEntry(pExtensionEntry); } pExtensionEntry = pTemp; } FreeADsMem(pClassEntry); } return; } PINTERFACE_ENTRY MakeCopyofInterfaceEntry( PINTERFACE_ENTRY pInterfaceEntry ) { PINTERFACE_ENTRY pNewInterfaceEntry = NULL; pNewInterfaceEntry = (PINTERFACE_ENTRY)AllocADsMem(sizeof(INTERFACE_ENTRY)); if (pNewInterfaceEntry) { wcscpy(pNewInterfaceEntry->szInterfaceIID, pInterfaceEntry->szInterfaceIID); memcpy(&(pNewInterfaceEntry->iid), &(pInterfaceEntry->iid), sizeof(GUID)); } return(pNewInterfaceEntry); } PEXTENSION_ENTRY MakeCopyofExtensionEntry( PEXTENSION_ENTRY pExtensionEntry ) { PEXTENSION_ENTRY pNewExtensionEntry = NULL; PINTERFACE_ENTRY pInterfaceEntry = NULL; PINTERFACE_ENTRY pNewInterfaceEntry = NULL; PINTERFACE_ENTRY pNewInterfaceHead = NULL; pInterfaceEntry = pExtensionEntry->pIID; while (pInterfaceEntry) { pNewInterfaceEntry = MakeCopyofInterfaceEntry(pInterfaceEntry); if (pNewInterfaceEntry) { pNewInterfaceEntry->pNext = pNewInterfaceHead; pNewInterfaceHead = pNewInterfaceEntry; } pInterfaceEntry = pInterfaceEntry->pNext; } pNewExtensionEntry = (PEXTENSION_ENTRY)AllocADsMem(sizeof(EXTENSION_ENTRY)); if (pNewExtensionEntry) { wcscpy( pNewExtensionEntry->szExtensionCLSID, pExtensionEntry->szExtensionCLSID ); memcpy( &(pNewExtensionEntry->ExtCLSID), &(pExtensionEntry->ExtCLSID), sizeof(GUID) ); pNewExtensionEntry->pIID = pNewInterfaceHead; // // Initialize fields we won't know the values of until an instacne of // the extension is created and aggregated (loaded). // pNewExtensionEntry->pUnknown=NULL; pNewExtensionEntry->pPrivDisp=NULL; pNewExtensionEntry->pADsExt=NULL; pNewExtensionEntry->fDisp=FALSE; pNewExtensionEntry->dwExtensionID = (DWORD) -1; //invalid dwExtensionID // // let class entry handle pNext // } else { // clear out the memory of interface entries pInterfaceEntry = pNewInterfaceHead; while (pInterfaceEntry) { pNewInterfaceHead = pNewInterfaceHead->pNext; FreeADsMem(pInterfaceEntry); pInterfaceEntry = pNewInterfaceHead; } } return(pNewExtensionEntry); } PCLASS_ENTRY MakeCopyofClassEntry( PCLASS_ENTRY pClassEntry ) { PCLASS_ENTRY pNewClassEntry = NULL; PEXTENSION_ENTRY pExtensionEntry = NULL; PEXTENSION_ENTRY pNewExtensionEntry = NULL; PEXTENSION_ENTRY pNewExtensionHead = NULL; pExtensionEntry = pClassEntry->pExtensionHead; while (pExtensionEntry) { pNewExtensionEntry = MakeCopyofExtensionEntry(pExtensionEntry); if (pNewExtensionEntry) { pNewExtensionEntry->pNext = pNewExtensionHead; pNewExtensionHead = pNewExtensionEntry; } pExtensionEntry = pExtensionEntry->pNext; } pNewClassEntry = (PCLASS_ENTRY)AllocADsMem(sizeof(CLASS_ENTRY)); if (pNewClassEntry) { wcscpy(pNewClassEntry->szClassName, pClassEntry->szClassName); pNewClassEntry->pExtensionHead = pNewExtensionHead; } else { // clear the memory of extension entries pExtensionEntry = pNewExtensionHead; while(pExtensionEntry) { pNewExtensionHead = pNewExtensionHead->pNext; FreeExtensionEntry(pExtensionEntry); pExtensionEntry = pNewExtensionHead; } } return(pNewClassEntry); } CRITICAL_SECTION g_ExtCritSect; #define ENTER_EXTENSION_CRITSECT() EnterCriticalSection(&g_ExtCritSect) #define LEAVE_EXTENSION_CRITSECT() LeaveCriticalSection(&g_ExtCritSect) HRESULT ADSIGetExtensionList( LPWSTR pszClassName, PCLASS_ENTRY * ppClassEntry ) { PCLASS_ENTRY pTempClassEntry = NULL; PCLASS_ENTRY pClassEntry = NULL; ENTER_EXTENSION_CRITSECT(); // // Initialize global extensions list if not already // initialized. Note that this takes place inside the // g_ExtCritSect to protect against multiple threads trying // to simultaneously initialize it. // if (!gpClassHead) { gpClassHead = BuildClassesList(); } pTempClassEntry = gpClassHead; while (pTempClassEntry) { if (!_wcsicmp(pTempClassEntry->szClassName, pszClassName)) { // // Make a copy of this entire extension and // hand it over to the calling entity. // pClassEntry = MakeCopyofClassEntry(pTempClassEntry); *ppClassEntry = pClassEntry; LEAVE_EXTENSION_CRITSECT(); RRETURN(S_OK); } pTempClassEntry = pTempClassEntry->pNext; } *ppClassEntry = NULL; LEAVE_EXTENSION_CRITSECT(); RRETURN(S_OK); } //+------------------------------------------------------------------------ // // Function: ADSIAppendToExntesionList // // Synopsis: Adds to the end of the current class entry, // the extensions of the class pszClassName. This is // used in scenarios as follows - suppose fooUser // is derived from User, then we want to load the extensions // defined for User too apart from the extensions available // directly on fooUser. // // The first cut is not going to see if the class is already // there in the list. This optimization can be done later if // needed. // // Arguments: [pszClassName] -- name of class. // [ppClassEntry] -- class entry returned // // The class entry will be modified only if there were no // entries, if not we will append the new entry at the end. // AjayR 11-17-98 (added) //------------------------------------------------------------------------- HRESULT ADSIAppendToExtensionList( LPWSTR pszClassName, PCLASS_ENTRY * ppClassEntry ) { HRESULT hr = S_OK; PEXTENSION_ENTRY pLocalExtEntry = NULL; PCLASS_ENTRY pLocClassEntry = NULL; // // Check if there are no extensions on the list // if (!*ppClassEntry) { RRETURN(ADSIGetExtensionList(pszClassName, ppClassEntry)); } pLocalExtEntry = (*ppClassEntry)->pExtensionHead; while(pLocalExtEntry->pNext) { pLocalExtEntry = pLocalExtEntry->pNext; } // // Now get the extension list for the current class // hr = ADSIGetExtensionList(pszClassName, &pLocClassEntry); if (FAILED(hr)) { // // not a critical failure // hr = S_OK; } else { // // Add to the end of the current list. // if (pLocClassEntry) { pLocalExtEntry->pNext = pLocClassEntry->pExtensionHead; FreeADsMem((void*)pLocClassEntry); } } RRETURN(hr); }
23.22435
90
0.553396
npocmaka
532ad4842704c1ea5256794b665fdba4f7e6c046
2,327
cpp
C++
src/rollingchecksum.cpp
sandin/vfs
c3547982e17ee424eea6399c2c3862d23faf64d5
[ "MIT" ]
null
null
null
src/rollingchecksum.cpp
sandin/vfs
c3547982e17ee424eea6399c2c3862d23faf64d5
[ "MIT" ]
null
null
null
src/rollingchecksum.cpp
sandin/vfs
c3547982e17ee424eea6399c2c3862d23faf64d5
[ "MIT" ]
null
null
null
#include "rollingchecksum.h" using namespace vfs; #define ADD1(buffer, i) \ { \ s1 += buffer[i]; \ s2 += s1; \ } #define ADD2(buffer, i) \ ADD1(buffer, i); \ ADD1(buffer, i + 1); #define ADD4(buffer, i) \ ADD2(buffer, i); \ ADD2(buffer, i + 2); #define ADD8(buffer, i) \ ADD4(buffer, i); \ ADD4(buffer, i + 4); #define ADD16(buffer) \ ADD8(buffer, 0); \ ADD8(buffer, 8); #define SUB1(buffer, i) \ { \ s1 -= (buffer[i] + CHAR_OFFSET); \ s2 -= count * (buffer[i] + CHAR_OFFSET); \ count--; \ } #define SUB2(buffer, i) \ SUB1(buffer, i); \ SUB1(buffer, i + 1); #define SUB4(buffer, i) \ SUB2(buffer, i); \ SUB2(buffer, i + 2); #define SUB8(buffer, i) \ SUB4(buffer, i); \ SUB4(buffer, i + 4); #define SUB16(buffer) \ SUB8(buffer, 0); \ SUB8(buffer, 8); void RollingChecksum::Update(const unsigned char* buffer, size_t size) { size_t n = size; uint_fast16_t s1 = s1_; uint_fast16_t s2 = s2_; while (n >= 16) { ADD16(buffer); buffer += 16; n -= 16; } while (n != 0) { s1 += *buffer++; s2 += s1; n--; } s1 += size * CHAR_OFFSET; s2 += ((size * (size + 1)) / 2) * CHAR_OFFSET; count_ += size; s1_ = s1; s2_ = s2; } void RollingChecksum::RollingIn(const unsigned char in) { s1_ += in + CHAR_OFFSET; s2_ += s1_; count_++; } void RollingChecksum::RollingIn(const unsigned char* buffer, size_t buffer_size) { Update(buffer, buffer_size); } void RollingChecksum::RollingOut(const unsigned char out) { s1_ -= out + CHAR_OFFSET; s2_ -= count_ * (out + CHAR_OFFSET); count_--; } void RollingChecksum::RollingOut(const unsigned char* buffer, size_t size) { size_t n = size; size_t count = count_; uint_fast16_t s1 = s1_; uint_fast16_t s2 = s2_; while (n >= 16) { SUB16(buffer); buffer += 16; n -= 16; } while (n != 0) { s1 -= *buffer + CHAR_OFFSET; s2 -= count * (*buffer + CHAR_OFFSET); buffer++; count--; n--; } s1_ = s1; s2_ = s2; count_ = count; }
22.592233
77
0.502793
sandin
532ca3c95bed76e5f1dd034d35ae7dc6cc562e24
1,469
cpp
C++
Sorting/quick-sort.cpp
divyanshu013/algorithm-journey
8dc32daa732f16099da148bb8669778d4ef3172a
[ "MIT" ]
null
null
null
Sorting/quick-sort.cpp
divyanshu013/algorithm-journey
8dc32daa732f16099da148bb8669778d4ef3172a
[ "MIT" ]
null
null
null
Sorting/quick-sort.cpp
divyanshu013/algorithm-journey
8dc32daa732f16099da148bb8669778d4ef3172a
[ "MIT" ]
null
null
null
/******************************************************************************* Quick sort ========== Ref - http://quiz.geeksforgeeks.org/quick-sort/ -------------------------------------------------------------------------------- Problem ======= Classic old quick sort. -------------------------------------------------------------------------------- Time Complexity =============== O(nlogn) -------------------------------------------------------------------------------- Output ====== Array is initially: 64 34 25 12 22 11 90 After quick sort, array is: 11 12 22 25 34 64 90 *******************************************************************************/ #include <stdio.h> void printArray(int arr[], int n) { for(int i = 0; i < n; ++i) printf("%d ", arr[i]); printf("\n"); } void swap(int *p, int *q) { int temp = *p; *p = *q; *q = temp; } int partition(int arr[], int l, int r) { int pivot = arr[r]; int i = l; for (int j = l; j < r; j++) { if (arr[j] <= pivot) { swap(&arr[i++], &arr[j]); } } swap(&arr[i], &arr[r]); return i; } void quickSort(int arr[], int l, int r) { if (l < r) { int p = partition(arr, l, r); quickSort(arr, l, p - 1); quickSort(arr, p + 1, r); } } int main() { int arr[] = {64, 34, 25, 12, 22, 11, 90}; printf("Array is initially:\n"); printArray(arr, 7); printf("After quick sort, array is:\n"); quickSort(arr, 0, 6); printArray(arr, 7); return 0; }
19.586667
80
0.381892
divyanshu013
532ec47c6251e00bd15b8cf905a2e4481aad2f95
7,431
cpp
C++
dockerfiles/gaas_tutorial_2/GAAS/software/SLAM/ygz_slam_ros/Thirdparty/PCL/examples/geometry/example_half_edge_mesh.cpp
hddxds/scripts_from_gi
afb8977c001b860335f9062464e600d9115ea56e
[ "Apache-2.0" ]
2
2019-04-10T14:04:52.000Z
2019-05-29T03:41:58.000Z
software/SLAM/ygz_slam_ros/Thirdparty/PCL/examples/geometry/example_half_edge_mesh.cpp
glider54321/GAAS
5c3b8c684e72fdf7f62c5731a260021e741069e7
[ "BSD-3-Clause" ]
null
null
null
software/SLAM/ygz_slam_ros/Thirdparty/PCL/examples/geometry/example_half_edge_mesh.cpp
glider54321/GAAS
5c3b8c684e72fdf7f62c5731a260021e741069e7
[ "BSD-3-Clause" ]
1
2021-12-20T06:54:41.000Z
2021-12-20T06:54:41.000Z
/* * Software License Agreement (BSD License) * * Point Cloud Library (PCL) - www.pointclouds.org * Copyright (c) 2009-2012, Willow Garage, Inc. * Copyright (c) 2012-, Open Perception, Inc. * * 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 of the copyright holder(s) nor the names of its * 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. * * $Id$ * */ #include <iostream> #include <pcl/geometry/polygon_mesh.h> //////////////////////////////////////////////////////////////////////////////// // User data for the vertices. Here I just store an Id. In a 3D application this would be, for example // - x, y, z // - nx, ny, nz // - r, g, b // ... class MyVertexData { public: MyVertexData (const int id = -1) : id_ (id) {} int id () const {return (id_);} int& id () {return (id_);} private: int id_; }; std::ostream& operator << (std::ostream& os, const MyVertexData& vd) { return (os << vd.id ()); } //////////////////////////////////////////////////////////////////////////////// // Declare the mesh. typedef pcl::geometry::PolygonMesh <pcl::geometry::DefaultMeshTraits <MyVertexData> > Mesh; typedef Mesh::VertexIndex VertexIndex; typedef Mesh::HalfEdgeIndex HalfEdgeIndex; typedef Mesh::FaceIndex FaceIndex; typedef Mesh::VertexIndices VertexIndices; typedef Mesh::HalfEdgeIndices HalfEdgeIndices; typedef Mesh::FaceIndices FaceIndices; typedef Mesh::VertexAroundVertexCirculator VAVC; typedef Mesh::OutgoingHalfEdgeAroundVertexCirculator OHEAVC; typedef Mesh::IncomingHalfEdgeAroundVertexCirculator IHEAVC; typedef Mesh::FaceAroundVertexCirculator FAVC; typedef Mesh::VertexAroundFaceCirculator VAFC; typedef Mesh::InnerHalfEdgeAroundFaceCirculator IHEAFC; typedef Mesh::OuterHalfEdgeAroundFaceCirculator OHEAFC; //////////////////////////////////////////////////////////////////////////////// // Some output functions void printVertices (const Mesh& mesh) { std::cout << "Vertices:\n "; for (unsigned int i=0; i<mesh.sizeVertices (); ++i) { std::cout << mesh.getVertexDataCloud () [i] << " "; } std::cout << std::endl; } void printEdge (const Mesh& mesh, const HalfEdgeIndex& idx_he) { std::cout << " " << mesh.getVertexDataCloud () [mesh.getOriginatingVertexIndex (idx_he).get ()] << " " << mesh.getVertexDataCloud () [mesh.getTerminatingVertexIndex (idx_he).get ()] << std::endl; } void printFace (const Mesh& mesh, const FaceIndex& idx_face) { // Circulate around all vertices in the face VAFC circ = mesh.getVertexAroundFaceCirculator (idx_face); const VAFC circ_end = circ; std::cout << " "; do { std::cout << mesh.getVertexDataCloud () [circ.getTargetIndex ().get ()] << " "; } while (++circ != circ_end); std::cout << std::endl; } void printFaces (const Mesh& mesh) { std::cout << "Faces:\n"; for (unsigned int i=0; i<mesh.sizeFaces (); ++i) { printFace (mesh, FaceIndex (i)); } } //////////////////////////////////////////////////////////////////////////////// int main () { Mesh mesh; VertexIndices vi; // Create a closed circle around vertex 0 // // 2 - 1 // // / \ / \ 7 <- Isolated vertex // // 3 - 0 6 // // \ / \ / // // 4 - 5 // for (unsigned int i=0; i<8; ++i) { vi.push_back (mesh.addVertex (MyVertexData (i))); } // General method to add faces. VertexIndices tmp; tmp.push_back (vi [0]); tmp.push_back (vi [1]); tmp.push_back (vi [2]); mesh.addFace (tmp); tmp.clear (); // Convenience method: Works only for triangles mesh.addFace (vi [0], vi [2], vi [3]); mesh.addFace (vi [0], vi [3], vi [4]); mesh.addFace (vi [0], vi [4], vi [5]); // Convenience method: Works only for quads mesh.addFace (vi [0], vi [5], vi [6], vi [1]); printVertices (mesh); printFaces (mesh); ////////////////////////////////////////////////////////////////////////////// std::cout << "Outgoing half-edges of vertex 0:" << std::endl; OHEAVC circ_oheav = mesh.getOutgoingHalfEdgeAroundVertexCirculator (vi[0]); const OHEAVC circ_oheav_end = circ_oheav; do { printEdge (mesh,circ_oheav.getTargetIndex ()); } while (++circ_oheav != circ_oheav_end); ////////////////////////////////////////////////////////////////////////////// std::cout << "Circulate around the boundary half-edges:" << std::endl; const HalfEdgeIndex& idx_he_boundary = mesh.getOutgoingHalfEdgeIndex (vi [6]); IHEAFC circ_iheaf = mesh.getInnerHalfEdgeAroundFaceCirculator (idx_he_boundary); const IHEAFC circ_iheaf_end = circ_iheaf; do { printEdge (mesh, circ_iheaf.getTargetIndex ()); } while (++circ_iheaf != circ_iheaf_end); ////////////////////////////////////////////////////////////////////////////// std::cout << std::endl << "Deleting face 1 (0 2 3) and 3 (0 4 5) ...\n"; std::cout << "(If the mesh is set to manifold further faces are removed automatically)\n\n"; mesh.deleteFace (FaceIndex (1)); mesh.deleteFace (FaceIndex (3)); mesh.cleanUp (); // Removes the isolated vertex (7) as well! vi.clear (); // The vertex indices are no longer synchronized with the mesh! printVertices (mesh); printFaces (mesh); ////////////////////////////////////////////////////////////////////////// std::cout << "Circulate around all faces of vertex 0:\n"; FAVC circ_fav = mesh.getFaceAroundVertexCirculator (vi [0]); const FAVC circ_fav_end = circ_fav; do { // Very important: Some half_edges are on the boundary // -> have an invalid face index if (!mesh.isBoundary (circ_fav.getCurrentHalfEdgeIndex ())) { printFace (mesh, circ_fav.getTargetIndex ()); } else { std::cout << " invalid face -> boundary half-edge\n"; } } while (++circ_fav!=circ_fav_end); return (0); }
31.75641
102
0.599785
hddxds
5331499b9235c169f20b8d531761c180854084f5
8,705
cpp
C++
src/libgeo/si.cpp
transpixel/TPQZcam
b44a97d44b49e9aa76c36efb6e4102091ff36c67
[ "MIT" ]
1
2017-06-01T00:21:16.000Z
2017-06-01T00:21:16.000Z
src/libgeo/si.cpp
transpixel/TPQZcam
b44a97d44b49e9aa76c36efb6e4102091ff36c67
[ "MIT" ]
3
2017-06-01T00:26:16.000Z
2020-05-09T21:06:27.000Z
libgeo/si.cpp
transpixel/tpqz
2d8400b1be03292d0c5ab74710b87e798ae6c52c
[ "MIT" ]
null
null
null
// // // MIT License // // Copyright (c) 2020 Stellacore Corporation. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject // to the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY // KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // /*! \file \brief Definitions for geo::si */ #include "libgeo/si.h" #include "libdat/info.h" #include "libla/eigen.h" #include "libmath/math.h" #include <algorithm> #include <sstream> namespace geo { namespace si { ga::Vector SemiAxis :: asVector () const { return { theMag * theDir }; } std::string SemiAxis :: infoString ( std::string const & title ) const { std::ostringstream oss; if (! title.empty()) { oss << title << " "; } oss << "Mag: " << dat::infoString(theMag); oss << " "; oss << "Dir: " << dat::infoString(theDir); return oss.str(); } SemiAxis PointSoln :: kthLargestSemiAxis ( size_t const & ndx ) const { SemiAxis axis{}; if (ndx < theSemiAxes.size()) { size_t const last{ theSemiAxes.size() - 1u }; size_t const kthNdx{ last - ndx }; axis = theSemiAxes[kthNdx]; } return axis; } double PointSoln :: rmsAxisMagnitude () const { double rms{ dat::nullValue<double>() }; double sumSqs{ 0. }; double count{ 0. }; for (size_t kk{0u} ; kk < 3u ; ++kk) { double const & mag = theSemiAxes[kk].theMag; if (dat::isValid(mag)) { sumSqs += math::sq(mag); count += 1.; } } if (0. < count) { rms = std::sqrt(sumSqs / count); } return rms; } std::vector<ga::Vector> PointSoln :: ellipsoidTips () const { ga::Vector const & mid = theLoc; return std::vector<ga::Vector> { mid + theSemiAxes[0].asVector() , mid - theSemiAxes[0].asVector() , mid + theSemiAxes[1].asVector() , mid - theSemiAxes[1].asVector() , mid + theSemiAxes[2].asVector() , mid - theSemiAxes[2].asVector() }; } std::string PointSoln :: infoString ( std::string const & title ) const { std::ostringstream oss; if (! title.empty()) { oss << title << std::endl; } oss << dat::infoString(theLoc, "theLoc"); oss << std::endl; oss << dat::infoString(theSemiAxes[0], "EllipA"); oss << std::endl; oss << dat::infoString(theSemiAxes[1], "EllipB"); oss << std::endl; oss << dat::infoString(theSemiAxes[2], "EllipC"); return oss.str(); } PointSystem :: PointSystem () : theNormCo{} , theNormRhs{} , theNumRays{ 0u } , theNumPlanes{ 0u } { std::fill(std::begin(theNormCo), std::end(theNormCo), 0.); std::fill(std::begin(theNormRhs), std::end(theNormRhs), 0.); } void PointSystem :: addWeightedRays ( std::vector<WRay> const & wrays ) { for (WRay const & wray : wrays) { addWeightedRay(wray); /* double const weightSq{ math::sq(wray.first) }; geo::Ray const & ray = wray.second; Dyadic const obsDyadic{ rayDyadicFor(ray.theDir) }; addWeightedDyadic(weightSq, obsDyadic); addWeightedRhs(weightSq, obsDyadic, ray.theStart); ++theNumRays; */ } } void PointSystem :: addWeightedPlanes ( std::vector<WPlane> const & wplanes ) { for (WPlane const & wplane : wplanes) { addWeightedPlane(wplane); /* double const weightSq{ math::sq(wplane.first) }; geo::Plane const & plane = wplane.second; Dyadic const obsDyadic{ planeDyadicFor(plane.unitNormal()) }; addWeightedDyadic(weightSq, obsDyadic); addWeightedRhs(weightSq, obsDyadic, plane.origin()); ++theNumPlanes; */ } } namespace { //! Extract ellipsoid axes from SVD decomposition of normal matrix inline std::array<SemiAxis, 3u> inverseEllipsoidFrom ( Eigen::BDCSVD<la::eigen::Matrix_t<double> > const & svd ) { // NOTE: Eigen return sVals sorted in decreasing order la::eigen::Matrix_t<double> const vecS{ svd.singularValues() }; la::eigen::Matrix_t<double> const matV{ svd.matrixU() }; // weights are eigenValues which are sqrt(SingularValues) std::array<double, 3u> const wVals { std::sqrt(vecS(0, 0)) , std::sqrt(vecS(1, 0)) , std::sqrt(vecS(2, 0)) }; /* io::out() << "======" << '\n'; io::out() << "matU:\n" << svd.matrixU() << '\n'; io::out() << "vecS:\n" << vecS << '\n'; io::out() << "wVal:" << dat::infoString(wVals) << '\n'; io::out() << "matV:\n" << svd.matrixV() << '\n'; io::out() << "======" << '\n'; */ // eigen vectors are columns of 'V' matrix ga::Vector const eVec0{ matV(0, 0), matV(1, 0), matV(2, 0) }; ga::Vector const eVec1{ matV(0, 1), matV(1, 1), matV(2, 1) }; ga::Vector const eVec2{ matV(0, 2), matV(1, 2), matV(2, 2) }; // return as inverse ellipsoid return { SemiAxis{ wVals[0], eVec0 } , SemiAxis{ wVals[1], eVec1 } , SemiAxis{ wVals[2], eVec2 } }; } //! Inverse of each axis std::array<SemiAxis, 3u> standardEllipsoid ( Eigen::BDCSVD<la::eigen::Matrix_t<double> > const & svd ) { std::array<SemiAxis, 3u> invAxes; std::array<SemiAxis, 3u> const fwdAxes{ inverseEllipsoidFrom(svd) }; size_t const numAxes{ fwdAxes.size() }; for (size_t kk{0u} ; kk < numAxes ; ++kk) { SemiAxis const & fwdAxis = fwdAxes[kk]; double const & wSqMag = fwdAxis.theMag; ga::Vector const & dir = fwdAxis.theDir; double invSqMag{ dat::nullValue<double>() }; if (math::eps < wSqMag) { invSqMag = 1. / wSqMag; } invAxes[kk] = SemiAxis{ invSqMag, dir }; } return invAxes; } //! Solve point location and uncertainty ellipsoid using SVD PointSoln pointSolnSVD ( Dyadic const & normCo , RhsVec const & normRhs ) { // Interpret input structures as Eigen data la::eigen::ConstMap<double> const coMat (normCo.begin(), 3u, 3u); la::eigen::ConstMap<double> const rhsMat (normRhs.begin(), normRhs.size(), 1u); // allocate output solution space std::array<double, 3u> soln{ dat::nullValue<double>() }; la::eigen::WriteMap<double> solnOut(soln.begin(), soln.size(), 1u); // construct SVD auto const eFlags{ Eigen::ComputeThinU + Eigen::ComputeThinV }; Eigen::BDCSVD<la::eigen::Matrix_t<double> > const svd(coMat, eFlags); // use SVD to solve system solnOut = svd.solve(rhsMat); // extract uncertainties std::array<SemiAxis, 3u> const covarAxes{ standardEllipsoid(svd) }; // pack results into PointSoln ga::Vector const pntLoc{ soln[0], soln[1], soln[2] }; return PointSoln{ pntLoc, covarAxes }; } } // [annon] PointSoln PointSystem :: pointSolution () const { PointSoln const tmp{ pointSolnSVD(theNormCo, theNormRhs) }; // adjust for statistical degrees of freedom (on average) // unclear if required constexpr double scale{ 1. }; /* double const domPlanes{ 1. * (double)theNumPlanes }; double const domRays{ 2. * (double)theNumRays }; double const dofPoint{ 3. }; double const redundancy{ domRays + domPlanes - dofPoint }; double scale{ dat::nullValue<double>() }; if (0. < redundancy) { scale = 1. / redundancy; } if (0. == redundancy) { scale = 1.; } io::out() << dat::infoString(domPlanes, "domPlanes") << '\n'; io::out() << dat::infoString(domRays, "domRays") << '\n'; io::out() << dat::infoString(dofPoint, "dofPoint") << '\n'; io::out() << dat::infoString(redundancy, "redundancy") << '\n'; io::out() << dat::infoString(scale, "scale") << '\n'; */ // adjust axes magnitudes for return values std::array<SemiAxis, 3u> const & tmpAxes = tmp.theSemiAxes; std::array<SemiAxis, 3u> const stdEllipAxes { SemiAxis{ scale*tmpAxes[0].theMag, tmpAxes[0].theDir } , SemiAxis{ scale*tmpAxes[1].theMag, tmpAxes[1].theDir } , SemiAxis{ scale*tmpAxes[2].theMag, tmpAxes[2].theDir } }; return PointSoln{ tmp.theLoc, stdEllipAxes }; } std::string PointSystem :: infoString ( std::string const & title ) const { std::ostringstream oss; if (! title.empty()) { oss << title << std::endl; } oss << priv::infoMatrix(theNormCo.begin(), "theNormCo", 3u); oss << std::endl; oss << priv::infoMatrix(theNormRhs.begin(), "theNormRhs", 1u); return oss.str(); } } // si } // geo
24.383754
72
0.653418
transpixel
533701c4844948c192103c881ae49b407fc972ec
2,805
cpp
C++
src/nietacka/event/GameEvent.cpp
PiotrJander/sik-achtung-die-kurve
a44af3b20e5baccd18d388a0a29f412a2c5e5902
[ "MIT" ]
null
null
null
src/nietacka/event/GameEvent.cpp
PiotrJander/sik-achtung-die-kurve
a44af3b20e5baccd18d388a0a29f412a2c5e5902
[ "MIT" ]
null
null
null
src/nietacka/event/GameEvent.cpp
PiotrJander/sik-achtung-die-kurve
a44af3b20e5baccd18d388a0a29f412a2c5e5902
[ "MIT" ]
null
null
null
// // Created by Piotr Jander on 22/08/2017. // #include <sstream> #include "GameEvent.h" #include "../crc32c.h" #include "PixelEvent.h" #include "PlayerEliminatedEvent.h" #include "GameOverEvent.h" #include "NewGameEvent.h" #include "../Exceptions.h" std::unique_ptr<GameEvent> GameEvent::read(ReadBuffer &readBuffer) { try { uint32_t length, expectedChecksum; readBuffer >> length; length = ntohl(length); const char *startOfEvent = readBuffer.peek(); auto event = readSelf(readBuffer, length); if (length != event->selfLength()) { throw ParseException("Event length mismatch"); } readBuffer >> expectedChecksum; expectedChecksum = ntohl(expectedChecksum); uint32_t actualChecksum = crc32c(0, reinterpret_cast<const unsigned char *>(startOfEvent), length); // if (expectedChecksum != actualChecksum) { // throw ParseException("Bad checksum"); // } return event; } catch (ReadBufferException &e) { throw ParseException("Trying to read past the buffer"); } } std::unique_ptr<GameEvent> GameEvent::readSelf(ReadBuffer &readBuffer, int length) { const HeaderPacked *header = reinterpret_cast<const HeaderPacked *>(readBuffer.peek()); switch (header->type) { case Type::NEW_GAME: { auto packedNoPlayerNames = readBuffer.castAndAdvance<NewGameEvent::SelfPackedNoPlayerNames>(); std::vector<std::string> names; int len = length - sizeof(NewGameEvent::SelfPackedNoPlayerNames); while (len) { std::string name = readBuffer.readString(len); len -= name.size() + 1; names.emplace_back(move(name)); } return std::make_unique<NewGameEvent>(*packedNoPlayerNames, names); } case Type::PIXEL: { return std::make_unique<PixelEvent>(*readBuffer.castAndAdvance<PixelEvent::SelfPacked>()); } case Type::PLAYER_ELIMINATED: { return std::make_unique<PlayerEliminatedEvent>(*readBuffer.castAndAdvance<PlayerEliminatedEvent::SelfPacked>()); } case Type::GAME_OVER: { return std::make_unique<GameOverEvent>(*readBuffer.castAndAdvance<HeaderPacked>()); } } } bool GameEvent::operator==(const GameEvent &other) const { return other.getEventNo() == getEventNo() && other.getType() == getType(); } void GameEvent::write(DynamicBuffer &buffer) { uint32_t length = selfLength(); buffer << htonl(length); const char *start = buffer.currentLocation(); writeSelf(buffer); uint32_t checksum = crc32c(0, (const unsigned char *) start, length); buffer << htonl(checksum); }
31.875
124
0.630303
PiotrJander
53376b589d20ca7205de812d1662d4199954e404
3,758
cpp
C++
src/atlas_fusion/src/algorithms/pointcloud/PointCloudExtrapolator.cpp
Robotics-BUT/Atlas-Fusion
3237f65d84a2686c5a20b89def4b706d89744ffb
[ "MIT" ]
15
2020-10-27T01:38:05.000Z
2021-09-21T07:27:01.000Z
src/atlas_fusion/src/algorithms/pointcloud/PointCloudExtrapolator.cpp
Robotics-BUT/Atlas-Fusion
3237f65d84a2686c5a20b89def4b706d89744ffb
[ "MIT" ]
2
2021-06-02T11:54:38.000Z
2021-10-05T13:05:29.000Z
src/atlas_fusion/src/algorithms/pointcloud/PointCloudExtrapolator.cpp
Robotics-BUT/Atlas-Fusion
3237f65d84a2686c5a20b89def4b706d89744ffb
[ "MIT" ]
4
2021-04-10T09:12:47.000Z
2021-04-27T15:33:27.000Z
/* * Copyright 2020 Brno University of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "algorithms/pointcloud/PointCloudExtrapolator.h" #include "local_map/Frames.h" namespace AtlasFusion::Algorithms { std::vector<std::shared_ptr<DataModels::PointCloudBatch>> PointCloudExtrapolator::splitPointCloudToBatches( std::shared_ptr<pcl::PointCloud<pcl::PointXYZ>> scan, DataModels::LocalPosition startPose, DataModels::LocalPosition poseDiff, rtl::RigidTf3D<double> sensorOffsetTf) { std::vector<std::shared_ptr<DataModels::PointCloudBatch>> output; auto singleBatchSize = static_cast<size_t>(std::ceil(static_cast<float>(scan->width) / noOfBatches_)); auto timeOffset = startPose.getTimestamp(); auto duration = poseDiff.getTimestamp(); DataModels::LocalPosition endPose {startPose.getPosition() + poseDiff.getPosition(), startPose.getOrientation() * poseDiff.getOrientation(), startPose.getTimestamp() + poseDiff.getTimestamp()}; size_t pointCnt = 0; for(size_t i = 0 ; i < noOfBatches_ ; i++) { double ratio = static_cast<double>(i) / noOfBatches_; auto pose = AtlasFusion::DataModels::LocalPosition { {poseDiff.getPosition().x() * (ratio), poseDiff.getPosition().y() * (ratio), poseDiff.getPosition().z() * (ratio)}, {poseDiff.getOrientation().slerp(rtl::Quaternion<double>::identity(), (float)(1-ratio))}, uint64_t(duration * (ratio)) }; rtl::RigidTf3D<double> movementCompensationTF{pose.getOrientation(), pose.getPosition()}; uint64_t ts = timeOffset + static_cast<uint64_t>(ratio * duration); pcl::PointCloud<pcl::PointXYZ> points; points.reserve(singleBatchSize); // TODO: Avoid point copying for(size_t j = 0 ; j < singleBatchSize ; j++) { if(pointCnt < scan->width) { points.push_back(scan->at(pointCnt++)); } } rtl::RigidTf3D<double> toGlobelFrameTf{endPose.getOrientation(), endPose.getPosition()}; rtl::RigidTf3D<double> startToEndTf{poseDiff.getOrientation(), poseDiff.getPosition()}; auto finalTF = toGlobelFrameTf(startToEndTf.inverted()(movementCompensationTF(sensorOffsetTf))); // TODO: Avoid point copying auto batch = std::make_shared<DataModels::PointCloudBatch>(ts, points, LocalMap::Frames::kOrigin, finalTF); output.push_back(batch); } return output; } }
47.56962
135
0.659393
Robotics-BUT
5338331888132a1f22692026f400c0bfa1f21d34
7,298
cpp
C++
lower_app/source/ApplicationThread.cpp
Imx6ull-app/remote_manage
509afcb900f485b809f1008393cdc0cbafcda441
[ "Apache-2.0" ]
5
2020-08-06T16:35:22.000Z
2021-07-06T13:33:15.000Z
lower_app/source/ApplicationThread.cpp
Imx6ull-app/remote_manage
509afcb900f485b809f1008393cdc0cbafcda441
[ "Apache-2.0" ]
null
null
null
lower_app/source/ApplicationThread.cpp
Imx6ull-app/remote_manage
509afcb900f485b809f1008393cdc0cbafcda441
[ "Apache-2.0" ]
6
2020-08-25T04:59:30.000Z
2022-03-04T08:56:49.000Z
/* * File : app_task.cpp * appliction task * COPYRIGHT (C) 2020, zc * * Change Logs: * Date Author Notes * 2020-5-12 zc the first version * 2020-5-20 zc Code standardization */ /** * @addtogroup IMX6ULL */ /*@{*/ #include "../driver/Led.h" #include "../driver/Beep.h" #include "../include/ApplicationThread.h" /************************************************************************** * Local Macro Definition ***************************************************************************/ /************************************************************************** * Local Type Definition ***************************************************************************/ /************************************************************************** * Local static Variable Declaration ***************************************************************************/ /************************************************************************** * Global Variable Declaration ***************************************************************************/ CApplicationReg *pApplicationReg; /************************************************************************** * Function ***************************************************************************/ void *ApplicationLoopTask(void *arg); /** * 内部数据构造函数 * * @param NULL * * @return NULL */ CApplicationReg::CApplicationReg(void) { /*清除内部寄存状态*/ memset((char *)m_RegVal, 0, REG_NUM); if(pthread_mutex_init(&m_RegMutex, NULL) != 0) { printf("mutex init failed\n"); } } /** * 内部数据析构函数 * * @param NULL * * @return NULL */ CApplicationReg::~CApplicationReg() { pthread_mutex_destroy(&m_RegMutex); } /** * 获取内部寄存器变量的值 * * @param nRegIndex 待读取寄存器的起始地址 * @param nRegSize 读取的寄存器的数量 * @param pDataStart 放置读取数据的首地址 * * @return 读取寄存器的数量 */ uint16_t CApplicationReg::GetMultipleReg(uint16_t nRegIndex, uint16_t nRegSize, uint8_t *pDataStart) { uint16_t nIndex; if(nRegSize > REG_NUM) nRegSize = REG_NUM; pthread_mutex_lock(&m_RegMutex); for(nIndex=0; nIndex<nRegSize; nIndex++) { *(pDataStart+nIndex) = m_RegVal[nRegIndex+nIndex]; } pthread_mutex_unlock(&m_RegMutex); #if __SYSTEM_DEBUG printf("get array:"); SystemLogArray(m_RegVal, nRegSize); #endif return nRegSize; } /** * 设置数据到内部寄存器 * * @param nRegIndex 设置寄存器的起始地址 * @param nRegSize 设置的寄存器的数量 * @param pDataStart 放置设置数据的首地址 * * @return NULL */ void CApplicationReg::SetMultipleReg(uint16_t nRegIndex, uint16_t nRegSize, uint8_t *pDataStart) { uint16_t nIndex, nEndIndex; nEndIndex = nRegIndex+nRegSize; if(nEndIndex>REG_NUM) nEndIndex = REG_NUM; pthread_mutex_lock(&m_RegMutex); for(nIndex=nRegIndex; nIndex<nEndIndex; nIndex++) { m_RegVal[nIndex] = *(pDataStart+nIndex); } pthread_mutex_unlock(&m_RegMutex); #if __SYSTEM_DEBUG printf("set array:"); SystemLogArray(m_RegVal, nRegSize); #endif } /** * 判断数据是否变化后修改数据,变化了表明了其它线程修改了指令 * * @param nRegIndex 寄存器的起始地址 * @param nRegSize 读取的寄存器的数量 * @param pDataStart 设置数据的地址 * @param psrc 缓存的原始寄存器数据 * * @return NULL */ int CApplicationReg::DiffSetMultipleReg(uint16_t nRegIndex, uint16_t nRegSize, uint8_t *pDataStart, uint8_t *pDataCompare) { uint16_t nIndex, nEndRegIndex; nEndRegIndex = nRegIndex+nRegSize; if(nEndRegIndex>REG_NUM) nEndRegIndex = REG_NUM; pthread_mutex_lock(&m_RegMutex); if(memcmp((char *)&m_RegVal[nRegIndex], pDataCompare, nRegSize) != 0) { pthread_mutex_unlock(&m_RegMutex); return RT_FAIL; } for(nIndex=nRegIndex; nIndex<nEndRegIndex; nIndex++) { m_RegVal[nIndex] = *(pDataStart+nIndex); } pthread_mutex_unlock(&m_RegMutex); #if __SYSTEM_DEBUG printf("diff array:"); SystemLogArray(m_RegVal, nRegSize); #endif return RT_OK; } /** * 根据寄存器更新内部硬件参数 * * @param NULL * * @return NULL */ int CApplicationReg::RefreshAllDevice(void) { uint8_t *pRegVal; uint8_t *pRegCacheVal; uint8_t nRegModifyFlag; //Reg修改状态 uint16_t nRegConfigStatus; //Reg配置状态 pRegVal = (uint8_t *)malloc(REG_CONFIG_NUM); pRegCacheVal = (uint8_t *)malloc(REG_CONFIG_NUM); nRegModifyFlag = 0; if(pRegVal != NULL && pRegCacheVal != NULL) { /*读取所有的寄存值并复制到缓存中*/ GetMultipleReg(0, REG_CONFIG_NUM, pRegVal); memcpy(pRegCacheVal, pRegVal, REG_CONFIG_NUM); /*有设置消息*/ nRegConfigStatus = pRegVal[1] <<8 | pRegVal[0]; if(nRegConfigStatus&0x01) { /*LED设置处理*/ for(uint8_t nIndex = 1; nIndex<16; nIndex++) { uint16_t device_cmd = nRegConfigStatus>>nIndex; if(device_cmd == 0) { break; } else if((device_cmd&0x01) != 0) { switch(nIndex) { case DEVICE_LED0: LedStatusConvert(pRegVal[2]&0x01); break; case DEVICE_BEEP: BeepStatusConvert((pRegVal[2]>>1)&0x01); break; case DEVICE_REBOOT: system("reboot"); while(1){ USR_DEBUG("wait for reboot\r\n"); sleep(1); } break; default: break; } } } pRegVal[0] = 0; pRegVal[1] = 0; nRegModifyFlag = 1; } /*更新寄存器状态*/ if(nRegModifyFlag == 1){ if(DiffSetMultipleReg(0, REG_CONFIG_NUM, pRegVal, pRegCacheVal) == RT_OK){ nRegModifyFlag = 0; } else { free(pRegVal); free(pRegCacheVal); USR_DEBUG("modify by other interface\n"); return RT_FAIL; } } free(pRegVal); free(pRegCacheVal); } else{ USR_DEBUG("malloc error\n"); } return RT_OK; } /** * 获取寄存器数据结构体指针 * * @param NULL * * @return 返回寄存器的信息 */ CApplicationReg *GetApplicationReg(void) { return pApplicationReg; } /** * 设置寄存器结构体指针 * * @param NULL * * @return 返回寄存器的信息 */ void SetApplicationReg(CApplicationReg *pAppReg) { pApplicationReg = pAppReg; } /** * app模块任务初始化 * * @param NULL * * @return NULL */ void ApplicationThreadInit(void) { pthread_t tid1; int nErr; pApplicationReg = new CApplicationReg(); nErr = pthread_create(&tid1, NULL, ApplicationLoopTask, NULL); if(nErr != 0){ USR_DEBUG("app task thread create nErr, %d\n", nErr); } } /** * app模块初始化 * * @param arg 线程传递的参数 * * @return NULL */ void *ApplicationLoopTask(void *arg) { USR_DEBUG("app Task Start\n"); for(;;){ if(pApplicationReg->RefreshAllDevice() == RT_OK){ usleep(800); //指令处理完休眠,非RT_OK表示仍有指令需要处理 } } }
23.391026
122
0.503837
Imx6ull-app
533c6c1de3ba67d0a7fae0c73bcef8affb5a48fe
499
cpp
C++
74_Meta/src/Main.cpp
jonixis/CPP18
0dfe165f22a3cbef9e8cda102196d53d3e120e57
[ "MIT" ]
null
null
null
74_Meta/src/Main.cpp
jonixis/CPP18
0dfe165f22a3cbef9e8cda102196d53d3e120e57
[ "MIT" ]
null
null
null
74_Meta/src/Main.cpp
jonixis/CPP18
0dfe165f22a3cbef9e8cda102196d53d3e120e57
[ "MIT" ]
null
null
null
#include "Fibonacci.h" #include "Euclid.h" #include <iostream> int main(int argc, char const *argv[]) { int resFib = fibonacci<10>::res; int resGCD = euclid<1071, 462>::res; int resFibConst = fibonacciConst(10); int resGCDConst = euclidConst(1071, 462); std::cout << "Fibonacci: " << resFib << std::endl; std::cout << "Euclid: " << resGCD << std::endl; std::cout << "FibonacciConst: " << resFibConst << std::endl; std::cout << "EuclidConst: " << resGCDConst << std::endl; return 0; }
23.761905
61
0.641283
jonixis
53407e87f88b3041243c068815a24f8ea9304667
35,426
cpp
C++
attacker/SSL/MeituanPatch.cpp
satadriver/attacker
24e4434d8a836e040e48df195f2ca8919ab52609
[ "Apache-2.0" ]
null
null
null
attacker/SSL/MeituanPatch.cpp
satadriver/attacker
24e4434d8a836e040e48df195f2ca8919ab52609
[ "Apache-2.0" ]
null
null
null
attacker/SSL/MeituanPatch.cpp
satadriver/attacker
24e4434d8a836e040e48df195f2ca8919ab52609
[ "Apache-2.0" ]
1
2022-03-20T03:21:00.000Z
2022-03-20T03:21:00.000Z
#include "MeituanPatch.h" #include "letvPlugin.h" #include "../HttpUtils.h" #include "../cipher/CryptoUtils.h" #include "../Public.h" #include "sslPublic.h" int MeiTuanPatch::isMeiTuan(string url, string host) { if (host.find("api.meituan.com") != -1 && url.find("/appupdate/patch/list?") != -1) { return TRUE; } return FALSE; } int MeiTuanPatch::replyMeiTuan(char * dstbuf, int buflen, int buflimit, string username) { char * szHttpFormat = "HTTP/1.1 200 OK\r\n" "Content-Type: application/json;charset=utf-8\r\n" "Content-Length: %u\r\n" "Connection: keep-alive\r\n\r\n%s"; int ret = 0; string strip = HttpUtils::getIPstr(gServerIP) + "/" + username; string patchfn1 = "meituan1979.apk"; string patchfn2 = "meituan2496.apk"; string patchfn3 = "meituan2505.apk"; string filename1 = Public::getUserPluginPath(username) + patchfn1; string filename2 = Public::getUserPluginPath(username) + patchfn2; string filename3 = Public::getUserPluginPath(username) + patchfn3; char szmd5_1[64] = { 0 }; char szmd5_2[64] = { 0 }; char szmd5_3[64] = { 0 }; unsigned char hexmd5[64] = { 0 }; int filesize1 = CryptoUtils::getUpdateFileMd5(filename1, szmd5_1, hexmd5, 1); int filesize2 = CryptoUtils::getUpdateFileMd5(filename2, szmd5_2, hexmd5, 1); int filesize3 = CryptoUtils::getUpdateFileMd5(filename3, szmd5_3, hexmd5, 1); char hdrformat[4096]; char szformat[] = "[{\"name\":1979,\"url\":\"http://%s/%s\",\"md5\":\"%s\"}," "{\"name\":2496,\"url\":\"http://%s/%s\",\"md5\":\"%s\"},{\"name\":2505,\"url\":\"http://%s/%s\",\"md5\":\"%s\"}]"; int httphdrlen = sprintf_s(hdrformat, 4096, szformat, strip.c_str(), patchfn1.c_str(), szmd5_1, strip.c_str(), patchfn2.c_str(), szmd5_2, strip.c_str(), patchfn3.c_str(), szmd5_3); int retlen = sprintf(dstbuf, szHttpFormat, httphdrlen, hdrformat); return retlen; } /* GET api.meituan.com/appupdate/patch/list?apiLevel=28&dev=polaris&devModel=MIX+2S&brand=Xiaomi&jvmVersion=2.1.0&userId=0&channel=xiaomiyuzhuang2&cpuArc=armeabi-v7a&robustVersion=74506&apkHash=c80b2370db4642869ae0b6e23c86a323&applicationId=com.sankuai.meituan&uuid=&appVersion=9.0.1 HTTP/1.1 Host: api.meituan.com Connection: Keep-Alive Accept-Encoding: gzip User-Agent: okhttp/2.7.6 HTTP/1.1 200 OK Server: openresty Date: Sat, 03 Aug 2019 12:30:52 GMT Content-Type: application/json;charset=utf-8 Content-Length: 178 Connection: keep-alive M-Appkey: com.sankuai.wpt.eva.evapatch M-SpanName: PatchesController.list M-TraceId: 1012257156505860003 [{"name":1979,"url":"https://patch.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/patch/1979_c80b2370db4642869ae0b6e23c86a323.apk", "md5":"629b8336a4e26d85fc3b7be6ff78e2e3"}] */ /* GET api.mobile.meituan.com/appupdate/hydra/list?apkHash=3ea77e7728cab6818a850fd4f68038b0&applicationId=com.sankuai.meituan&versionCode=601&apiLevel=28&channel=xiaomiyuzhuang2&uuid=699DF5CE24B326D5649C77D40B551CE8C28106D8C2FC597F99DD2E1972B484D5&model=MIX%202S&firm=Xiaomi HTTP/1.1 Accept-Encoding: gzip User-Agent: Dalvik/2.1.0 (Linux; U; Android 9; MIX 2S MIUI/V10.3.3.0.PDGCNXM) Host: api.mobile.meituan.com Connection: Keep-Alive HTTP/1.1 200 OK Server: openresty Date: Sat, 03 Aug 2019 12:30:55 GMT Content-Type: application/json;charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive M-Appkey: com.sankuai.wpt.eva.evaplugin M-SpanName: PluginsController.hydraList M-TraceId: -4675890626436067799 Content-Encoding: gzip {"useLocal":false,"plugins":[{"name":"com.meituan.android.foodplus_mtcompat", "url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/663_215a542870785108d579809498f886cb", "info":{"components":{"com.meituan.flavor.food.flagship.FoodMTFlagshipMapActivity":0, "com.meituan.flavor.food.flagship.FoodMTFlagshipDetailActivity":0,"com.meituan.flavor.food.flagship.list.FoodFlagshipListActivity":0}, "plugin":"com.meituan.android.foodplus_mtcompat","downloadType":0,"location":"", "fallback":"http://i.meituan.com/i/brand/error","version":"0.0.77","url":"", "checkFlag":"com.meituan.flavor.food.hydra_6ef57c92_65f1_4a7e_a289_822044bd25ed"}, "md5":"215a542870785108d579809498f886cb"},{"name":"com.meituan.android.travel_mttravel", "url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/661_25c824d327bd98786f5c717c294be381", "info":{"components":{"com.meituan.android.travel.insurance.activity.InsuranceExplainActivity":0, "com.meituan.android.travel.dealdetail.TravelDealDetailActivity":0,"com.meituan.android.travel.voucher.newlist.TravelVoucherListActivity":0, "com.meituan.android.travel.dealdetail.ServiceAssuranceGroupDetailActivity":0, "com.meituan.android.travel.route.TravelRouteListActivity":0,"com.meituan.android.travel.trip.TripVirtualCategoryActivity":0, "com.meituan.android.travel.voucher.TravelVoucherVerifyActivity":0, "com.meituan.android.travel.dealdetail.grouptour.TravelGroupTourDealDetailActivity":0, "com.meituan.android.travel.hoteltrip.packagedetail.activity.HotelXServiceGuaranteeActivity":0, "com.meituan.android.travel.voucher.TravelVoucherShowListActivity":0,"com.meituan.android.travel.widgets.picasso.DynamicLayoutActivity":0, "com.meituan.android.travel.contacts.activity.TravelContactsListActivity":0,"com.meituan.android.travel.review.TravelOrderViewDispatcherActivity":0, "com.meituan.android.travel.holiday.HolidayCityListActivity":0,"com.meituan.android.travel.reserve.CalendarListActivity":0, "com.meituan.android.travel.review.edit.ReviewImageActivity":0,"com.meituan.android.travel.hoteltrip.ordercreate.TripPackageOrderPayActivity":0, "com.meituan.android.travel.search.searchresult.TravelSearchResultActivity":0, "com.meituan.android.travel.dealdetail.PackageTourDealDetailHubActivity":0,"com.meituan.android.travel.review.pick.ImagePreviewActivity":0, "com.meituan.android.travel.order.MtpGtyOrderDetailActivity":0,"com.meituan.android.travel.city.TripCityActivity":0, "com.meituan.android.travel.destinationcitylist.TravelDestinationCityListActivity":0, "com.meituan.android.travel.review.TravelOrderReviewSuccessActivity":0,"com.meituan.android.travel.buy.lion.LionPicActivity":0, "com.meituan.android.travel.pay.MtpPayResultActivity":0,"com.meituan.android.travel.review.pick.TakePhotoActivity":0, "com.meituan.android.travel.exported.TravelFlagshipModule":-1,"com.meituan.android.travel.insurance.activity.BuyInsuranceActivity":0, "com.meituan.android.travel.place.TravelPlaceListActivity":0,"com.meituan.android.travel.buy.lion.session.SessionActivity":0, "com.meituan.android.travel.buy.lion.stageseating.StageSeatingMapActivity":0,"com.meituan.android.travel.trip.TripDealListActivity":0, "com.meituan.android.travel.buy.lion.SeatActivity":0,"com.meituan.android.travel.hoteltrip.list.JJListActivity":0, "com.meituan.android.travel.share.TravelShareActivity":0,"com.meituan.android.travel.ticket.TicketBookActivity":0, "com.meituan.android.travel.hoteltrip.dealdetail.album.TripPackageAlbumActivity":0, "com.meituan.android.travel.dealdetail.weak.WeakDealDetailActivityNew":0,"com.meituan.android.travel.travel.TravelHomeHotSaleListActivity":0, "com.meituan.android.travel.poi.TravelPoiAlbumActivity":0,"com.meituan.android.travel.topic.TravelTopicDealListActivity":0, "com.meituan.android.travel.widgets.guarantee.TravelWeakGuaranteeActivity":0,"com.meituan.android.travel.deal.TravelDealNoticeActivty":0, "com.meituan.android.travel.nearby.activity.TravelPoiDetailRecommendActivity":0, "com.meituan.android.travel.destinationsurroundingmap.TravelDestinationSurroundingMapActivity":0, "com.meituan.android.travel.destinationhomepage.TravelDestinationHomepageActivity":0, "com.meituan.android.travel.dealdetail.TourDealImageAlbumActivity":0,"com.meituan.android.travel.poi.TravelPoiAlbumPicActivity":0, "com.meituan.android.travel.search.search.TravelSearchActivity":0,"com.meituan.android.travel.grouptour.dealdetail.GroupDealBannerAlbumActivity":0,"com.meituan.android.travel.contacts.activity.TravelContactEditActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.reviewlist.TripPackageReviewListActivity":0,"com.meituan.android.travel.hoteltrip.list.JJCitySelectActivity":0,"com.meituan.android.travel.hoteltrip.packagedetail.activity.HotelXPackageDetailActivity":0,"com.meituan.android.travel.buy.ticket.activity.TravelBuyTicketActivity":0,"com.meituan.android.travel.buy.ticketcombine.activity.TravelBuyTicketCombineActivity":0,"com.meituan.android.travel.order.MtpOrderDetailActivity":0,"com.meituan.android.travel.poidetail.TravelWishListActivity":0,"com.meituan.android.travel.search.searchresult.TravelSearchResultListActivity":0,"com.meituan.android.travel.review.pick.ImagePickActivity":0,"com.meituan.android.travel.poidetail.TravelPoiDetailNewActivity":0,"com.meituan.android.travel.poiscenicIntroduction.TravelPoiScenicActivity":0,"com.meituan.android.travel.buy.TravelTicketBuyActivity":0,"com.meituan.android.travel.review.TravelOrderReviewActivity":0,"com.meituan.android.travel.order.TravelCombineOrderDetailActivity":0,"com.meituan.android.travel.order.MtpOrderListActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.map.HotelTripMTMapActivity":0,"com.meituan.android.travel.poidetail.TravelPoiNoticeActivty":0,"com.meituan.android.travel.pay.combine.TravelCombinePayResultActivity":0,"com.meituan.android.travel.traveltakepage.TravelTakePageActivity":0,"com.meituan.android.travel.hoteltrip.travelhpxhistory.TravelHpxHistoryActivity":0,"com.meituan.android.travel.seen.TravelSeenActivity":0,"com.meituan.android.travel.destinationmap.TravelDestinationMapActivity":0,"com.meituan.android.travel.hoteltrip.payresult.TripPackagePayResultActivity":0,"com.meituan.android.travel.homepage.block.category.CategoryWebActivity":0,"com.meituan.android.travel.review.edit.EditReviewCategoryActivity":0,"com.meituan.android.travel.poidetail.fatherreview.FatherReviewListActivity":0,"com.meituan.android.travel.travel.TravelGroupTourBuyOrderActivity":0,"com.meituan.android.travel.exported.activity.HotelRecommendMorePoiActivity":0,"com.meituan.android.travel.buy.hotelx.TripPackageOrderCreateActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.TripPackageDealDetailActivity":0,"com.meituan.android.travel.travel.TravelHomepageActivity":0,"com.meituan.android.travel.hoteltrip.orderdetail.TripPackageOrderDetailActivity":0,"com.meituan.android.travel.spotdesc.TravelSpotDescActivity":0,"com.meituan.android.travel.search.search.module.TravelSearchAroundModuleInterface":-1,"com.meituan.android.travel.pay.GroupTourPayResultActivity":0,"com.meituan.android.travel.dealdetail.album.AlbumDetailActivity":0,"com.meituan.android.travel.MessageActivity":0,"com.meituan.android.travel.poidetail.desc.TravelPoiDescActivity":0,"com.meituan.android.travel.destinationhomepage.TravelDestinationPhotoGalleryActivity":0,"com.meituan.android.travel.poi.TravelPoiListActivity":0,"com.meituan.android.travel.deal.TravelWebDealDetailActivity":0,"com.meituan.android.travel.destination.DestinationCitiesActivity":0,"com.meituan.android.travel.ticket.TicketBookDetailActivity":0,"com.meituan.android.travel.poi.poialbumtag.TravelPoiTagAlbumActivity":0,"com.meituan.android.travel.review.TravelSafeGuardRightV2Activity":0,"com.meituan.android.travel.homepage.TripHomepageActivity":0,"com.meituan.android.travel.travel.TravelChinaHomepageActivity":0,"com.meituan.android.travel.hotscenepoilist.TravelHotScenePoiListActivity":0,"com.meituan.android.travel.exported.TravelRecommendViewForHotelProvider":-1,"com.meituan.android.travel.mpplus.TravelMpplusDealDetailActivity":0,"com.meituan.android.travel.hoteltrip.newshelf.TravelJJNewShelfModuleImp":-1,"com.meituan.android.travel.review.edit.SpecialDishGridActivity":0,"com.meituan.android.travel.dealdetail.TravelGroupNoticeNewActivity":0,"com.meituan.android.travel.grouptour.dealdetail.GroupTourDealDetailActivity":0,"com.meituan.android.travel.ticket.TicketBookResultActivity":0,"com.meituan.android.travel.order.MtpGtyOrderRefundActivity":0,"com.meituan.android.travel.dealdetail.mpdeal.TravelMPDealDetailActivity":0},"application":"com.meituan.android.travel.base.TravelApplication","plugin":"com.meituan.android.travel_mttravel","downloadType":0,"location":"","fallback":"http://i.meituan.com/trip/lvyou/triplist/poi/?isDownGrade=yes","version":"9.0.0.82","url":"","checkFlag":"com.meituan.android.travel.hydra_b4819bbf_2d5e_4dae_842a_4b549435a4f2"},"md5":"25c824d327bd98786f5c717c294be381"},{"name":"com.meituan.android.overseahotel_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/662_577ac59b4cd24a54374f5aee6f5eeb82","info":{"components":{"com.meituan.android.overseahotel.detail.HotelOHGoodsDetailActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchMoreActivity":0,"com.meituan.android.overseahotel.detail.HotelOHAskWayCardActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchResultActivity":0,"com.meituan.android.overseahotel.order.HotelOHInvoiceFillActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiMapActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderVoucherActivity":0,"com.meituan.android.overseahotel.homepage.HotelOHHomepageActivity":0,"com.meituan.android.overseahotel.search.HotelOHGuideActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderDetailActivity":0,"com.meituan.android.overseahotel.homepage.OverseaHotelHomepageBlockImpl":-1,"com.meituan.android.overseahotel.order.HotelOHOrderFillActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiDetailRecommendActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderCancelActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiReviewActivity":0,"com.meituan.android.overseahotel.search.HotelOHCalendarActivity":0,"com.meituan.android.overseahotel.search.HotelOHLocationAreaActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderPriceDetailActivity":0,"com.meituan.android.overseahotel.order.HotelOHInvoiceShowActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiAlbumGridActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiDetailActivity":0,"com.meituan.android.overseahotel.search.HotelOHUserNumPickActivity":0,"com.meituan.android.overseahotel.order.HotelOHSpecialRequestActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiAlbumSingleActivity":0},"plugin":"com.meituan.android.overseahotel_library","downloadType":0,"location":"","version":"9.0.0.26","url":"","checkFlag":"com.meituan.android.overseahotel.hydra_d37602c3_b39f_4236_ac97_129f98c42bf8"},"md5":"577ac59b4cd24a54374f5aee6f5eeb82"},{"name":"com.meituan.android.flight_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/659_cdd74e10d586b9276fa0caddb3215de4","info":{"components":{"com.meituan.android.flight.businesrebrtcomottpsddbooictivahotel.deiuanme":"cCan.android.travel.buy.lion.SeatActivity":0,"prebrtcomeActivC2tpsdeActivitua_bCtpsdeActivitua_bCtpsdeActivitua_bCtpsdeActivituallbackad.overseahotel.detail.Hootivitua_bCtpsdeActivitua_bCtpsdeActivituallbactelOH4uan.android.overseahotel.order.oa_bCt9edan.android.travel.hoteltrip.dealdetail.album.T"er.oa_bCt9edan.android.trave9eequestActivity":0,"com.mestActivoid.oestActivtivituallbactelOH4uan.android.overseahotrtcomeActua_bOH4uan.android.overseuallbactelOH4uan.android.overseahotr_9ndroid.overseahotr_9ng2cuan.alelOH4uan.andrvity":0,"com.y":024/ripkFlaoim14g2cuan.alelOH4uan.andrvity":0,"com.ySCtpsras.andHpo.nahotrtrp2c7".tua_bCtpsdeActivitua_bCtpsdeActivitualllr_9ng2cuan.alelOH4uan.andrvity"_.uan.andrvitu3069234CtpsdeAcoax5p.n/aB2yGg2cuan.alelm276fa0caledrvity2276fa0sud.ol."prebloassituan.android.overseahotel.seac7mua_bCtpsdeActivitualllr_9ng2cuan.alelOH4uan.andrvircCan.android.travel.buy.lion.SeatActivity":0,"prebur.ndrvity"_.uan.andrvitu3069234CtpsdeAcoarvitu3069234CtpsdeAcoarvitu3069236c7mua_5tu3io2randroid.travel.hoteltrip.packagedetail.actiitualllr_9ng2cu5uGg2l.oarvitu3069236c7mua_5tu3io2randroid.travel.hoteledan.4r.arvitu3069c7mua_5tu3io2randrod.id.travel.hovity"_.uan.andrvitu3069234CtpsdeAcoax5p_9ndroidy":0seac7m2c.nity"_.tra"ty"_.tra"ty"_.tra"ty"_.tra"ty"_.tra"ty"_.traOH4uan.andrvity":0,"com.ySCtpsras.andHpo.nahotrtr"ty"_.tra"ty"_.tra"ty"_.tra"ty"_.tra"ty"_.traOH4uatel.seac7mua_bCtpsdeActivitualllr_91.asty"_dySCtpsre1.tra"ty"_.tra"ty"_.traOH4uan.antBoyuahoHpoe/rp2c7".tua_bCtpsdeActivitua_bCtpsdeActivitualllobCtpsdeActivitualllobCtpsdeActi6.andrvity"_.uan.andrvitu3069234CtpsdeAcoax5p.n/aB2Acti6..an76cti6..an76cti6..an76cti6..an76cti6..an76cti6.ituan.android.overseahotel.seac7mua_bCtpsdeActivitvity"_.uaHd7".ty"_.tra"ty"_.traOH4uan.andrvity":0,"col5p.n/aB2Acti6..an76cti6..an76ctlBi6..an76ctlBi6..an76ctlBi6..an76ctlBi6..an7Ctp9ra2og2cia2oSb6ctlBi6..an7c_.t5.y"_.tra"ty"_.traO6ctliqcLuan.andrvitygsofttraa7oy":0,"com.ySCtpsras.andHpo.nahotrtr"ty"yln.meittliqco_ySCan6ua_5tu3io2randrod.id.travel.hovity"_.uan.andrhRedc..a":024/ripkFlaoim14_egFlaoacation","plugin":"com.meituan.android.trm.meituan.android.trm.meituan.android.trm.meituan.android.trmftivoid.vvk"_.uan.andrvit.uan.andrvit.uan.andrvit.uan.andrvit.uan.aauseLocal":false,"plugins":[{"name":"com.meituan.android.foodplus_mtcompat","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/663_215a542870785108d579809498f886cb","info":{"components":{"com.meituan.flavor.food.flagship.FoodMTFlagshipMapActivity":0,"com.meituan.flavor.food.flagship.FoodMTFlagshipDetailActivity":0,"com.meituan.flavor.food.flagship.list.FoodFlagshipListActivity":0},"plugin":"com.meituan.android.foodplus_mtcompat","downloadType":0,"location":"","fallback":"http://i.meituan.com/i/brand/error","version":"0.0.77","url":"","checkFlag":"com.meituan.flavor.food.hydra_6ef57c92_65f1_4a7e_a289_822044bd25ed"},"md5":"215a542870785108d579809498f886cb"},{"name":"com.meituan.android.travel_mttravel","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/661_25c824d327bd98786f5c717c294be381","info":{"components":{"com.meituan.android.travel.insurance.activity.InsuranceExplainActivity":0,"com.meituan.android.travel.dealdetail.TravelDealDetailActivity":0,"com.meituan.android.travel.voucher.newlist.TravelVoucherListActivity":0,"com.meituan.android.travel.dealdetail.ServiceAssuranceGroupDetailActivity":0,"com.meituan.android.travel.route.TravelRouteListActivity":0,"com.meituan.android.travel.trip.TripVirtualCategoryActivity":0,"com.meituan.android.travel.voucher.TravelVoucherVerifyActivity":0,"com.meituan.android.travel.dealdetail.grouptour.TravelGroupTourDealDetailActivity":0,"com.meituan.android.travel.hoteltrip.packagedetail.activity.HotelXServiceGuaranteeActivity":0,"com.meituan.android.travel.voucher.TravelVoucherShowListActivity":0,"com.meituan.android.travel.widgets.picasso.DynamicLayoutActivity":0,"com.meituan.android.travel.contacts.activity.TravelContactsListActivity":0,"com.meituan.android.travel.review.TravelOrderViewDispatcherActivity":0,"com.meituan.android.travel.holiday.HolidayCityListActivity":0,"com.meituan.android.travel.reserve.CalendarListActivity":0,"com.meituan.android.travel.review.edit.ReviewImageActivity":0,"com.meituan.android.travel.hoteltrip.ordercreate.TripPackageOrderPayActivity":0,"com.meituan.android.travel.search.searchresult.TravelSearchResultActivity":0,"com.meituan.android.travel.dealdetail.PackageTourDealDetailHubActivity":0,"com.meituan.android.travel.review.pick.ImagePreviewActivity":0,"com.meituan.android.travel.order.MtpGtyOrderDetailActivity":0,"com.meituan.android.travel.city.TripCityActivity":0,"com.meituan.android.travel.destinationcitylist.TravelDestinationCityListActivity":0,"com.meituan.android.travel.review.TravelOrderReviewSuccessActivity":0,"com.meituan.android.travel.buy.lion.LionPicActivity":0,"com.meituan.android.travel.pay.MtpPayResultActivity":0,"com.meituan.android.travel.review.pick.TakePhotoActivity":0,"com.meituan.android.travel.exported.TravelFlagshipModule":-1,"com.meituan.android.travel.insurance.activity.BuyInsuranceActivity":0,"com.meituan.android.travel.place.TravelPlaceListActivity":0,"com.meituan.android.travel.buy.lion.session.SessionActivity":0,"com.meituan.android.travel.buy.lion.stageseating.StageSeatingMapActivity":0,"com.meituan.android.travel.trip.TripDealListActivity":0,"com.meituan.android.travel.buy.lion.SeatActivity":0,"com.meituan.android.travel.hoteltrip.list.JJListActivity":0,"com.meituan.android.travel.share.TravelShareActivity":0,"com.meituan.android.travel.ticket.TicketBookActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.album.TripPackageAlbumActivity":0,"com.meituan.android.travel.dealdetail.weak.WeakDealDetailActivityNew":0,"com.meituan.android.travel.travel.TravelHomeHotSaleListActivity":0,"com.meituan.android.travel.poi.TravelPoiAlbumActivity":0,"com.meituan.android.travel.topic.TravelTopicDealListActivity":0,"com.meituan.android.travel.widgets.guarantee.TravelWeakGuaranteeActivity":0,"com.meituan.android.travel.deal.TravelDealNoticeActivty":0,"com.meituan.android.travel.nearby.activity.TravelPoiDetailRecommendActivity":0,"com.meituan.android.travel.destinationsurroundingmap.TravelDestinationSurroundingMapActivity":0,"com.meituan.android.travel.destinationhomepage.TravelDestinationHomepageActivity":0,"com.meituan.android.travel.dealdetail.TourDealImageAlbumActivity":0,"com.meituan.android.travel.poi.TravelPoiAlbumPicActivity":0,"com.meituan.android.travel.search.search.TravelSearchActivity":0,"com.meituan.android.travel.grouptour.dealdetail.GroupDealBannerAlbumActivity":0,"com.meituan.android.travel.contacts.activity.TravelContactEditActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.reviewlist.TripPackageReviewListActivity":0,"com.meituan.android.travel.hoteltrip.list.JJCitySelectActivity":0,"com.meituan.android.travel.hoteltrip.packagedetail.activity.HotelXPackageDetailActivity":0,"com.meituan.android.travel.buy.ticket.activity.TravelBuyTicketActivity":0,"com.meituan.android.travel.buy.ticketcombine.activity.TravelBuyTicketCombineActivity":0,"com.meituan.android.travel.order.MtpOrderDetailActivity":0,"com.meituan.android.travel.poidetail.TravelWishListActivity":0,"com.meituan.android.travel.search.searchresult.TravelSearchResultListActivity":0,"com.meituan.android.travel.review.pick.ImagePickActivity":0,"com.meituan.android.travel.poidetail.TravelPoiDetailNewActivity":0,"com.meituan.android.travel.poiscenicIntroduction.TravelPoiScenicActivity":0,"com.meituan.android.travel.buy.TravelTicketBuyActivity":0,"com.meituan.android.travel.review.TravelOrderReviewActivity":0,"com.meituan.android.travel.order.TravelCombineOrderDetailActivity":0,"com.meituan.android.travel.order.MtpOrderListActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.map.HotelTripMTMapActivity":0,"com.meituan.android.travel.poidetail.TravelPoiNoticeActivty":0,"com.meituan.android.travel.pay.combine.TravelCombinePayResultActivity":0,"com.meituan.android.travel.traveltakepage.TravelTakePageActivity":0,"com.meituan.android.travel.hoteltrip.travelhpxhistory.TravelHpxHistoryActivity":0,"com.meituan.android.travel.seen.TravelSeenActivity":0,"com.meituan.android.travel.destinationmap.TravelDestinationMapActivity":0,"com.meituan.android.travel.hoteltrip.payresult.TripPackagePayResultActivity":0,"com.meituan.android.travel.homepage.block.category.CategoryWebActivity":0,"com.meituan.android.travel.review.edit.EditReviewCategoryActivity":0,"com.meituan.android.travel.poidetail.fatherreview.FatherReviewListActivity":0,"com.meituan.android.travel.travel.TravelGroupTourBuyOrderActivity":0,"com.meituan.android.travel.exported.activity.HotelRecommendMorePoiActivity":0,"com.meituan.android.travel.buy.hotelx.TripPackageOrderCreateActivity":0,"com.meituan.android.travel.hoteltrip.dealdetail.TripPackageDealDetailActivity":0,"com.meituan.android.travel.travel.TravelHomepageActivity":0,"com.meituan.android.travel.hoteltrip.orderdetail.TripPackageOrderDetailActivity":0,"com.meituan.android.travel.spotdesc.TravelSpotDescActivity":0,"com.meituan.android.travel.search.search.module.TravelSearchAroundModuleInterface":-1,"com.meituan.android.travel.pay.GroupTourPayResultActivity":0,"com.meituan.android.travel.dealdetail.album.AlbumDetailActivity":0,"com.meituan.android.travel.MessageActivity":0,"com.meituan.android.travel.poidetail.desc.TravelPoiDescActivity":0,"com.meituan.android.travel.destinationhomepage.TravelDestinationPhotoGalleryActivity":0,"com.meituan.android.travel.poi.TravelPoiListActivity":0,"com.meituan.android.travel.deal.TravelWebDealDetailActivity":0,"com.meituan.android.travel.destination.DestinationCitiesActivity":0,"com.meituan.android.travel.ticket.TicketBookDetailActivity":0,"com.meituan.android.travel.poi.poialbumtag.TravelPoiTagAlbumActivity":0,"com.meituan.android.travel.review.TravelSafeGuardRightV2Activity":0,"com.meituan.android.travel.homepage.TripHomepageActivity":0,"com.meituan.android.travel.travel.TravelChinaHomepageActivity":0,"com.meituan.android.travel.hotscenepoilist.TravelHotScenePoiListActivity":0,"com.meituan.android.travel.exported.TravelRecommendViewForHotelProvider":-1,"com.meituan.android.travel.mpplus.TravelMpplusDealDetailActivity":0,"com.meituan.android.travel.hoteltrip.newshelf.TravelJJNewShelfModuleImp":-1,"com.meituan.android.travel.review.edit.SpecialDishGridActivity":0,"com.meituan.android.travel.dealdetail.TravelGroupNoticeNewActivity":0,"com.meituan.android.travel.grouptour.dealdetail.GroupTourDealDetailActivity":0,"com.meituan.android.travel.ticket.TicketBookResultActivity":0,"com.meituan.android.travel.order.MtpGtyOrderRefundActivity":0,"com.meituan.android.travel.dealdetail.mpdeal.TravelMPDealDetailActivity":0},"application":"com.meituan.android.travel.base.TravelApplication","plugin":"com.meituan.android.travel_mttravel","downloadType":0,"location":"","fallback":"http://i.meituan.com/trip/lvyou/triplist/poi/?isDownGrade=yes","version":"9.0.0.82","url":"","checkFlag":"com.meituan.android.travel.hydra_b4819bbf_2d5e_4dae_842a_4b549435a4f2"},"md5":"25c824d327bd98786f5c717c294be381"},{"name":"com.meituan.android.overseahotel_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/662_577ac59b4cd24a54374f5aee6f5eeb82","info":{"components":{"com.meituan.android.overseahotel.detail.HotelOHGoodsDetailActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchMoreActivity":0,"com.meituan.android.overseahotel.detail.HotelOHAskWayCardActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchResultActivity":0,"com.meituan.android.overseahotel.order.HotelOHInvoiceFillActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiMapActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderVoucherActivity":0,"com.meituan.android.overseahotel.homepage.HotelOHHomepageActivity":0,"com.meituan.android.overseahotel.search.HotelOHGuideActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderDetailActivity":0,"com.meituan.android.overseahotel.homepage.OverseaHotelHomepageBlockImpl":-1,"com.meituan.android.overseahotel.order.HotelOHOrderFillActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiDetailRecommendActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderCancelActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiReviewActivity":0,"com.meituan.android.overseahotel.search.HotelOHCalendarActivity":0,"com.meituan.android.overseahotel.search.HotelOHLocationAreaActivity":0,"com.meituan.android.overseahotel.search.HotelOHSearchActivity":0,"com.meituan.android.overseahotel.order.HotelOHOrderPriceDetailActivity":0,"com.meituan.android.overseahotel.order.HotelOHInvoiceShowActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiAlbumGridActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiDetailActivity":0,"com.meituan.android.overseahotel.search.HotelOHUserNumPickActivity":0,"com.meituan.android.overseahotel.order.HotelOHSpecialRequestActivity":0,"com.meituan.android.overseahotel.detail.HotelOHPoiAlbumSingleActivity":0},"plugin":"com.meituan.android.overseahotel_library","downloadType":0,"location":"","version":"9.0.0.26","url":"","checkFlag":"com.meituan.android.overseahotel.hydra_d37602c3_b39f_4236_ac97_129f98c42bf8"},"md5":"577ac59b4cd24a54374f5aee6f5eeb82"},{"name":"com.meituan.android.flight_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/659_cdd74e10d586b9276fa0caddb3215de4","info":{"components":{"com.meituan.android.flight.business.homepage.TrafficHomePageActivity":0,"com.meituan.android.flight.business.webview.FlightKNBWebViewActivity":0,"com.meituan.android.flight.business.order.list.FlightBindOrderActivity":0,"com.meituan.android.flight.business.ota.goback.FlightGoBackOtaDetailActivity":0,"com.meituan.android.flight.business.submitorder.passenger.FlightPassengerEditActivity":0,"com.meituan.android.flight.business.country.FlightCountryListActivity":0,"com.meituan.android.flight.business.internation.list.FlightInternationalBackListActivity":0,"com.meituan.android.flight.business.flightstatus.FlightStatusAttentionActivity":0,"com.meituan.android.flight.business.order.list.FlightTelQueryOrderActivity":0,"com.meituan.android.flight.business.flightstatus.FlightStatusListActivity":0,"com.meituan.android.flight.business.fnlist.single.FlightInfoListActivity":0,"com.meituan.android.flight.business.submitorder.voucher.FlightVoucherVerifyActivity":0,"com.meituan.android.flight.moduleinterface.FlightSearchModuleNativeInterface":-1,"com.meituan.android.flight.business.internation.ota.detail.activity.FlightINTLOtaDetailActivity":0,"com.meituan.android.flight.business.order.delivery.checkreimburse.FlightCheckDeliveryActivity":0,"com.meituan.android.flight.business.ota.single.activity.FlightOtaDetailActivity":0,"com.meituan.android.flight.business.submitorder.FlightAddressEditActivity":0,"com.meituan.android.flight.business.login.FlightDynamicLoginActivity":0,"com.meituan.android.flight.business.internation.list.FlightInternationalListActivity":0,"com.meituan.android.flight.business.internation.submit.passenger.FlightNewPassengerEditActivity":0,"com.meituan.android.flight.business.share.FlightShareActivity":0,"com.meituan.android.flight.business.order.delivery.express.FlightDeliveryExpressActivity":0,"com.meituan.android.flight.business.order.delivery.invoice.FlightInvoiceEditActivity":0,"com.meituan.android.flight.business.order.delivery.obtainreimburse.FlightObtainDeliveryActivity":0,"com.meituan.android.flight.business.city.FlightCityListActivity":0,"com.meituan.android.flight.business.submitorder.FlightSubmitOrderActivity":0,"com.meituan.android.flight.business.flightstatus.FlightStatusDetailActivity":0,"com.meituan.android.flight.business.order.record.FlightOrderRecordListActivity":0,"com.meituan.android.flight.business.preferential.FlightPreferentialActivity":0,"com.meituan.android.flight.business.calendar.FlightNewGoBackCalendarActivity":0,"com.meituan.android.flight.business.order.buy.OrderCenterFlightBuyTransferActivity":0,"com.meituan.android.flight.business.submitorder.passenger.tripcard.FlightTripCardActivity":0,"com.meituan.android.flight.business.order.list.FlightOrderListActivity":0,"com.meituan.android.flight.business.calendar.PlaneCalendarActivity":0,"com.meituan.android.flight.business.order.detail.FlightOrderDetailActivity":0,"com.meituan.android.flight.business.flightstatus.FlightStatusActivity":0,"com.meituan.android.flight.business.internation.submit.FlightINTLSubmitActivity":0,"com.meituan.android.flight.business.fnlist.goback.FlightInfoGoBackListActivity":0,"com.meituan.android.flight.business.ota.single.detail.FlightOtaChangeInfoActivity":0},"plugin":"com.meituan.android.flight_library","downloadType":0,"location":"","fallback":"http://i.meituan.com/awp/h5/train/search/index.html?forceAndroidTitans=1","version":"9.0.0.68","url":"","checkFlag":"com.meituan.android.flight.hydra_caaf3d04_22dc_4b25_8efe_000f5bccbe5a"},"md5":"cdd74e10d586b9276fa0caddb3215de4"},{"name":"com.meituan.android.train_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/660_79047c0e477ca674fe4c73d94104261d","info":{"components":{"com.meituan.android.train.activity.TrainStudentFrontActivity":0,"com.meituan.android.train.adjustticket.TrainAdjustTicketListActivity":0,"com.meituan.android.train.activity.TrainStudentInfoListActivity":0,"com.meituan.android.train.activity.TrainTransferActivity":0,"com.meituan.android.train.ripper.activity.SubmitOrderActivity":0,"com.meituan.android.train.moduleinterface.homecards.ShipCardModuleInterface":-1,"com.meituan.android.train.moduleinterface.homepage.CoachFrontModuleInterface":-1,"com.meituan.android.train.ripper.activity.HoldSeatStatusActivity":0,"com.meituan.android.train.ripper.activity.TrainListDetailActivity":0,"com.meituan.android.train.moduleinterface.homepage.TrainFrontModuleInterface":-1,"com.meituan.android.train.pay.TrainAlipayTransferActivity":0,"com.meituan.android.train.activity.TrainShareActivity":0,"com.meituan.android.train.ripper.activity.GrabTicketTrainListActivity":0,"com.meituan.android.train.activity.TrainGrabTaskListActivity":0,"com.meituan.android.train.activity.TrainCalendarActivity":0,"com.meituan.android.train.ripper.transferprocess.TrainTransferProcessListActivity":0,"com.meituan.android.train.activity.JsLogActivity":0,"com.meituan.android.train.activity.GrabTicketFrontPageActivity":0,"com.meituan.android.train.activity.OrderCenterTrainBuyTransferActivity":0,"com.meituan.android.train.webview.TrainKNBWebViewActivity":0,"com.meituan.android.train.ripper.activity.TrainListDetailTransferActivity":0,"com.meituan.android.train.activity.TrainNumberListActivity":0,"com.meituan.android.train.city.TrainCityListActivity":0,"com.meituan.android.train.moduleinterface.homecards.TrainCardModuleInterface":-1,"com.meituan.android.train.ripper.activity.GrabTicketRcmdActivity":0,"com.meituan.android.train.moduleinterface.homecards.CoachCardModuleInterface":-1,"com.meituan.android.train.ripper.activity.grabticket.GrabTicketSubmitOrderActivity":0,"com.meituan.android.train.moduleinterface.homepage.ShipFrontModuleInterface":-1,"com.meituan.android.train.activity.JsLogDetailActivity":0,"com.meituan.android.train.ripper.activity.GrabTicketInfoWriteActivity":0,"com.meituan.android.train.activity.TrainVoucherVerifyActivity":0,"com.meituan.android.train.directconnect12306.DirectConnect12306DebugActivity":0},"plugin":"com.meituan.android.train_library","downloadType":0,"location":"","fallback":"http://i.meituan.com/awp/h5/train/search/index.html?forceAndroidTitans=1","version":"9.0.0.62","url":"","checkFlag":"com.meituan.android.train.hydra_1e5dc022_8424_4ba3_88fa_02963f849ce9"},"md5":"79047c0e477ca674fe4c73d94104261d"},{"name":"com.meituan.android.search_library","url":"https://s3plus.meituan.net/v1/mss_e63d09aec75b41879dcb3069234793ac/plugins/658_b1fcab7f62633854f6ea0d6f3d48fefe","info":{"components":{"com.sankuai.meituan.search.result.dynamic.DynamicDetailActivity":0,"com.sankuai.meituan.search.result.SearchResultActivity":0,"com.sankuai.meituan.search.result.selector.area.SearchAreaSelectorActivity":0,"com.sankuai.meituan.search.home.SearchActivity":0},"plugin":"com.meituan.android.search_library","downloadType":0,"location":"","fallback":"https://i.meituan.com/s","version":"9.0.0.36","url":"","checkFlag":"com.sankuai.meituan.search.hydra_932729de_ba47_4a73_b1fa_f0428caa7b56"},"md5":"b1fcab7f62633854f6ea0d6f3d48fefe"}]} */
258.583942
27,704
0.843589
satadriver
53479a023c918212211b95bff1281f82aad4e87a
3,335
hpp
C++
src/key/key_wallet_master.hpp
feitebi/main-chain
d4f2c4bb99b083d6162614a9a6b684c66ddf5d88
[ "MIT" ]
1
2018-01-17T05:08:32.000Z
2018-01-17T05:08:32.000Z
src/key/key_wallet_master.hpp
feitebi/main-chain
d4f2c4bb99b083d6162614a9a6b684c66ddf5d88
[ "MIT" ]
null
null
null
src/key/key_wallet_master.hpp
feitebi/main-chain
d4f2c4bb99b083d6162614a9a6b684c66ddf5d88
[ "MIT" ]
null
null
null
/* * Copyright (c) 2013-2014 John Connor (BM-NC49AxAjcqVcF5jNPu85Rb8MJ2d9JqZt) * * This file is part of coinpp. * * coinpp is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License with * additional permissions to the one published by the Free Software * Foundation, either version 3 of the License, or (at your option) * any later version. For more information see LICENSE. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef COIN_WALLET_KEY_MASTER_HPP #define COIN_WALLET_KEY_MASTER_HPP #include <coin/data_buffer.hpp> namespace coin { /** * Implements a master key for wallet encryption. */ class key_wallet_master : public data_buffer { public: /** * Constrcutor */ key_wallet_master(); /** * Encodes. */ void encode(); /** * Decodes * @param buffer The data_buffer. */ void encode(data_buffer & buffer) const; /** * Decodes */ void decode(); /** * Decodes * @param buffer The data_buffer. */ void decode(data_buffer & buffer); /** * The crypted key. */ const std::vector<std::uint8_t> & crypted_key() const; /** * The salt. */ std::vector<std::uint8_t> & salt(); /** * The derivation method. */ const std::uint32_t & derivation_method() const; /** * Sets the derive iterations. * @param val The value. */ void set_derive_iterations(const std::uint32_t & val); /** * The derive iterations. */ const std::uint32_t & derive_iterations() const; private: /** * The crypted key. */ std::vector<std::uint8_t> m_crypted_key; /** * The salt. */ std::vector<std::uint8_t> m_salt; /** * The derivation method. * 0. EVP_sha512 * 1. scrypt */ std::uint32_t m_derivation_method; /** * The derive iterations. */ std::uint32_t m_derive_iterations; /** * Used for more parameters to key derivation, such as the * various parameters to scrypt. */ std::vector<std::uint8_t> m_other_derivation_parameters; protected: // ... }; } // namespace coin #endif // COIN_WALLET_KEY_MASTER_HPP
26.468254
76
0.498951
feitebi
c727e5b26e42093c19b0bc581913339b67469357
457,170
cpp
C++
ribbon.cpp
lordgnu/wxPHP
368a75c893039e5eaa31bc1ee38e341991039f3f
[ "PHP-3.01" ]
1
2019-02-07T23:18:31.000Z
2019-02-07T23:18:31.000Z
ribbon.cpp
lordgnu/wxPHP
368a75c893039e5eaa31bc1ee38e341991039f3f
[ "PHP-3.01" ]
null
null
null
ribbon.cpp
lordgnu/wxPHP
368a75c893039e5eaa31bc1ee38e341991039f3f
[ "PHP-3.01" ]
null
null
null
/* * @author Mário Soares * @contributors Jefferson González * * @license * This file is part of wxPHP check the LICENSE file for information. * * @note * This file was auto-generated by the wxPHP source maker */ #include "php_wxwidgets.h" #include "appmanagement.h" #include "cfg.h" #include "bookctrl.h" #include "dnd.h" #include "cmndlg.h" #include "containers.h" #include "ctrl.h" #include "data.h" #include "dc.h" #include "docview.h" #include "events.h" #include "file.h" #include "gdi.h" #include "grid.h" #include "html.h" #include "help.h" #include "logging.h" #include "managedwnd.h" #include "menus.h" #include "misc.h" #include "miscwnd.h" #include "media.h" #include "pickers.h" #include "printing.h" #include "ribbon.h" #include "richtext.h" #include "rtti.h" #include "stc.h" #include "streams.h" #include "threading.h" #include "validator.h" #include "vfs.h" #include "aui.h" #include "winlayout.h" #include "xml.h" #include "xrc.h" #include "dvc.h" #include "others.h" void php_wxRibbonArtProvider_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Calling php_wxRibbonArtProvider_destruction_handler on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n"); #endif wxRibbonArtProvider_php* object = static_cast<wxRibbonArtProvider_php*>(rsrc->ptr); if(rsrc->ptr != NULL) { #ifdef USE_WXPHP_DEBUG php_printf("Pointer not null\n"); php_printf("Pointer address %x\n", (unsigned int)(size_t)rsrc->ptr); #endif if(object->references.IsUserInitialized()) { #ifdef USE_WXPHP_DEBUG php_printf("Deleting pointer with delete\n"); #endif delete object; rsrc->ptr = NULL; } #ifdef USE_WXPHP_DEBUG php_printf("Deletion of wxRibbonArtProvider done\n"); php_printf("===========================================\n\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Not user space initialized\n"); #endif } } wxRibbonArtProvider* wxRibbonArtProvider_php::Clone()const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::Clone\n"); php_printf("===========================================\n"); #endif zval* arguments[1]; arguments[0] = NULL; zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "Clone", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 0, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'Clone'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return (wxRibbonArtProvider*) return_object; } void wxRibbonArtProvider_php::DrawButtonBarBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawButtonBarBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawButtonBarBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawButtonBarBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawGalleryBackground(wxDC& dc, wxRibbonGallery* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawGalleryBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawGalleryBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonGallery_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonGallery)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawGalleryBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawGalleryItemBackground(wxDC& dc, wxRibbonGallery* wnd, const wxRect& rect, wxRibbonGalleryItem* item) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawGalleryItemBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawGalleryItemBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonGallery_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonGallery)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); object_init_ex(arguments[3], php_wxRibbonGalleryItem_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)item, le_wxRibbonGalleryItem)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawGalleryItemBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawMinimisedPanel(wxDC& dc, wxRibbonPanel* wnd, const wxRect& rect, wxBitmap& bitmap) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawMinimisedPanel\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawMinimisedPanel", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPanel_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPanel)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); object_init_ex(arguments[3], php_wxBitmap_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)&bitmap, le_wxBitmap)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawMinimisedPanel'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawPageBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawPageBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawPageBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawPageBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawPanelBackground(wxDC& dc, wxRibbonPanel* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawPanelBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawPanelBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPanel_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPanel)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawPanelBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawScrollButton(wxDC& dc, wxWindow* wnd, const wxRect& rect, long style) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawScrollButton\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawScrollButton", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); ZVAL_LONG(arguments[3], style); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawScrollButton'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawTabCtrlBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawTabCtrlBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawTabCtrlBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawTabCtrlBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawTabSeparator(wxDC& dc, wxWindow* wnd, const wxRect& rect, double visibility) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawTabSeparator\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawTabSeparator", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); ZVAL_DOUBLE(arguments[3], visibility); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawTabSeparator'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawTool(wxDC& dc, wxWindow* wnd, const wxRect& rect, const wxBitmap& bitmap, wxRibbonButtonKind kind, long state) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawTool\n"); php_printf("===========================================\n"); #endif zval *arguments[6]; //Initilize arguments array for(int i=0; i<6; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawTool", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); object_init_ex(arguments[3], php_wxBitmap_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)&bitmap, le_wxBitmap)); ZVAL_LONG(arguments[4], kind); ZVAL_LONG(arguments[5], state); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 6, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawTool'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawToolBarBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawToolBarBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawToolBarBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawToolBarBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawToolGroupBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawToolGroupBackground\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawToolGroupBackground", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawToolGroupBackground'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::GetBarTabWidth(wxDC& dc, wxWindow* wnd, const wxString& label, const wxBitmap& bitmap, int* ideal, int* small_begin_need_separator, int* small_must_have_separator, int* minimum) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetBarTabWidth\n"); php_printf("===========================================\n"); #endif zval *arguments[8]; //Initilize arguments array for(int i=0; i<8; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetBarTabWidth", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); temp_string = (char*)malloc(sizeof(wxChar)*(label.size()+1)); strcpy(temp_string, (const char *) label.char_str()); ZVAL_STRING(arguments[2], temp_string, 1); free(temp_string); object_init_ex(arguments[3], php_wxBitmap_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)&bitmap, le_wxBitmap)); ZVAL_LONG(arguments[4], *ideal); ZVAL_LONG(arguments[5], *small_begin_need_separator); ZVAL_LONG(arguments[6], *small_must_have_separator); ZVAL_LONG(arguments[7], *minimum); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 8, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetBarTabWidth'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } PHP_METHOD(php_wxRibbonArtProvider, GetColor) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonArtProvider::GetColor\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonArtProvider::GetColor\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonArtProvider){ references = &((wxRibbonArtProvider_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long id0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&id0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &id0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonArtProvider::GetColor((int) id0) to return new object\n\n"); #endif wxColour value_to_return1; if(parent_rsrc_type == le_wxRibbonArtProvider) { value_to_return1 = ((wxRibbonArtProvider_php*)_this)->GetColor((int) id0); void* ptr = safe_emalloc(1, sizeof(wxColour_php), 0); memcpy(ptr, &value_to_return1, sizeof(wxColour)); object_init_ex(return_value, php_wxColour_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxColour)); } return; break; } } } } wxColour wxRibbonArtProvider_php::GetColour(int id)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetColour\n"); php_printf("===========================================\n"); #endif zval *arguments[1]; //Initilize arguments array for(int i=0; i<1; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetColour", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], id); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 1, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetColour'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxColour*) return_object; } void wxRibbonArtProvider_php::GetColourScheme(wxColour* primary, wxColour* secondary, wxColour* tertiary)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetColourScheme\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetColourScheme", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxColour_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)primary, le_wxColour)); object_init_ex(arguments[1], php_wxColour_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)secondary, le_wxColour)); object_init_ex(arguments[2], php_wxColour_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)tertiary, le_wxColour)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetColourScheme'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } long wxRibbonArtProvider_php::GetFlags()const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetFlags\n"); php_printf("===========================================\n"); #endif zval* arguments[1]; arguments[0] = NULL; zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetFlags", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 0, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetFlags'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return (long) Z_LVAL_P(return_value); } wxFont wxRibbonArtProvider_php::GetFont(int id)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetFont\n"); php_printf("===========================================\n"); #endif zval *arguments[1]; //Initilize arguments array for(int i=0; i<1; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetFont", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], id); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 1, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetFont'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxFont*) return_object; } wxSize wxRibbonArtProvider_php::GetGalleryClientSize(wxDC& dc, const wxRibbonGallery* wnd, wxSize size, wxPoint* client_offset, wxRect* scroll_up_button, wxRect* scroll_down_button, wxRect* extension_button) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetGalleryClientSize\n"); php_printf("===========================================\n"); #endif zval *arguments[7]; //Initilize arguments array for(int i=0; i<7; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetGalleryClientSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonGallery_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonGallery)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&size, le_wxSize)); object_init_ex(arguments[3], php_wxPoint_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)client_offset, le_wxPoint)); object_init_ex(arguments[4], php_wxRect_entry); add_property_resource(arguments[4], _wxResource, zend_list_insert((void*)scroll_up_button, le_wxRect)); object_init_ex(arguments[5], php_wxRect_entry); add_property_resource(arguments[5], _wxResource, zend_list_insert((void*)scroll_down_button, le_wxRect)); object_init_ex(arguments[6], php_wxRect_entry); add_property_resource(arguments[6], _wxResource, zend_list_insert((void*)extension_button, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 7, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetGalleryClientSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } wxSize wxRibbonArtProvider_php::GetGallerySize(wxDC& dc, const wxRibbonGallery* wnd, wxSize client_size) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetGallerySize\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetGallerySize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonGallery_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonGallery)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&client_size, le_wxSize)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetGallerySize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } int wxRibbonArtProvider_php::GetMetric(int id)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetMetric\n"); php_printf("===========================================\n"); #endif zval *arguments[1]; //Initilize arguments array for(int i=0; i<1; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetMetric", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], id); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 1, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetMetric'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return (int) Z_LVAL_P(return_value); } wxSize wxRibbonArtProvider_php::GetMinimisedPanelMinimumSize(wxDC& dc, const wxRibbonPanel* wnd, wxSize* desired_bitmap_size, wxDirection* expanded_panel_direction) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetMinimisedPanelMinimumSize\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetMinimisedPanelMinimumSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPanel_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPanel)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)desired_bitmap_size, le_wxSize)); ZVAL_LONG(arguments[3], *expanded_panel_direction); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetMinimisedPanelMinimumSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } wxRect wxRibbonArtProvider_php::GetPageBackgroundRedrawArea(wxDC& dc, const wxRibbonPage* wnd, wxSize page_old_size, wxSize page_new_size) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetPageBackgroundRedrawArea\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetPageBackgroundRedrawArea", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPage_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPage)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&page_old_size, le_wxSize)); object_init_ex(arguments[3], php_wxSize_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)&page_new_size, le_wxSize)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetPageBackgroundRedrawArea'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxRect*) return_object; } wxSize wxRibbonArtProvider_php::GetPanelClientSize(wxDC& dc, const wxRibbonPanel* wnd, wxSize size, wxPoint* client_offset) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetPanelClientSize\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetPanelClientSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPanel_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPanel)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&size, le_wxSize)); object_init_ex(arguments[3], php_wxPoint_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)client_offset, le_wxPoint)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetPanelClientSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } wxSize wxRibbonArtProvider_php::GetPanelSize(wxDC& dc, const wxRibbonPanel* wnd, wxSize client_size, wxPoint* client_offset) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetPanelSize\n"); php_printf("===========================================\n"); #endif zval *arguments[4]; //Initilize arguments array for(int i=0; i<4; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetPanelSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxRibbonPanel_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxRibbonPanel)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&client_size, le_wxSize)); object_init_ex(arguments[3], php_wxPoint_entry); add_property_resource(arguments[3], _wxResource, zend_list_insert((void*)client_offset, le_wxPoint)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 4, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetPanelSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } wxSize wxRibbonArtProvider_php::GetScrollButtonMinimumSize(wxDC& dc, wxWindow* wnd, long style) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetScrollButtonMinimumSize\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetScrollButtonMinimumSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); ZVAL_LONG(arguments[2], style); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetScrollButtonMinimumSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } wxSize wxRibbonArtProvider_php::GetToolSize(wxDC& dc, wxWindow* wnd, wxSize bitmap_size, wxRibbonButtonKind kind, bool is_first, bool is_last, wxRect* dropdown_region) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetToolSize\n"); php_printf("===========================================\n"); #endif zval *arguments[7]; //Initilize arguments array for(int i=0; i<7; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetToolSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxSize_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&bitmap_size, le_wxSize)); ZVAL_LONG(arguments[3], kind); ZVAL_BOOL(arguments[4], is_first); ZVAL_BOOL(arguments[5], is_last); object_init_ex(arguments[6], php_wxRect_entry); add_property_resource(arguments[6], _wxResource, zend_list_insert((void*)dropdown_region, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 7, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetToolSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } PHP_METHOD(php_wxRibbonArtProvider, SetColor) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonArtProvider::SetColor\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonArtProvider::SetColor\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonArtProvider){ references = &((wxRibbonArtProvider_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long id0; zval* color0 = 0; void* object_pointer0_1 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO' (&id0, &color0, php_wxColour_entry)\n"); #endif char parse_parameters_string[] = "lO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &id0, &color0, php_wxColour_entry ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(color0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(color0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(color0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonArtProvider::SetColor((int) id0, *(wxColour*) object_pointer0_1)\n\n"); #endif if(parent_rsrc_type == le_wxRibbonArtProvider) { ((wxRibbonArtProvider_php*)_this)->SetColor((int) id0, *(wxColour*) object_pointer0_1); } references->AddReference(color0); return; break; } } } } void wxRibbonArtProvider_php::SetColourScheme(const wxColour& primary, const wxColour& secondary, const wxColour& tertiary) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::SetColourScheme\n"); php_printf("===========================================\n"); #endif zval *arguments[3]; //Initilize arguments array for(int i=0; i<3; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "SetColourScheme", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxColour_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&primary, le_wxColour)); object_init_ex(arguments[1], php_wxColour_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&secondary, le_wxColour)); object_init_ex(arguments[2], php_wxColour_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&tertiary, le_wxColour)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 3, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'SetColourScheme'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::SetFlags(long flags) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::SetFlags\n"); php_printf("===========================================\n"); #endif zval *arguments[1]; //Initilize arguments array for(int i=0; i<1; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "SetFlags", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], flags); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 1, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'SetFlags'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::SetFont(int id, const wxFont& font) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::SetFont\n"); php_printf("===========================================\n"); #endif zval *arguments[2]; //Initilize arguments array for(int i=0; i<2; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "SetFont", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], id); object_init_ex(arguments[1], php_wxFont_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&font, le_wxFont)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 2, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'SetFont'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::SetMetric(int id, int new_val) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::SetMetric\n"); php_printf("===========================================\n"); #endif zval *arguments[2]; //Initilize arguments array for(int i=0; i<2; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "SetMetric", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], id); ZVAL_LONG(arguments[1], new_val); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 2, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'SetMetric'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } void wxRibbonArtProvider_php::DrawButtonBarButton(wxDC& dc, wxWindow* wnd, const wxRect& rect, wxRibbonButtonKind kind, long state, const wxString& label, const wxBitmap& bitmap_large, const wxBitmap& bitmap_small) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::DrawButtonBarButton\n"); php_printf("===========================================\n"); #endif zval *arguments[8]; //Initilize arguments array for(int i=0; i<8; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DrawButtonBarButton", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); object_init_ex(arguments[2], php_wxRect_entry); add_property_resource(arguments[2], _wxResource, zend_list_insert((void*)&rect, le_wxRect)); ZVAL_LONG(arguments[3], kind); ZVAL_LONG(arguments[4], state); temp_string = (char*)malloc(sizeof(wxChar)*(label.size()+1)); strcpy(temp_string, (const char *) label.char_str()); ZVAL_STRING(arguments[5], temp_string, 1); free(temp_string); object_init_ex(arguments[6], php_wxBitmap_entry); add_property_resource(arguments[6], _wxResource, zend_list_insert((void*)&bitmap_large, le_wxBitmap)); object_init_ex(arguments[7], php_wxBitmap_entry); add_property_resource(arguments[7], _wxResource, zend_list_insert((void*)&bitmap_small, le_wxBitmap)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 8, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'DrawButtonBarButton'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return; } bool wxRibbonArtProvider_php::GetButtonBarButtonSize(wxDC& dc, wxWindow* wnd, wxRibbonButtonKind kind, wxRibbonButtonBarButtonState size, const wxString& label, wxSize bitmap_size_large, wxSize bitmap_size_small, wxSize* button_size, wxRect* normal_region, wxRect* dropdown_region) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonArtProvider::GetButtonBarButtonSize\n"); php_printf("===========================================\n"); #endif zval *arguments[10]; //Initilize arguments array for(int i=0; i<10; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "GetButtonBarButtonSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion object_init_ex(arguments[0], php_wxDC_entry); add_property_resource(arguments[0], _wxResource, zend_list_insert((void*)&dc, le_wxDC)); object_init_ex(arguments[1], php_wxWindow_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)wnd, le_wxWindow)); ZVAL_LONG(arguments[2], kind); ZVAL_LONG(arguments[3], size); temp_string = (char*)malloc(sizeof(wxChar)*(label.size()+1)); strcpy(temp_string, (const char *) label.char_str()); ZVAL_STRING(arguments[4], temp_string, 1); free(temp_string); object_init_ex(arguments[5], php_wxSize_entry); add_property_resource(arguments[5], _wxResource, zend_list_insert((void*)&bitmap_size_large, le_wxSize)); object_init_ex(arguments[6], php_wxSize_entry); add_property_resource(arguments[6], _wxResource, zend_list_insert((void*)&bitmap_size_small, le_wxSize)); object_init_ex(arguments[7], php_wxSize_entry); add_property_resource(arguments[7], _wxResource, zend_list_insert((void*)button_size, le_wxSize)); object_init_ex(arguments[8], php_wxRect_entry); add_property_resource(arguments[8], _wxResource, zend_list_insert((void*)normal_region, le_wxRect)); object_init_ex(arguments[9], php_wxRect_entry); add_property_resource(arguments[9], _wxResource, zend_list_insert((void*)dropdown_region, le_wxRect)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 10, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif wxMessageBox("Failed to call virtual method 'GetButtonBarButtonSize'!", "Error"); } #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif return Z_BVAL_P(return_value); } void php_wxRibbonBar_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonBar_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonBar, ArePanelsShown) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::ArePanelsShown\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::ArePanelsShown\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::ArePanelsShown())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->ArePanelsShown()); return; break; } } } } PHP_METHOD(php_wxRibbonBar, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; zval* pos0 = 0; void* object_pointer0_2 = 0; zval* size0 = 0; void* object_pointer0_3 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Create((wxWindow*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Create((wxWindow*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2)); references->AddReference(parent0); references->AddReference(pos0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } } } } PHP_METHOD(php_wxRibbonBar, DismissExpandedPanel) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::DismissExpandedPanel\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::DismissExpandedPanel\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::DismissExpandedPanel())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->DismissExpandedPanel()); return; break; } } } } PHP_METHOD(php_wxRibbonBar, GetActivePage) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::GetActivePage\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::GetActivePage\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonBar::GetActivePage())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonBar_php*)_this)->GetActivePage()); return; break; } } } } PHP_METHOD(php_wxRibbonBar, GetPage) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::GetPage\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::GetPage\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long n0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&n0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &n0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::GetPage((int) n0) to return object pointer\n\n"); #endif wxRibbonPage_php* value_to_return1; value_to_return1 = (wxRibbonPage_php*) ((wxRibbonBar_php*)_this)->GetPage((int) n0); if(value_to_return1 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return1->references.IsUserInitialized()){ if(value_to_return1->phpObj != NULL){ *return_value = *value_to_return1->phpObj; zval_add_ref(&value_to_return1->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonPage_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return1, le_wxRibbonPage)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return1 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonBar, HidePanels) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::HidePanels\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::HidePanels\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::HidePanels()\n\n"); #endif ((wxRibbonBar_php*)_this)->HidePanels(); return; break; } } } } PHP_METHOD(php_wxRibbonBar, Realize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::Realize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::Realize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::Realize())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->Realize()); return; break; } } } } PHP_METHOD(php_wxRibbonBar, SetActivePage) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::SetActivePage\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::SetActivePage\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long page0; bool overload0_called = false; //Parameters for overload 1 zval* page1 = 0; void* object_pointer1_0 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&page0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &page0 ) == SUCCESS) { overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&page1)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &page1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(page1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(page1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(page1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::SetActivePage((size_t) page0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->SetActivePage((size_t) page0)); return; break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonBar::SetActivePage((wxRibbonPage*) object_pointer1_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonBar_php*)_this)->SetActivePage((wxRibbonPage*) object_pointer1_0)); references->AddReference(page1); return; break; } } } } PHP_METHOD(php_wxRibbonBar, SetArtProvider) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::SetArtProvider\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::SetArtProvider\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* art0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&art0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &art0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(art0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(art0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(art0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::SetArtProvider((wxRibbonArtProvider*) object_pointer0_0)\n\n"); #endif ((wxRibbonBar_php*)_this)->SetArtProvider((wxRibbonArtProvider*) object_pointer0_0); references->AddReference(art0); return; break; } } } } PHP_METHOD(php_wxRibbonBar, SetTabCtrlMargins) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::SetTabCtrlMargins\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::SetTabCtrlMargins\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long left0; long right0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'll' (&left0, &right0)\n"); #endif char parse_parameters_string[] = "ll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &left0, &right0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::SetTabCtrlMargins((int) left0, (int) right0)\n\n"); #endif ((wxRibbonBar_php*)_this)->SetTabCtrlMargins((int) left0, (int) right0); return; break; } } } } PHP_METHOD(php_wxRibbonBar, ShowPanels) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::ShowPanels\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonBar::ShowPanels\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonBar){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool show0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 0 && arguments_received <= 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '|b' (&show0)\n"); #endif char parse_parameters_string[] = "|b"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &show0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::ShowPanels()\n\n"); #endif ((wxRibbonBar_php*)_this)->ShowPanels(); return; break; } case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonBar::ShowPanels(show0)\n\n"); #endif ((wxRibbonBar_php*)_this)->ShowPanels(show0); return; break; } } } } PHP_METHOD(php_wxRibbonBar, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonBar::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; zval* pos1 = 0; void* object_pointer1_2 = 0; zval* size1 = 0; void* object_pointer1_3 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonBar_php(); ((wxRibbonBar_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0)\n"); #endif _this = new wxRibbonBar_php((wxWindow*) object_pointer1_0); ((wxRibbonBar_php*) _this)->references.Initialize(); ((wxRibbonBar_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonBar_php*) _this)->references.Initialize(); ((wxRibbonBar_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2)\n"); #endif _this = new wxRibbonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2); ((wxRibbonBar_php*) _this)->references.Initialize(); ((wxRibbonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonBar_php*) _this)->references.AddReference(pos1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3)\n"); #endif _this = new wxRibbonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3); ((wxRibbonBar_php*) _this)->references.Initialize(); ((wxRibbonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonBar_php*) _this)->references.AddReference(pos1); ((wxRibbonBar_php*) _this)->references.AddReference(size1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1); ((wxRibbonBar_php*) _this)->references.Initialize(); ((wxRibbonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonBar_php*) _this)->references.AddReference(pos1); ((wxRibbonBar_php*) _this)->references.AddReference(size1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonBar); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonBar_php*) _this)->evnArray); array_init(((wxRibbonBar_php*) _this)->evnArray); ((wxRibbonBar_php*) _this)->phpObj = getThis(); ((wxRibbonBar_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonBar_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } void php_wxRibbonButtonBar_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonButtonBar_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonButtonBar, AddDropdownButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::AddDropdownButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::AddDropdownButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; char* label0; long label_len0; zval* bitmap0 = 0; void* object_pointer0_2 = 0; char* help_string0; long help_string_len0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 3 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lsO|s' (&button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0)\n"); #endif char parse_parameters_string[] = "lsO|s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0 ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddDropdownButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return3; value_to_return3 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddDropdownButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddDropdownButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return4; value_to_return4 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddDropdownButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, AddHybridButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::AddHybridButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::AddHybridButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; char* label0; long label_len0; zval* bitmap0 = 0; void* object_pointer0_2 = 0; char* help_string0; long help_string_len0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 3 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lsO|s' (&button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0)\n"); #endif char parse_parameters_string[] = "lsO|s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0 ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddHybridButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return3; value_to_return3 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddHybridButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddHybridButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return4; value_to_return4 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddHybridButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, AddToggleButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::AddToggleButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::AddToggleButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; char* label0; long label_len0; zval* bitmap0 = 0; void* object_pointer0_2 = 0; char* help_string0; long help_string_len0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 3 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lsO|s' (&button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0)\n"); #endif char parse_parameters_string[] = "lsO|s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0 ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddToggleButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return3; value_to_return3 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddToggleButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddToggleButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return4; value_to_return4 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddToggleButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, ClearButtons) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::ClearButtons\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::ClearButtons\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::ClearButtons()\n\n"); #endif ((wxRibbonButtonBar_php*)_this)->ClearButtons(); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; zval* pos0 = 0; void* object_pointer0_2 = 0; zval* size0 = 0; void* object_pointer0_3 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Create((wxWindow*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Create((wxWindow*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2)); references->AddReference(parent0); references->AddReference(pos0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, DeleteButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::DeleteButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::DeleteButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&button_id0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::DeleteButton((int) button_id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->DeleteButton((int) button_id0)); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, EnableButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::EnableButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::EnableButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; bool enable0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l|b' (&button_id0, &enable0)\n"); #endif char parse_parameters_string[] = "l|b"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &enable0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::EnableButton((int) button_id0)\n\n"); #endif ((wxRibbonButtonBar_php*)_this)->EnableButton((int) button_id0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::EnableButton((int) button_id0, enable0)\n\n"); #endif ((wxRibbonButtonBar_php*)_this)->EnableButton((int) button_id0, enable0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, Realize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::Realize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::Realize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonButtonBar::Realize())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonButtonBar_php*)_this)->Realize()); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, ToggleButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::ToggleButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::ToggleButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; bool checked0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lb' (&button_id0, &checked0)\n"); #endif char parse_parameters_string[] = "lb"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &checked0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::ToggleButton((int) button_id0, checked0)\n\n"); #endif ((wxRibbonButtonBar_php*)_this)->ToggleButton((int) button_id0, checked0); return; break; } } } } PHP_METHOD(php_wxRibbonButtonBar, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; zval* pos1 = 0; void* object_pointer1_2 = 0; zval* size1 = 0; void* object_pointer1_3 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonButtonBar_php(); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0)\n"); #endif _this = new wxRibbonButtonBar_php((wxWindow*) object_pointer1_0); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); ((wxRibbonButtonBar_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonButtonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); ((wxRibbonButtonBar_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2)\n"); #endif _this = new wxRibbonButtonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); ((wxRibbonButtonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonButtonBar_php*) _this)->references.AddReference(pos1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3)\n"); #endif _this = new wxRibbonButtonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); ((wxRibbonButtonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonButtonBar_php*) _this)->references.AddReference(pos1); ((wxRibbonButtonBar_php*) _this)->references.AddReference(size1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonButtonBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1); ((wxRibbonButtonBar_php*) _this)->references.Initialize(); ((wxRibbonButtonBar_php*) _this)->references.AddReference(parent1); ((wxRibbonButtonBar_php*) _this)->references.AddReference(pos1); ((wxRibbonButtonBar_php*) _this)->references.AddReference(size1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonButtonBar); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonButtonBar_php*) _this)->evnArray); array_init(((wxRibbonButtonBar_php*) _this)->evnArray); ((wxRibbonButtonBar_php*) _this)->phpObj = getThis(); ((wxRibbonButtonBar_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonButtonBar_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonButtonBar, AddButton) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonButtonBar::AddButton\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonButtonBar::AddButton\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonButtonBar){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long button_id0; char* label0; long label_len0; zval* bitmap0 = 0; void* object_pointer0_2 = 0; char* help_string0; long help_string_len0; long kind0; bool overload0_called = false; //Parameters for overload 1 long button_id1; char* label1; long label_len1; zval* bitmap1 = 0; void* object_pointer1_2 = 0; zval* bitmap_small1 = 0; void* object_pointer1_3 = 0; zval* bitmap_disabled1 = 0; void* object_pointer1_4 = 0; zval* bitmap_small_disabled1 = 0; void* object_pointer1_5 = 0; long kind1; char* help_string1; long help_string_len1; zval* client_data1 = 0; void* object_pointer1_8 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 4 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lsOs|l' (&button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0, &kind0)\n"); #endif char parse_parameters_string[] = "lsOs|l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id0, &label0, &label_len0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0, &kind0 ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { goto overload1; } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { goto overload1; } } overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received >= 3 && arguments_received <= 9) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lsO|OOOlsz' (&button_id1, &label1, &label_len1, &bitmap1, php_wxBitmap_entry, &bitmap_small1, php_wxBitmap_entry, &bitmap_disabled1, php_wxBitmap_entry, &bitmap_small_disabled1, php_wxBitmap_entry, &kind1, &help_string1, &help_string_len1, &client_data1)\n"); #endif char parse_parameters_string[] = "lsO|OOOlsz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &button_id1, &label1, &label_len1, &bitmap1, php_wxBitmap_entry, &bitmap_small1, php_wxBitmap_entry, &bitmap_disabled1, php_wxBitmap_entry, &bitmap_small_disabled1, php_wxBitmap_entry, &kind1, &help_string1, &help_string_len1, &client_data1 ) == SUCCESS) { if(arguments_received >= 3){ if(Z_TYPE_P(bitmap1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(bitmap_small1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap_small1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap_small1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 5){ if(Z_TYPE_P(bitmap_disabled1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap_disabled1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_4 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_4 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap_disabled1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 6){ if(Z_TYPE_P(bitmap_small_disabled1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap_small_disabled1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_5 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_5 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap_small_disabled1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 9){ if(Z_TYPE_P(client_data1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(client_data1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_8 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_8 || (rsrc_type != le_wxEvtHandler && rsrc_type != le_wxWindow && rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow && rsrc_type != le_wxValidator && rsrc_type != le_wxTextValidator && rsrc_type != le_wxGenericValidator && rsrc_type != le_wxMenu && rsrc_type != le_wxAuiManager && rsrc_type != le_wxMouseEventsManager && rsrc_type != le_wxTimer && rsrc_type != le_wxEventBlocker && rsrc_type != le_wxProcess && rsrc_type != le_wxFileSystemWatcher && rsrc_type != le_wxTaskBarIcon && rsrc_type != le_wxNotificationMessage && rsrc_type != le_wxBitmapHandler && rsrc_type != le_wxImage && rsrc_type != le_wxSizer && rsrc_type != le_wxBoxSizer && rsrc_type != le_wxStaticBoxSizer && rsrc_type != le_wxWrapSizer && rsrc_type != le_wxStdDialogButtonSizer && rsrc_type != le_wxGridSizer && rsrc_type != le_wxFlexGridSizer && rsrc_type != le_wxGridBagSizer && rsrc_type != le_wxSizerItem && rsrc_type != le_wxGBSizerItem && rsrc_type != le_wxImageList && rsrc_type != le_wxDC && rsrc_type != le_wxWindowDC && rsrc_type != le_wxClientDC && rsrc_type != le_wxPaintDC && rsrc_type != le_wxScreenDC && rsrc_type != le_wxPostScriptDC && rsrc_type != le_wxPrinterDC && rsrc_type != le_wxMemoryDC && rsrc_type != le_wxBufferedDC && rsrc_type != le_wxBufferedPaintDC && rsrc_type != le_wxAutoBufferedPaintDC && rsrc_type != le_wxMirrorDC && rsrc_type != le_wxColour && rsrc_type != le_wxMenuItem && rsrc_type != le_wxEvent && rsrc_type != le_wxMenuEvent && rsrc_type != le_wxKeyEvent && rsrc_type != le_wxCommandEvent && rsrc_type != le_wxNotifyEvent && rsrc_type != le_wxTreeEvent && rsrc_type != le_wxBookCtrlEvent && rsrc_type != le_wxAuiNotebookEvent && rsrc_type != le_wxAuiToolBarEvent && rsrc_type != le_wxListEvent && rsrc_type != le_wxSpinEvent && rsrc_type != le_wxSplitterEvent && rsrc_type != le_wxSpinDoubleEvent && rsrc_type != le_wxGridSizeEvent && rsrc_type != le_wxWizardEvent && rsrc_type != le_wxGridEvent && rsrc_type != le_wxGridRangeSelectEvent && rsrc_type != le_wxDataViewEvent && rsrc_type != le_wxHeaderCtrlEvent && rsrc_type != le_wxRibbonBarEvent && rsrc_type != le_wxStyledTextEvent && rsrc_type != le_wxChildFocusEvent && rsrc_type != le_wxHtmlCellEvent && rsrc_type != le_wxHtmlLinkEvent && rsrc_type != le_wxHyperlinkEvent && rsrc_type != le_wxColourPickerEvent && rsrc_type != le_wxFontPickerEvent && rsrc_type != le_wxScrollEvent && rsrc_type != le_wxWindowModalDialogEvent && rsrc_type != le_wxDateEvent && rsrc_type != le_wxCalendarEvent && rsrc_type != le_wxWindowCreateEvent && rsrc_type != le_wxWindowDestroyEvent && rsrc_type != le_wxUpdateUIEvent && rsrc_type != le_wxHelpEvent && rsrc_type != le_wxGridEditorCreatedEvent && rsrc_type != le_wxCollapsiblePaneEvent && rsrc_type != le_wxClipboardTextEvent && rsrc_type != le_wxFileCtrlEvent && rsrc_type != le_wxSashEvent && rsrc_type != le_wxFileDirPickerEvent && rsrc_type != le_wxContextMenuEvent && rsrc_type != le_wxRibbonButtonBarEvent && rsrc_type != le_wxRibbonGalleryEvent && rsrc_type != le_wxCloseEvent && rsrc_type != le_wxActivateEvent && rsrc_type != le_wxAuiManagerEvent && rsrc_type != le_wxSizeEvent && rsrc_type != le_wxMouseEvent && rsrc_type != le_wxMoveEvent && rsrc_type != le_wxTimerEvent && rsrc_type != le_wxThreadEvent && rsrc_type != le_wxScrollWinEvent && rsrc_type != le_wxSysColourChangedEvent && rsrc_type != le_wxProcessEvent && rsrc_type != le_wxEraseEvent && rsrc_type != le_wxSetCursorEvent && rsrc_type != le_wxIdleEvent && rsrc_type != le_wxPaintEvent && rsrc_type != le_wxPaletteChangedEvent && rsrc_type != le_wxInitDialogEvent && rsrc_type != le_wxMaximizeEvent && rsrc_type != le_wxNavigationKeyEvent && rsrc_type != le_wxFocusEvent && rsrc_type != le_wxFileSystemWatcherEvent && rsrc_type != le_wxDisplayChangedEvent && rsrc_type != le_wxCalculateLayoutEvent && rsrc_type != le_wxQueryLayoutInfoEvent && rsrc_type != le_wxTaskBarIconEvent && rsrc_type != le_wxAcceleratorTable && rsrc_type != le_wxGDIObject && rsrc_type != le_wxBitmap && rsrc_type != le_wxPalette && rsrc_type != le_wxIcon && rsrc_type != le_wxFont && rsrc_type != le_wxAnimation && rsrc_type != le_wxIconBundle && rsrc_type != le_wxCursor && rsrc_type != le_wxRegion && rsrc_type != le_wxPen && rsrc_type != le_wxBrush && rsrc_type != le_wxArtProvider && rsrc_type != le_wxHtmlCell && rsrc_type != le_wxHtmlContainerCell && rsrc_type != le_wxHtmlColourCell && rsrc_type != le_wxHtmlWidgetCell && rsrc_type != le_wxHtmlEasyPrinting && rsrc_type != le_wxHtmlLinkInfo && rsrc_type != le_wxFindReplaceData && rsrc_type != le_wxSound && rsrc_type != le_wxFileSystem && rsrc_type != le_wxFileSystemHandler && rsrc_type != le_wxMask && rsrc_type != le_wxToolTip && rsrc_type != le_wxGraphicsRenderer && rsrc_type != le_wxLayoutConstraints && rsrc_type != le_wxFSFile && rsrc_type != le_wxColourData && rsrc_type != le_wxFontData && rsrc_type != le_wxGridTableBase && rsrc_type != le_wxDataViewRenderer && rsrc_type != le_wxDataViewBitmapRenderer && rsrc_type != le_wxDataViewChoiceRenderer && rsrc_type != le_wxDataViewCustomRenderer && rsrc_type != le_wxDataViewSpinRenderer && rsrc_type != le_wxDataViewDateRenderer && rsrc_type != le_wxDataViewIconTextRenderer && rsrc_type != le_wxDataViewProgressRenderer && rsrc_type != le_wxDataViewTextRenderer && rsrc_type != le_wxDataViewToggleRenderer && rsrc_type != le_wxDataViewIconText && rsrc_type != le_wxVariant && rsrc_type != le_wxClipboard && rsrc_type != le_wxConfigBase && rsrc_type != le_wxFileConfig && rsrc_type != le_wxXmlResource && rsrc_type != le_wxPageSetupDialogData && rsrc_type != le_wxPrintDialogData && rsrc_type != le_wxPrintData && rsrc_type != le_wxPrintPreview && rsrc_type != le_wxPrinter && rsrc_type != le_wxPrintout && rsrc_type != le_wxHtmlPrintout && rsrc_type != le_wxHtmlDCRenderer && rsrc_type != le_wxHtmlFilter && rsrc_type != le_wxHtmlHelpData && rsrc_type != le_wxHtmlTagHandler && rsrc_type != le_wxHtmlWinTagHandler && rsrc_type != le_wxModule && rsrc_type != le_wxHtmlTagsModule && rsrc_type != le_wxImageHandler && rsrc_type != le_wxXmlResourceHandler && rsrc_type != le_wxXmlDocument && rsrc_type != le_wxLayoutAlgorithm && rsrc_type != le_wxFileHistory && rsrc_type != le_wxToolBarToolBase)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(client_data1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return4; value_to_return4 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8)); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8), (wxRibbonButtonKind) kind0) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return5; value_to_return5 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_2, wxString(help_string0, wxConvUTF8), (wxRibbonButtonKind) kind0); if(value_to_return5 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return5->references.IsUserInitialized()){ if(value_to_return5->phpObj != NULL){ *return_value = *value_to_return5->phpObj; zval_add_ref(&value_to_return5->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return5, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return5 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } if(overload1_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return3; value_to_return3 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return4; value_to_return4 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return5; value_to_return5 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4); if(value_to_return5 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return5->references.IsUserInitialized()){ if(value_to_return5->phpObj != NULL){ *return_value = *value_to_return5->phpObj; zval_add_ref(&value_to_return5->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return5, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return5 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); references->AddReference(bitmap_disabled1); return; break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return6; value_to_return6 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5); if(value_to_return6 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return6->references.IsUserInitialized()){ if(value_to_return6->phpObj != NULL){ *return_value = *value_to_return6->phpObj; zval_add_ref(&value_to_return6->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return6, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return6 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); references->AddReference(bitmap_disabled1); references->AddReference(bitmap_small_disabled1); return; break; } case 7: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return7; value_to_return7 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1); if(value_to_return7 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return7->references.IsUserInitialized()){ if(value_to_return7->phpObj != NULL){ *return_value = *value_to_return7->phpObj; zval_add_ref(&value_to_return7->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return7, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return7 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); references->AddReference(bitmap_disabled1); references->AddReference(bitmap_small_disabled1); return; break; } case 8: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1, wxString(help_string1, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return8; value_to_return8 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1, wxString(help_string1, wxConvUTF8)); if(value_to_return8 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return8->references.IsUserInitialized()){ if(value_to_return8->phpObj != NULL){ *return_value = *value_to_return8->phpObj; zval_add_ref(&value_to_return8->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return8, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return8 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); references->AddReference(bitmap_disabled1); references->AddReference(bitmap_small_disabled1); return; break; } case 9: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonButtonBar::AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1, wxString(help_string1, wxConvUTF8), (wxObject*) object_pointer1_8) to return object pointer\n\n"); #endif wxRibbonButtonBarButtonBase_php* value_to_return9; value_to_return9 = (wxRibbonButtonBarButtonBase_php*) ((wxRibbonButtonBar_php*)_this)->AddButton((int) button_id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_2, *(wxBitmap*) object_pointer1_3, *(wxBitmap*) object_pointer1_4, *(wxBitmap*) object_pointer1_5, (wxRibbonButtonKind) kind1, wxString(help_string1, wxConvUTF8), (wxObject*) object_pointer1_8); if(value_to_return9 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return9->references.IsUserInitialized()){ if(value_to_return9->phpObj != NULL){ *return_value = *value_to_return9->phpObj; zval_add_ref(&value_to_return9->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonButtonBarButtonBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return9, le_wxRibbonButtonBarButtonBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return9 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_small1); references->AddReference(bitmap_disabled1); references->AddReference(bitmap_small_disabled1); references->AddReference(client_data1); return; break; } } } } void php_wxRibbonControl_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonControl_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } wxSize wxRibbonControl_php::DoGetNextLargerSize(wxOrientation direction, wxSize relative_to)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonControl::DoGetNextLargerSize\n"); php_printf("===========================================\n"); #endif zval *arguments[2]; //Initilize arguments array for(int i=0; i<2; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DoGetNextLargerSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], direction); object_init_ex(arguments[1], php_wxSize_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&relative_to, le_wxSize)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 2, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } #ifdef USE_WXPHP_DEBUG php_printf("Calling original method\n"); php_printf("===========================================\n\n"); #endif //Call original method return wxRibbonControl::DoGetNextLargerSize(direction, relative_to); } wxSize wxRibbonControl_php::DoGetNextSmallerSize(wxOrientation direction, wxSize relative_to)const { #ifdef USE_WXPHP_DEBUG php_printf("Invoking virtual wxRibbonControl::DoGetNextSmallerSize\n"); php_printf("===========================================\n"); #endif zval *arguments[2]; //Initilize arguments array for(int i=0; i<2; i++) { MAKE_STD_ZVAL(arguments[i]); } zval* return_value; MAKE_STD_ZVAL(return_value); zval function_name; ZVAL_STRING(&function_name, "DoGetNextSmallerSize", 0); char* temp_string; char _wxResource[] = "wxResource"; zval **tmp; int id_to_find; void* return_object; int rsrc_type; //Parameters for conversion ZVAL_LONG(arguments[0], direction); object_init_ex(arguments[1], php_wxSize_entry); add_property_resource(arguments[1], _wxResource, zend_list_insert((void*)&relative_to, le_wxSize)); #ifdef USE_WXPHP_DEBUG php_printf("Trying to call user defined method\n"); #endif if(call_user_function(NULL, (zval**) &this->phpObj, &function_name, return_value, 2, arguments TSRMLS_CC) == FAILURE) { #ifdef USE_WXPHP_DEBUG php_printf("Invocation of user defined method failed\n"); #endif } else { #ifdef USE_WXPHP_DEBUG php_printf("Returning userspace value.\n"); #endif if(Z_TYPE_P(return_value) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(return_value), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); return_object = zend_list_find(id_to_find, &rsrc_type); } return *(wxSize*) return_object; } #ifdef USE_WXPHP_DEBUG php_printf("Calling original method\n"); php_printf("===========================================\n\n"); #endif //Call original method return wxRibbonControl::DoGetNextSmallerSize(direction, relative_to); } PHP_METHOD(php_wxRibbonControl, GetArtProvider) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::GetArtProvider\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::GetArtProvider\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::GetArtProvider() to return object pointer\n\n"); #endif wxRibbonArtProvider_php* value_to_return0; value_to_return0 = (wxRibbonArtProvider_php*) ((wxRibbonControl_php*)_this)->GetArtProvider(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonArtProvider_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonArtProvider)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonControl, GetNextLargerSize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::GetNextLargerSize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::GetNextLargerSize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long direction0; bool overload0_called = false; //Parameters for overload 1 long direction1; zval* relative_to1 = 0; void* object_pointer1_1 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&direction0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &direction0 ) == SUCCESS) { overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO' (&direction1, &relative_to1, php_wxSize_entry)\n"); #endif char parse_parameters_string[] = "lO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &direction1, &relative_to1, php_wxSize_entry ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(relative_to1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(relative_to1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(relative_to1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::GetNextLargerSize((wxOrientation) direction0) to return new object\n\n"); #endif wxSize value_to_return1; value_to_return1 = ((wxRibbonControl_php*)_this)->GetNextLargerSize((wxOrientation) direction0); void* ptr = safe_emalloc(1, sizeof(wxSize_php), 0); memcpy(ptr, &value_to_return1, sizeof(wxSize)); object_init_ex(return_value, php_wxSize_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxSize)); return; break; } } } if(overload1_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::GetNextLargerSize((wxOrientation) direction1, *(wxSize*) object_pointer1_1) to return new object\n\n"); #endif wxSize value_to_return2; value_to_return2 = ((wxRibbonControl_php*)_this)->GetNextLargerSize((wxOrientation) direction1, *(wxSize*) object_pointer1_1); void* ptr = safe_emalloc(1, sizeof(wxSize_php), 0); memcpy(ptr, &value_to_return2, sizeof(wxSize)); object_init_ex(return_value, php_wxSize_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxSize)); return; break; } } } } PHP_METHOD(php_wxRibbonControl, GetNextSmallerSize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::GetNextSmallerSize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::GetNextSmallerSize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long direction0; bool overload0_called = false; //Parameters for overload 1 long direction1; zval* relative_to1 = 0; void* object_pointer1_1 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&direction0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &direction0 ) == SUCCESS) { overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO' (&direction1, &relative_to1, php_wxSize_entry)\n"); #endif char parse_parameters_string[] = "lO"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &direction1, &relative_to1, php_wxSize_entry ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(relative_to1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(relative_to1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(relative_to1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::GetNextSmallerSize((wxOrientation) direction0) to return new object\n\n"); #endif wxSize value_to_return1; value_to_return1 = ((wxRibbonControl_php*)_this)->GetNextSmallerSize((wxOrientation) direction0); void* ptr = safe_emalloc(1, sizeof(wxSize_php), 0); memcpy(ptr, &value_to_return1, sizeof(wxSize)); object_init_ex(return_value, php_wxSize_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxSize)); return; break; } } } if(overload1_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::GetNextSmallerSize((wxOrientation) direction1, *(wxSize*) object_pointer1_1) to return new object\n\n"); #endif wxSize value_to_return2; value_to_return2 = ((wxRibbonControl_php*)_this)->GetNextSmallerSize((wxOrientation) direction1, *(wxSize*) object_pointer1_1); void* ptr = safe_emalloc(1, sizeof(wxSize_php), 0); memcpy(ptr, &value_to_return2, sizeof(wxSize)); object_init_ex(return_value, php_wxSize_entry); add_property_resource(return_value, "wxResource", zend_list_insert(ptr, le_wxSize)); return; break; } } } } PHP_METHOD(php_wxRibbonControl, IsSizingContinuous) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::IsSizingContinuous\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::IsSizingContinuous\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonControl::IsSizingContinuous())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonControl_php*)_this)->IsSizingContinuous()); return; break; } } } } PHP_METHOD(php_wxRibbonControl, Realise) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::Realise\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::Realise\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonControl::Realise())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonControl_php*)_this)->Realise()); return; break; } } } } PHP_METHOD(php_wxRibbonControl, Realize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::Realize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::Realize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonControl::Realize())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonControl_php*)_this)->Realize()); return; break; } } } } PHP_METHOD(php_wxRibbonControl, SetArtProvider) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::SetArtProvider\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonControl::SetArtProvider\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonControl){ references = &((wxRibbonControl_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonBar) && (!reference_type_found)){ references = &((wxRibbonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonButtonBar) && (!reference_type_found)){ references = &((wxRibbonButtonBar_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonGallery) && (!reference_type_found)){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPage) && (!reference_type_found)){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonPanel) && (!reference_type_found)){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } if((parent_rsrc_type == le_wxRibbonToolBar) && (!reference_type_found)){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* art0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&art0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &art0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(art0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(art0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(art0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonControl::SetArtProvider((wxRibbonArtProvider*) object_pointer0_0)\n\n"); #endif ((wxRibbonControl_php*)_this)->SetArtProvider((wxRibbonArtProvider*) object_pointer0_0); references->AddReference(art0); return; break; } } } } PHP_METHOD(php_wxRibbonControl, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonControl::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; zval* pos1 = 0; void* object_pointer1_2 = 0; zval* size1 = 0; void* object_pointer1_3 = 0; long style1; zval* validator1 = 0; void* object_pointer1_5 = 0; char* name1; long name_len1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 2 && arguments_received <= 7) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'zl|OOlOs' (&parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1, &validator1, php_wxValidator_entry, &name1, &name_len1)\n"); #endif char parse_parameters_string[] = "zl|OOlOs"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1, &validator1, php_wxValidator_entry, &name1, &name_len1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 6){ if(Z_TYPE_P(validator1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(validator1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_5 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_5 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(validator1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonControl_php(); ((wxRibbonControl_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2)\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); ((wxRibbonControl_php*) _this)->references.AddReference(pos1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3)\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); ((wxRibbonControl_php*) _this)->references.AddReference(pos1); ((wxRibbonControl_php*) _this)->references.AddReference(size1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); ((wxRibbonControl_php*) _this)->references.AddReference(pos1); ((wxRibbonControl_php*) _this)->references.AddReference(size1); break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1, *(wxValidator*) object_pointer1_5)\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1, *(wxValidator*) object_pointer1_5); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); ((wxRibbonControl_php*) _this)->references.AddReference(pos1); ((wxRibbonControl_php*) _this)->references.AddReference(size1); ((wxRibbonControl_php*) _this)->references.AddReference(validator1); break; } case 7: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1, *(wxValidator*) object_pointer1_5, wxString(name1, wxConvUTF8))\n"); #endif _this = new wxRibbonControl_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1, *(wxValidator*) object_pointer1_5, wxString(name1, wxConvUTF8)); ((wxRibbonControl_php*) _this)->references.Initialize(); ((wxRibbonControl_php*) _this)->references.AddReference(parent1); ((wxRibbonControl_php*) _this)->references.AddReference(pos1); ((wxRibbonControl_php*) _this)->references.AddReference(size1); ((wxRibbonControl_php*) _this)->references.AddReference(validator1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonControl); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonControl_php*) _this)->evnArray); array_init(((wxRibbonControl_php*) _this)->evnArray); ((wxRibbonControl_php*) _this)->phpObj = getThis(); ((wxRibbonControl_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonControl_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } void php_wxRibbonGallery_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonGallery_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonGallery, Append) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::Append\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::Append\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* bitmap0 = 0; void* object_pointer0_0 = 0; long id0; bool overload0_called = false; //Parameters for overload 1 zval* bitmap1 = 0; void* object_pointer1_0 = 0; long id1; char* clientData1; long clientData_len1; zval* clientData1_ref; bool overload1_called = false; //Parameters for overload 2 zval* bitmap2 = 0; void* object_pointer2_0 = 0; long id2; zval* clientData2 = 0; void* object_pointer2_2 = 0; bool overload2_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Ol' (&bitmap0, php_wxBitmap_entry, &id0)\n"); #endif char parse_parameters_string[] = "Ol"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &bitmap0, php_wxBitmap_entry, &id0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { goto overload1; } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { goto overload1; } } overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received == 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Ols' (&bitmap1, php_wxBitmap_entry, &id1, &clientData1, &clientData_len1)\n"); #endif char parse_parameters_string[] = "Ols"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &bitmap1, php_wxBitmap_entry, &id1, &clientData1, &clientData_len1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(bitmap1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 ) { goto overload2; } } else if(Z_TYPE_P(bitmap1) != IS_NULL) { goto overload2; } } overload1_called = true; already_called = true; char parse_references_string[] = "zzz"; zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_references_string, &dummy, &dummy, &clientData1_ref ); } } //Overload 2 overload2: if(!already_called && arguments_received == 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'Olz' (&bitmap2, php_wxBitmap_entry, &id2, &clientData2)\n"); #endif char parse_parameters_string[] = "Olz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &bitmap2, php_wxBitmap_entry, &id2, &clientData2 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(bitmap2) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap2), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer2_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer2_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap2) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(clientData2) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(clientData2), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer2_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer2_2 || (rsrc_type != le_wxTreeItemData)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(clientData2) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload2_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::Append(*(wxBitmap*) object_pointer0_0, (int) id0) to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return2; value_to_return2 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->Append(*(wxBitmap*) object_pointer0_0, (int) id0); if(value_to_return2 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return2->references.IsUserInitialized()){ if(value_to_return2->phpObj != NULL){ *return_value = *value_to_return2->phpObj; zval_add_ref(&value_to_return2->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return2, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return2 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } if(overload1_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::Append(*(wxBitmap*) object_pointer1_0, (int) id1, (void*) clientData1) to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return3; value_to_return3 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->Append(*(wxBitmap*) object_pointer1_0, (int) id1, (void*) clientData1); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); ZVAL_STRING(clientData1_ref, (char*) clientData1, 1); return; break; } } } if(overload2_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::Append(*(wxBitmap*) object_pointer2_0, (int) id2, (wxClientData*) object_pointer2_2) to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return3; value_to_return3 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->Append(*(wxBitmap*) object_pointer2_0, (int) id2, (wxClientData*) object_pointer2_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap2); references->AddReference(clientData2); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, Clear) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::Clear\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::Clear\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::Clear()\n\n"); #endif ((wxRibbonGallery_php*)_this)->Clear(); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; zval* pos0 = 0; void* object_pointer0_2 = 0; zval* size0 = 0; void* object_pointer0_3 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::Create((wxWindow*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->Create((wxWindow*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2)); references->AddReference(parent0); references->AddReference(pos0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, EnsureVisible) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::EnsureVisible\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::EnsureVisible\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&item0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::EnsureVisible((const wxRibbonGalleryItem*) object_pointer0_0)\n\n"); #endif ((wxRibbonGallery_php*)_this)->EnsureVisible((const wxRibbonGalleryItem*) object_pointer0_0); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetActiveItem) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetActiveItem\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetActiveItem\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetActiveItem() to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return0; value_to_return0 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->GetActiveItem(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetCount) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetCount\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetCount\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonGallery::GetCount())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonGallery_php*)_this)->GetCount()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetDownButtonState) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetDownButtonState\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetDownButtonState\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonGallery::GetDownButtonState())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonGallery_php*)_this)->GetDownButtonState()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetExtensionButtonState) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetExtensionButtonState\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetExtensionButtonState\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonGallery::GetExtensionButtonState())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonGallery_php*)_this)->GetExtensionButtonState()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetHoveredItem) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetHoveredItem\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetHoveredItem\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetHoveredItem() to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return0; value_to_return0 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->GetHoveredItem(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetItem) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetItem\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetItem\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long n0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&n0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &n0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetItem((unsigned int) n0) to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return1; value_to_return1 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->GetItem((unsigned int) n0); if(value_to_return1 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return1->references.IsUserInitialized()){ if(value_to_return1->phpObj != NULL){ *return_value = *value_to_return1->phpObj; zval_add_ref(&value_to_return1->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return1, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return1 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetItemClientData) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetItemClientData\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetItemClientData\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&item0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetItemClientData((const wxRibbonGalleryItem*) object_pointer0_0)\n\n"); #endif ZVAL_STRING(return_value, (char*) ((wxRibbonGallery_php*)_this)->GetItemClientData((const wxRibbonGalleryItem*) object_pointer0_0), 1); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetItemClientObject) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetItemClientObject\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetItemClientObject\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&item0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetItemClientObject((const wxRibbonGalleryItem*) object_pointer0_0) to return object pointer\n\n"); #endif wxClientData_php* value_to_return1; value_to_return1 = (wxClientData_php*) ((wxRibbonGallery_php*)_this)->GetItemClientObject((const wxRibbonGalleryItem*) object_pointer0_0); if(value_to_return1 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return1->references.IsUserInitialized()){ if(value_to_return1->phpObj != NULL){ *return_value = *value_to_return1->phpObj; zval_add_ref(&value_to_return1->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxClientData_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return1, le_wxClientData)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return1 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetSelection) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetSelection\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetSelection\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::GetSelection() to return object pointer\n\n"); #endif wxRibbonGalleryItem_php* value_to_return0; value_to_return0 = (wxRibbonGalleryItem_php*) ((wxRibbonGallery_php*)_this)->GetSelection(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonGalleryItem_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonGalleryItem)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonGallery, GetUpButtonState) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::GetUpButtonState\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::GetUpButtonState\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonGallery::GetUpButtonState())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonGallery_php*)_this)->GetUpButtonState()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, IsEmpty) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::IsEmpty\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::IsEmpty\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::IsEmpty())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->IsEmpty()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, IsHovered) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::IsHovered\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::IsHovered\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::IsHovered())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->IsHovered()); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, ScrollLines) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::ScrollLines\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::ScrollLines\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long lines0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&lines0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &lines0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::ScrollLines((int) lines0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->ScrollLines((int) lines0)); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, ScrollPixels) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::ScrollPixels\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::ScrollPixels\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long pixels0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&pixels0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &pixels0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonGallery::ScrollPixels((int) pixels0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonGallery_php*)_this)->ScrollPixels((int) pixels0)); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, SetItemClientData) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::SetItemClientData\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::SetItemClientData\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; char* data0; long data_len0; zval* data0_ref; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'zs' (&item0, &data0, &data_len0)\n"); #endif char parse_parameters_string[] = "zs"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, &data0, &data_len0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; char parse_references_string[] = "zz"; zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_references_string, &dummy, &data0_ref ); } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::SetItemClientData((wxRibbonGalleryItem*) object_pointer0_0, (void*) data0)\n\n"); #endif ((wxRibbonGallery_php*)_this)->SetItemClientData((wxRibbonGalleryItem*) object_pointer0_0, (void*) data0); references->AddReference(item0); ZVAL_STRING(data0_ref, (char*) data0, 1); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, SetItemClientObject) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::SetItemClientObject\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::SetItemClientObject\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; zval* data0 = 0; void* object_pointer0_1 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'zz' (&item0, &data0)\n"); #endif char parse_parameters_string[] = "zz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0, &data0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 2){ if(Z_TYPE_P(data0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(data0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_1 || (rsrc_type != le_wxTreeItemData)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(data0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::SetItemClientObject((wxRibbonGalleryItem*) object_pointer0_0, (wxClientData*) object_pointer0_1)\n\n"); #endif ((wxRibbonGallery_php*)_this)->SetItemClientObject((wxRibbonGalleryItem*) object_pointer0_0, (wxClientData*) object_pointer0_1); references->AddReference(item0); references->AddReference(data0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, SetSelection) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::SetSelection\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonGallery::SetSelection\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonGallery){ references = &((wxRibbonGallery_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* item0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&item0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &item0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(item0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(item0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(item0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonGallery::SetSelection((wxRibbonGalleryItem*) object_pointer0_0)\n\n"); #endif ((wxRibbonGallery_php*)_this)->SetSelection((wxRibbonGalleryItem*) object_pointer0_0); references->AddReference(item0); return; break; } } } } PHP_METHOD(php_wxRibbonGallery, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonGallery::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; zval* pos1 = 0; void* object_pointer1_2 = 0; zval* size1 = 0; void* object_pointer1_3 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonGallery_php(); ((wxRibbonGallery_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0)\n"); #endif _this = new wxRibbonGallery_php((wxWindow*) object_pointer1_0); ((wxRibbonGallery_php*) _this)->references.Initialize(); ((wxRibbonGallery_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonGallery_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonGallery_php*) _this)->references.Initialize(); ((wxRibbonGallery_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2)\n"); #endif _this = new wxRibbonGallery_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2); ((wxRibbonGallery_php*) _this)->references.Initialize(); ((wxRibbonGallery_php*) _this)->references.AddReference(parent1); ((wxRibbonGallery_php*) _this)->references.AddReference(pos1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3)\n"); #endif _this = new wxRibbonGallery_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3); ((wxRibbonGallery_php*) _this)->references.Initialize(); ((wxRibbonGallery_php*) _this)->references.AddReference(parent1); ((wxRibbonGallery_php*) _this)->references.AddReference(pos1); ((wxRibbonGallery_php*) _this)->references.AddReference(size1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonGallery_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1); ((wxRibbonGallery_php*) _this)->references.Initialize(); ((wxRibbonGallery_php*) _this)->references.AddReference(parent1); ((wxRibbonGallery_php*) _this)->references.AddReference(pos1); ((wxRibbonGallery_php*) _this)->references.AddReference(size1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonGallery); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonGallery_php*) _this)->evnArray); array_init(((wxRibbonGallery_php*) _this)->evnArray); ((wxRibbonGallery_php*) _this)->phpObj = getThis(); ((wxRibbonGallery_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonGallery_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } void php_wxRibbonPage_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonPage_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonPage, AdjustRectToIncludeScrollButtons) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::AdjustRectToIncludeScrollButtons\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::AdjustRectToIncludeScrollButtons\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* rect0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&rect0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &rect0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(rect0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(rect0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(rect0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPage::AdjustRectToIncludeScrollButtons((wxRect*) object_pointer0_0)\n\n"); #endif ((wxRibbonPage_php*)_this)->AdjustRectToIncludeScrollButtons((wxRect*) object_pointer0_0); references->AddReference(rect0); return; break; } } } } PHP_METHOD(php_wxRibbonPage, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; char* label0; long label_len0; zval* icon0 = 0; void* object_pointer0_3 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lsOl' (&parent0, &id0, &label0, &label_len0, &icon0, php_wxBitmap_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lsOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &label0, &label_len0, &icon0, php_wxBitmap_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(icon0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(icon0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(icon0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Create((wxRibbonBar*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Create((wxRibbonBar*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8)))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8))); references->AddReference(parent0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(icon0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Create((wxRibbonBar*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, (long) style0)); references->AddReference(parent0); references->AddReference(icon0); return; break; } } } } PHP_METHOD(php_wxRibbonPage, DismissExpandedPanel) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::DismissExpandedPanel\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::DismissExpandedPanel\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::DismissExpandedPanel())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->DismissExpandedPanel()); return; break; } } } } PHP_METHOD(php_wxRibbonPage, GetIcon) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::GetIcon\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::GetIcon\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPage::GetIcon() to return object reference\n\n"); #endif wxBitmap_php* value_to_return0; value_to_return0 = (wxBitmap_php*) &((wxRibbonPage_php*)_this)->GetIcon(); if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxBitmap_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxBitmap)); } if(value_to_return0 != _this && return_is_user_initialized){ //Prevent adding references to it self references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonPage, GetMajorAxis) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::GetMajorAxis\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::GetMajorAxis\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_LONG(wxRibbonPage::GetMajorAxis())\n\n"); #endif ZVAL_LONG(return_value, ((wxRibbonPage_php*)_this)->GetMajorAxis()); return; break; } } } } PHP_METHOD(php_wxRibbonPage, Realize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::Realize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::Realize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::Realize())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->Realize()); return; break; } } } } PHP_METHOD(php_wxRibbonPage, ScrollLines) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::ScrollLines\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::ScrollLines\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long lines0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&lines0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &lines0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::ScrollLines((int) lines0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->ScrollLines((int) lines0)); return; break; } } } } PHP_METHOD(php_wxRibbonPage, ScrollPixels) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::ScrollPixels\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::ScrollPixels\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long pixels0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l' (&pixels0)\n"); #endif char parse_parameters_string[] = "l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &pixels0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPage::ScrollPixels((int) pixels0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPage_php*)_this)->ScrollPixels((int) pixels0)); return; break; } } } } PHP_METHOD(php_wxRibbonPage, SetArtProvider) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::SetArtProvider\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::SetArtProvider\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* art0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&art0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &art0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(art0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(art0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(art0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPage::SetArtProvider((wxRibbonArtProvider*) object_pointer0_0)\n\n"); #endif ((wxRibbonPage_php*)_this)->SetArtProvider((wxRibbonArtProvider*) object_pointer0_0); references->AddReference(art0); return; break; } } } } PHP_METHOD(php_wxRibbonPage, SetSizeWithScrollButtonAdjustment) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::SetSizeWithScrollButtonAdjustment\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPage::SetSizeWithScrollButtonAdjustment\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPage){ references = &((wxRibbonPage_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long x0; long y0; long width0; long height0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'llll' (&x0, &y0, &width0, &height0)\n"); #endif char parse_parameters_string[] = "llll"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &x0, &y0, &width0, &height0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPage::SetSizeWithScrollButtonAdjustment((int) x0, (int) y0, (int) width0, (int) height0)\n\n"); #endif ((wxRibbonPage_php*)_this)->SetSizeWithScrollButtonAdjustment((int) x0, (int) y0, (int) width0, (int) height0); return; break; } } } } PHP_METHOD(php_wxRibbonPage, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPage::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; char* label1; long label_len1; zval* icon1 = 0; void* object_pointer1_3 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lsOl' (&parent1, &id1, &label1, &label_len1, &icon1, php_wxBitmap_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lsOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &label1, &label_len1, &icon1, php_wxBitmap_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(icon1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(icon1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(icon1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonPage_php(); ((wxRibbonPage_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxRibbonBar*) object_pointer1_0)\n"); #endif _this = new wxRibbonPage_php((wxRibbonBar*) object_pointer1_0); ((wxRibbonPage_php*) _this)->references.Initialize(); ((wxRibbonPage_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonPage_php((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonPage_php*) _this)->references.Initialize(); ((wxRibbonPage_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8))\n"); #endif _this = new wxRibbonPage_php((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8)); ((wxRibbonPage_php*) _this)->references.Initialize(); ((wxRibbonPage_php*) _this)->references.AddReference(parent1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3)\n"); #endif _this = new wxRibbonPage_php((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3); ((wxRibbonPage_php*) _this)->references.Initialize(); ((wxRibbonPage_php*) _this)->references.AddReference(parent1); ((wxRibbonPage_php*) _this)->references.AddReference(icon1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonPage_php((wxRibbonBar*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, (long) style1); ((wxRibbonPage_php*) _this)->references.Initialize(); ((wxRibbonPage_php*) _this)->references.AddReference(parent1); ((wxRibbonPage_php*) _this)->references.AddReference(icon1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonPage); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonPage_php*) _this)->evnArray); array_init(((wxRibbonPage_php*) _this)->evnArray); ((wxRibbonPage_php*) _this)->phpObj = getThis(); ((wxRibbonPage_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonPage_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } void php_wxRibbonPanel_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonPanel_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonPanel, CanAutoMinimise) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::CanAutoMinimise\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::CanAutoMinimise\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::CanAutoMinimise())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->CanAutoMinimise()); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; char* label0; long label_len0; zval* icon0 = 0; void* object_pointer0_3 = 0; zval* pos0 = 0; void* object_pointer0_4 = 0; zval* size0 = 0; void* object_pointer0_5 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 7) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lsOOOl' (&parent0, &id0, &label0, &label_len0, &icon0, php_wxBitmap_entry, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lsOOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &label0, &label_len0, &icon0, php_wxBitmap_entry, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(icon0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(icon0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(icon0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 5){ if(Z_TYPE_P(pos0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_4 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_4 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 6){ if(Z_TYPE_P(size0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_5 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_5 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8)))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8))); references->AddReference(parent0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(icon0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(pos0); return; break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4, *(wxSize*) object_pointer0_5))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4, *(wxSize*) object_pointer0_5)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(pos0); references->AddReference(size0); return; break; } case 7: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4, *(wxSize*) object_pointer0_5, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, wxString(label0, wxConvUTF8), *(wxBitmap*) object_pointer0_3, *(wxPoint*) object_pointer0_4, *(wxSize*) object_pointer0_5, (long) style0)); references->AddReference(parent0); references->AddReference(icon0); references->AddReference(pos0); references->AddReference(size0); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, GetExpandedDummy) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::GetExpandedDummy\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::GetExpandedDummy\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPanel::GetExpandedDummy() to return object pointer\n\n"); #endif wxRibbonPanel_php* value_to_return0; value_to_return0 = (wxRibbonPanel_php*) ((wxRibbonPanel_php*)_this)->GetExpandedDummy(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonPanel_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonPanel)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonPanel, GetExpandedPanel) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::GetExpandedPanel\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::GetExpandedPanel\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPanel::GetExpandedPanel() to return object pointer\n\n"); #endif wxRibbonPanel_php* value_to_return0; value_to_return0 = (wxRibbonPanel_php*) ((wxRibbonPanel_php*)_this)->GetExpandedPanel(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonPanel_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonPanel)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonPanel, GetMinimisedIcon) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::GetMinimisedIcon\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::GetMinimisedIcon\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload1_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPanel::GetMinimisedIcon() to return object reference\n\n"); #endif wxBitmap_php* value_to_return0; value_to_return0 = (wxBitmap_php*) &((wxRibbonPanel_php*)_this)->GetMinimisedIcon(); if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxBitmap_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxBitmap)); } if(value_to_return0 != _this && return_is_user_initialized){ //Prevent adding references to it self references->AddReference(return_value); } return; break; } } } if(overload1_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPanel::GetMinimisedIcon() to return object reference\n\n"); #endif wxBitmap_php* value_to_return0; value_to_return0 = (wxBitmap_php*) &((wxRibbonPanel_php*)_this)->GetMinimisedIcon(); if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxBitmap_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxBitmap)); } if(value_to_return0 != _this && return_is_user_initialized){ //Prevent adding references to it self references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonPanel, HideExpanded) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::HideExpanded\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::HideExpanded\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::HideExpanded())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->HideExpanded()); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, IsHovered) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::IsHovered\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::IsHovered\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::IsHovered())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->IsHovered()); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, IsMinimised) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::IsMinimised\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::IsMinimised\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* at_size1 = 0; void* object_pointer1_0 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'O' (&at_size1, php_wxSize_entry)\n"); #endif char parse_parameters_string[] = "O"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &at_size1, php_wxSize_entry ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(at_size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(at_size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(at_size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::IsMinimised())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->IsMinimised()); return; break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::IsMinimised(*(wxSize*) object_pointer1_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->IsMinimised(*(wxSize*) object_pointer1_0)); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, Realize) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::Realize\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::Realize\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::Realize())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->Realize()); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, SetArtProvider) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::SetArtProvider\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::SetArtProvider\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* art0 = 0; void* object_pointer0_0 = 0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 1) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z' (&art0)\n"); #endif char parse_parameters_string[] = "z"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &art0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(art0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(art0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(art0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonPanel::SetArtProvider((wxRibbonArtProvider*) object_pointer0_0)\n\n"); #endif ((wxRibbonPanel_php*)_this)->SetArtProvider((wxRibbonArtProvider*) object_pointer0_0); references->AddReference(art0); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, ShowExpanded) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::ShowExpanded\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonPanel::ShowExpanded\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonPanel){ references = &((wxRibbonPanel_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonPanel::ShowExpanded())\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonPanel_php*)_this)->ShowExpanded()); return; break; } } } } PHP_METHOD(php_wxRibbonPanel, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonPanel::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; char* label1; long label_len1; zval* minimised_icon1 = 0; void* object_pointer1_3 = 0; zval* pos1 = 0; void* object_pointer1_4 = 0; zval* size1 = 0; void* object_pointer1_5 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 7) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lsOOOl' (&parent1, &id1, &label1, &label_len1, &minimised_icon1, php_wxBitmap_entry, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lsOOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &label1, &label_len1, &minimised_icon1, php_wxBitmap_entry, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(minimised_icon1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(minimised_icon1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(minimised_icon1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 5){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_4 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_4 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 6){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_5 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_5 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonPanel_php(); ((wxRibbonPanel_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8))\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8)); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); ((wxRibbonPanel_php*) _this)->references.AddReference(minimised_icon1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); ((wxRibbonPanel_php*) _this)->references.AddReference(minimised_icon1); ((wxRibbonPanel_php*) _this)->references.AddReference(pos1); break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4, *(wxSize*) object_pointer1_5)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4, *(wxSize*) object_pointer1_5); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); ((wxRibbonPanel_php*) _this)->references.AddReference(minimised_icon1); ((wxRibbonPanel_php*) _this)->references.AddReference(pos1); ((wxRibbonPanel_php*) _this)->references.AddReference(size1); break; } case 7: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4, *(wxSize*) object_pointer1_5, (long) style1)\n"); #endif _this = new wxRibbonPanel_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, wxString(label1, wxConvUTF8), *(wxBitmap*) object_pointer1_3, *(wxPoint*) object_pointer1_4, *(wxSize*) object_pointer1_5, (long) style1); ((wxRibbonPanel_php*) _this)->references.Initialize(); ((wxRibbonPanel_php*) _this)->references.AddReference(parent1); ((wxRibbonPanel_php*) _this)->references.AddReference(minimised_icon1); ((wxRibbonPanel_php*) _this)->references.AddReference(pos1); ((wxRibbonPanel_php*) _this)->references.AddReference(size1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonPanel); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonPanel_php*) _this)->evnArray); array_init(((wxRibbonPanel_php*) _this)->evnArray); ((wxRibbonPanel_php*) _this)->phpObj = getThis(); ((wxRibbonPanel_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonPanel_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif } void php_wxRibbonToolBar_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { #ifdef USE_WXPHP_DEBUG php_printf("Obviate php_wxRibbonToolBar_destruction_handler call on %s at line %i\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); php_printf("===========================================\n\n"); #endif } PHP_METHOD(php_wxRibbonToolBar, AddDropdownTool) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::AddDropdownTool\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::AddDropdownTool\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long tool_id0; zval* bitmap0 = 0; void* object_pointer0_1 = 0; char* help_string0; long help_string_len0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 2 && arguments_received <= 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO|s' (&tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0)\n"); #endif char parse_parameters_string[] = "lO|s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0 ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddDropdownTool((int) tool_id0, *(wxBitmap*) object_pointer0_1) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return2; value_to_return2 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddDropdownTool((int) tool_id0, *(wxBitmap*) object_pointer0_1); if(value_to_return2 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return2->references.IsUserInitialized()){ if(value_to_return2->phpObj != NULL){ *return_value = *value_to_return2->phpObj; zval_add_ref(&value_to_return2->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return2, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return2 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddDropdownTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return3; value_to_return3 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddDropdownTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, AddHybridTool) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::AddHybridTool\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::AddHybridTool\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long tool_id0; zval* bitmap0 = 0; void* object_pointer0_1 = 0; char* help_string0; long help_string_len0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 2 && arguments_received <= 3) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO|s' (&tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0)\n"); #endif char parse_parameters_string[] = "lO|s"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0 ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddHybridTool((int) tool_id0, *(wxBitmap*) object_pointer0_1) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return2; value_to_return2 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddHybridTool((int) tool_id0, *(wxBitmap*) object_pointer0_1); if(value_to_return2 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return2->references.IsUserInitialized()){ if(value_to_return2->phpObj != NULL){ *return_value = *value_to_return2->phpObj; zval_add_ref(&value_to_return2->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return2, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return2 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddHybridTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return3; value_to_return3 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddHybridTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, AddSeparator) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::AddSeparator\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::AddSeparator\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddSeparator() to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return0; value_to_return0 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddSeparator(); if(value_to_return0 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return0->references.IsUserInitialized()){ if(value_to_return0->phpObj != NULL){ *return_value = *value_to_return0->phpObj; zval_add_ref(&value_to_return0->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return0, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return0 != _this && return_is_user_initialized){ references->AddReference(return_value); } return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, AddTool) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::AddTool\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::AddTool\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long tool_id0; zval* bitmap0 = 0; void* object_pointer0_1 = 0; char* help_string0; long help_string_len0; long kind0; bool overload0_called = false; //Parameters for overload 1 long tool_id1; zval* bitmap1 = 0; void* object_pointer1_1 = 0; zval* bitmap_disabled1 = 0; void* object_pointer1_2 = 0; char* help_string1; long help_string_len1; long kind1; zval* client_data1 = 0; void* object_pointer1_5 = 0; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 3 && arguments_received <= 4) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lOs|l' (&tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0, &kind0)\n"); #endif char parse_parameters_string[] = "lOs|l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &tool_id0, &bitmap0, php_wxBitmap_entry, &help_string0, &help_string_len0, &kind0 ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(bitmap0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_1 ) { goto overload1; } } else if(Z_TYPE_P(bitmap0) != IS_NULL) { goto overload1; } } overload0_called = true; already_called = true; } } //Overload 1 overload1: if(!already_called && arguments_received >= 2 && arguments_received <= 6) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'lO|Oslz' (&tool_id1, &bitmap1, php_wxBitmap_entry, &bitmap_disabled1, php_wxBitmap_entry, &help_string1, &help_string_len1, &kind1, &client_data1)\n"); #endif char parse_parameters_string[] = "lO|Oslz"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &tool_id1, &bitmap1, php_wxBitmap_entry, &bitmap_disabled1, php_wxBitmap_entry, &help_string1, &help_string_len1, &kind1, &client_data1 ) == SUCCESS) { if(arguments_received >= 2){ if(Z_TYPE_P(bitmap1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_1 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_1 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(bitmap_disabled1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(bitmap_disabled1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(bitmap_disabled1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 6){ if(Z_TYPE_P(client_data1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(client_data1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_5 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_5 || (rsrc_type != le_wxEvtHandler && rsrc_type != le_wxWindow && rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow && rsrc_type != le_wxValidator && rsrc_type != le_wxTextValidator && rsrc_type != le_wxGenericValidator && rsrc_type != le_wxMenu && rsrc_type != le_wxAuiManager && rsrc_type != le_wxMouseEventsManager && rsrc_type != le_wxTimer && rsrc_type != le_wxEventBlocker && rsrc_type != le_wxProcess && rsrc_type != le_wxFileSystemWatcher && rsrc_type != le_wxTaskBarIcon && rsrc_type != le_wxNotificationMessage && rsrc_type != le_wxBitmapHandler && rsrc_type != le_wxImage && rsrc_type != le_wxSizer && rsrc_type != le_wxBoxSizer && rsrc_type != le_wxStaticBoxSizer && rsrc_type != le_wxWrapSizer && rsrc_type != le_wxStdDialogButtonSizer && rsrc_type != le_wxGridSizer && rsrc_type != le_wxFlexGridSizer && rsrc_type != le_wxGridBagSizer && rsrc_type != le_wxSizerItem && rsrc_type != le_wxGBSizerItem && rsrc_type != le_wxImageList && rsrc_type != le_wxDC && rsrc_type != le_wxWindowDC && rsrc_type != le_wxClientDC && rsrc_type != le_wxPaintDC && rsrc_type != le_wxScreenDC && rsrc_type != le_wxPostScriptDC && rsrc_type != le_wxPrinterDC && rsrc_type != le_wxMemoryDC && rsrc_type != le_wxBufferedDC && rsrc_type != le_wxBufferedPaintDC && rsrc_type != le_wxAutoBufferedPaintDC && rsrc_type != le_wxMirrorDC && rsrc_type != le_wxColour && rsrc_type != le_wxMenuItem && rsrc_type != le_wxEvent && rsrc_type != le_wxMenuEvent && rsrc_type != le_wxKeyEvent && rsrc_type != le_wxCommandEvent && rsrc_type != le_wxNotifyEvent && rsrc_type != le_wxTreeEvent && rsrc_type != le_wxBookCtrlEvent && rsrc_type != le_wxAuiNotebookEvent && rsrc_type != le_wxAuiToolBarEvent && rsrc_type != le_wxListEvent && rsrc_type != le_wxSpinEvent && rsrc_type != le_wxSplitterEvent && rsrc_type != le_wxSpinDoubleEvent && rsrc_type != le_wxGridSizeEvent && rsrc_type != le_wxWizardEvent && rsrc_type != le_wxGridEvent && rsrc_type != le_wxGridRangeSelectEvent && rsrc_type != le_wxDataViewEvent && rsrc_type != le_wxHeaderCtrlEvent && rsrc_type != le_wxRibbonBarEvent && rsrc_type != le_wxStyledTextEvent && rsrc_type != le_wxChildFocusEvent && rsrc_type != le_wxHtmlCellEvent && rsrc_type != le_wxHtmlLinkEvent && rsrc_type != le_wxHyperlinkEvent && rsrc_type != le_wxColourPickerEvent && rsrc_type != le_wxFontPickerEvent && rsrc_type != le_wxScrollEvent && rsrc_type != le_wxWindowModalDialogEvent && rsrc_type != le_wxDateEvent && rsrc_type != le_wxCalendarEvent && rsrc_type != le_wxWindowCreateEvent && rsrc_type != le_wxWindowDestroyEvent && rsrc_type != le_wxUpdateUIEvent && rsrc_type != le_wxHelpEvent && rsrc_type != le_wxGridEditorCreatedEvent && rsrc_type != le_wxCollapsiblePaneEvent && rsrc_type != le_wxClipboardTextEvent && rsrc_type != le_wxFileCtrlEvent && rsrc_type != le_wxSashEvent && rsrc_type != le_wxFileDirPickerEvent && rsrc_type != le_wxContextMenuEvent && rsrc_type != le_wxRibbonButtonBarEvent && rsrc_type != le_wxRibbonGalleryEvent && rsrc_type != le_wxCloseEvent && rsrc_type != le_wxActivateEvent && rsrc_type != le_wxAuiManagerEvent && rsrc_type != le_wxSizeEvent && rsrc_type != le_wxMouseEvent && rsrc_type != le_wxMoveEvent && rsrc_type != le_wxTimerEvent && rsrc_type != le_wxThreadEvent && rsrc_type != le_wxScrollWinEvent && rsrc_type != le_wxSysColourChangedEvent && rsrc_type != le_wxProcessEvent && rsrc_type != le_wxEraseEvent && rsrc_type != le_wxSetCursorEvent && rsrc_type != le_wxIdleEvent && rsrc_type != le_wxPaintEvent && rsrc_type != le_wxPaletteChangedEvent && rsrc_type != le_wxInitDialogEvent && rsrc_type != le_wxMaximizeEvent && rsrc_type != le_wxNavigationKeyEvent && rsrc_type != le_wxFocusEvent && rsrc_type != le_wxFileSystemWatcherEvent && rsrc_type != le_wxDisplayChangedEvent && rsrc_type != le_wxCalculateLayoutEvent && rsrc_type != le_wxQueryLayoutInfoEvent && rsrc_type != le_wxTaskBarIconEvent && rsrc_type != le_wxAcceleratorTable && rsrc_type != le_wxGDIObject && rsrc_type != le_wxBitmap && rsrc_type != le_wxPalette && rsrc_type != le_wxIcon && rsrc_type != le_wxFont && rsrc_type != le_wxAnimation && rsrc_type != le_wxIconBundle && rsrc_type != le_wxCursor && rsrc_type != le_wxRegion && rsrc_type != le_wxPen && rsrc_type != le_wxBrush && rsrc_type != le_wxArtProvider && rsrc_type != le_wxHtmlCell && rsrc_type != le_wxHtmlContainerCell && rsrc_type != le_wxHtmlColourCell && rsrc_type != le_wxHtmlWidgetCell && rsrc_type != le_wxHtmlEasyPrinting && rsrc_type != le_wxHtmlLinkInfo && rsrc_type != le_wxFindReplaceData && rsrc_type != le_wxSound && rsrc_type != le_wxFileSystem && rsrc_type != le_wxFileSystemHandler && rsrc_type != le_wxMask && rsrc_type != le_wxToolTip && rsrc_type != le_wxGraphicsRenderer && rsrc_type != le_wxLayoutConstraints && rsrc_type != le_wxFSFile && rsrc_type != le_wxColourData && rsrc_type != le_wxFontData && rsrc_type != le_wxGridTableBase && rsrc_type != le_wxDataViewRenderer && rsrc_type != le_wxDataViewBitmapRenderer && rsrc_type != le_wxDataViewChoiceRenderer && rsrc_type != le_wxDataViewCustomRenderer && rsrc_type != le_wxDataViewSpinRenderer && rsrc_type != le_wxDataViewDateRenderer && rsrc_type != le_wxDataViewIconTextRenderer && rsrc_type != le_wxDataViewProgressRenderer && rsrc_type != le_wxDataViewTextRenderer && rsrc_type != le_wxDataViewToggleRenderer && rsrc_type != le_wxDataViewIconText && rsrc_type != le_wxVariant && rsrc_type != le_wxClipboard && rsrc_type != le_wxConfigBase && rsrc_type != le_wxFileConfig && rsrc_type != le_wxXmlResource && rsrc_type != le_wxPageSetupDialogData && rsrc_type != le_wxPrintDialogData && rsrc_type != le_wxPrintData && rsrc_type != le_wxPrintPreview && rsrc_type != le_wxPrinter && rsrc_type != le_wxPrintout && rsrc_type != le_wxHtmlPrintout && rsrc_type != le_wxHtmlDCRenderer && rsrc_type != le_wxHtmlFilter && rsrc_type != le_wxHtmlHelpData && rsrc_type != le_wxHtmlTagHandler && rsrc_type != le_wxHtmlWinTagHandler && rsrc_type != le_wxModule && rsrc_type != le_wxHtmlTagsModule && rsrc_type != le_wxImageHandler && rsrc_type != le_wxXmlResourceHandler && rsrc_type != le_wxXmlDocument && rsrc_type != le_wxLayoutAlgorithm && rsrc_type != le_wxFileHistory && rsrc_type != le_wxToolBarToolBase)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(client_data1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return3; value_to_return3 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8)); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8), (wxRibbonButtonKind) kind0) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return4; value_to_return4 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id0, *(wxBitmap*) object_pointer0_1, wxString(help_string0, wxConvUTF8), (wxRibbonButtonKind) kind0); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap0); return; break; } } } if(overload1_called) { switch(arguments_received) { case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return2; value_to_return2 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1); if(value_to_return2 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return2->references.IsUserInitialized()){ if(value_to_return2->phpObj != NULL){ *return_value = *value_to_return2->phpObj; zval_add_ref(&value_to_return2->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return2, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return2 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return3; value_to_return3 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2); if(value_to_return3 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return3->references.IsUserInitialized()){ if(value_to_return3->phpObj != NULL){ *return_value = *value_to_return3->phpObj; zval_add_ref(&value_to_return3->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return3, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return3 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_disabled1); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8)) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return4; value_to_return4 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8)); if(value_to_return4 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return4->references.IsUserInitialized()){ if(value_to_return4->phpObj != NULL){ *return_value = *value_to_return4->phpObj; zval_add_ref(&value_to_return4->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return4, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return4 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_disabled1); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8), (wxRibbonButtonKind) kind1) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return5; value_to_return5 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8), (wxRibbonButtonKind) kind1); if(value_to_return5 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return5->references.IsUserInitialized()){ if(value_to_return5->phpObj != NULL){ *return_value = *value_to_return5->phpObj; zval_add_ref(&value_to_return5->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return5, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return5 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_disabled1); return; break; } case 6: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8), (wxRibbonButtonKind) kind1, (wxObject*) object_pointer1_5) to return object pointer\n\n"); #endif wxRibbonToolBarToolBase_php* value_to_return6; value_to_return6 = (wxRibbonToolBarToolBase_php*) ((wxRibbonToolBar_php*)_this)->AddTool((int) tool_id1, *(wxBitmap*) object_pointer1_1, *(wxBitmap*) object_pointer1_2, wxString(help_string1, wxConvUTF8), (wxRibbonButtonKind) kind1, (wxObject*) object_pointer1_5); if(value_to_return6 == NULL){ ZVAL_NULL(return_value); } else if(value_to_return6->references.IsUserInitialized()){ if(value_to_return6->phpObj != NULL){ *return_value = *value_to_return6->phpObj; zval_add_ref(&value_to_return6->phpObj); return_is_user_initialized = true; } else{ zend_error(E_ERROR, "Could not retreive original zval."); } } else{ object_init_ex(return_value,php_wxRibbonToolBarToolBase_entry); add_property_resource(return_value, "wxResource", zend_list_insert(value_to_return6, le_wxRibbonToolBarToolBase)); } if(Z_TYPE_P(return_value) != IS_NULL && value_to_return6 != _this && return_is_user_initialized){ references->AddReference(return_value); } references->AddReference(bitmap1); references->AddReference(bitmap_disabled1); references->AddReference(client_data1); return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, Create) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::Create\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::Create\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 zval* parent0 = 0; void* object_pointer0_0 = 0; long id0; zval* pos0 = 0; void* object_pointer0_2 = 0; zval* size0 = 0; void* object_pointer0_3 = 0; long style0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent0, &id0, &pos0, php_wxPoint_entry, &size0, php_wxSize_entry, &style0 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size0) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size0), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer0_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer0_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size0) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonToolBar::Create((wxWindow*) object_pointer0_0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonToolBar_php*)_this)->Create((wxWindow*) object_pointer0_0)); references->AddReference(parent0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonToolBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonToolBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0)); references->AddReference(parent0); return; break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonToolBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonToolBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2)); references->AddReference(parent0); references->AddReference(pos0); return; break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonToolBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonToolBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing RETURN_BOOL(wxRibbonToolBar::Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0))\n\n"); #endif ZVAL_BOOL(return_value, ((wxRibbonToolBar_php*)_this)->Create((wxWindow*) object_pointer0_0, (wxWindowID) id0, *(wxPoint*) object_pointer0_2, *(wxSize*) object_pointer0_3, (long) style0)); references->AddReference(parent0); references->AddReference(pos0); references->AddReference(size0); return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, SetRows) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::SetRows\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int parent_rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; wxPHPObjectReferences* references; bool return_is_user_initialized = false; //Get pointer of object that called this method if not a static method if (getThis() != NULL) { if(zend_hash_find(Z_OBJPROP_P(getThis()), _wxResource, sizeof(_wxResource), (void **)&tmp) == FAILURE) { zend_error(E_ERROR, "Failed to get the parent object that called wxRibbonToolBar::SetRows\n"); return; } else { id_to_find = Z_RESVAL_P(*tmp); _this = zend_list_find(id_to_find, &parent_rsrc_type); bool reference_type_found = false; if(parent_rsrc_type == le_wxRibbonToolBar){ references = &((wxRibbonToolBar_php*)_this)->references; reference_type_found = true; } } } else { #ifdef USE_WXPHP_DEBUG php_printf("Processing the method call as static\n"); #endif } //Parameters for overload 0 long nMin0; long nMax0; bool overload0_called = false; //Overload 0 overload0: if(!already_called && arguments_received >= 1 && arguments_received <= 2) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'l|l' (&nMin0, &nMax0)\n"); #endif char parse_parameters_string[] = "l|l"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &nMin0, &nMax0 ) == SUCCESS) { overload0_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::SetRows((int) nMin0)\n\n"); #endif ((wxRibbonToolBar_php*)_this)->SetRows((int) nMin0); return; break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing wxRibbonToolBar::SetRows((int) nMin0, (int) nMax0)\n\n"); #endif ((wxRibbonToolBar_php*)_this)->SetRows((int) nMin0, (int) nMax0); return; break; } } } } PHP_METHOD(php_wxRibbonToolBar, __construct) { #ifdef USE_WXPHP_DEBUG php_printf("Invoking wxRibbonToolBar::__construct\n"); php_printf("===========================================\n"); #endif //In case the constructor uses objects zval **tmp; int rsrc_type; int id_to_find; char _wxResource[] = "wxResource"; //Other variables used thru the code int arguments_received = ZEND_NUM_ARGS(); void *_this; zval* dummy; bool already_called = false; //Parameters for overload 0 bool overload0_called = false; //Parameters for overload 1 zval* parent1 = 0; void* object_pointer1_0 = 0; long id1; zval* pos1 = 0; void* object_pointer1_2 = 0; zval* size1 = 0; void* object_pointer1_3 = 0; long style1; bool overload1_called = false; //Overload 0 overload0: if(!already_called && arguments_received == 0) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with '' ()\n"); #endif overload0_called = true; already_called = true; } //Overload 1 overload1: if(!already_called && arguments_received >= 1 && arguments_received <= 5) { #ifdef USE_WXPHP_DEBUG php_printf("Parameters received %d\n", arguments_received); php_printf("Parsing parameters with 'z|lOOl' (&parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1)\n"); #endif char parse_parameters_string[] = "z|lOOl"; if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, arguments_received TSRMLS_CC, parse_parameters_string, &parent1, &id1, &pos1, php_wxPoint_entry, &size1, php_wxSize_entry, &style1 ) == SUCCESS) { if(arguments_received >= 1){ if(Z_TYPE_P(parent1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(parent1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_0 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_0 || (rsrc_type != le_wxNonOwnedWindow && rsrc_type != le_wxTopLevelWindow && rsrc_type != le_wxFrame && rsrc_type != le_wxSplashScreen && rsrc_type != le_wxMDIChildFrame && rsrc_type != le_wxMDIParentFrame && rsrc_type != le_wxMiniFrame && rsrc_type != le_wxPreviewFrame && rsrc_type != le_wxHtmlHelpDialog && rsrc_type != le_wxHtmlHelpFrame && rsrc_type != le_wxDialog && rsrc_type != le_wxTextEntryDialog && rsrc_type != le_wxPasswordEntryDialog && rsrc_type != le_wxMessageDialog && rsrc_type != le_wxFindReplaceDialog && rsrc_type != le_wxDirDialog && rsrc_type != le_wxSymbolPickerDialog && rsrc_type != le_wxPropertySheetDialog && rsrc_type != le_wxWizard && rsrc_type != le_wxProgressDialog && rsrc_type != le_wxColourDialog && rsrc_type != le_wxFileDialog && rsrc_type != le_wxFontDialog && rsrc_type != le_wxPageSetupDialog && rsrc_type != le_wxPrintDialog && rsrc_type != le_wxSingleChoiceDialog && rsrc_type != le_wxGenericProgressDialog && rsrc_type != le_wxPopupWindow && rsrc_type != le_wxPopupTransientWindow && rsrc_type != le_wxControl && rsrc_type != le_wxStatusBar && rsrc_type != le_wxAnyButton && rsrc_type != le_wxButton && rsrc_type != le_wxBitmapButton && rsrc_type != le_wxToggleButton && rsrc_type != le_wxBitmapToggleButton && rsrc_type != le_wxTreeCtrl && rsrc_type != le_wxControlWithItems && rsrc_type != le_wxListBox && rsrc_type != le_wxCheckListBox && rsrc_type != le_wxRearrangeList && rsrc_type != le_wxChoice && rsrc_type != le_wxBookCtrlBase && rsrc_type != le_wxAuiNotebook && rsrc_type != le_wxListbook && rsrc_type != le_wxChoicebook && rsrc_type != le_wxNotebook && rsrc_type != le_wxTreebook && rsrc_type != le_wxToolbook && rsrc_type != le_wxAnimationCtrl && rsrc_type != le_wxStyledTextCtrl && rsrc_type != le_wxScrollBar && rsrc_type != le_wxStaticText && rsrc_type != le_wxStaticLine && rsrc_type != le_wxStaticBox && rsrc_type != le_wxStaticBitmap && rsrc_type != le_wxCheckBox && rsrc_type != le_wxTextCtrl && rsrc_type != le_wxSearchCtrl && rsrc_type != le_wxComboBox && rsrc_type != le_wxBitmapComboBox && rsrc_type != le_wxAuiToolBar && rsrc_type != le_wxListCtrl && rsrc_type != le_wxListView && rsrc_type != le_wxRadioBox && rsrc_type != le_wxRadioButton && rsrc_type != le_wxSlider && rsrc_type != le_wxSpinCtrl && rsrc_type != le_wxSpinButton && rsrc_type != le_wxGauge && rsrc_type != le_wxHyperlinkCtrl && rsrc_type != le_wxSpinCtrlDouble && rsrc_type != le_wxGenericDirCtrl && rsrc_type != le_wxCalendarCtrl && rsrc_type != le_wxPickerBase && rsrc_type != le_wxColourPickerCtrl && rsrc_type != le_wxFontPickerCtrl && rsrc_type != le_wxFilePickerCtrl && rsrc_type != le_wxDirPickerCtrl && rsrc_type != le_wxTimePickerCtrl && rsrc_type != le_wxToolBar && rsrc_type != le_wxDatePickerCtrl && rsrc_type != le_wxCollapsiblePane && rsrc_type != le_wxComboCtrl && rsrc_type != le_wxDataViewCtrl && rsrc_type != le_wxDataViewListCtrl && rsrc_type != le_wxDataViewTreeCtrl && rsrc_type != le_wxHeaderCtrl && rsrc_type != le_wxHeaderCtrlSimple && rsrc_type != le_wxFileCtrl && rsrc_type != le_wxInfoBar && rsrc_type != le_wxRibbonControl && rsrc_type != le_wxRibbonBar && rsrc_type != le_wxRibbonButtonBar && rsrc_type != le_wxRibbonGallery && rsrc_type != le_wxRibbonPage && rsrc_type != le_wxRibbonPanel && rsrc_type != le_wxRibbonToolBar && rsrc_type != le_wxSplitterWindow && rsrc_type != le_wxPanel && rsrc_type != le_wxScrolledWindow && rsrc_type != le_wxHtmlWindow && rsrc_type != le_wxGrid && rsrc_type != le_wxPreviewCanvas && rsrc_type != le_wxWizardPage && rsrc_type != le_wxWizardPageSimple && rsrc_type != le_wxEditableListBox && rsrc_type != le_wxHScrolledWindow && rsrc_type != le_wxPreviewControlBar && rsrc_type != le_wxMenuBar && rsrc_type != le_wxBannerWindow && rsrc_type != le_wxMDIClientWindow && rsrc_type != le_wxTreeListCtrl && rsrc_type != le_wxSashWindow && rsrc_type != le_wxSashLayoutWindow && rsrc_type != le_wxHtmlHelpWindow)) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(parent1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 3){ if(Z_TYPE_P(pos1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(pos1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_2 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_2 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(pos1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } if(arguments_received >= 4){ if(Z_TYPE_P(size1) == IS_OBJECT && zend_hash_find(Z_OBJPROP_P(size1), _wxResource , sizeof(_wxResource), (void **)&tmp) == SUCCESS) { id_to_find = Z_RESVAL_P(*tmp); object_pointer1_3 = zend_list_find(id_to_find, &rsrc_type); if (!object_pointer1_3 ) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } else if(Z_TYPE_P(size1) != IS_NULL) { zend_error(E_ERROR, "Parameter could not be retreived correctly."); } } overload1_called = true; already_called = true; } } if(overload0_called) { switch(arguments_received) { case 0: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct()\n"); #endif _this = new wxRibbonToolBar_php(); ((wxRibbonToolBar_php*) _this)->references.Initialize(); break; } } } if(overload1_called) { switch(arguments_received) { case 1: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0)\n"); #endif _this = new wxRibbonToolBar_php((wxWindow*) object_pointer1_0); ((wxRibbonToolBar_php*) _this)->references.Initialize(); ((wxRibbonToolBar_php*) _this)->references.AddReference(parent1); break; } case 2: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1)\n"); #endif _this = new wxRibbonToolBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1); ((wxRibbonToolBar_php*) _this)->references.Initialize(); ((wxRibbonToolBar_php*) _this)->references.AddReference(parent1); break; } case 3: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2)\n"); #endif _this = new wxRibbonToolBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2); ((wxRibbonToolBar_php*) _this)->references.Initialize(); ((wxRibbonToolBar_php*) _this)->references.AddReference(parent1); ((wxRibbonToolBar_php*) _this)->references.AddReference(pos1); break; } case 4: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3)\n"); #endif _this = new wxRibbonToolBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3); ((wxRibbonToolBar_php*) _this)->references.Initialize(); ((wxRibbonToolBar_php*) _this)->references.AddReference(parent1); ((wxRibbonToolBar_php*) _this)->references.AddReference(pos1); ((wxRibbonToolBar_php*) _this)->references.AddReference(size1); break; } case 5: { #ifdef USE_WXPHP_DEBUG php_printf("Executing __construct((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1)\n"); #endif _this = new wxRibbonToolBar_php((wxWindow*) object_pointer1_0, (wxWindowID) id1, *(wxPoint*) object_pointer1_2, *(wxSize*) object_pointer1_3, (long) style1); ((wxRibbonToolBar_php*) _this)->references.Initialize(); ((wxRibbonToolBar_php*) _this)->references.AddReference(parent1); ((wxRibbonToolBar_php*) _this)->references.AddReference(pos1); ((wxRibbonToolBar_php*) _this)->references.AddReference(size1); break; } } } if(already_called) { long id_to_find = zend_list_insert(_this, le_wxRibbonToolBar); add_property_resource(getThis(), _wxResource, id_to_find); MAKE_STD_ZVAL(((wxRibbonToolBar_php*) _this)->evnArray); array_init(((wxRibbonToolBar_php*) _this)->evnArray); ((wxRibbonToolBar_php*) _this)->phpObj = getThis(); ((wxRibbonToolBar_php*) _this)->InitProperties(); #ifdef ZTS ((wxRibbonToolBar_php*) _this)->TSRMLS_C = TSRMLS_C; #endif } else { zend_error(E_ERROR, "Abstract type: failed to call a proper constructor"); } #ifdef USE_WXPHP_DEBUG php_printf("===========================================\n\n"); #endif }
32.953939
10,035
0.710565
lordgnu
c729287ec2820448277920d026269c719f0df736
6,508
cpp
C++
bithorded/router/router.cpp
zidz/bithorde
dbaa67eb0ddfa7d28e5325d87428c1b0225d598b
[ "Apache-2.0" ]
null
null
null
bithorded/router/router.cpp
zidz/bithorde
dbaa67eb0ddfa7d28e5325d87428c1b0225d598b
[ "Apache-2.0" ]
null
null
null
bithorded/router/router.cpp
zidz/bithorde
dbaa67eb0ddfa7d28e5325d87428c1b0225d598b
[ "Apache-2.0" ]
null
null
null
/* Copyright 2012 <copyright holder> <email> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "router.hpp" #include <boost/asio/deadline_timer.hpp> #include <boost/asio/placeholders.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/lexical_cast.hpp> #include <boost/make_shared.hpp> #include <unordered_set> #include <log4cplus/logger.h> #include <log4cplus/loggingmacros.h> #include "../server/server.hpp" namespace asio = boost::asio; namespace ptime = boost::posix_time; using namespace bithorded; using namespace bithorded::router; using namespace std; const ptime::seconds RECONNECT_INTERVAL(5); namespace bithorded { namespace router { log4cplus::Logger routerLog = log4cplus::Logger::getInstance("router"); } } class bithorded::router::FriendConnector : public boost::enable_shared_from_this<bithorded::router::FriendConnector> { Server& _server; Config::Friend _f; boost::shared_ptr<boost::asio::ip::tcp::socket> _socket; boost::asio::ip::tcp::resolver _resolver; boost::asio::deadline_timer _timer; boost::asio::ip::tcp::resolver::query _q; bool _cancelled; public: FriendConnector(Server& server, const bithorded::Config::Friend& cfg) : _server(server), _f(cfg), _socket(boost::make_shared<boost::asio::ip::tcp::socket>(server.ioService())), _resolver(server.ioService()), _timer(server.ioService()), _q(cfg.addr, boost::lexical_cast<string>(cfg.port)), _cancelled(false) { } static boost::shared_ptr<FriendConnector> create(Server& server, const bithorded::Config::Friend& cfg) { auto res = boost::make_shared<FriendConnector>(server, cfg); res->start(); return res; } void cancel() { _cancelled = true; } private: void scheduleRestart(ptime::time_duration delay=RECONNECT_INTERVAL) { _timer.expires_from_now(delay); _timer.async_wait(boost::bind(&FriendConnector::start, shared_from_this())); } void start() { if (!_cancelled) _resolver.async_resolve(_q, boost::bind(&FriendConnector::hostResolved, shared_from_this(), asio::placeholders::error, asio::placeholders::iterator)); } void hostResolved(const boost::system::error_code& error, boost::asio::ip::tcp::resolver::iterator iterator) { if (error) { scheduleRestart(); } else if (!_cancelled) { _socket->async_connect(iterator->endpoint(), boost::bind(&FriendConnector::connectionDone, shared_from_this(), asio::placeholders::error)); } } void connectionDone(const boost::system::error_code& error) { if (error) { scheduleRestart(); } else if (!_cancelled) { _server.hookup(_socket, _f); scheduleRestart(RECONNECT_INTERVAL * 2); } } }; bithorded::router::Router::Router(Server& server) : _server(server) { } void bithorded::router::Router::addFriend(const bithorded::Config::Friend& f) { _friends[f.name] = f; if (f.port && !_connectors.count(f.name)) _connectors[f.name] = FriendConnector::create(_server, f); } size_t Router::friends() const { return _friends.size(); } size_t Router::upstreams() const { return _connectedFriends.size(); } const map< string, Client::Ptr >& Router::connectedFriends() const { return _connectedFriends; } void Router::onConnected(const bithorded::Client::Ptr& client ) { string peerName = client->peerName(); if (_friends.count(peerName)) { LOG4CPLUS_INFO(routerLog, "Friend " << peerName << " connected"); if (_connectors[peerName].get()) _connectors[peerName]->cancel(); _connectors.erase(peerName); _connectedFriends[peerName] = client; for (auto iter=_openAssets.begin(); iter != _openAssets.end(); iter++) { if (auto forwardedAsset = iter->lock()) { forwardedAsset->addUpstream(client); } } } } void Router::onDisconnected(const bithorded::Client::Ptr& client) { string peerName = client->peerName(); auto iter = _connectedFriends.find(peerName); if ((iter != _connectedFriends.end()) && (iter->second == client)) _connectedFriends.erase(iter); if (_friends.count(peerName) && _friends[peerName].port && !_connectors.count(peerName)) _connectors[peerName] = FriendConnector::create(_server, _friends[peerName]); } UpstreamRequestBinding::Ptr Router::findAsset( const bithorde::BindRead& req ) { // TODO; make sure returned asset isn't stale return AssetSessions::findAsset(req); } void Router::inspect(management::InfoList& target) const { for (auto iter=_friends.begin(); iter!=_friends.end(); iter++) { auto name = iter->first; auto connectedIter = _connectedFriends.find(iter->first); if (connectedIter != _connectedFriends.end()) { target.append(name, *connectedIter->second); } else { target.append(name) << iter->second.addr << ':' << iter->second.port; } } } void Router::describe(management::Info& target) const { target << upstreams() << " upstreams (" << friends() << " configured)"; } bithorded::IAsset::Ptr bithorded::router::Router::openAsset(const bithorde::BindRead& req) { auto now = ptime::microsec_clock::universal_time(); if (_isBlacklisted(now, req.requesters())) throw bithorded::BindError(bithorde::WOULD_LOOP); auto asset = boost::make_shared<ForwardedAsset, Router&, const BitHordeIds&>(*this, req.ids()); _openAssets.insert(asset); ptime::ptime deadline; if (req.has_timeout()) { deadline = now + ptime::milliseconds(req.timeout()*2); } else { deadline = now + ptime::seconds(30); } _addToBlacklist(deadline, asset->sessionId()); return asset; } void Router::_addToBlacklist(const ptime::ptime& deadline, uint64_t uid) { _blacklist.insert(uid); _blacklistQueue.push(pair<ptime::ptime, uint64_t>(deadline, uid)); } bool Router::_isBlacklisted(const ptime::ptime& now, const google::protobuf::RepeatedField <google::protobuf::uint64 >& uids) { while (_blacklistQueue.size() && _blacklistQueue.front().first <= now) { _blacklist.erase(_blacklistQueue.front().second); _blacklistQueue.pop(); } for (auto iter=uids.begin(); iter != uids.end(); iter++) { if (_blacklist.count(*iter)) { return true; } } return false; }
29.315315
153
0.720652
zidz
c72f9e2e9f4699cc9f0285e149da90723ddd30e5
12,932
cpp
C++
graphfilter/src/datafilter.cpp
intel/tsdv
02409a1c23fd3c5c652c2d02a96ee190c12d5919
[ "Apache-2.0" ]
6
2016-04-20T23:23:42.000Z
2018-03-06T02:47:40.000Z
graphfilter/src/datafilter.cpp
intel/tsdv
02409a1c23fd3c5c652c2d02a96ee190c12d5919
[ "Apache-2.0" ]
null
null
null
graphfilter/src/datafilter.cpp
intel/tsdv
02409a1c23fd3c5c652c2d02a96ee190c12d5919
[ "Apache-2.0" ]
2
2019-11-02T04:55:28.000Z
2021-02-20T10:59:48.000Z
/* * Copyright (c) 2015, Intel Corporation. * * This program is licensed under the terms and conditions of the * Apache License, version 2.0. The full text of the Apache License is at * http://www.apache.org/licenses/LICENSE-2.0 * */ #ifdef ANDROID #define LOG_TAG "DataFilter" #include <android/log.h> #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) #else #define LOGI(...) printf(__VA_ARGS__) #define LOGD(...) printf(__VA_ARGS__) #define LOGE(...) printf(__VA_ARGS__) #endif #include <graphfilter/datafilter.h> #include <vector> #include <stdexcept> #include <cmath> namespace intel { namespace poc { std::string DataFilter::date_key_ = ""; bool DataFilter::initialized_ = false; DataFilter::FilterType DataFilter::getType(std::string filter_string){ if(filter_string == "POINTS"){ return FilterType::POINTS; } else if(filter_string == "TIME_WEIGHTED_POINTS"){ return FilterType::TIME_WEIGHTED_POINTS; } else if(filter_string == "TIME_WEIGHTED_TIME"){ return FilterType::TIME_WEIGHTED_TIME; } else { throw std::runtime_error(std::string("Invalid data downsampling filter: ") + filter_string); } } bool DataFilter::init(const std::string& date_key){ initialized_ = false; if(date_key.empty()){ LOGE("Invalid date_key: %s.\n", date_key.c_str()); return false; } else { date_key_ = date_key; initialized_ = true; } return initialized_; } Json::Value DataFilter::applyFilter(const Json::Value& data, const std::map<std::string, std::string>& data_schema, int num_of_points, FilterType filter){ if(!initialized_){ LOGE("DataFilter not initialized.\n"); throw std::runtime_error("DataFilter not initialized."); } /*LOGD("Schema:\n"); for(std::map<std::string,std::string>::const_iterator it = data_schema.begin(); it != data_schema.end(); ++it){ LOGD("%s : %s\n", it->first.c_str(),it->second.c_str()); }*/ if(!data.isMember("points") || !data["points"].isArray()){ throw std::runtime_error("Json data missing or malformed \"points\" element."); } int point_size = data["points"].size(); LOGD("Requesting %d points downsampled to %d points\n", point_size, num_of_points); if (point_size == 0 || point_size <= num_of_points) { LOGD("No downsampling required.\n"); return data; } // construct new json response Json::Value downsampled_results; downsampled_results["startDate"] = data.get("startDate", "").asString(); downsampled_results["endDate"] = data.get("endDate", "").asString(); downsampled_results["points"] = Json::Value(Json::arrayValue); switch(filter){ case FilterType::POINTS: LOGD("Using points-based downsampling filter\n"); applyFilterPoints(data, downsampled_results["points"], 0, data["points"].size(), data_schema, num_of_points); break; case FilterType::TIME_WEIGHTED_POINTS: LOGD("Using time-weighted-points-based downsampling filter\n"); applyFilterTimeWeighted(data, downsampled_results["points"],0, data["points"].size(), data_schema, num_of_points, FilterType::TIME_WEIGHTED_POINTS); break; case FilterType::TIME_WEIGHTED_TIME: LOGD("Using time-weighted-time-based downsampling filter\n"); applyFilterTimeWeighted(data, downsampled_results["points"],0, data["points"].size(), data_schema, num_of_points, FilterType::TIME_WEIGHTED_TIME); break; default: LOGD("Invalid/uninitialized FilterType value passed: %d", filter); throw std::runtime_error("Invalid/uninitialized FilterType value passed: " + static_cast<int>(filter)); break; } LOGD("Final downsampled points count: %d\n", downsampled_results["points"].size()); return downsampled_results; } void DataFilter::applyFilterPoints(const Json::Value& data, Json::Value& out_points, int start_i, int end_i, const std::map<std::string, std::string>& data_schema, int num_of_points){ if(num_of_points == 0){ return; } const Json::Value& points = data["points"]; //LOGD("Averaging points %d through %d\n", start_i, end_i); //LOGD("out_points already has %d points\n", out_points.size()); int num_fields = points[start_i].size(); double avg_data_per_point = static_cast<double>(end_i - start_i) / static_cast<double>(num_of_points); //LOGD("avg_data_per_point = %f\n",avg_data_per_point); double averages[num_fields]; int prev_point_index = start_i - 1; for (int i = 0; i < num_fields; i++) { averages[i] = 0; } // loop through every element in the points array for (int point_index = start_i; point_index < end_i; point_index++) { Json::Value element = points[point_index]; //LOGD("Point %d: %s\n",point_index, element.toStyledString().c_str()); int mapping_index = 0; std::vector<std::string> data_names = element.getMemberNames(); for(std::vector<std::string>::const_iterator i = data_names.begin(); i != data_names.end(); ++i) { std::string element_name = *i; //LOGD("element_name: %s\n", element_name.c_str()); std::string element_type = data_schema.find(*i)->second; //LOGD("element_type: %s\n", element_type.c_str()); // only average numeric number, not strings values like date time if (element_type == "INT" || element_type == "REAL") { try { //LOGD("%s average = %f + %f = ",element_name.c_str(), averages[mapping_index], element[element_name].asDouble()); averages[mapping_index] += element[element_name].asDouble(); //LOGD("%f\n",averages[mapping_index]); } catch (...) { averages[mapping_index] += 0; } } mapping_index++; } //if (downsampled_points.size() == num_of_points - 1 && point_index != end_i - 1) { // continue; //} if ((point_index > 0 && fmod((point_index + 1 - start_i), ceil(avg_data_per_point)) == 0) || (point_index == end_i - 1)) { Json::Value new_element; int range = point_index - prev_point_index; // loop through all value pair and calculate averages mapping_index = 0; std::vector<std::string> data_names = element.getMemberNames(); for(std::vector<std::string>::const_iterator i = data_names.begin(); i != data_names.end(); ++i) { std::string element_name = *i; std::string element_type = data_schema.find(*i)->second; //LOGD("element_name: %s, element_type: %s, value = %f / %d", element_name.c_str(), element_type.c_str(), averages[mapping_index], range); averages[mapping_index] /= range; //LOGD(" = %f\n", averages[mapping_index]); if (element_type == "INT") { new_element[element_name] = static_cast<int>(averages[mapping_index]); } else if (element_type == "REAL") { new_element[element_name] = averages[mapping_index]; } else { new_element[element_name] = element.get(element_name, "").asString(); } averages[mapping_index] = 0; mapping_index++; } prev_point_index = point_index; out_points.append(new_element); } } } long timeStringToEpochSeconds(const std::string& time_string){ struct tm tm = {}; // 2015-03-03 00:00Z // TODO: Expand this to check for and allow other common date formats if (strptime(time_string.c_str(), "%Y-%m-%d %H:%MZ", &tm) == NULL){ LOGE("Error converting time_string to time struct: %s\n", time_string.c_str()); return -1; } return static_cast<long>(mktime(&tm)); } void DataFilter::applyFilterTimeWeighted(const Json::Value& data, Json::Value& out_points, int start_i, int end_i, const std::map<std::string, std::string>& data_schema, int num_of_points, DataFilter::FilterType filter_type){ const Json::Value& points = data["points"]; if(num_of_points == 0){ return; } else if(num_of_points <= AVG_POINTS_PER_BUCKET_){ applyFilterPoints(data, out_points, start_i, end_i, data_schema, num_of_points); } else { long start_time = timeStringToEpochSeconds(points[start_i].get(date_key_,"").asString()); long end_time = timeStringToEpochSeconds(points[end_i - 1].get(date_key_,"").asString()); long bucket_duration = static_cast<double>(end_time - start_time) / (static_cast<double>(num_of_points) / AVG_POINTS_PER_BUCKET_); long bucket_start = start_time; long bucket_end = start_time + bucket_duration; int bucket_size = 0; for(int i = start_i; i < end_i; ++i){ //LOGD("bucket_start = %ld, bucket_end = %ld\n",bucket_start, bucket_end); //LOGD("point.date = %ld\n",timeStringToEpochSeconds(points[i].get(date_key_,"").asString())); if(timeStringToEpochSeconds(points[i].get(date_key_,"").asString()) >= bucket_start && timeStringToEpochSeconds(points[i].get(date_key_,"").asString()) <= bucket_end){ bucket_size++; } else { int scaled_num_of_points = static_cast<int>(static_cast<double>(bucket_size) / static_cast<double>(end_i - start_i) * num_of_points); //LOGD("scaled points = %d / %d * %d = %d\n", bucket_size, (end_i - start_i), num_of_points, scaled_num_of_points); //LOGD("Downsample %d points to %d scaled points.\n", bucket_size, scaled_num_of_points); if(scaled_num_of_points > 0){ switch(filter_type){ case FilterType::TIME_WEIGHTED_POINTS: applyFilterPoints(data, out_points, i - bucket_size, i, data_schema, scaled_num_of_points); break; case FilterType::TIME_WEIGHTED_TIME: applyFilterTimeWeighted(data, out_points, i - bucket_size, i, data_schema, scaled_num_of_points, FilterType::TIME_WEIGHTED_TIME); break; } } //LOGD("Update current bucket\n"); bucket_size = 1; bucket_start += bucket_duration; bucket_end += bucket_duration; } } //LOGD("Final bucket_size = %d\n", bucket_size); int scaled_num_of_points = static_cast<int>(static_cast<double>(bucket_size) / static_cast<double>(end_i - start_i) * num_of_points); //LOGD("Downsample %d points to %d scaled points.\n", bucket_size, scaled_num_of_points); switch(filter_type){ case FilterType::TIME_WEIGHTED_POINTS: applyFilterPoints(data, out_points, end_i - bucket_size, end_i, data_schema, scaled_num_of_points); break; case FilterType::TIME_WEIGHTED_TIME: applyFilterTimeWeighted(data, out_points, end_i - bucket_size, end_i, data_schema, scaled_num_of_points, FilterType::TIME_WEIGHTED_TIME); break; } } } }}
45.858156
164
0.558073
intel
c73245a8a063aeeda4865f0d2fc5a49a0ea5f122
1,859
cc
C++
src/fifo.cc
fabiocody/AOS_Project
5f95c3748a09361bf75882e1d722592ab17d93aa
[ "Unlicense" ]
null
null
null
src/fifo.cc
fabiocody/AOS_Project
5f95c3748a09361bf75882e1d722592ab17d93aa
[ "Unlicense" ]
null
null
null
src/fifo.cc
fabiocody/AOS_Project
5f95c3748a09361bf75882e1d722592ab17d93aa
[ "Unlicense" ]
null
null
null
// fifo.cc #include "fifo.h" Fifo::Fifo(const char *filename): buffer_size(CHUNK_SIZE) { fifoname = strdup(filename); mkfifo(filename, S_IRUSR | S_IWUSR); fd = open(filename, O_RDWR); if (fd == 0) { perror("Cannot open FIFO"); unlink(filename); exit(1); } buffer = malloc(buffer_size); if (buffer == nullptr) buffer_allocation_error(); dout << "Created FIFO " << fifoname << std::endl; } Fifo::Fifo(const std::string & fifoname): Fifo(fifoname.c_str()) {} Fifo::~Fifo() { dout << "Releasing FIFO " << fifoname << std::endl; close(fd); unlink(fifoname); free(fifoname); free(buffer); } void Fifo::buffer_allocation_error() { perror("Cannot allocate buffer"); close(fd); unlink(fifoname); exit(1); } ssize_t Fifo::send_msg(const rpc_msg & msg) { size_t msg_size = msg.ByteSizeLong(); if (msg_size > buffer_size) { buffer_size = msg_size + CHUNK_SIZE; buffer = realloc(buffer, buffer_size); if (buffer == nullptr) buffer_allocation_error(); } write(fd, &msg_size, sizeof(size_t)); msg.SerializeToArray(buffer, (int)msg_size); ssize_t written_bytes = write(fd, buffer, msg_size); dout << written_bytes << " bytes sent" << std::endl; dout << msg.DebugString() << std::endl; return written_bytes; } ssize_t Fifo::send_msg(std::shared_ptr<rpc_msg> msg) { return send_msg(*msg); } std::shared_ptr<rpc_msg> Fifo::recv_msg() { size_t msg_size; read(fd, &msg_size, sizeof(size_t)); ssize_t read_bytes = read(fd, buffer, msg_size); std::shared_ptr<rpc_msg> msg = std::make_shared<rpc_msg>(); msg->ParseFromArray(buffer, (int)msg_size); dout << read_bytes << " bytes read" << std::endl; dout << msg->DebugString() << std::endl; return msg; }
25.121622
67
0.620764
fabiocody
c734444850ca0b3531b782fabf1f063300503178
477
cpp
C++
_site/Competitive Programming/UVa/UVa10943.cpp
anujkyadav07/anuj-k-yadav.github.io
ac5cccc8cdada000ba559538cd84921437b3c5e6
[ "MIT" ]
1
2019-06-10T04:39:49.000Z
2019-06-10T04:39:49.000Z
_site/Competitive Programming/UVa/UVa10943.cpp
anujkyadav07/anuj-k-yadav.github.io
ac5cccc8cdada000ba559538cd84921437b3c5e6
[ "MIT" ]
2
2021-09-27T23:34:07.000Z
2022-02-26T05:54:27.000Z
_site/Competitive Programming/UVa/UVa10943.cpp
anujkyadav07/anuj-k-yadav.github.io
ac5cccc8cdada000ba559538cd84921437b3c5e6
[ "MIT" ]
3
2019-06-23T14:15:08.000Z
2019-07-09T20:40:58.000Z
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll N, K; ll dp[105][105]; ll cal(ll sum, ll len){ if(sum == N && len == K){ return 1; } else if(sum > N){ return 0; } if(len > K){ return 0; } if(dp[sum][len] != -1){ return dp[sum][len]; } ll ans = 0; for(ll i = sum; i <= N; i++){ ans += cal(sum+i,len+1); } return dp[sum][len] = ans; } int main(){ while(cin>>N>>K && N+K){ memset(dp, -1, sizeof dp); cout<<cal(0,0)<<"\n"; } }
14.029412
30
0.515723
anujkyadav07
c7393cbc0f655951a5d5dc6573f7d2cd915b2bee
8,955
cpp
C++
jni/love/src/modules/keyboard/sdl/Keyboard.cpp
ultimateprogramer/love2d-admob-android
5f6fa8c2b5cb7743c2df4c2c04ea91540a2b0a13
[ "Xnet", "X11" ]
1
2021-02-26T02:29:31.000Z
2021-02-26T02:29:31.000Z
jni/love/src/modules/keyboard/sdl/Keyboard.cpp
ultimateprogramer/love2d-admob-android
5f6fa8c2b5cb7743c2df4c2c04ea91540a2b0a13
[ "Xnet", "X11" ]
null
null
null
jni/love/src/modules/keyboard/sdl/Keyboard.cpp
ultimateprogramer/love2d-admob-android
5f6fa8c2b5cb7743c2df4c2c04ea91540a2b0a13
[ "Xnet", "X11" ]
1
2021-06-22T10:59:48.000Z
2021-06-22T10:59:48.000Z
/** * Copyright (c) 2006-2014 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. **/ #include "common/config.h" #include "Keyboard.h" namespace love { namespace keyboard { namespace sdl { Keyboard::Keyboard() : key_repeat(false) { } const char *Keyboard::getName() const { return "love.keyboard.sdl"; } void Keyboard::setKeyRepeat(bool enable) { key_repeat = enable; } bool Keyboard::hasKeyRepeat() const { return key_repeat; } bool Keyboard::isDown(Key *keylist) const { const Uint8 *keystate = SDL_GetKeyboardState(0); std::map<Key, SDL_Keycode>::const_iterator it; for (Key key = *keylist; key != KEY_MAX_ENUM; key = *(++keylist)) { it = keys.find(key); if (it != keys.end() && keystate[SDL_GetScancodeFromKey(it->second)]) return true; } return false; } void Keyboard::setTextInput(bool enable) { if (enable) SDL_StartTextInput(); else SDL_StopTextInput(); } bool Keyboard::hasTextInput() const { return SDL_IsTextInputActive(); } std::map<Keyboard::Key, SDL_Keycode> Keyboard::createKeyMap() { std::map<Keyboard::Key, SDL_Keycode> k; k[Keyboard::KEY_UNKNOWN] = SDLK_UNKNOWN; k[Keyboard::KEY_RETURN] = SDLK_RETURN; k[Keyboard::KEY_ESCAPE] = SDLK_ESCAPE; k[Keyboard::KEY_BACKSPACE] = SDLK_BACKSPACE; k[Keyboard::KEY_TAB] = SDLK_TAB; k[Keyboard::KEY_SPACE] = SDLK_SPACE; k[Keyboard::KEY_EXCLAIM] = SDLK_EXCLAIM; k[Keyboard::KEY_QUOTEDBL] = SDLK_QUOTEDBL; k[Keyboard::KEY_HASH] = SDLK_HASH; k[Keyboard::KEY_DOLLAR] = SDLK_DOLLAR; k[Keyboard::KEY_AMPERSAND] = SDLK_AMPERSAND; k[Keyboard::KEY_QUOTE] = SDLK_QUOTE; k[Keyboard::KEY_LEFTPAREN] = SDLK_LEFTPAREN; k[Keyboard::KEY_RIGHTPAREN] = SDLK_RIGHTPAREN; k[Keyboard::KEY_ASTERISK] = SDLK_ASTERISK; k[Keyboard::KEY_PLUS] = SDLK_PLUS; k[Keyboard::KEY_COMMA] = SDLK_COMMA; k[Keyboard::KEY_MINUS] = SDLK_MINUS; k[Keyboard::KEY_PERIOD] = SDLK_PERIOD; k[Keyboard::KEY_SLASH] = SDLK_SLASH; k[Keyboard::KEY_0] = SDLK_0; k[Keyboard::KEY_1] = SDLK_1; k[Keyboard::KEY_2] = SDLK_2; k[Keyboard::KEY_3] = SDLK_3; k[Keyboard::KEY_4] = SDLK_4; k[Keyboard::KEY_5] = SDLK_5; k[Keyboard::KEY_6] = SDLK_6; k[Keyboard::KEY_7] = SDLK_7; k[Keyboard::KEY_8] = SDLK_8; k[Keyboard::KEY_9] = SDLK_9; k[Keyboard::KEY_COLON] = SDLK_COLON; k[Keyboard::KEY_SEMICOLON] = SDLK_SEMICOLON; k[Keyboard::KEY_LESS] = SDLK_LESS; k[Keyboard::KEY_EQUALS] = SDLK_EQUALS; k[Keyboard::KEY_GREATER] = SDLK_GREATER; k[Keyboard::KEY_QUESTION] = SDLK_QUESTION; k[Keyboard::KEY_AT] = SDLK_AT; k[Keyboard::KEY_LEFTBRACKET] = SDLK_LEFTBRACKET; k[Keyboard::KEY_BACKSLASH] = SDLK_BACKSLASH; k[Keyboard::KEY_RIGHTBRACKET] = SDLK_RIGHTBRACKET; k[Keyboard::KEY_CARET] = SDLK_CARET; k[Keyboard::KEY_UNDERSCORE] = SDLK_UNDERSCORE; k[Keyboard::KEY_BACKQUOTE] = SDLK_BACKQUOTE; k[Keyboard::KEY_A] = SDLK_a; k[Keyboard::KEY_B] = SDLK_b; k[Keyboard::KEY_C] = SDLK_c; k[Keyboard::KEY_D] = SDLK_d; k[Keyboard::KEY_E] = SDLK_e; k[Keyboard::KEY_F] = SDLK_f; k[Keyboard::KEY_G] = SDLK_g; k[Keyboard::KEY_H] = SDLK_h; k[Keyboard::KEY_I] = SDLK_i; k[Keyboard::KEY_J] = SDLK_j; k[Keyboard::KEY_K] = SDLK_k; k[Keyboard::KEY_L] = SDLK_l; k[Keyboard::KEY_M] = SDLK_m; k[Keyboard::KEY_N] = SDLK_n; k[Keyboard::KEY_O] = SDLK_o; k[Keyboard::KEY_P] = SDLK_p; k[Keyboard::KEY_Q] = SDLK_q; k[Keyboard::KEY_R] = SDLK_r; k[Keyboard::KEY_S] = SDLK_s; k[Keyboard::KEY_T] = SDLK_t; k[Keyboard::KEY_U] = SDLK_u; k[Keyboard::KEY_V] = SDLK_v; k[Keyboard::KEY_W] = SDLK_w; k[Keyboard::KEY_X] = SDLK_x; k[Keyboard::KEY_Y] = SDLK_y; k[Keyboard::KEY_Z] = SDLK_z; k[Keyboard::KEY_CAPSLOCK] = SDLK_CAPSLOCK; k[Keyboard::KEY_F1] = SDLK_F1; k[Keyboard::KEY_F2] = SDLK_F2; k[Keyboard::KEY_F3] = SDLK_F3; k[Keyboard::KEY_F4] = SDLK_F4; k[Keyboard::KEY_F5] = SDLK_F5; k[Keyboard::KEY_F6] = SDLK_F6; k[Keyboard::KEY_F7] = SDLK_F7; k[Keyboard::KEY_F8] = SDLK_F8; k[Keyboard::KEY_F9] = SDLK_F9; k[Keyboard::KEY_F10] = SDLK_F10; k[Keyboard::KEY_F11] = SDLK_F11; k[Keyboard::KEY_F12] = SDLK_F12; k[Keyboard::KEY_PRINTSCREEN] = SDLK_PRINTSCREEN; k[Keyboard::KEY_SCROLLLOCK] = SDLK_SCROLLLOCK; k[Keyboard::KEY_PAUSE] = SDLK_PAUSE; k[Keyboard::KEY_INSERT] = SDLK_INSERT; k[Keyboard::KEY_HOME] = SDLK_HOME; k[Keyboard::KEY_PAGEUP] = SDLK_PAGEUP; k[Keyboard::KEY_DELETE] = SDLK_DELETE; k[Keyboard::KEY_END] = SDLK_END; k[Keyboard::KEY_PAGEDOWN] = SDLK_PAGEDOWN; k[Keyboard::KEY_RIGHT] = SDLK_RIGHT; k[Keyboard::KEY_LEFT] = SDLK_LEFT; k[Keyboard::KEY_DOWN] = SDLK_DOWN; k[Keyboard::KEY_UP] = SDLK_UP; k[Keyboard::KEY_NUMLOCKCLEAR] = SDLK_NUMLOCKCLEAR; k[Keyboard::KEY_KP_DIVIDE] = SDLK_KP_DIVIDE; k[Keyboard::KEY_KP_MULTIPLY] = SDLK_KP_MULTIPLY; k[Keyboard::KEY_KP_MINUS] = SDLK_KP_MINUS; k[Keyboard::KEY_KP_PLUS] = SDLK_KP_PLUS; k[Keyboard::KEY_KP_ENTER] = SDLK_KP_ENTER; k[Keyboard::KEY_KP_0] = SDLK_KP_0; k[Keyboard::KEY_KP_1] = SDLK_KP_1; k[Keyboard::KEY_KP_2] = SDLK_KP_2; k[Keyboard::KEY_KP_3] = SDLK_KP_3; k[Keyboard::KEY_KP_4] = SDLK_KP_4; k[Keyboard::KEY_KP_5] = SDLK_KP_5; k[Keyboard::KEY_KP_6] = SDLK_KP_6; k[Keyboard::KEY_KP_7] = SDLK_KP_7; k[Keyboard::KEY_KP_8] = SDLK_KP_8; k[Keyboard::KEY_KP_9] = SDLK_KP_9; k[Keyboard::KEY_KP_PERIOD] = SDLK_KP_PERIOD; k[Keyboard::KEY_KP_COMMA] = SDLK_KP_COMMA; k[Keyboard::KEY_KP_EQUALS] = SDLK_KP_EQUALS; k[Keyboard::KEY_APPLICATION] = SDLK_APPLICATION; k[Keyboard::KEY_POWER] = SDLK_POWER; k[Keyboard::KEY_F13] = SDLK_F13; k[Keyboard::KEY_F14] = SDLK_F14; k[Keyboard::KEY_F15] = SDLK_F15; k[Keyboard::KEY_F16] = SDLK_F16; k[Keyboard::KEY_F17] = SDLK_F17; k[Keyboard::KEY_F18] = SDLK_F18; k[Keyboard::KEY_F19] = SDLK_F19; k[Keyboard::KEY_F20] = SDLK_F20; k[Keyboard::KEY_F21] = SDLK_F21; k[Keyboard::KEY_F22] = SDLK_F22; k[Keyboard::KEY_F23] = SDLK_F23; k[Keyboard::KEY_F24] = SDLK_F24; k[Keyboard::KEY_EXECUTE] = SDLK_EXECUTE; k[Keyboard::KEY_HELP] = SDLK_HELP; k[Keyboard::KEY_MENU] = SDLK_MENU; k[Keyboard::KEY_SEARCH] = SDLK_AC_SEARCH; k[Keyboard::KEY_SELECT] = SDLK_SELECT; k[Keyboard::KEY_STOP] = SDLK_STOP; k[Keyboard::KEY_AGAIN] = SDLK_AGAIN; k[Keyboard::KEY_UNDO] = SDLK_UNDO; k[Keyboard::KEY_CUT] = SDLK_CUT; k[Keyboard::KEY_COPY] = SDLK_COPY; k[Keyboard::KEY_PASTE] = SDLK_PASTE; k[Keyboard::KEY_FIND] = SDLK_FIND; k[Keyboard::KEY_MUTE] = SDLK_MUTE; k[Keyboard::KEY_VOLUMEUP] = SDLK_VOLUMEUP; k[Keyboard::KEY_VOLUMEDOWN] = SDLK_VOLUMEDOWN; k[Keyboard::KEY_ALTERASE] = SDLK_ALTERASE; k[Keyboard::KEY_SYSREQ] = SDLK_SYSREQ; k[Keyboard::KEY_CANCEL] = SDLK_CANCEL; k[Keyboard::KEY_CLEAR] = SDLK_CLEAR; k[Keyboard::KEY_PRIOR] = SDLK_PRIOR; k[Keyboard::KEY_RETURN2] = SDLK_RETURN2; k[Keyboard::KEY_SEPARATOR] = SDLK_SEPARATOR; k[Keyboard::KEY_OUT] = SDLK_OUT; k[Keyboard::KEY_OPER] = SDLK_OPER; k[Keyboard::KEY_CLEARAGAIN] = SDLK_CLEARAGAIN; k[Keyboard::KEY_THOUSANDSSEPARATOR] = SDLK_THOUSANDSSEPARATOR; k[Keyboard::KEY_DECIMALSEPARATOR] = SDLK_DECIMALSEPARATOR; k[Keyboard::KEY_CURRENCYUNIT] = SDLK_CURRENCYUNIT; k[Keyboard::KEY_CURRENCYSUBUNIT] = SDLK_CURRENCYSUBUNIT; k[Keyboard::KEY_LCTRL] = SDLK_LCTRL; k[Keyboard::KEY_LSHIFT] = SDLK_LSHIFT; k[Keyboard::KEY_LALT] = SDLK_LALT; k[Keyboard::KEY_LGUI] = SDLK_LGUI; k[Keyboard::KEY_RCTRL] = SDLK_RCTRL; k[Keyboard::KEY_RSHIFT] = SDLK_RSHIFT; k[Keyboard::KEY_RALT] = SDLK_RALT; k[Keyboard::KEY_RGUI] = SDLK_RGUI; k[Keyboard::KEY_MODE] = SDLK_MODE; k[Keyboard::KEY_AUDIONEXT] = SDLK_AUDIONEXT; k[Keyboard::KEY_AUDIOPREV] = SDLK_AUDIOPREV; k[Keyboard::KEY_AUDIOSTOP] = SDLK_AUDIOSTOP; k[Keyboard::KEY_AUDIOPLAY] = SDLK_AUDIOPLAY; k[Keyboard::KEY_AUDIOMUTE] = SDLK_AUDIOMUTE; k[Keyboard::KEY_MEDIASELECT] = SDLK_MEDIASELECT; k[Keyboard::KEY_BRIGHTNESSDOWN] = SDLK_BRIGHTNESSDOWN; k[Keyboard::KEY_BRIGHTNESSUP] = SDLK_BRIGHTNESSUP; k[Keyboard::KEY_DISPLAYSWITCH] = SDLK_DISPLAYSWITCH; k[Keyboard::KEY_KBDILLUMTOGGLE] = SDLK_KBDILLUMTOGGLE; k[Keyboard::KEY_KBDILLUMDOWN] = SDLK_KBDILLUMDOWN; k[Keyboard::KEY_KBDILLUMUP] = SDLK_KBDILLUMUP; k[Keyboard::KEY_EJECT] = SDLK_EJECT; k[Keyboard::KEY_SLEEP] = SDLK_SLEEP; return k; } std::map<Keyboard::Key, SDL_Keycode> Keyboard::keys = Keyboard::createKeyMap(); } // sdl } // keyboard } // love
31.311189
79
0.733445
ultimateprogramer
c73b589c4a6cf600ea10252a2e2012eab4c06104
989
cpp
C++
Src/17.cpp
ZHIHAO93/TAIS
0aab66f0dde965ed051a649b431d31941d136250
[ "MIT" ]
null
null
null
Src/17.cpp
ZHIHAO93/TAIS
0aab66f0dde965ed051a649b431d31941d136250
[ "MIT" ]
null
null
null
Src/17.cpp
ZHIHAO93/TAIS
0aab66f0dde965ed051a649b431d31941d136250
[ "MIT" ]
null
null
null
// TAIS03, LUIS ARROYO Y ZHIHAO ZHENG #include <iostream> #include <fstream> #include "Navegar.h" using namespace std; // O(n), siendo n el numero de enlaces void ponerEnlace(NavegarWeb &web){ int M; cin >> M; int v, w, valor; for (int i = 0; i < M; i++) { cin >> v >> w >> valor; web.ponerEnlace(v, w, valor); } } bool resuelveCaso(){ int N; cin >> N; if (N == 0) return false; std::vector<int> vectTiempo; int t; vectTiempo.push_back(0); for (int i = 0; i < N; i++) { cin >> t; vectTiempo.push_back(t); } NavegarWeb web(N + 1, vectTiempo); ponerEnlace(web); if (web.esPosible()){ cout << web.minTiempo() << endl; } else { cout << "IMPOSIBLE" << endl; } return true; } int main(){ #ifndef DOMJUDGE std::fstream in("casos.txt"); auto cinbuf = std::cin.rdbuf(in.rdbuf()); #endif while (resuelveCaso()){} #ifndef DOMJUDGE std::cin.rdbuf(cinbuf); system("pause"); #endif return 0; }
16.483333
43
0.578362
ZHIHAO93
c73cf78c3843f574b08ee148adced418d13ec3ae
4,391
cpp
C++
msdb/src/array/array.cpp
KUDB/MSDB
19e89d1d9c09c57b242737f0634ac30b4c8ecfd7
[ "MIT" ]
2
2021-08-31T12:43:16.000Z
2021-12-13T13:49:19.000Z
msdb/src/array/array.cpp
KUDB/MSDB
19e89d1d9c09c57b242737f0634ac30b4c8ecfd7
[ "MIT" ]
3
2021-09-09T17:23:31.000Z
2021-09-09T19:14:50.000Z
msdb/src/array/array.cpp
KUDB/MSDB
19e89d1d9c09c57b242737f0634ac30b4c8ecfd7
[ "MIT" ]
null
null
null
#include <pch.h> #include <array/array.h> #include <util/math.h> #include <util/logger.h> namespace msdb { namespace core { arrayBase::arrayBase(pArrayDesc desc) : chunkBitmap_() { this->desc_ = desc; this->chunkBitmap_ = std::make_shared<bitmap>(desc_->dimDescs_->getChunkSpace().area(), false); } arrayBase::~arrayBase() { //BOOST_LOG_TRIVIAL(debug) << "~arrayBase(): " << this->desc_->name_; this->chunks_.clear(); this->chunkBitmap_ = nullptr; this->desc_ = nullptr; } pArrayDesc arrayBase::getDesc() { return this->desc_; } // TODO::required an attirubteId as an input parameter pChunkIterator arrayBase::getChunkIterator(const iterateMode itMode) { return std::make_shared<chunkIterator>(this->desc_->dimDescs_->getChunkSpace(), &this->chunks_, this->chunkBitmap_, itMode); } arrayBase::size_type arrayBase::getNumChunks() { return this->chunks_.size(); } coor arrayBase::itemCoorToChunkCoor(const coor& itemCoor) { coor chunkCoor(this->desc_->dimDescs_->size()); for (dimensionId d = 0; d < this->desc_->dimDescs_->size(); d++) { chunkCoor[d] = floor(itemCoor[d] / (*this->desc_->dimDescs_)[d]->chunkSize_); } return chunkCoor; } pChunk arrayBase::insertChunk(const attributeId attrId, pChunk inputChunk) { assert(attrId < this->desc_->attrDescs_->size()); this->chunks_.insert(chunkPair(inputChunk->getId(), inputChunk)); this->chunkBitmap_->setExist(inputChunk->getId()); return inputChunk; } void arrayBase::flush() { } pChunk arrayBase::makeChunk(const chunkDesc& desc) { return this->makeChunk(desc.attrDesc_->id_, desc.id_); } void arrayBase::makeChunks(const attributeId attrId, const bitmap& input) { chunkId capacity = this->getChunkIterator()->getCapacity(); for(chunkId cid = 0; cid < capacity; ++cid) { if(input.isExist(cid) && !this->chunkBitmap_->isExist(cid)) { this->makeChunk(attrId, cid); } } } pChunkDesc arrayBase::getChunkDesc(const attributeId attrId, const chunkId cId) { dimension chunkDims = this->desc_->getDimDescs()->getChunkDims(); dimension blockDims = this->desc_->getDimDescs()->getBlockDims(); pAttributeDesc attrDesc = (*this->desc_->getAttrDescs())[attrId]; auto cItr = this->getChunkIterator(); coor chunkCoor = cItr->seqToCoor(cId); dimension sp = chunkDims * chunkCoor; dimension ep = sp + chunkDims; return std::make_shared<chunkDesc>(cId, attrDesc, chunkDims, blockDims, sp, ep, chunkDims.area() * attrDesc->typeSize_); } pChunk arrayBase::getChunk(const chunkId cId) { return this->chunks_[cId]; } arrayId arrayBase::getId() { return this->desc_->id_; } void arrayBase::setId(const arrayId id) { this->desc_->id_ = id; } chunkId arrayBase::getChunkId(pChunkDesc cDesc) { return this->getChunkIdFromItemCoor(cDesc->sp_); } chunkId arrayBase::getChunkIdFromItemCoor(const coor& itemCoor) { coor chunkCoor = itemCoor; for (dimensionId d = this->desc_->dimDescs_->size() - 1; d != -1; --d) { chunkCoor[d] /= this->desc_->dimDescs_->at(d)->chunkSize_; } return this->getChunkIdFromChunkCoor(chunkCoor); } chunkId arrayBase::getChunkIdFromChunkCoor(const coor& chunkCoor) { chunkId id = 0; chunkId offset = 1; for (dimensionId d = this->desc_->dimDescs_->size() - 1; d != -1; d--) { id += offset * chunkCoor[d]; offset *= (*this->desc_->dimDescs_)[d]->getChunkNum(); } return id; } cpBitmap arrayBase::getChunkBitmap() const { return this->chunkBitmap_; } void arrayBase::copyChunkBitmap(cpBitmap chunkBitmap) { this->chunkBitmap_ = std::make_shared<bitmap>(*chunkBitmap); } void arrayBase::replaceChunkBitmap(pBitmap chunkBitmap) { this->chunkBitmap_ = chunkBitmap; } void arrayBase::mergeChunkBitmap(pBitmap chunkBitmap) { this->chunkBitmap_->andMerge(*chunkBitmap); } void arrayBase::print() { auto cit = this->getChunkIterator(); while (!cit->isEnd()) { if(cit->isExist()) { BOOST_LOG_TRIVIAL(debug) << "==============================\n"; BOOST_LOG_TRIVIAL(trace) << "Chunk (" << cit->seqPos() << ") exist\n"; (**cit)->print(); BOOST_LOG_TRIVIAL(debug) << "==============================\n"; }else { //BOOST_LOG_TRIVIAL(trace) << "==============================\n"; //BOOST_LOG_TRIVIAL(trace) << "Chunk (" << cit->seqPos() << ") is not exist\n"; //BOOST_LOG_TRIVIAL(trace) << "==============================\n"; } ++(*cit); } } } // core } // msdb
25.235632
96
0.670918
KUDB
c742c1f6b561b6772a2046f8b7490744bc78e096
1,604
hh
C++
src/cxx/include/data/AggregatedBclFileReader.hh
sbooeshaghi/bcl2fastq
3f39a24cd743fa71fba9b7dcf62e5d33cea8272d
[ "BSD-3-Clause" ]
5
2021-06-07T12:36:11.000Z
2022-02-08T09:49:02.000Z
src/cxx/include/data/AggregatedBclFileReader.hh
sbooeshaghi/bcl2fastq
3f39a24cd743fa71fba9b7dcf62e5d33cea8272d
[ "BSD-3-Clause" ]
1
2022-03-01T23:55:57.000Z
2022-03-01T23:57:15.000Z
src/cxx/include/data/AggregatedBclFileReader.hh
sbooeshaghi/bcl2fastq
3f39a24cd743fa71fba9b7dcf62e5d33cea8272d
[ "BSD-3-Clause" ]
null
null
null
/** * BCL to FASTQ file converter * Copyright (c) 2007-2017 Illumina, Inc. * * This software is covered by the accompanying EULA * and certain third party copyright/licenses, and any user of this * source file is bound by the terms therein. * * \file TileBclFileReader.hh * * \brief Declaration of BCL reader for a single tile. * * \author Aaron Day */ #ifndef BCL2FASTQ_DATA_AGGREGATED_BCL_FILE_READER_HH #define BCL2FASTQ_DATA_AGGREGATED_BCL_FILE_READER_HH #include "data/BclFileReader.hh" #include "data/RawBclBuffer.hh" #include "data/CycleBCIFile.hh" #include "io/SyncFile.hh" #include <boost/filesystem/path.hpp> #include <boost/noncopyable.hpp> #include <memory> namespace bcl2fastq { namespace data { class AggregatedBclFileReader : public BclFileReaderT<io::SyncFile> { public: AggregatedBclFileReader(const::boost::filesystem::path& inputDir, const layout::LaneInfo& laneInfo, common::CycleNumber cycleNumber, size_t cycleIndex, bool ignoreMissingBcls, std::shared_ptr<io::SyncFile> bclFile, std::shared_ptr<data::CycleBCIFile> cycleBciFile); virtual bool read(RawBclBufferGroup& outputBuffer); private: bool openAggFileIfNeeded(); std::shared_ptr<data::CycleBCIFile> cycleBciFile_; }; } // namespace data } // namespace bcl2fastq #endif // BCL2FASTQ_DATA_AGGREGATED_BCL_FILE_READER_HH
28.140351
82
0.642768
sbooeshaghi
c743a759588c916f54a2697485a326917abaea28
2,485
cc
C++
test/generic.cc
imkaywu/open3DCV
33ef0507e565bce2ccff7409ff35a8970e6eed2d
[ "BSD-3-Clause" ]
37
2018-07-30T15:34:29.000Z
2022-01-10T22:50:39.000Z
test/generic.cc
imkaywu/open3DCV
33ef0507e565bce2ccff7409ff35a8970e6eed2d
[ "BSD-3-Clause" ]
1
2020-10-09T17:51:42.000Z
2020-11-11T19:41:06.000Z
test/generic.cc
imkaywu/open3DCV
33ef0507e565bce2ccff7409ff35a8970e6eed2d
[ "BSD-3-Clause" ]
14
2017-12-03T15:24:01.000Z
2021-09-16T02:13:31.000Z
extern "C" { #include <stdlib.h> #include <stdio.h> #include "vl/generic.h" #include "vl/pgm.h" #include "vl/sift.h" } #include <iostream> #include "image.h" int main(int argc, const char * argv[]) { std::string fname = "/Users/BlacKay/Documents/Projects/Images/test/mandrill.pgm"; FILE *in = 0; vl_uint8 *data = 0; vl_sift_pix *fdata = 0; VlPgmImage pim; vl_bool err = VL_ERR_OK ; char err_msg[1024]; int verbose; in = fopen(fname.c_str(), "rb"); // read PGM header err = vl_pgm_extract_head (in, &pim); if (err) { switch (vl_get_last_error()) { case VL_ERR_PGM_IO : snprintf(err_msg, sizeof(err_msg), "Cannot read from '%s'.", fname.c_str()) ; err = VL_ERR_IO ; break ; case VL_ERR_PGM_INV_HEAD : snprintf(err_msg, sizeof(err_msg), "'%s' contains a malformed PGM header.", fname.c_str()) ; err = VL_ERR_IO ; //goto done ; } } if (verbose) printf ("sift: image is %" VL_FMT_SIZE " by %" VL_FMT_SIZE " pixels\n", pim. width, pim. height) ; // allocate buffer data = (vl_uint8*)malloc(vl_pgm_get_npixels (&pim) * vl_pgm_get_bpp (&pim) * sizeof (vl_uint8) ) ; fdata = (vl_sift_pix*)malloc(vl_pgm_get_npixels (&pim) * vl_pgm_get_bpp (&pim) * sizeof (vl_sift_pix)) ; std::cout << "number of pixel:" << vl_pgm_get_npixels(&pim) << std::endl; std::cout << "types per pixel:" << vl_pgm_get_bpp(&pim) << std::endl; if (!data || !fdata) { err = VL_ERR_ALLOC ; snprintf(err_msg, sizeof(err_msg), "Could not allocate enough memory."); //goto done; } // read PGM body err = vl_pgm_extract_data (in, &pim, data) ; if (err) { snprintf(err_msg, sizeof(err_msg), "PGM body malformed.") ; err = VL_ERR_IO ; //goto done ; } open3DCV::Image img; img.init(fname); vector<unsigned char> image; int w, h; img.readPGMImage(fname, image, w, h); std::cout << "Start: VlPgmImage" << std::endl; for (int i = 0; i < 100; ++i) std::cout << (int)data[i] << " " << (int)image[i] << std::endl; std::cout << "End: VlPgmImage" << std::endl; }
28.238636
85
0.517103
imkaywu
c7476c3eb20d5bcc4f8c39599975f1ec7b11cc2c
898
cc
C++
tests/unittests/lite_test.cc
manavrion/segment_tree
20e3513395c8b9c28994817e7df76aa85e41ed85
[ "MIT" ]
null
null
null
tests/unittests/lite_test.cc
manavrion/segment_tree
20e3513395c8b9c28994817e7df76aa85e41ed85
[ "MIT" ]
2
2020-09-08T22:39:12.000Z
2020-10-02T11:02:08.000Z
tests/unittests/lite_test.cc
manavrion/segment_tree
20e3513395c8b9c28994817e7df76aa85e41ed85
[ "MIT" ]
null
null
null
// // Copyright (C) 2020 Ruslan Manaev (manavrion@gmail.com) // This file is part of the segment_tree header-only library. // #include <gtest/gtest.h> #include "manavrion/segment_tree/mapped_segment_tree.h" #include "manavrion/segment_tree/naive_segment_tree.h" #include "manavrion/segment_tree/segment_tree.h" using namespace manavrion::segment_tree; namespace { template <typename SegmentTree> void LiteTest() { SegmentTree st = {0, 1, 2, 3, 4, 5, 6, 7}; EXPECT_EQ(st.query(0, 0), 0); EXPECT_EQ(st.query(0, 1), 0); EXPECT_EQ(st.query(0, 2), 1); EXPECT_EQ(st.query(2, 5), 9); EXPECT_EQ(st.query(6, 7), 6); EXPECT_EQ(st.query(3, 6), 12); } } // namespace TEST(LiteTest, MappedSegmentTree) { LiteTest<mapped_segment_tree<int>>(); } TEST(LiteTest, NaiveSegmentTree) { LiteTest<naive_segment_tree<int>>(); } TEST(LiteTest, SimpleSegmentTree) { LiteTest<segment_tree<int>>(); }
26.411765
75
0.713808
manavrion
c747f63a9033349bdf261f259316708993beb7e1
5,190
cpp
C++
MyWin32App/MainWnd.cpp
HyundongHwang/MyShellHookTest
ddce2f43d699759d91cd7bfdae9631feae399ddd
[ "MIT" ]
null
null
null
MyWin32App/MainWnd.cpp
HyundongHwang/MyShellHookTest
ddce2f43d699759d91cd7bfdae9631feae399ddd
[ "MIT" ]
null
null
null
MyWin32App/MainWnd.cpp
HyundongHwang/MyShellHookTest
ddce2f43d699759d91cd7bfdae9631feae399ddd
[ "MIT" ]
null
null
null
#include "stdafx.h" #include "MainWnd.h" MainWnd* MainWnd::s_pCurrent = NULL; MainWnd::MainWnd() { s_pCurrent = this; } MainWnd::~MainWnd() { } LRESULT MainWnd::_On_WM_CREATE(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { USES_CONVERSION; auto x = 0; auto y = 0; auto w = 500; auto h = 30; m_arrLabelFuncSimple.Add(CSTRING_FUNC_SIMPLE_PAIR(L"test 00", MainWnd::_OnClickBtn_test_00)); m_arrLabelFuncSimple.Add(CSTRING_FUNC_SIMPLE_PAIR(L"test 01", MainWnd::_OnClickBtn_test_01)); m_arrLabelFuncSimple.Add(CSTRING_FUNC_SIMPLE_PAIR(L"test 02", MainWnd::_OnClickBtn_test_02)); for (auto i = 0; i < m_arrLabelFuncSimple.GetCount(); i++) { auto pair = m_arrLabelFuncSimple[i]; auto strBtnName = pair.strLabel; auto nBtnId = i; CWindow wndBtn; wndBtn.Create(L"Button", this->m_hWnd, CRect(x, y, x + w, y + h), strBtnName, WS_CHILD | WS_VISIBLE | BS_LEFT, NULL, nBtnId); y += h; } m_edLog.Create(L"Edit", this->m_hWnd, CRect(0, 0, 0, 0), L"log", WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | ES_MULTILINE | ES_WANTRETURN, NULL, 1001); return 0; } LRESULT MainWnd::_On_WM_DESTROY(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { ::PostQuitMessage(0); return 0; } LRESULT MainWnd::_On_WM_SIZE(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CRect rcClient; ::GetClientRect(m_hWnd, &rcClient); m_edLog.MoveWindow(0, rcClient.Height() / 2, rcClient.Width(), rcClient.Height() / 2); return 0; } int MainWnd::_GetValidByteCountFromCharPtr(char* pSz) { byte* pBuf = (byte*)pSz; int lengthStr = ::strlen(pSz); for (auto i = 0; i < lengthStr * 3; i++) { if (pBuf[i] == '\0') return i + 1; } return -1; } void MainWnd::_WriteLog(LPCSTR szLog) { USES_CONVERSION; CString strEd; m_edLog.GetWindowText(strEd); strEd += L"\r\n"; strEd += A2T(szLog); m_edLog.SetWindowText(strEd); } void MainWnd::_ReadFile(LPCWSTR wFileName, LPSTR szFileContent, int nFileContent) { USES_CONVERSION; wchar_t wJsonFilePath[MAX_PATH] = { 0, }; ::GetModuleFileName(NULL, wJsonFilePath, MAX_PATH); ::PathRemoveFileSpec(wJsonFilePath); ::PathAppend(wJsonFilePath, wFileName); CAtlFile file; file.Create(wJsonFilePath, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING); file.Read(szFileContent, nFileContent); file.Close(); } LRESULT MainWnd::_On_ID_BTN(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { auto nBtnId = wID; auto pair = m_arrLabelFuncSimple[nBtnId]; pair.pFuncSimple(this); return 0; } //Creating a Child Process with Redirected Input and Output //https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms682499(v=vs.85).aspx HANDLE g_hChildStd_OUT_Rd = NULL; HANDLE g_hChildStd_OUT_Wr = NULL; #define BUFSIZE 4096 void MainWnd::_OnClickBtn_test_00(MainWnd* pThis) { USES_CONVERSION; SECURITY_ATTRIBUTES saAttr; saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; saAttr.lpSecurityDescriptor = NULL; BOOL bSuccess = FALSE; bSuccess = ::CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &saAttr, 0); bSuccess = ::SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0); wchar_t szCmdline[] = L"C:\\Users\\hhd20\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe devices"; PROCESS_INFORMATION piProcInfo; STARTUPINFO siStartInfo; ::ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION)); ::ZeroMemory(&siStartInfo, sizeof(STARTUPINFO)); siStartInfo.cb = sizeof(STARTUPINFO); siStartInfo.hStdError = g_hChildStd_OUT_Wr; siStartInfo.hStdOutput = g_hChildStd_OUT_Wr; siStartInfo.dwFlags |= STARTF_USESTDHANDLES; bSuccess = ::CreateProcess(NULL, szCmdline, // command line NULL, // process security attributes NULL, // primary thread security attributes TRUE, // handles are inherited 0, // creation flags NULL, // use parent's environment NULL, // use parent's current directory &siStartInfo, // STARTUPINFO pointer &piProcInfo); // receives PROCESS_INFORMATION ::CloseHandle(piProcInfo.hProcess); ::CloseHandle(piProcInfo.hThread); DWORD dwRead, dwWritten; char chBuf[BUFSIZE]; HANDLE hParentStdOut = ::GetStdHandle(STD_OUTPUT_HANDLE); CStringA strStdOut; for (;;) { ::ZeroMemory(chBuf, BUFSIZE); bSuccess = ::ReadFile(g_hChildStd_OUT_Rd, chBuf, BUFSIZE, &dwRead, NULL); if (!bSuccess || dwRead == 0) break; chBuf[dwRead] = '\0'; strStdOut += chBuf; bSuccess = ::WriteFile(hParentStdOut, chBuf, dwRead, &dwWritten, NULL); if (!bSuccess) break; } pThis->_WriteLog(strStdOut); } void MainWnd::_OnClickBtn_test_01(MainWnd* pThis) { ::MessageBox(NULL, L"test 01", L"MyWin32App", MB_OK); } void MainWnd::_OnClickBtn_test_02(MainWnd* pThis) { ::MessageBox(NULL, L"test 02", L"MyWin32App", MB_OK); }
26.615385
160
0.663006
HyundongHwang
c74a061a7bb051079e7292243d7efdb3feac3062
1,100
cpp
C++
src/sdk/client/network_service.cpp
proximax-storage/cpp-xpx-chain-sdk
ff562e8a089849eb0b7f8edc83ad61c7a2728f34
[ "Apache-2.0" ]
1
2019-12-06T06:55:37.000Z
2019-12-06T06:55:37.000Z
src/sdk/client/network_service.cpp
proximax-storage/cpp-xpx-chain-sdk
ff562e8a089849eb0b7f8edc83ad61c7a2728f34
[ "Apache-2.0" ]
null
null
null
src/sdk/client/network_service.cpp
proximax-storage/cpp-xpx-chain-sdk
ff562e8a089849eb0b7f8edc83ad61c7a2728f34
[ "Apache-2.0" ]
null
null
null
/** *** Copyright 2019 ProximaX Limited. All rights reserved. *** Use of this source code is governed by the Apache 2.0 *** license that can be found in the LICENSE file. **/ #include "xpxchaincpp/client/network_service.h" #include <infrastructure/utils/deserialization_json.h> #include <infrastructure/network/http.h> using namespace xpx_chain_sdk; using xpx_chain_sdk::internal::json::dto::NetworkInfoDto; using xpx_chain_sdk::internal::json::dto::from_json; NetworkService::NetworkService( std::shared_ptr<Config> config, std::shared_ptr<internal::network::Context> context, std::shared_ptr<RequestParamsBuilder> builder ):_config(config), _context(context), _builder(builder){} NetworkInfo NetworkService::getNetworkInfo() { auto requestParams = _builder ->setPath("network") .setMethod(internal::network::HTTPRequestMethod::GET) .getRequestParams(); std::string response = internal::network::performHTTPRequest(_context, requestParams); auto result = from_json<NetworkInfo, NetworkInfoDto>(response); return result; }
33.333333
90
0.737273
proximax-storage
c74a0b9fa83fc56225d5a694228f2c1b94ca1638
8,030
cpp
C++
graph_utils/src/graph_utils.cpp
guo-zixuan/exploration-project
2ecd3a68dc92f8461f262c7860fa2de6a5e812b4
[ "MIT" ]
null
null
null
graph_utils/src/graph_utils.cpp
guo-zixuan/exploration-project
2ecd3a68dc92f8461f262c7860fa2de6a5e812b4
[ "MIT" ]
null
null
null
graph_utils/src/graph_utils.cpp
guo-zixuan/exploration-project
2ecd3a68dc92f8461f262c7860fa2de6a5e812b4
[ "MIT" ]
null
null
null
#include "graph_utils.h" #include <queue> #include <vector> #include <misc_utils/misc_utils.h> #include <bits/stdc++.h> #include <math.h> #define INF 0x3f3f3f3f // integer infinity #define PI 3.14159265358979323846 using namespace std; namespace graph_utils_ns { // Function for getting the shortest path on a graph between two vertexes // Input: graph, index of the start vertex and index of the goal vertex // Output: a sequence of vertex ids as the path void ShortestPathBtwVertex(vector<int> &path, const graph_utils::TopologicalGraph &graph, int start_index, int goal_index) { if (start_index == goal_index) { path.clear(); path.push_back(start_index); return; } // Vertices are represented by their index in the graph.vertices list typedef pair<float, int> iPair; // Priority queue of vertices priority_queue<iPair, vector<iPair>, greater<iPair>> pq; // Vector of distances vector<float> dist(graph.vertices.size(), INFINITY); // Vector of backpointers vector<int> backpointers(graph.vertices.size(), INF); // Add the start vertex pq.push(make_pair(0, start_index)); dist[start_index] = 0; // Loop until priority queue is empty while (!pq.empty()) { // Pop the minimum distance vertex int u = pq.top().second; pq.pop(); // Get all adjacent vertices for (auto it = graph.vertices[u].edges.begin(); it != graph.vertices[u].edges.end(); ++it) { // Get vertex label and weight of current adjacent edge of u int v = it->vertex_id_end; float weight = it->traversal_costs; // If there is a shorter path to v through u if (dist[v] > dist[u] + weight) { // Updating distance of v dist[v] = dist[u] + weight; pq.push(make_pair(dist[v], v)); backpointers[v] = u; } } // Early termination if (u == goal_index) { break; } } // Backtrack to find path vector<int> reverse_path; int current = goal_index; if (backpointers[current] == INF) { // no path found // std::cout << "WARNING: no path found " << start_index << "<->" << // goal_index << std::endl; path.clear(); } else { // path found while (current != INF) { reverse_path.push_back(current); current = backpointers[current]; } // Reverse the path (constructing it this way since vector is more efficient // at push_back than insert[0]) path.clear(); for (int i = reverse_path.size() - 1; i >= 0; --i) { path.push_back(reverse_path[i]); } } } /// Compute path length, where path represented by sequence of vertex indices float PathLength(const vector<int> &path, const graph_utils::TopologicalGraph &graph) { float cost = 0; if (path.size() == 0) { std::cout << "WARNING: PathLength queried for empty path" << std::endl; return 0; } for (int i = 0; i < -1 + path.size(); i++) { int index1 = path[i]; int index2 = path[i + 1]; bool found = false; // search for the edge for (auto it = graph.vertices[index1].edges.begin(); it != graph.vertices[index1].edges.end(); ++it) { if (it->vertex_id_end == index2) { cost += it->traversal_costs; found = true; break; } } if (!found) std::cout << "WARNING: edge " << index1 << "<->" << index2 << " not found" << std::endl; } return cost; } /// Find the vertex idx in graph that is closest (Euclidean distance) to pnt int GetClosestVertexIdxToPoint(const graph_utils::TopologicalGraph &graph, const geometry_msgs::Point &pnt) { double best_idx = -1; double best_distance = INFINITY; for (int v_idx = 0; v_idx < graph.vertices.size(); ++v_idx) { double distance = misc_utils_ns::PointXYZDist(pnt, graph.vertices[v_idx].location); if (distance < best_distance && fabs(pnt.z - graph.vertices[v_idx].location.z) < 1.0) { best_idx = v_idx; best_distance = distance; } } // std::cout << "The closest vertex is "<< best_idx<< std::endl; return best_idx; } /// Returns the vertex_index of the first vertex along the path that is beyond /// threshold distance from the 1st vertex on /// path /// if none exist, it returns the last vertex /// To be considered, a vertex must have BOTH accumulated and Euclidean distance /// away /// Euclidean distance only relevant if path wraps back on itself (shouldn't /// happen if it's a "shortest path") /// Assumes path is not empty int GetFirstVertexBeyondThreshold(const geometry_msgs::Point &start_location, const std::vector<int> &path, const graph_utils::TopologicalGraph &graph, const float distance_threshold) { if (path.size() == 1) { // trivial case return path[0]; } // Start with distance to first vertex auto first_vertex_location = graph.vertices[path[0]].location; double distance_along_path = misc_utils_ns::PointXYZDist(start_location, first_vertex_location); // Move along path, accumulating the distance // Pick first for (int i = 1; i < path.size(); i++) { // Extract consecutive pair of graph locations on path int v_idx = path[i]; auto vertex_location_prev = graph.vertices[path[i - 1]].location; auto vertex_location = graph.vertices[path[i]].location; // Accumulate distance distance_along_path += misc_utils_ns::PointXYZDist(vertex_location, vertex_location_prev); // Get Euclidean distance from start double distance_euclidean = misc_utils_ns::PointXYZDist(start_location, vertex_location); // If distance threshold exceeded using BOTH measures if ((distance_along_path >= distance_threshold) && (distance_euclidean >= distance_threshold)) { return v_idx; } } // if none are above the threshold, return index of last point on path return path.back(); } bool PathCircleDetect(std::vector<int> &path, const graph_utils::TopologicalGraph &graph, int next_vertex_index, geometry_msgs::Point rob_pos) { double accumulated_angle_difference = 0; double angle1 = 0; double angle2 = 0; double angle_difference = 0; geometry_msgs::Point pointA, pointB, pointC; std::vector<int>::iterator it = std::find(path.begin(), path.end(), next_vertex_index); if (it != path.end()) { int index = it - path.begin(); if (index >= 3) { // compute path angle from the robot position pointA = rob_pos; pointB = graph.vertices[path[0]].location; pointB = graph.vertices[path[1]].location; angle1 = atan2(pointB.y - pointA.y, pointB.x - pointA.x); angle2 = atan2(pointC.y - pointB.y, pointC.x - pointB.x); angle_difference = angle2 - angle1; if (angle_difference > PI) { angle_difference = angle_difference - 2 * PI; } else if (angle_difference < -PI) { angle_difference = 2 * PI + angle_difference; } accumulated_angle_difference += angle_difference; for (int i = 2; i < index + 1; i++) { pointA = graph.vertices[path[i - 2]].location; pointB = graph.vertices[path[i - 1]].location; pointC = graph.vertices[path[i]].location; angle1 = atan2(pointB.y - pointA.y, pointB.x - pointA.x); angle2 = atan2(pointC.y - pointB.y, pointC.x - pointB.x); angle_difference = angle2 - angle1; if (angle_difference > PI) { angle_difference = angle_difference - 2 * PI; } else if (angle_difference < -PI) { angle_difference = 2 * PI + angle_difference; } accumulated_angle_difference += angle_difference; } if (std::fabs(accumulated_angle_difference) > 2.0 / 3 * PI) { return true; } else { return false; } } else { return false; } } else { return false; } } }
32.510121
80
0.626899
guo-zixuan
c74afdd9d5447229d14a92324ba3401704677439
6,236
cpp
C++
cpp/src/ui_less.cpp
kn65op/cli-toolkit
f31a9d738cb7e262abb3162dae3d77d78602ea67
[ "BSD-3-Clause" ]
null
null
null
cpp/src/ui_less.cpp
kn65op/cli-toolkit
f31a9d738cb7e262abb3162dae3d77d78602ea67
[ "BSD-3-Clause" ]
null
null
null
cpp/src/ui_less.cpp
kn65op/cli-toolkit
f31a9d738cb7e262abb3162dae3d77d78602ea67
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2006-2013, Alexis Royer, http://alexis.royer.free.fr/CLI 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 of the CLI library project nor the names of its 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. */ #include "cli/pch.h" #include "cli/assert.h" #include "cli/ui_less.h" #include "cli/shell.h" #include "cli/string_device.h" #include "ui_text.h" #include "command_line_edition.h" CLI_NS_BEGIN(cli) CLI_NS_BEGIN(ui) Less::Less(const unsigned int UI_MaxLines, const unsigned int UI_MaxLineLength) : UI(), m_uiText(* new Text(UI_MaxLines, UI_MaxLineLength)), m_puiTextIt(NULL), m_cliLessLine(* new CmdLineEdition()) { } Less::Less(ExecutionContext& CLI_ParentContext, const unsigned int UI_MaxLines, const unsigned int UI_MaxLineLength) : UI(CLI_ParentContext), m_uiText(* new Text(UI_MaxLines, UI_MaxLineLength)), m_puiTextIt(NULL), m_cliLessLine(* new CmdLineEdition()) { } Less::~Less(void) { delete & m_uiText; if (m_puiTextIt != NULL) { delete m_puiTextIt; m_puiTextIt = NULL; } delete & m_cliLessLine; } const OutputDevice& Less::GetText(void) { return m_uiText; } void Less::Reset(void) { // Nothing to do. } void Less::ResetToDefault(void) { // Very first display. if (m_puiTextIt == NULL) { const OutputDevice::ScreenInfo cli_ScreenInfo = GetStream(OUTPUT_STREAM).GetScreenInfo(); m_puiTextIt = new TextIterator(cli_ScreenInfo, cli_ScreenInfo.GetSafeHeight() - 1); } CLI_ASSERT(m_puiTextIt != NULL); if (m_puiTextIt != NULL) { m_uiText.Begin(*m_puiTextIt); } PrintScreen(); } void Less::OnKey(const KEY E_KeyCode) { // Ensure m_puiTextIt is valid. CLI_ASSERT(m_puiTextIt != NULL); if (m_puiTextIt == NULL) { Quit(); } else { switch (E_KeyCode) { case KEY_BEGIN: m_uiText.Begin(*m_puiTextIt); PrintScreen(); break; case PAGE_UP: if (m_uiText.PageUp(*m_puiTextIt)) PrintScreen(); else Beep(); break; case KEY_UP: if (m_uiText.LineUp(*m_puiTextIt)) PrintScreen(); else Beep(); break; case KEY_DOWN: case ENTER: if (m_uiText.LineDown(*m_puiTextIt, NULL)) PrintScreen(); else Beep(); break; case PAGE_DOWN: case SPACE: if (m_uiText.PageDown(*m_puiTextIt, NULL)) PrintScreen(); else Beep(); break; case KEY_END: m_uiText.End(*m_puiTextIt, NULL); PrintScreen(); break; case KEY_q: case KEY_Q: case ESCAPE: case BREAK: case LOGOUT: case NULL_KEY: // Stop display Quit(); break; default: // Non managed character: beep. Beep(); break; } } } void Less::PrintScreen(void) { const OutputDevice::ScreenInfo cli_ScreenInfo = GetStream(OUTPUT_STREAM).GetScreenInfo(); // Then let current bottom position move one page down while printing the page. const StringDevice cli_Out(cli_ScreenInfo.GetSafeHeight() * (cli_ScreenInfo.GetSafeWidth() + 1), false); CLI_ASSERT(m_puiTextIt != NULL); if (m_puiTextIt != NULL) { m_uiText.PrintPage(*m_puiTextIt, cli_Out, true); } // Eventually clean out the screen and print out the computed string. m_cliLessLine.Reset(); GetStream(OUTPUT_STREAM).CleanScreen(); GetStream(OUTPUT_STREAM) << cli_Out.GetString(); m_cliLessLine.Put(GetStream(OUTPUT_STREAM), tk::String(10, ":")); } void Less::Quit(void) { m_cliLessLine.CleanAll(GetStream(OUTPUT_STREAM)); EndControl(true); } CLI_NS_END(ui) CLI_NS_END(cli)
37.341317
158
0.552919
kn65op
c74b2c79ee2bb1bb519eacf91ddc11b568a961c9
647
cpp
C++
Kodovi/src/main.cpp
ssttefann/Visualizing-Sorting-Algorithms
0946bb8e743ef98e318db3c8f478898447520937
[ "MIT" ]
null
null
null
Kodovi/src/main.cpp
ssttefann/Visualizing-Sorting-Algorithms
0946bb8e743ef98e318db3c8f478898447520937
[ "MIT" ]
null
null
null
Kodovi/src/main.cpp
ssttefann/Visualizing-Sorting-Algorithms
0946bb8e743ef98e318db3c8f478898447520937
[ "MIT" ]
null
null
null
//============================================================================ // Name : main.cpp // Author :Stefan Kandic // Date : 8.1.2018. // Copyright : // Description : module only responsible for the start of the program //============================================================================ #include "MyWindow.h" #include <FL/abi-version.h> #include <string> #include <FL/fl_utf8.h> using namespace std; int main(int argc, char* argv[]) { IO inout; inout.loadFlights(); MyWindow w(Point(450,250),800, 600, "SortVizz"); w.color(FL_DARK2); w.setIO(inout); w.wait_for_button(); return 0; }
17.972222
79
0.483771
ssttefann
c74c099370bc967aa16046d04f450386ff09b0c3
14,828
cpp
C++
src/dict/dictWord.cpp
objectx/Paraphrase
02c44405efc8604428ed362893ace50104298021
[ "MIT" ]
null
null
null
src/dict/dictWord.cpp
objectx/Paraphrase
02c44405efc8604428ed362893ace50104298021
[ "MIT" ]
null
null
null
src/dict/dictWord.cpp
objectx/Paraphrase
02c44405efc8604428ed362893ace50104298021
[ "MIT" ]
null
null
null
#include "externals.h" #include "typedValue.h" #include "stack.h" #include "word.h" #include "context.h" static bool colon(const char *inName,Context& inContext,bool inDefineShortend); static bool compileValue(Context& inContext,TypedValue& inLambda); static bool constant(const char *inName,Context& inContext,bool inOverwriteCheck); static bool isInCStyleComment(Context& inContext); static bool isInCppStyleComment(Context& inContext); void InitDict_Word() { Install(new Word("_lit",WORD_FUNC { TypedValue *tv=(TypedValue *)(inContext.ip+1); inContext.DS.emplace_back(*tv); inContext.ip+=TvSize; NEXT; })); Install(new Word("_semis",WORD_FUNC { if(inContext.IS.size()<1) { return inContext.Error(E_IS_BROKEN); } inContext.ip=inContext.IS.back(); inContext.IS.pop_back(); NEXT; })); Install(new Word(":",WORD_FUNC { if(colon(":",inContext,true)==false) { return false; } NEXT; })); Install(new Word("::",WORD_FUNC { if(colon("::",inContext,false)==false) { return false; } NEXT; })); Install(new Word(";",WordLevel::Immediate,WORD_FUNC { inContext.Compile(std::string("_semis")); inContext.FinishNewWord(); inContext.SetInterpretMode(); NEXT; })); Install(new Word("immediate",WORD_FUNC { if(inContext.lastDefinedWord==NULL) { return inContext.Error(E_NO_LAST_DEFINED_WORD); } inContext.lastDefinedWord->level=WordLevel::Immediate; NEXT; })); Install(new Word("vocabulary",WORD_FUNC { inContext.DS.emplace_back(GetCurrentVocName()); NEXT; })); Install(new Word("set-vocabulary",WORD_FUNC { if(inContext.DS.size()<1) { return inContext.Error(E_DS_IS_EMPTY); } TypedValue tos=Pop(inContext.DS); if(tos.dataType!=kTypeString) { return inContext.Error_InvalidType(E_TOS_STRING,tos); } SetCurrentVocName(*tos.stringPtr.get()); NEXT; })); // usage: "constName" value const // string value --- Install(new Word("const",WORD_FUNC { const char *name="const"; if(constant(name,inContext,true)==false) { return false; } NEXT; })); // usage: "constName" value const! // string value --- Install(new Word("const!",WORD_FUNC { const char *name="const!"; if(constant(name,inContext,false)==false) { return false; } NEXT; })); // usage: "varName" var // string --- Install(new Word("var",WORD_FUNC { if(inContext.DS.size()<1) { return inContext.Error(E_DS_IS_EMPTY); } TypedValue tos=Pop(inContext.DS); if(tos.dataType!=kTypeString) { return inContext.Error_InvalidType(E_TOS_STRING,tos); } auto iter=Dict.find(*tos.stringPtr); if(iter!=Dict.end()) { return inContext.Error(E_ALREADY_DEFINED,*tos.stringPtr); } Word *newWord=new Word(tos.stringPtr.get()); const int paramSize=2+TvSize*2+MutexSize; newWord->param=new const Word*[paramSize]; const Word *lit=GetWordPtr(std::string("_lit")); if(lit==NULL) { return inContext.Error(E_CAN_NOT_FIND_THE_WORD,std::string("_lit")); } const Word *semis=GetWordPtr(std::string("_semis")); if(semis==NULL) { return inContext.Error(E_CAN_NOT_FIND_THE_WORD,std::string("_semis")); } const int storageIndex=1+TvSize+1; const int mutexIndex=1+TvSize+1+TvSize; newWord->param[0]=lit; new((TypedValue*)(newWord->param+1)) TypedValue(kTypeParamDest, newWord->param+storageIndex); newWord->param[1+TvSize]=semis; new((TypedValue*)(newWord->param+storageIndex)) TypedValue(); // <- storage new ((Mutex *)(newWord->param+mutexIndex)) Mutex(); initMutex(*((Mutex *)(newWord->param+mutexIndex))); Dict[newWord->shortName]=newWord; Dict[newWord->longName]=newWord; // define utility words. Word *newWordBackup=inContext.newWord; // define >$varName (ex: >$x) std::string toVarName((">$"+*tos.stringPtr.get()).c_str()); Word *toVar=new Word(&toVarName); inContext.newWord=toVar; inContext.Compile(std::string(*tos.stringPtr.get())); inContext.Compile(std::string("store")); inContext.Compile(std::string("_semis")); inContext.FinishNewWord(); Dict[toVar->shortName]=toVar; Dict[toVar->longName ]=toVar; // dfine $varName> (ex: $x>) std::string fromVarName((("$"+*tos.stringPtr.get())+">").c_str()); Word *fromVar=new Word(&fromVarName); inContext.newWord=fromVar; inContext.Compile(std::string(*tos.stringPtr.get())); inContext.Compile(std::string("fetch")); inContext.Compile(std::string("_semis")); inContext.FinishNewWord(); Dict[fromVar->shortName]=fromVar; Dict[fromVar->longName ]=fromVar; inContext.newWord=newWordBackup; NEXT; })); // usage: value var store // ex: // "x" var // 100 x store // // value address --- // note: same as Forth's '!' Install(new Word("store",WORD_FUNC { if(inContext.DS.size()<2) { return inContext.Error(E_DS_AT_LEAST_2); } TypedValue tos=Pop(inContext.DS); if(tos.dataType!=kTypeParamDest) { return inContext.Error_InvalidType(E_TOS_PARAMDEST,tos); } Mutex *mutex=(Mutex *)(((Word**)tos.ipValue)+TvSize); Lock(*mutex); TypedValue second=Pop(inContext.DS); new((TypedValue*)tos.ipValue) TypedValue(second); Unlock(*mutex); NEXT; })); // address --- value // same as Forth's '@'. Install(new Word("fetch",WORD_FUNC { if(inContext.DS.size()<1) { return inContext.Error(E_DS_IS_EMPTY); } TypedValue tos=Pop(inContext.DS); if(tos.dataType!=kTypeParamDest) { return inContext.Error_InvalidType(E_TOS_PARAMDEST,tos); } Mutex *mutex=(Mutex *)(((Word**)tos.ipValue)+TvSize); Lock(*mutex); inContext.DS.emplace_back(*(TypedValue*)tos.ipValue); Unlock(*mutex); NEXT; })); // left_curly Install(new Word("{",WordLevel::Level2,WORD_FUNC { if( inContext.IsInComment() ) { NEXT; } inContext.BeginNoNameWordBlock(); NEXT; })); Install(new Word("}",WordLevel::Level2,WORD_FUNC { if( inContext.IsInComment() ) { NEXT; } inContext.Compile(std::string("_semis")); inContext.FinishNewWord(); TypedValue tvWord(kTypeWord,inContext.newWord); if(inContext.EndNoNameWordBlock()==false) { return false; } switch(inContext.ExecutionThreshold) { case kInterpretLevel: inContext.DS.emplace_back(tvWord); break; case kCompileLevel: assert(inContext.newWord!=NULL); inContext.Compile(std::string("_lit")); if(compileValue(inContext,tvWord)==false) { return false; } break; case kSymbolLevel: assert(inContext.newWord!=NULL); if(compileValue(inContext,tvWord)==false) { return false; } break; default: inContext.Error(E_SYSTEM_ERROR); exit(-1); } NEXT; })); Install(new Word("${",WordLevel::Level2,WORD_FUNC { if( inContext.IsInComment() ) { NEXT; } inContext.BeginNoNameWordBlock(); inContext.newWord->level=WordLevel::Immediate; NEXT; })); Install(new Word("{{",WordLevel::Level2,Dict["{"]->code)); Install(new Word("}}",WordLevel::Level2,WORD_FUNC { if( inContext.IsInComment() ) { NEXT; } inContext.Compile(std::string("_semis")); inContext.FinishNewWord(); TypedValue tvWord(kTypeWord,inContext.newWord); if(inContext.EndNoNameWordBlock()==false) { return false; } if(inContext.Exec(tvWord)==false) { return false; } NEXT; })); Install(new Word("/*",WordLevel::Level2,WORD_FUNC { if( isInCppStyleComment(inContext) ) { NEXT; } inContext.PushThreshold(); inContext.PushNewWord(); inContext.RS.emplace_back(kTypeMiscInt,kOPEN_C_STYLE_COMMENT); inContext.newWord=new Word(WordType::Normal); inContext.ExecutionThreshold=kSymbolLevel; NEXT; })); Install(new Word("*/",WordLevel::Level2,WORD_FUNC { if( isInCppStyleComment(inContext) ) { NEXT; } if(inContext.RS.size()<1) { return inContext.Error(E_C_STYLE_COMMENT_MISMATCH); } TypedValue& tvSyntax=ReadTOS(inContext.RS); if(tvSyntax.dataType==kTypeMiscInt && tvSyntax.intValue==kOPEN_CPP_STYLE_ONE_LINE_COMMENT) { // do nothing in CPP style comment. NEXT; } if(tvSyntax.dataType!=kTypeMiscInt || tvSyntax.intValue!=kOPEN_C_STYLE_COMMENT) { return inContext.Error(E_C_STYLE_COMMENT_MISMATCH); } Pop(inContext.RS); delete inContext.newWord->tmpParam; delete inContext.newWord; if(inContext.DS.size()<2) { return inContext.Error(E_DS_AT_LEAST_2); } TypedValue tvNW=Pop(inContext.DS); if(tvNW.dataType!=kTypeNewWord) { return inContext.Error_InvalidType(E_TOS_NEW_WORD,tvNW); } inContext.newWord=(Word *)tvNW.wordPtr; TypedValue tvThreshold=Pop(inContext.DS); if(tvThreshold.dataType!=kTypeThreshold) { return inContext.Error_InvalidType(E_SECOND_THRESHOLD,tvThreshold); } inContext.ExecutionThreshold=tvThreshold.intValue; NEXT; })); Install(new Word("//",WordLevel::Level2,WORD_FUNC { if( isInCStyleComment(inContext) ) { NEXT; } if( isInCppStyleComment(inContext) ) { NEXT; } inContext.PushThreshold(); inContext.PushNewWord(); inContext.RS.emplace_back(kTypeMiscInt,kOPEN_CPP_STYLE_ONE_LINE_COMMENT); inContext.newWord=new Word(WordType::Normal); inContext.ExecutionThreshold=kSymbolLevel; NEXT; })); Install(new Word(EOL_WORD,WordLevel::Level2,WORD_FUNC { if(inContext.RS.size()<1) { NEXT; } TypedValue& rsTos=ReadTOS(inContext.RS); if(rsTos.dataType==kTypeMiscInt && rsTos.intValue==kOPEN_CPP_STYLE_ONE_LINE_COMMENT) { delete inContext.newWord->tmpParam; delete inContext.newWord; if(inContext.DS.size()<2) { return inContext.Error(E_DS_AT_LEAST_2); } TypedValue tvNW=Pop(inContext.DS); if(tvNW.dataType!=kTypeNewWord) { return inContext.Error_InvalidType(E_TOS_NEW_WORD,tvNW); } inContext.newWord=(Word *)tvNW.wordPtr; Pop(inContext.RS); // already checked by ReadTOS(inContext.RS). TypedValue tvThreshold=Pop(inContext.DS); if(tvThreshold.dataType!=kTypeThreshold) { return inContext.Error_InvalidType(E_SECOND_THRESHOLD,tvThreshold); } inContext.ExecutionThreshold=tvThreshold.intValue; } NEXT; })); // (s -- wordPtr) Install(new Word(">word",WORD_FUNC { if(inContext.DS.size()<1) { return inContext.Error(E_DS_IS_EMPTY); } TypedValue tos=Pop(inContext.DS); if(tos.dataType!=kTypeString) { return inContext.Error_InvalidType(E_TOS_STRING,tos); } auto iter=Dict.find(*tos.stringPtr); if(iter==Dict.end()) { return inContext.Error(E_CAN_NOT_FIND_THE_WORD,*tos.stringPtr); } const Word *word=iter->second; inContext.DS.emplace_back(kTypeWord,word); NEXT; })); Install(new Word(">lit",WORD_FUNC { if(inContext.DS.size()<1) { return inContext.Error(E_DS_IS_EMPTY); } TypedValue tos=Pop(inContext.DS); inContext.Compile(std::string("_lit")); inContext.Compile(tos); NEXT; })); Install(new Word(">sym",WORD_FUNC { if(inContext.DS.size()<1) { return inContext.Error(E_DS_IS_EMPTY); } TypedValue tos=Pop(inContext.DS); inContext.Compile(tos); NEXT; })); // original-wordName aliaseName alias // ex: "dup" "case" alias Install(new Word("alias",WORD_FUNC { if(inContext.DS.size()<2) { return inContext.Error(E_DS_AT_LEAST_2); } TypedValue tvSrcWordName=Pop(inContext.DS); if(tvSrcWordName.dataType!=kTypeString) { return inContext.Error_InvalidType(E_SECOND_STRING,tvSrcWordName); } auto iter=Dict.find(*tvSrcWordName.stringPtr); if(iter==Dict.end()) { return inContext.Error(E_CAN_NOT_FIND_THE_WORD,*tvSrcWordName.stringPtr); } TypedValue tvNewWordName=Pop(inContext.DS); if(tvNewWordName.dataType!=kTypeString) { return inContext.Error_InvalidType(E_TOS_STRING,tvNewWordName); } const Word *srcWord=iter->second; const char *newWordName=strdup(tvNewWordName.stringPtr.get()->c_str()); Word *newWord=new Word(newWordName,srcWord->level,srcWord->code); Install(newWord); newWord->param=srcWord->param; newWord->tmpParam=srcWord->tmpParam; NEXT; })); // wordPtr --- Install(new Word("dump",WORD_FUNC { if(inContext.DS.size()<1) { return inContext.Error(E_DS_IS_EMPTY); } TypedValue tos=Pop(inContext.DS); if(tos.dataType!=kTypeWord && tos.dataType!=kTypeString) { return inContext.Error_InvalidType(E_TOS_WP,tos); } const Word *word=NULL; if(tos.dataType==kTypeWord) { word=tos.wordPtr; } else { auto iter=Dict.find(*tos.stringPtr); if(iter==Dict.end()) { return inContext.Error(E_CAN_NOT_FIND_THE_WORD,*tos.stringPtr); } word=iter->second; } if(word->isForgetable==false) { printf("the word '%s' is internal.\n",word->longName.c_str()); } else { printf("the word '%s' is:\n",word->longName.c_str()); const size_t n=word->tmpParam->size(); for(size_t i=0; i<n; i++) { printf("[%zu] ",i); word->tmpParam->at(i).Dump(); } } NEXT; })); } static bool colon(const char *inName,Context& inContext,bool inDefineShortend) { if(inContext.DS.size()<1) { return inContext.Error(E_DS_IS_EMPTY); } TypedValue tos=Pop(inContext.DS); if(tos.dataType!=kTypeString) { inContext.Error_InvalidType(E_TOS_STRING,tos); } Word *newWord=new Word(tos.stringPtr.get()); if(Install(newWord,inDefineShortend)==false) { delete newWord; inContext.newWord=NULL; return false; } newWord->isForgetable=true; inContext.newWord=newWord; inContext.SetCompileMode(); return true; } static bool compileValue(Context& inContext,TypedValue& inLambda) { if(inLambda.wordPtr->level==WordLevel::Immediate) { // the case of '${' if(inContext.Exec(inLambda)==false) { return false; } if(inContext.DS.size()<1) { return inContext.Error(E_DS_IS_EMPTY); } TypedValue tos=Pop(inContext.DS); inContext.Compile(tos); } else { inContext.Compile(inLambda); } return true; } static bool constant(const char *inName,Context& inContext,bool inOverwriteCheck) { if(inContext.DS.size()<2) { return inContext.Error(E_DS_AT_LEAST_2); } TypedValue tos=Pop(inContext.DS); TypedValue second=Pop(inContext.DS); if(second.dataType!=kTypeString) { return inContext.Error_InvalidType(E_SECOND_STRING,second); } if( inOverwriteCheck ) { auto iter=Dict.find(*second.stringPtr); if(iter!=Dict.end()) { return inContext.Error(E_ALREADY_DEFINED,*second.stringPtr); } } Word *newWord=new Word(second.stringPtr.get()); Word *newWordBackup=inContext.newWord; inContext.newWord=newWord; inContext.Compile(std::string("_lit")); inContext.Compile(tos); inContext.Compile(std::string("_semis")); inContext.FinishNewWord(); inContext.newWord=newWordBackup; Dict[newWord->shortName]=newWord; Dict[newWord->longName ]=newWord; return true; } static bool isInCStyleComment(Context& inContext) { if(inContext.RS.size()>0) { TypedValue& rsTos=ReadTOS(inContext.RS); if(rsTos.dataType==kTypeMiscInt && rsTos.intValue==kOPEN_C_STYLE_COMMENT) { return true; } } return false; } static bool isInCppStyleComment(Context& inContext) { if(inContext.RS.size()>0) { TypedValue& rsTos=ReadTOS(inContext.RS); if(rsTos.dataType==kTypeMiscInt && rsTos.intValue==kOPEN_CPP_STYLE_ONE_LINE_COMMENT) { return true; } } return false; }
29.83501
83
0.707648
objectx
c757b3b7c0a178e9dc5c34c01e1d0b8b1da636dd
5,367
cpp
C++
UI/BitmapCatalog.cpp
HaikuArchives/WhisperBeNet
56515401b1eab401a3b2390196f85d70aedaaedf
[ "MIT" ]
1
2021-01-09T14:59:21.000Z
2021-01-09T14:59:21.000Z
UI/BitmapCatalog.cpp
HaikuArchives/WhisperBeNet
56515401b1eab401a3b2390196f85d70aedaaedf
[ "MIT" ]
null
null
null
UI/BitmapCatalog.cpp
HaikuArchives/WhisperBeNet
56515401b1eab401a3b2390196f85d70aedaaedf
[ "MIT" ]
2
2015-01-04T10:10:39.000Z
2020-10-26T08:58:28.000Z
/***********************************************************************************************\ * BeNetBitmapCatalog.cpp * ************************************************************************************************* * Programmer par: Patrick Henri * * Derniere modification: 17-03-99 * ************************************************************************************************* * Cette classe singleton permet de stocker les bitmap. * \***********************************************************************************************/ #ifndef _BitmapCatalog_h #include "BitmapCatalog.h" #endif #include <File.h> #include <TranslatorRoster.h> #include <BitmapStream.h> #include <TranslationUtils.h> //OliverESP: BitmapCatalog* BitmapCatalog::m_pInstance = NULL; /*=============================================================================================*\ | BeNetBitmapCatalog | +-----------------------------------------------------------------------------------------------+ | Effet: Charge en memoire les bitmap. | \*=============================================================================================*/ BitmapCatalog::BitmapCatalog() { m_pLArrow = FetchBitmap("Bitmaps/LArrow.jpg", false); m_pRArrow = FetchBitmap("Bitmaps/RArrow.jpg", false); m_pAccept = FetchBitmap("Bitmaps/Accept.jpg", false); m_pCancel = FetchBitmap("Bitmaps/Cancel.jpg", false); m_pDelete = FetchBitmap("Bitmaps/Delete.jpg", false); m_pStatusBarRemote = FetchBitmap("Bitmaps/statusbar-remote.bmp", true); m_pStatusBarServer = FetchBitmap("Bitmaps/statusbar-server.bmp", true); m_pToolBarRemote = FetchBitmap("Bitmaps/toolbar_connect.bmp", true); m_pToolBarServer = FetchBitmap("Bitmaps/toolbar-online.bmp", true); m_pToolBarBookmarks = FetchBitmap("Bitmaps/toolbar-contacts.bmp", true); m_pToolBarPreferences = FetchBitmap("Bitmaps/toolbar-settings.bmp", true); m_pToolBarHelp = FetchBitmap("Bitmaps/toolbar-help.bmp", true); } /*=============================================================================================*\ | ~BeNetBitmapCatalog | +-----------------------------------------------------------------------------------------------+ | Effet: Detruit la seule instance de la classe ainsi que les bitmap. | \*=============================================================================================*/ BitmapCatalog::~BitmapCatalog() { delete m_pLArrow; delete m_pRArrow; delete m_pAccept; delete m_pCancel; delete m_pDelete; delete m_pStatusBarRemote; delete m_pStatusBarServer; delete m_pToolBarRemote; delete m_pToolBarServer; delete m_pToolBarBookmarks; delete m_pToolBarPreferences; delete m_pToolBarHelp; delete m_pInstance; } /*=============================================================================================*\ | Instance | +-----------------------------------------------------------------------------------------------+ | Effet: Cree la seule instance de la classe si elle n'existe pas deja. | | Sortie: | | BeNetBitmapCatalog*: Le pointeur vers la seule instance de la classe. | \*=============================================================================================*/ BitmapCatalog* BitmapCatalog::Instance() { if(m_pInstance == NULL) m_pInstance = new BitmapCatalog; return m_pInstance; } /*=============================================================================================*\ | FetchBitmap | +-----------------------------------------------------------------------------------------------+ | Effet: Converie une image en un BBitmap. La couleur de transparence est celle du pixel dans | | le coin superieur gauche. | | Entree: | | char *pzFileName: Le path du fichier image a convertir. | | bool bTran: True si on utilise la transparence, false sinon. | | Sortie: | | BBitmap *: Le pointeur le bitmap de l'image. NULL si la conversion a echouer. | \*=============================================================================================*/ BBitmap* BitmapCatalog::FetchBitmap(char* pzFileName, bool bTrans) { BFile file(pzFileName, B_READ_ONLY); BTranslatorRoster *roster = BTranslatorRoster::Default(); BBitmapStream stream; BBitmap *result = NULL; if (roster->Translate(&file, NULL, NULL, &stream, B_TRANSLATOR_BITMAP) < B_OK) return NULL; stream.DetachBitmap(&result); // OliverESP: 7 x 1 so -> #include <TranslationUtils.h> //OliverESP: // less code and works //BBitmap *result = BTranslationUtils::GetBitmapFile(pzFileName); if (result == NULL) return NULL; if(!bTrans) return result; int32 iLenght = result->BitsLength() / 4; int32 i; int32 * cBit = (int32*)result->Bits(); int32 backColor = cBit[result->Bounds().IntegerWidth() - 1]; int32 iTrans = 0; //Determine le mode de definition de couleur switch(result->ColorSpace()) { case B_RGB32: iTrans = B_TRANSPARENT_MAGIC_RGBA32; break; case B_RGB32_BIG: iTrans = B_TRANSPARENT_MAGIC_RGBA32_BIG; break; default: break; //TODO: Major screwup here! } if (iTrans) { for(i = 0; i < iLenght; i++) { if(cBit[i] == backColor) cBit[i] = iTrans; } } return result; }
38.06383
97
0.484069
HaikuArchives
c75b8f6dc620adf01ebc97733ab40ce6c88b1c77
435
cpp
C++
ianlmk/cs161a/c++/misc/zybooks7.2.cpp
ianlmk/cs161
7a50740d1642ca0111a6d0d076b600744552a066
[ "MIT" ]
null
null
null
ianlmk/cs161a/c++/misc/zybooks7.2.cpp
ianlmk/cs161
7a50740d1642ca0111a6d0d076b600744552a066
[ "MIT" ]
1
2022-03-25T18:34:47.000Z
2022-03-25T18:35:23.000Z
ianlmk/cs161a/c++/misc/zybooks7.2.cpp
ianlmk/cs161
7a50740d1642ca0111a6d0d076b600744552a066
[ "MIT" ]
null
null
null
#include <iostream> #include <iomanip> using namespace std; int main() { string word = "words"; cout << "\n\n2 number combos" << endl; for (int i = 0; i < word.length() ; ++i) { cout << word[i] << ","; for (int x = i; x > word.length(); x--) { cout << word[x] << ","; for (int y = x; y < word.length(); ++y) { cout << word[y] << "," << endl; } } cout << endl; } return 0; }
17.4
47
0.452874
ianlmk
c75c39292fde09061c83d84e1d1c77ca842dbc71
2,353
cpp
C++
OgreCWrapper/Src/ManagedRenderTargetListener.cpp
AnomalousMedical/Engine
a19e21f597bd277e4ca17e0e5f3f89577f2307bb
[ "MIT" ]
null
null
null
OgreCWrapper/Src/ManagedRenderTargetListener.cpp
AnomalousMedical/Engine
a19e21f597bd277e4ca17e0e5f3f89577f2307bb
[ "MIT" ]
null
null
null
OgreCWrapper/Src/ManagedRenderTargetListener.cpp
AnomalousMedical/Engine
a19e21f597bd277e4ca17e0e5f3f89577f2307bb
[ "MIT" ]
null
null
null
#include "StdAfx.h" class ManagedRenderTargetListener : Ogre::RenderTargetListener { public: ManagedRenderTargetListener(NativeAction preRenderTargetUpdateCb, NativeAction postRenderTargetUpdateCb, NativeAction preViewportUpdateCb, NativeAction postViewportUpdateCb, NativeAction viewportAddedCb, NativeAction viewportRemovedCb HANDLE_ARG) :preRenderTargetUpdateCb(preRenderTargetUpdateCb), postRenderTargetUpdateCb(postRenderTargetUpdateCb), preViewportUpdateCb(preViewportUpdateCb), postViewportUpdateCb(postViewportUpdateCb), viewportAddedCb(viewportAddedCb), viewportRemovedCb(viewportRemovedCb) ASSIGN_HANDLE_INITIALIZER { } virtual ~ManagedRenderTargetListener() { } virtual void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) { preRenderTargetUpdateCb(PASS_HANDLE); } virtual void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) { postRenderTargetUpdateCb(PASS_HANDLE); } virtual void preViewportUpdate(const Ogre::RenderTargetViewportEvent& evt) { preViewportUpdateCb(PASS_HANDLE); } virtual void postViewportUpdate(const Ogre::RenderTargetViewportEvent& evt) { postViewportUpdateCb(PASS_HANDLE); } virtual void viewportAdded(const Ogre::RenderTargetViewportEvent& evt) { viewportAddedCb(PASS_HANDLE); } virtual void viewportRemoved(const Ogre::RenderTargetViewportEvent& evt) { viewportRemovedCb(PASS_HANDLE); } private: NativeAction preRenderTargetUpdateCb; NativeAction postRenderTargetUpdateCb; NativeAction preViewportUpdateCb; NativeAction postViewportUpdateCb; NativeAction viewportAddedCb; NativeAction viewportRemovedCb; HANDLE_INSTANCE }; extern "C" _AnomalousExport ManagedRenderTargetListener* ManagedRenderTargetListener_Create(NativeAction preRenderTargetUpdateCb, NativeAction postRenderTargetUpdateCb, NativeAction preViewportUpdateCb, NativeAction postViewportUpdateCb, NativeAction viewportAddedCb, NativeAction viewportRemovedCb HANDLE_ARG) { return new ManagedRenderTargetListener(preRenderTargetUpdateCb, postRenderTargetUpdateCb, preViewportUpdateCb, postViewportUpdateCb, viewportAddedCb, viewportRemovedCb PASS_HANDLE_ARG); } extern "C" _AnomalousExport void ManagedRenderTargetListener_Delete(ManagedRenderTargetListener *listener) { delete listener; }
32.680556
311
0.822354
AnomalousMedical
c75c3e8d3776c3977dfeef364cff002732cda124
7,297
hpp
C++
include/nonstd/fifo-set.hpp
cjxgm/fifo-map
714f57b5de6aeab88cd00a0c0def9ae368851dba
[ "MIT" ]
null
null
null
include/nonstd/fifo-set.hpp
cjxgm/fifo-map
714f57b5de6aeab88cd00a0c0def9ae368851dba
[ "MIT" ]
null
null
null
include/nonstd/fifo-set.hpp
cjxgm/fifo-map
714f57b5de6aeab88cd00a0c0def9ae368851dba
[ "MIT" ]
null
null
null
#pragma once // A hash set that guarantees iteration in insertion-order for C++14 or above. // Or you can say, "a FIFO-ordered duplication-free container" if you feel like it. // // It's basically an `std::forward_list` of values, // with a lookup index built using `std::unordered_map`. // // It's a drop-in replacement for `std::unordered_set` // if the interface you used was implemented. // // Time complexity of all implemented operations are basically // the same as `std::unordered_map`, which should be the same as `std::unordered_set`. // // Copyright (C) Giumo Clanjor (哆啦比猫/兰威举), 2020. // Licensed under the MIT License. #include <unordered_map> #include <forward_list> #include <cassert> namespace nonstd { template < class T , class Hash = std::hash<T> , class Equal = std::equal_to<T> > struct fifo_set final { using value_type = T; using hasher = Hash; using equal = Equal; using list_type = std::forward_list<value_type>; using list_iterator = typename list_type::iterator; using list_const_iterator = typename list_type::const_iterator; using iterator = list_iterator; using const_iterator = list_const_iterator; struct value_reference final { value_reference(value_type const& x): x{x} {} auto hash() const -> std::size_t { hasher h{}; return h(x); } friend auto operator == (value_reference const& a, value_reference const& b) -> bool { equal eq{}; return eq(a.x, b.x); } private: value_type const& x; }; struct value_reference_hasher final { auto operator () (value_reference const& xr) const -> std::size_t { return xr.hash(); } }; using map_type = std::unordered_map<value_reference, list_iterator, value_reference_hasher>; using map_iterator = typename map_type::iterator; using size_type = typename map_type::size_type; // rule of five; force noexcept move constructible fifo_set() = default; fifo_set(fifo_set const& x) { for (auto&& kv: x) emplace_back(kv); } auto operator = (fifo_set const& x) -> fifo_set& { clear(); for (auto&& kv: x) emplace_back(kv); return *this; } fifo_set(fifo_set&& other) noexcept : map{std::move(other.map)} , list{std::move(other.list)} , list_back{(list.empty() ? list.before_begin() : other.list_back)} { if (!list.empty()) map.at(list.front()) = list.before_begin(); } auto operator = (fifo_set&& other) noexcept -> fifo_set& { map = std::move(other.map); list = std::move(other.list); list_back = (list.empty() ? list.before_begin() : other.list_back); if (!list.empty()) map.at(list.front()) = list.before_begin(); return *this; } // For interface compatibility with std::unordered_set. template <class... Args> auto emplace(Args&&... args) -> std::pair<iterator, bool> { return emplace_back(std::forward<Args>(args)...); } template <class... Args> auto emplace_back(Args&&... args) -> std::pair<iterator, bool> { value_type value{std::forward<Args>(args)...}; auto map_it = map.find(value); if (map_it == map.end()) { auto list_before_item = list_back; list_back = list.insert_after(list_back, std::move(value)); map.emplace(*list_back, list_before_item); return { list_back, true }; } else { auto list_it = map_it->second; ++list_it; return { list_it, false }; } } template <class... Args> auto emplace_front(Args&&... args) -> std::pair<iterator, bool> { value_type value{std::forward<Args>(args)...}; auto map_it = map.find(value); if (map_it == map.end()) { auto& list_it = (empty() ? list_back : map.at(list.front())); auto list_before_item = list_it; list_it = list.insert_after(list_before_item, std::move(value)); map.emplace(*list_it, list_before_item); return { list_it, true }; } else { auto list_it = map_it->second; ++list_it; return { list_it, false }; } } auto erase(list_iterator list_it) -> void { auto map_it = map.find(*list_it); assert(map_it != map.end()); auto list_before_item = map_it->second; map.erase(map_it); list_it = list.erase_after(list_before_item); if (list_it == list.end()) { list_back = list_before_item; } else { map.at(*list_it) = list_before_item; } } auto erase(value_type const& x) -> void { auto map_it = map.find(x); if (map_it == map.end()) return; auto list_before_item = map_it->second; map.erase(map_it); auto list_it = list.erase_after(list_before_item); if (list_it == list.end()) { list_back = list_before_item; } else { map.at(*list_it) = list_before_item; } } auto clear() -> void { map.clear(); list.clear(); list_back = list.before_begin(); } auto count(value_type const& x) const -> size_type { return map.count(x); } auto size() const -> size_type { return map.size(); } auto empty() const -> bool { return map.empty(); } auto find(value_type const& x) const -> const_iterator { auto map_it = map.find(x); if (map_it == map.end()) return end(); auto list_before_item = map_it->second; return ++list_before_item; } auto find(value_type const& x) -> iterator { auto map_it = map.find(x); if (map_it == map.end()) return end(); auto list_before_item = map_it->second; return ++list_before_item; } auto begin() -> iterator { return list.begin(); } auto end() -> iterator { return list. end(); } auto begin() const -> const_iterator { return list.begin(); } auto end() const -> const_iterator { return list. end(); } auto cbegin() const -> const_iterator { return list.cbegin(); } auto cend() const -> const_iterator { return list. cend(); } private: map_type map; list_type list; list_iterator list_back{list.before_begin()}; }; }
29.905738
100
0.521036
cjxgm
c75d10916f644b9347ac9371979a620158399f8f
3,001
cxx
C++
main/sw/source/ui/table/rowht.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
679
2015-01-06T06:34:58.000Z
2022-03-30T01:06:03.000Z
main/sw/source/ui/table/rowht.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
102
2017-11-07T08:51:31.000Z
2022-03-17T12:13:49.000Z
main/sw/source/ui/table/rowht.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
331
2015-01-06T11:40:55.000Z
2022-03-14T04:07:51.000Z
/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. * *************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" #ifdef SW_DLLIMPLEMENTATION #undef SW_DLLIMPLEMENTATION #endif #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <sfx2/dispatch.hxx> #include <svx/dlgutil.hxx> #include <fmtfsize.hxx> #include <swtypes.hxx> #include <rowht.hxx> #include <wrtsh.hxx> #include <frmatr.hxx> #ifndef _WDOCSH_HXX #include <wdocsh.hxx> #endif #ifndef _VIEW_HXX #include <view.hxx> #endif #include <swmodule.hxx> #include <usrpref.hxx> #ifndef _CMDID_H #include <cmdid.h> #endif #ifndef _ROWHT_HRC #include <rowht.hrc> #endif #ifndef _TABLE_HRC #include <table.hrc> #endif void SwTableHeightDlg::Apply() { SwTwips nHeight = static_cast< SwTwips >(aHeightEdit.Denormalize(aHeightEdit.GetValue(FUNIT_TWIP))); SwFmtFrmSize aSz(ATT_FIX_SIZE, 0, nHeight); SwFrmSize eFrmSize = (SwFrmSize) aAutoHeightCB.IsChecked() ? ATT_MIN_SIZE : ATT_FIX_SIZE; if(eFrmSize != aSz.GetHeightSizeType()) { aSz.SetHeightSizeType(eFrmSize); } rSh.SetRowHeight( aSz ); } // CTOR / DTOR ----------------------------------------------------------- SwTableHeightDlg::SwTableHeightDlg( Window *pParent, SwWrtShell &rS ) : SvxStandardDialog(pParent, SW_RES(DLG_ROW_HEIGHT)), aHeightFL(this, SW_RES(FL_HEIGHT)), aHeightEdit(this, SW_RES(ED_HEIGHT)), aAutoHeightCB(this, SW_RES(CB_AUTOHEIGHT)), aOKBtn(this, SW_RES(BT_OK)), aCancelBtn(this, SW_RES(BT_CANCEL)), aHelpBtn( this, SW_RES( BT_HELP ) ), rSh( rS ) { FreeResource(); FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() ) )->GetMetric(); ::SetFieldUnit( aHeightEdit, eFieldUnit ); aHeightEdit.SetMin(MINLAY, FUNIT_TWIP); if(!aHeightEdit.GetMin()) aHeightEdit.SetMin(1); SwFmtFrmSize *pSz; rSh.GetRowHeight( pSz ); if ( pSz ) { long nHeight = pSz->GetHeight(); aAutoHeightCB.Check(pSz->GetHeightSizeType() != ATT_FIX_SIZE); aHeightEdit.SetValue(aHeightEdit.Normalize(nHeight), FUNIT_TWIP); delete pSz; } }
25.649573
104
0.688437
Grosskopf
c75d9bba4880f0d536589fcbf0ef236d3655c50b
3,628
cpp
C++
cpp/godot-cpp/src/gen/InputMap.cpp
GDNative-Gradle/proof-of-concept
162f467430760cf959f68f1638adc663fd05c5fd
[ "MIT" ]
1
2021-03-16T09:51:00.000Z
2021-03-16T09:51:00.000Z
cpp/godot-cpp/src/gen/InputMap.cpp
GDNative-Gradle/proof-of-concept
162f467430760cf959f68f1638adc663fd05c5fd
[ "MIT" ]
null
null
null
cpp/godot-cpp/src/gen/InputMap.cpp
GDNative-Gradle/proof-of-concept
162f467430760cf959f68f1638adc663fd05c5fd
[ "MIT" ]
null
null
null
#include "InputMap.hpp" #include <core/GodotGlobal.hpp> #include <core/CoreTypes.hpp> #include <core/Ref.hpp> #include <core/Godot.hpp> #include "__icalls.hpp" #include "InputEvent.hpp" namespace godot { InputMap *InputMap::_singleton = NULL; InputMap::InputMap() { _owner = godot::api->godot_global_get_singleton((char *) "InputMap"); } InputMap::___method_bindings InputMap::___mb = {}; void InputMap::___init_method_bindings() { ___mb.mb_action_add_event = godot::api->godot_method_bind_get_method("InputMap", "action_add_event"); ___mb.mb_action_erase_event = godot::api->godot_method_bind_get_method("InputMap", "action_erase_event"); ___mb.mb_action_erase_events = godot::api->godot_method_bind_get_method("InputMap", "action_erase_events"); ___mb.mb_action_has_event = godot::api->godot_method_bind_get_method("InputMap", "action_has_event"); ___mb.mb_action_set_deadzone = godot::api->godot_method_bind_get_method("InputMap", "action_set_deadzone"); ___mb.mb_add_action = godot::api->godot_method_bind_get_method("InputMap", "add_action"); ___mb.mb_erase_action = godot::api->godot_method_bind_get_method("InputMap", "erase_action"); ___mb.mb_event_is_action = godot::api->godot_method_bind_get_method("InputMap", "event_is_action"); ___mb.mb_get_action_list = godot::api->godot_method_bind_get_method("InputMap", "get_action_list"); ___mb.mb_get_actions = godot::api->godot_method_bind_get_method("InputMap", "get_actions"); ___mb.mb_has_action = godot::api->godot_method_bind_get_method("InputMap", "has_action"); ___mb.mb_load_from_globals = godot::api->godot_method_bind_get_method("InputMap", "load_from_globals"); } void InputMap::action_add_event(const String action, const Ref<InputEvent> event) { ___godot_icall_void_String_Object(___mb.mb_action_add_event, (const Object *) this, action, event.ptr()); } void InputMap::action_erase_event(const String action, const Ref<InputEvent> event) { ___godot_icall_void_String_Object(___mb.mb_action_erase_event, (const Object *) this, action, event.ptr()); } void InputMap::action_erase_events(const String action) { ___godot_icall_void_String(___mb.mb_action_erase_events, (const Object *) this, action); } bool InputMap::action_has_event(const String action, const Ref<InputEvent> event) { return ___godot_icall_bool_String_Object(___mb.mb_action_has_event, (const Object *) this, action, event.ptr()); } void InputMap::action_set_deadzone(const String action, const real_t deadzone) { ___godot_icall_void_String_float(___mb.mb_action_set_deadzone, (const Object *) this, action, deadzone); } void InputMap::add_action(const String action, const real_t deadzone) { ___godot_icall_void_String_float(___mb.mb_add_action, (const Object *) this, action, deadzone); } void InputMap::erase_action(const String action) { ___godot_icall_void_String(___mb.mb_erase_action, (const Object *) this, action); } bool InputMap::event_is_action(const Ref<InputEvent> event, const String action) const { return ___godot_icall_bool_Object_String(___mb.mb_event_is_action, (const Object *) this, event.ptr(), action); } Array InputMap::get_action_list(const String action) { return ___godot_icall_Array_String(___mb.mb_get_action_list, (const Object *) this, action); } Array InputMap::get_actions() { return ___godot_icall_Array(___mb.mb_get_actions, (const Object *) this); } bool InputMap::has_action(const String action) const { return ___godot_icall_bool_String(___mb.mb_has_action, (const Object *) this, action); } void InputMap::load_from_globals() { ___godot_icall_void(___mb.mb_load_from_globals, (const Object *) this); } }
39.868132
113
0.791621
GDNative-Gradle
c75e5403bac8737812337909399e723929a4171c
1,692
cpp
C++
carpi_master/src/comm/comm_server.cpp
Yanick-Salzmann/carpi
29f5e1bf1eb6243e45690f040e4df8e7c228e897
[ "Apache-2.0" ]
2
2020-06-07T16:47:20.000Z
2021-03-20T10:41:34.000Z
carpi_master/src/comm/comm_server.cpp
Yanick-Salzmann/carpi
29f5e1bf1eb6243e45690f040e4df8e7c228e897
[ "Apache-2.0" ]
null
null
null
carpi_master/src/comm/comm_server.cpp
Yanick-Salzmann/carpi
29f5e1bf1eb6243e45690f040e4df8e7c228e897
[ "Apache-2.0" ]
null
null
null
#include <common_utils/error.hpp> #include "comm_server.hpp" namespace carpi { LOGGER_IMPL(CommServer); CommServer::CommServer() { _server = std::make_shared<bluetooth::BluetoothServer>(0x01); _network_thread = std::thread{[=]() { network_runner(); }}; } void CommServer::shutdown_acceptor(){ _is_running = false; if(_network_thread.joinable()) { _network_thread.join(); } } void CommServer::network_runner() { while(_is_running) { fd_set socket_set{}; FD_ZERO(&socket_set); auto max_socket = _server->fd(); FD_SET(_server->fd(), &socket_set); for(const auto& connection : _connections) { FD_SET(connection->fd(), &socket_set); max_socket = std::max(max_socket, connection->fd()); } timeval timeout{ .tv_sec = 1, .tv_usec = 0 }; const auto rc = select(max_socket + 1, &socket_set, nullptr, nullptr, &timeout); if(rc < 0) { log->error("Error selecting from sockets: {} (errno={})", utils::error_to_string(errno), errno); return; // TODO: trigger error } if(rc > 0) { if(FD_ISSET(_server->fd(), &socket_set)) { const auto connection = _server->accept_connection(); log->info("Accepted new bluetooth connection: {}", connection->to_string()); _connections.emplace_back(connection); } // TODO: handle active connections } } } }
29.684211
112
0.521868
Yanick-Salzmann
c75f86e06ccc6dc9584efbdffd9456c5d9b48991
1,734
cpp
C++
vol2/valid-number/valid-number.cpp
zeyuanxy/LeetCode
fab1b6ea07249d7024f37a8f4bbef9d397edc3ec
[ "MIT" ]
3
2015-12-07T05:40:08.000Z
2018-12-17T18:39:15.000Z
vol2/valid-number/valid-number.cpp
zeyuanxy/leet-code
fab1b6ea07249d7024f37a8f4bbef9d397edc3ec
[ "MIT" ]
null
null
null
vol2/valid-number/valid-number.cpp
zeyuanxy/leet-code
fab1b6ea07249d7024f37a8f4bbef9d397edc3ec
[ "MIT" ]
null
null
null
class Solution { public: bool isNumber(const char *s) { int start = 0, end = 0; int len = strlen(s), ePos = -1, pPos = -1; for(start = 0; start < len; ++ start) if(s[start] != ' ') break; for(end = len - 1; end >= 0; -- end) if(s[end] != ' ') break; if(s[start] == '-' || s[start] == '+') ++ start; bool flag = false; for(int i = start; i <= end; ++ i) if(!isdigit(s[i])) { if(s[i] == 'e' && ePos == -1) ePos = i; else if(s[i] == '.' && pPos == -1) pPos = i; else if((s[i] == '+' || s[i] == '-') && ePos == i - 1 && i < end) ; else return false; } else flag = true; if(!flag) return false; if(ePos >= start) { if(ePos == start || (!isdigit(s[ePos - 1]) && s[ePos - 1] != '.')) return false; if(ePos + 1 > end || (!isdigit(s[ePos + 1]) && s[ePos + 1] != '.' && s[ePos + 1] != '+' && s[ePos + 1] != '-')) return false; } if(pPos >= start) { if(pPos > start && !isdigit(s[pPos - 1]) && s[pPos - 1] != 'e') return false; if(pPos < end && !isdigit(s[pPos + 1]) && s[pPos + 1] != 'e') return false; if(pPos == start && ePos == pPos + 1) return false; if(pPos == end && ePos == pPos - 1) return false; } if(ePos >= 0 && pPos > ePos) return false; return true; } };
34.68
123
0.340254
zeyuanxy
c75f9c1a3ad094e5958f95b370a65ae9dafced56
12,714
hpp
C++
src/circular_list.hpp
mrtryhard/circular_list
47807fd5025e93b5978011a0927a20b084229d26
[ "BSD-3-Clause" ]
null
null
null
src/circular_list.hpp
mrtryhard/circular_list
47807fd5025e93b5978011a0927a20b084229d26
[ "BSD-3-Clause" ]
1
2018-03-19T22:52:13.000Z
2018-03-19T22:52:13.000Z
src/circular_list.hpp
mrtryhard/circular_list
47807fd5025e93b5978011a0927a20b084229d26
[ "BSD-3-Clause" ]
null
null
null
#ifndef MRT_CONTAINERS_CIRCULAR_LIST_HPP_ #define MRT_CONTAINERS_CIRCULAR_LIST_HPP_ #include <algorithm> #include <cstddef> #include <initializer_list> #include <iterator> namespace mrt { namespace containers { namespace { template<typename T, typename size_type = std::size_t> T* next(T* buffer, size_type max_size, T* position) noexcept { if (position == buffer + max_size) { return buffer; } else { return position + 1; } } template<typename T, typename size_type = std::size_t> T* previous(T* buffer, size_type max_size, T* position) noexcept { if (position == buffer) { return buffer + max_size; } else { return position - 1; } } } template<typename U> class circular_iterator { public: using value_type = U; using pointer = U * ; using const_pointer = const U*; using reference = U & ; using const_reference = const U&; using iterator_category = std::random_access_iterator_tag; using size_type = std::size_t; using difference_type = std::ptrdiff_t; using my_it = circular_iterator<value_type>; public: using _Unchecked_type = circular_iterator<U>; // msvc C4996. private: pointer value; pointer base; size_type max_size; bool tail_over_head; public: circular_iterator() = delete; explicit circular_iterator(pointer val, pointer buffer, size_type max_size, bool tail_over_head) : value{ val }, base{ buffer }, max_size{ max_size }, tail_over_head{ tail_over_head } {} circular_iterator(const circular_iterator<value_type>& other) : value{ other.value }, base{ other.base }, max_size{ other.max_size } {} my_it& operator=(const my_it& other) { value = other.value; base = other.base; max_size = other.max_size; return *this; } reference operator*() noexcept { return *value; } const_reference operator*() const noexcept { return *value; } pointer operator->() noexcept { return &(operator*()); } const_pointer operator->() const noexcept { return &(operator*()); } reference operator [] (difference_type n) noexcept { return *(*this + n); } const_reference operator [] (difference_type n) const noexcept { return *(*this + n); } bool operator==(const my_it& other) { return value == other.value; } bool operator!=(const my_it& other) { return !(*this == other); } my_it& operator+=(difference_type n) noexcept { if (n >= 0) { while (n--) value = previous(base, max_size, value); } else { while (n++) value = next(base, max_size, value); } return *this; } my_it operator+(difference_type n) const noexcept { my_it new_it{ value, base, max_size, tail_over_head }; new_it += n; return new_it; } my_it operator-(difference_type n) const noexcept { my_it new_it{ value, base, max_size, tail_over_head }; new_it += -n; return new_it; } difference_type operator-(my_it n) const noexcept { if (tail_over_head) { return ((base + static_cast<std::ptrdiff_t>(max_size + 1)) - value) + (n.value - base); } else { return n.value - value; } } my_it& operator-=(difference_type n) noexcept { return *this += (-n); } my_it& operator++(int) { value = previous(base, max_size, value); return *this; } my_it& operator++() { value = previous(base, max_size, value); return *this; } my_it& operator--(int) { value = next(base, max_size, value); return *this; } my_it& operator--() { value = next(base, max_size, value); return *this; } bool operator<(my_it b) const noexcept { auto n = (b - *this); return n < 0; } bool operator>(my_it b) const noexcept { return b < *this; } bool operator>=(my_it b) const noexcept { return !(*this < b); } bool operator<=(my_it b) const noexcept { return !(*this > b); } }; template<typename T> class circular_list { public: using value_type = T; using size_type = std::size_t; using pointer = value_type * ; using const_pointer = const pointer; using reference = value_type & ; using const_reference = const value_type&; using iterator = circular_iterator<value_type>; using const_iterator = const circular_iterator<value_type>; using reverse_iterator = std::reverse_iterator<circular_iterator<value_type> >; using const_reverse_iterator = const reverse_iterator; private: size_type max_size; pointer buffer; pointer head; pointer tail; public: circular_list() = delete; explicit circular_list(size_type size) : max_size{ size }, buffer{ new value_type[size + 1] } { head = tail = buffer; } explicit circular_list(std::initializer_list<value_type> list) : max_size{ list.size() }, buffer{ new value_type[list.size() + 1] } { head = buffer + list.size(); tail = buffer; try { std::copy(std::rbegin(list), std::rend(list), begin()); } catch (...) { delete[] buffer; throw; } } template<typename It> circular_list(It first, It last) : max_size{ std::distance(first, last) }, buffer{ new value_type[max_size + 1] }, head{ buffer + 1 }, tail{ buffer } { try { std::copy(first, last, begin()); } catch (...) { delete[] buffer; throw; } } circular_list(circular_list<value_type>&& other) noexcept : max_size{ other.max_size }, buffer{ other.buffer }, head{ other.head }, tail{ other.tail } { other.buffer = {}; other.head = {}; other.tail = {}; other.max_size = {}; } circular_list(const circular_list<value_type>& other) : max_size{ other.max_size }, buffer{ new value_type[max_size + 1] }, head{ buffer + 1 }, tail{ buffer } { try { std::copy(other.crbegin(), other.crend(), begin()); head = buffer + (other.head - other.buffer); tail = buffer + (other.tail - other.buffer); } catch (...) { delete[] buffer; throw; } } circular_list<value_type>& operator=(const circular_list<value_type>& other) { if (this == &other) return *this; head = buffer + 1; tail = buffer; std::copy(other.crbegin(), other.crend(), begin()); head = buffer + (other.head - other.buffer); tail = buffer + (other.tail - other.buffer); return *this; } circular_list<value_type>& operator=(circular_list<value_type>&& other) { delete[] buffer; buffer = other.buffer; head = other.head; tail = other.tail; max_size = other.max_size; other.buffer = {}; other.head = {}; other.tail = {}; other.max_size = {}; return *this; } ~circular_list() { delete[] buffer; } reference front() noexcept { return *previous(buffer, max_size, head); } const_reference front() const noexcept { return *previous(buffer, max_size, head); } reference back() noexcept { return *tail; } const_reference back() const noexcept { return *tail; } void pop() { tail = next(buffer, max_size, tail); } void push(const value_type& element) { *head = element; head = next(buffer, max_size, head); if (head == tail) { tail = next(buffer, max_size, tail); } } void push(value_type&& element) { *head = std::move(element); head = next(buffer, max_size, head); if (head == tail) { tail = next(buffer, max_size, tail); } } void swap(circular_list<value_type>& other) noexcept { std::swap(head, other.head); std::swap(tail, other.tail); std::swap(buffer, other.buffer); std::swap(max_size, other.max_size); } bool empty() const noexcept { return head == tail; } bool full() const noexcept { return next(buffer, max_size, head) == tail; } void clear() noexcept { head = buffer; tail = buffer; } size_type size() const noexcept { if (head >= tail) { return static_cast<size_type>(head - tail); } else { return static_cast<size_type>((head + (max_size + 1) - tail)); } } iterator begin() noexcept { return iterator{ previous(buffer, max_size, head), buffer, max_size, tail > head }; } reverse_iterator rbegin() noexcept { return reverse_iterator{ iterator{ previous(buffer, max_size, tail), buffer, max_size, tail > head } }; } const_iterator cbegin() const noexcept { return const_iterator{ previous(buffer, max_size, head), buffer, max_size, tail > head }; } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator{ const_iterator{ previous(buffer, max_size, tail), buffer, max_size, tail > head } }; } iterator end() noexcept { return iterator{ previous(buffer, max_size, tail), buffer, max_size, tail > head }; } reverse_iterator rend() noexcept { return reverse_iterator{ iterator{ previous(buffer, max_size, head), buffer, max_size, tail > head } }; } const_iterator cend() const noexcept { return const_iterator{ previous(buffer, max_size, tail), buffer, max_size, tail > head }; } const_reverse_iterator crend() const noexcept { return const_reverse_iterator{ const_iterator{ previous(buffer, max_size, head), buffer, max_size, tail > head } }; } }; template <class TValue> void swap(circular_list<TValue>& left, circular_list<TValue>& right) noexcept { left.swap(right); } } } #endif
33.195822
147
0.471606
mrtryhard
c75fc01f8fd87b552cf23271ec96e323eee96c2d
2,232
hpp
C++
external/boost_1_60_0/qsboost/range/size.hpp
wouterboomsma/quickstep
a33447562eca1350c626883f21c68125bd9f776c
[ "MIT" ]
1
2019-06-27T17:54:13.000Z
2019-06-27T17:54:13.000Z
external/boost_1_60_0/qsboost/range/size.hpp
wouterboomsma/quickstep
a33447562eca1350c626883f21c68125bd9f776c
[ "MIT" ]
null
null
null
external/boost_1_60_0/qsboost/range/size.hpp
wouterboomsma/quickstep
a33447562eca1350c626883f21c68125bd9f776c
[ "MIT" ]
null
null
null
// Boost.Range library // // Copyright Thorsten Ottosen 2003-2004. Use, modification and // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // For more information, see http://www.boost.org/libs/range/ // #ifndef QSBOOST_RANGE_SIZE_HPP #define QSBOOST_RANGE_SIZE_HPP #if defined(_MSC_VER) # pragma once #endif #include <qsboost/range/config.hpp> #include <qsboost/range/begin.hpp> #include <qsboost/range/end.hpp> #include <qsboost/range/size_type.hpp> #include <qsboost/range/detail/has_member_size.hpp> #include <qsboost/assert.hpp> #include <qsboost/cstdint.hpp> #include <qsboost/utility.hpp> namespace qsboost { namespace range_detail { template<class SinglePassRange> inline typename ::qsboost::enable_if< has_member_size<SinglePassRange>, typename range_size<const SinglePassRange>::type >::type range_calculate_size(const SinglePassRange& rng) { return rng.size(); } template<class SinglePassRange> inline typename disable_if< has_member_size<SinglePassRange>, typename range_size<const SinglePassRange>::type >::type range_calculate_size(const SinglePassRange& rng) { return std::distance(qsboost::begin(rng), qsboost::end(rng)); } } template<class SinglePassRange> inline typename range_size<const SinglePassRange>::type size(const SinglePassRange& rng) { // Very strange things happen on some compilers that have the range concept // asserts disabled. This preprocessor condition is clearly redundant on a // working compiler but is vital for at least some compilers such as clang 4.2 // but only on the Mac! #if QSBOOST_RANGE_ENABLE_CONCEPT_ASSERT == 1 QSBOOST_RANGE_CONCEPT_ASSERT((qsboost::SinglePassRangeConcept<SinglePassRange>)); #endif #if !QSBOOST_WORKAROUND(__BORLANDC__, QSBOOST_TESTED_AT(0x564)) && \ !QSBOOST_WORKAROUND(__GNUC__, < 3) \ /**/ using namespace range_detail; #endif return range_calculate_size(rng); } } // namespace 'boost' #endif
28.987013
89
0.702957
wouterboomsma
c763f174c1bf57f3f95c19b6bab7bc7a91ef7619
3,552
hpp
C++
sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/delete_key_operation.hpp
chidozieononiwu/azure-sdk-for-cpp
7d9032fcc815523231d6ff3e1d96d6212e94b079
[ "MIT" ]
null
null
null
sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/delete_key_operation.hpp
chidozieononiwu/azure-sdk-for-cpp
7d9032fcc815523231d6ff3e1d96d6212e94b079
[ "MIT" ]
null
null
null
sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/delete_key_operation.hpp
chidozieononiwu/azure-sdk-for-cpp
7d9032fcc815523231d6ff3e1d96d6212e94b079
[ "MIT" ]
null
null
null
// Copyright (c) Microsoft Corporation. All rights reserved. // SPDX-License-Identifier: MIT /** * @file * @brief A long-running operation for deleting a Key. * */ #pragma once #include <azure/core/http/http.hpp> #include <azure/core/operation.hpp> #include <azure/core/operation_status.hpp> #include <azure/core/response.hpp> #include <azure/keyvault/common/internal/keyvault_pipeline.hpp> #include <azure/keyvault/common/keyvault_exception.hpp> #include "azure/keyvault/keys/deleted_key.hpp" #include <memory> #include <string> #include <thread> namespace Azure { namespace Security { namespace KeyVault { namespace Keys { /** * @brief A long running operation to delete a key. * */ class DeleteKeyOperation : public Azure::Core::Operation<Azure::Security::KeyVault::Keys::DeletedKey> { private: /* DeleteKeyOperation can be constructed only by friends classes (internal creation). The * constructor is private and requires internal components.*/ friend class KeyClient; std::shared_ptr<Azure::Security::KeyVault::Common::_internal::KeyVaultPipeline> m_pipeline; Azure::Security::KeyVault::Keys::DeletedKey m_value; std::string m_continuationToken; /* This is the implementation for checking the status of a deleted key. The key is considered * deleted if querying /deletedkeys/keyName returns 200 from server. Or whenever soft-delete is * disabled.*/ std::unique_ptr<Azure::Core::Http::RawResponse> PollInternal( Azure::Core::Context& context) override; Azure::Response<Azure::Security::KeyVault::Keys::DeletedKey> PollUntilDoneInternal( std::chrono::milliseconds period, Azure::Core::Context& context) override { while (true) { // Poll will update the raw response. Poll(context); if (IsDone()) { break; } std::this_thread::sleep_for(period); } return Azure::Response<Azure::Security::KeyVault::Keys::DeletedKey>( m_value, std::make_unique<Azure::Core::Http::RawResponse>(*m_rawResponse)); } /* * Only friend classes are permitted to construct a DeleteOperation. This is because a * KeyVaultPipelne is required and it is not exposed to customers. * * Since C++ doesn't offer `internal` access, we use friends-only instead. */ DeleteKeyOperation( std::shared_ptr<Azure::Security::KeyVault::Common::_internal::KeyVaultPipeline> keyvaultPipeline, Azure::Response<Azure::Security::KeyVault::Keys::DeletedKey> response); /** * @brief Get the #Azure::Core::Http::RawResponse of the operation request. * @return A reference to an #Azure::Core::Http::RawResponse. * @note Does not give up ownership of the RawResponse. */ Azure::Core::Http::RawResponse const& GetRawResponseInternal() const override { return *m_rawResponse; } public: /** * @brief Get the #Azure::Security::KeyVault::Keys::DeletedKey object. * * @remark The deleted key contains the recovery id if the key can be recovered. * * @return A deleted key object. */ Azure::Security::KeyVault::Keys::DeletedKey Value() const override { return m_value; } /** * @brief Get an Url as string which can be used to get the status of the delete key operation. * * @return std::string */ std::string GetResumeToken() const override { return m_continuationToken; } }; }}}} // namespace Azure::Security::KeyVault::Keys
32.888889
99
0.679054
chidozieononiwu
c7647b4f780373217243e89f92ca89defb522190
30,114
cpp
C++
DeepLearningToolKit/Toolkit/Core/Mathematics/SanMathematicsVector.cpp
zxyinz/DeepLearningForBlueShark
025206aa7450b7ec86ebab9ca2bbcabe4421af91
[ "MIT" ]
null
null
null
DeepLearningToolKit/Toolkit/Core/Mathematics/SanMathematicsVector.cpp
zxyinz/DeepLearningForBlueShark
025206aa7450b7ec86ebab9ca2bbcabe4421af91
[ "MIT" ]
null
null
null
DeepLearningToolKit/Toolkit/Core/Mathematics/SanMathematicsVector.cpp
zxyinz/DeepLearningForBlueShark
025206aa7450b7ec86ebab9ca2bbcabe4421af91
[ "MIT" ]
null
null
null
#include"SanMathematicsVector.h" using namespace std; using namespace San; using namespace San::Mathematics; San::Mathematics::stSPOINT2::stSPOINT2(const sfloat x, const sfloat y) :x(x), y(y) { } San::Mathematics::stSPOINT2::~stSPOINT2() { } San::Mathematics::stSPOINT3::stSPOINT3(const sfloat x, const sfloat y, const sfloat z) :x(x), y(y), z(z) { } San::Mathematics::stSPOINT3::~stSPOINT3() { } San::Mathematics::stSPOINT4::stSPOINT4(const sfloat x, const sfloat y, const sfloat z, const sfloat w) :x(x), y(y), z(z), w(w) { } San::Mathematics::stSPOINT4::~stSPOINT4() { } San::Mathematics::SPOINT2::SPOINT2(const sfloat Val) :stSPOINT2(Val, Val) { } San::Mathematics::SPOINT2::SPOINT2(const sfloat x, const sfloat y) :stSPOINT2(x, y) { } San::Mathematics::SPOINT2::SPOINT2(const sfloat* pArray) :stSPOINT2(0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; } } San::Mathematics::SPOINT2::SPOINT2(const SPOINT2 &Point2) :stSPOINT2(Point2.x, Point2.y) { } San::Mathematics::SPOINT2::SPOINT2(const SPOINT3 &Point3) :stSPOINT2(Point3.x, Point3.y) { } San::Mathematics::SPOINT2::SPOINT2(const SPOINT4 &Point4) :stSPOINT2(Point4.x, Point4.y) { } San::Mathematics::SPOINT2::SPOINT2(const SVECTOR2 &Vec2) :stSPOINT2(Vec2.x, Vec2.y) { } San::Mathematics::SPOINT2::SPOINT2(const SVECTOR3 &Vec3) :stSPOINT2(Vec3.x, Vec3.y) { } San::Mathematics::SPOINT2::SPOINT2(const SVECTOR4 &Vec4) :stSPOINT2(Vec4.x, Vec4.y) { } San::Mathematics::SPOINT2::~SPOINT2() { } const sfloat& San::Mathematics::SPOINT2::operator[](const uint32 Position) const { return this->p[Position > 2 ? 2 : Position]; } sfloat& San::Mathematics::SPOINT2::operator[](const uint32 Position) { return this->p[Position > 2 ? 2 : Position]; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; return *this; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; return *this; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; return *this; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; return *this; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; return *this; } San::Mathematics::SPOINT2& San::Mathematics::SPOINT2::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; return *this; } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator+(const SPOINT2 &Point2) const { return SPOINT2(this->x + Point2.x, this->y + Point2.y); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator-(const SPOINT2 &Point2) const { return SPOINT2(this->x - Point2.x, this->y - Point2.y); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator*(const SPOINT2 &Point2) const { return SPOINT2(this->x * Point2.x, this->y * Point2.y); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator+(const sfloat Val) const { return SPOINT2(this->x + Val, this->y + Val); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator-(const sfloat Val) const { return SPOINT2(this->x - Val, this->y - Val); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::operator*(const sfloat Val) const { return SPOINT2(this->x * Val, this->y * Val); } bool San::Mathematics::SPOINT2::operator==(const SPOINT2 &Point2) const { if (!::gloIsFloatEqual(this->x, Point2.x)){ return false; } if (!::gloIsFloatEqual(this->y, Point2.y)){ return false; } //return (::gloIsFloatEqual(this->x, Point2.x) && ::gloIsFloatEqual(this->y, Point2.y)) ? true : false; return true; } bool San::Mathematics::SPOINT2::operator!=(const SPOINT2 &Point2) const { return !((*this) == Point2); } bool San::Mathematics::SPOINT2::operator<(const SPOINT2 &Point2) const { return (this->x < Point2.x) && (this->y < Point2.y); } bool San::Mathematics::SPOINT2::operator>(const SPOINT2 &Point2) const { return (this->x > Point2.x) && (this->y > Point2.y); } bool San::Mathematics::SPOINT2::operator<=(const SPOINT2 &Point2) const { return (this->x <= Point2.x) && (this->y <= Point2.y); } bool San::Mathematics::SPOINT2::operator>=(const SPOINT2 &Point2) const { return (this->x >= Point2.x) && (this->y >= Point2.y); } San::Mathematics::SPOINT2 San::Mathematics::SPOINT2::iGetHomogeneousPoint() const { if (::gloIsFloatEqual(this->y, 0.0)) { return SPOINT2(this->x, 1.0); } return SPOINT2(this->x/this->y,1.0); } void San::Mathematics::SPOINT2::iHomogenzation() { if (::gloIsFloatEqual(this->y, 0.0)) { this->y = 1.0; return; } this->x = this->x / this->y; this->y = 1.0; } San::Mathematics::SVECTOR2::SVECTOR2(const sfloat Val) :stSPOINT2(Val, Val) { } San::Mathematics::SVECTOR2::SVECTOR2(const sfloat x, const sfloat y) :stSPOINT2(x, y) { } San::Mathematics::SVECTOR2::SVECTOR2(const sfloat* pArray) :stSPOINT2(0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; } } San::Mathematics::SVECTOR2::SVECTOR2(const SVECTOR2 &Vec2) :stSPOINT2(Vec2.x, Vec2.y) { } San::Mathematics::SVECTOR2::SVECTOR2(const SPOINT2 &Point2) :stSPOINT2(Point2.x, Point2.y) { } San::Mathematics::SVECTOR2::SVECTOR2(const SPOINT3 &Point3) :stSPOINT2(Point3.x, Point3.y) { } San::Mathematics::SVECTOR2::SVECTOR2(const SPOINT4 &Point4) :stSPOINT2(Point4.x, Point4.y) { } San::Mathematics::SVECTOR2::SVECTOR2(const SVECTOR3 &Vec3) :stSPOINT2(Vec3.x, Vec3.y) { } San::Mathematics::SVECTOR2::SVECTOR2(const SVECTOR4 &Vec4) :stSPOINT2(Vec4.x, Vec4.y) { } San::Mathematics::SVECTOR2::~SVECTOR2() { } const sfloat& San::Mathematics::SVECTOR2::operator[](const uint32 Position) const { return this->p[Position > 2 ? 2 : Position]; } sfloat& San::Mathematics::SVECTOR2::operator[](const uint32 Position) { return this->p[Position > 2 ? 2 : Position]; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; return *this; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; return *this; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; return *this; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; return *this; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; return *this; } San::Mathematics::SVECTOR2& San::Mathematics::SVECTOR2::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; return *this; } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator+(const SVECTOR2 &Vec2) const { return SVECTOR2(this->x + Vec2.x, this->y + Vec2.y); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator-(const SVECTOR2 &Vec2) const { return SVECTOR2(this->x - Vec2.x, this->y - Vec2.y); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator*(const SVECTOR2 &Vec2) const { return SVECTOR2(this->x * Vec2.x, this->y * Vec2.y); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator+(const sfloat Val) const { return SVECTOR2(this->x + Val, this->y + Val); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator-(const sfloat Val) const { return SVECTOR2(this->x - Val, this->y - Val); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::operator*(const sfloat Val) const { return SVECTOR2(this->x * Val, this->y * Val); } bool San::Mathematics::SVECTOR2::operator==(const SVECTOR3 &Vec2) const { if (!::gloIsFloatEqual(this->x, Vec2.x)){ return false; } if (!::gloIsFloatEqual(this->y, Vec2.y)){ return false; } return true; } bool San::Mathematics::SVECTOR2::operator!=(const SVECTOR3 &Vec2) const { return !((*this) == Vec2); } bool San::Mathematics::SVECTOR2::operator<(const SVECTOR3 &Vec2) const { return (this->x < Vec2.x) && (this->y < Vec2.y); } bool San::Mathematics::SVECTOR2::operator>(const SVECTOR3 &Vec2) const { return (this->x > Vec2.x) && (this->y > Vec2.y); } bool San::Mathematics::SVECTOR2::operator<=(const SVECTOR3 &Vec2) const { return (this->x <= Vec2.x) && (this->y <= Vec2.y); } bool San::Mathematics::SVECTOR2::operator>=(const SVECTOR3 &Vec2) const { return (this->x >= Vec2.x) && (this->y >= Vec2.y); } San::Mathematics::SVECTOR2 San::Mathematics::SVECTOR2::iGetHomogeneousVector() const { return SVECTOR2(this->x, 0.0); } void San::Mathematics::SVECTOR2::iHomogenzation() { this->y = 0.0; } San::Mathematics::SPOINT3::SPOINT3(const sfloat Val) :stSPOINT3(Val, Val, Val) { } San::Mathematics::SPOINT3::SPOINT3(const sfloat x, const sfloat y, const sfloat z) :stSPOINT3(x, y, z) { } San::Mathematics::SPOINT3::SPOINT3(const sfloat* pArray) :stSPOINT3(0.0, 0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; this->z = pArray[2]; } } San::Mathematics::SPOINT3::SPOINT3(const SPOINT3& Point3) :stSPOINT3(Point3.x, Point3.y, Point3.z) { } San::Mathematics::SPOINT3::SPOINT3(const SPOINT2 &Point2, const sfloat z) :stSPOINT3(Point2.x, Point2.y, z) { } San::Mathematics::SPOINT3::SPOINT3(const SPOINT4 &Point4) :stSPOINT3(Point4.x, Point4.y, Point4.z) { /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ } San::Mathematics::SPOINT3::SPOINT3(const SVECTOR2 &Vec2, const sfloat z) :stSPOINT3(Vec2.x, Vec2.y, z) { } San::Mathematics::SPOINT3::SPOINT3(const SVECTOR3 &Vec3) :stSPOINT3(Vec3.x, Vec3.y, Vec3.z) { } San::Mathematics::SPOINT3::SPOINT3(const SVECTOR4 &Vec4) :stSPOINT3(Vec4.x, Vec4.y, Vec4.z) { } San::Mathematics::SPOINT3::~SPOINT3() { } const sfloat& San::Mathematics::SPOINT3::operator[](const uint32 Position) const { return this->p[Position > 3 ? 3 : Position]; } sfloat& San::Mathematics::SPOINT3::operator[](const uint32 Position) { return this->p[Position > 3 ? 3 : Position]; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; this->z = 0.0; return *this; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; this->z = Point3.z; return *this; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; this->z = Point4.z; /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ return *this; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; this->z = 0.0; return *this; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; this->z = Vec3.z; return *this; } San::Mathematics::SPOINT3& San::Mathematics::SPOINT3::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; this->z = Vec4.z; return *this; } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator+(const SPOINT3 &Point3) const { return SPOINT3(this->x + Point3.x, this->y + Point3.y, this->z + Point3.z); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator-(const SPOINT3 &Point3) const { return SPOINT3(this->x - Point3.x, this->y - Point3.y, this->z - Point3.z); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator*(const SPOINT3 &Point3) const { return SPOINT3(this->x * Point3.x, this->y * Point3.y, this->z * Point3.z); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator+(const sfloat Val) const { return SPOINT3(this->x + Val, this->y + Val, this->z + Val); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator-(const sfloat Val) const { return SPOINT3(this->x - Val, this->y - Val, this->z - Val); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::operator*(const sfloat Val) const { return SPOINT3(this->x * Val, this->y * Val, this->z * Val); } bool San::Mathematics::SPOINT3::operator==(const SPOINT3 &Point3) const { if (!::gloIsFloatEqual(this->x, Point3.x)){ return false; } if (!::gloIsFloatEqual(this->y, Point3.y)){ return false; } if (!::gloIsFloatEqual(this->z, Point3.z)){ return false; } return true; } bool San::Mathematics::SPOINT3::operator!=(const SPOINT3 &Point3) const { return !((*this) == Point3); } bool San::Mathematics::SPOINT3::operator<(const SPOINT3 &Point3) const { return (this->x < Point3.x) && (this->y < Point3.y) && (this->z < Point3.z); } bool San::Mathematics::SPOINT3::operator>(const SPOINT3 &Point3) const { return (this->x > Point3.x) && (this->y > Point3.y) && (this->z > Point3.z); } bool San::Mathematics::SPOINT3::operator<=(const SPOINT3 &Point3) const { return (this->x <= Point3.x) && (this->y <= Point3.y) && (this->z <= Point3.z); } bool San::Mathematics::SPOINT3::operator>=(const SPOINT3 &Point3) const { return (this->x >= Point3.x) && (this->y >= Point3.y) && (this->z >= Point3.z); } San::Mathematics::SPOINT3 San::Mathematics::SPOINT3::iGetHomogeneousPoint() const { if (::gloIsFloatEqual(this->z, 0.0)) { return SPOINT3(this->x, this->y, 1.0); } return SPOINT3(this->x / this->z, this->y / this->z, 1.0); } void San::Mathematics::SPOINT3::iHomogenzation() { if (::gloIsFloatEqual(this->z, 0.0)) { this->z = 1.0; } this->x = this->x / this->z; this->y = this->y / this->z; this->z = 1.0; } San::Mathematics::SVECTOR3::SVECTOR3(const sfloat Val) :stSPOINT3(Val, Val, Val) { } San::Mathematics::SVECTOR3::SVECTOR3(const sfloat x, const sfloat y, const sfloat z) :stSPOINT3(x, y, z) { } San::Mathematics::SVECTOR3::SVECTOR3(const sfloat* pArray) :stSPOINT3(0.0, 0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; this->z = pArray[2]; } } San::Mathematics::SVECTOR3::SVECTOR3(const SVECTOR3 &Vec3) :stSPOINT3(Vec3.x, Vec3.y, Vec3.z) { } San::Mathematics::SVECTOR3::SVECTOR3(const SPOINT2 &Point2, const sfloat z) :stSPOINT3(Point2.x, Point2.y, z) { } San::Mathematics::SVECTOR3::SVECTOR3(const SPOINT3 &Point3) :stSPOINT3(Point3.x, Point3.y, Point3.z) { } San::Mathematics::SVECTOR3::SVECTOR3(const SPOINT4 &Point4) :stSPOINT3(Point4.x, Point4.y, Point4.z) { } San::Mathematics::SVECTOR3::SVECTOR3(const SVECTOR2 &Vec2, const sfloat z) :stSPOINT3(Vec2.x, Vec2.y, z) { } San::Mathematics::SVECTOR3::SVECTOR3(const SVECTOR4 &Vec4) :stSPOINT3(Vec4.x, Vec4.y, Vec4.z) { } San::Mathematics::SVECTOR3::~SVECTOR3() { } const sfloat& San::Mathematics::SVECTOR3::operator[](const uint32 Position) const { return this->p[Position > 3 ? 3 : Position]; } sfloat& San::Mathematics::SVECTOR3::operator[](const uint32 Position) { return this->p[Position > 3 ? 3 : Position]; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; this->z = 0.0; return *this; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; this->z = Point3.z; return *this; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; this->z = Point4.z; return *this; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; this->z = 0.0; return *this; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; this->z = Vec3.z; return *this; } San::Mathematics::SVECTOR3& San::Mathematics::SVECTOR3::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; this->z = Vec4.z; return *this; } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator+(const SVECTOR3 &Vec3) const { return SVECTOR3(this->x + Vec3.x, this->y + Vec3.y, this->z + Vec3.z); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator-(const SVECTOR3 &Vec3) const { return SVECTOR3(this->x - Vec3.x, this->y - Vec3.y, this->z - Vec3.z); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator*(const SVECTOR3 &Vec3) const { return SVECTOR3(this->x * Vec3.x, this->y * Vec3.y, this->z * Vec3.z); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator+(const sfloat Val) const { return SVECTOR3(this->x + Val, this->y + Val, this->z + Val); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator-(const sfloat Val) const { return SVECTOR3(this->x - Val, this->y - Val, this->z - Val); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::operator*(const sfloat Val) const { return SVECTOR3(this->x * Val, this->y * Val, this->z * Val); } bool San::Mathematics::SVECTOR3::operator==(const SVECTOR3 &Vec3) const { if (!::gloIsFloatEqual(this->x, Vec3.x)){ return false; } if (!::gloIsFloatEqual(this->y, Vec3.y)){ return false; } if (!::gloIsFloatEqual(this->z, Vec3.z)){ return false; } return true; } bool San::Mathematics::SVECTOR3::operator!=(const SVECTOR3 &Vec3) const { return !((*this) == Vec3); } bool San::Mathematics::SVECTOR3::operator<(const SVECTOR3 &Vec3) const { return (this->x < Vec3.x) && (this->y < Vec3.y) && (this->z < Vec3.z); } bool San::Mathematics::SVECTOR3::operator>(const SVECTOR3 &Vec3) const { return (this->x > Vec3.x) && (this->y > Vec3.y) && (this->z > Vec3.z); } bool San::Mathematics::SVECTOR3::operator<=(const SVECTOR3 &Vec3) const { return (this->x <= Vec3.x) && (this->y <= Vec3.y) && (this->z <= Vec3.z); } bool San::Mathematics::SVECTOR3::operator>=(const SVECTOR3 &Vec3) const { return (this->x >= Vec3.x) && (this->y >= Vec3.y) && (this->z >= Vec3.z); } San::Mathematics::SVECTOR3 San::Mathematics::SVECTOR3::iGetHomogeneousVector() const { return SVECTOR3(this->x, this->y, 0.0); } void San::Mathematics::SVECTOR3::iHomogenzation() { this->z = 0.0; } San::Mathematics::SPOINT4::SPOINT4(const sfloat Val) :stSPOINT4(Val, Val, Val, Val) { } San::Mathematics::SPOINT4::SPOINT4(const sfloat x, const sfloat y, const sfloat z, const sfloat w) :stSPOINT4(x, y, z, w) { /*if (!::gloIsFloatEqual(w, 1.0)) { if (!gloIsFloatEqual(w, 0.0)) { this->x = this->x / w; this->y = this->y / w; this->z = this->z / w; } }*/ } San::Mathematics::SPOINT4::SPOINT4(const sfloat* pArray) :stSPOINT4(0.0, 0.0, 0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; this->z = pArray[2]; this->w = pArray[3]; } /*if (!::gloIsFloatEqual(pArray[3], 1.0)) { if (!gloIsFloatEqual(pArray[3], 0.0)) { this->x = this->x / pArray[3]; this->y = this->y / pArray[3]; this->z = this->z / pArray[3]; } }*/ } San::Mathematics::SPOINT4::SPOINT4(const SPOINT4 &Point4) :stSPOINT4(Point4.x, Point4.y, Point4.z, Point4.w) { /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ } San::Mathematics::SPOINT4::SPOINT4(const SPOINT2 &Point2, const sfloat z, const sfloat w) :stSPOINT4(Point2.x, Point2.y, z, w) { } San::Mathematics::SPOINT4::SPOINT4(const SPOINT3 &Point3, const sfloat w) :stSPOINT4(Point3.x, Point3.y, Point3.z, w) { } San::Mathematics::SPOINT4::SPOINT4(const SVECTOR2 &Vec2, const sfloat z, const sfloat w) :stSPOINT4(Vec2.x, Vec2.y, z, w) { } San::Mathematics::SPOINT4::SPOINT4(const SVECTOR3 &Vec3, const sfloat w) :stSPOINT4(Vec3.x, Vec3.y, Vec3.z, w) { } San::Mathematics::SPOINT4::SPOINT4(const SVECTOR4 &Vec4) :stSPOINT4(Vec4.x, Vec4.y, Vec4.z, Vec4.w) { } San::Mathematics::SPOINT4::~SPOINT4() { } const sfloat& San::Mathematics::SPOINT4::operator[](const uint32 Position) const { return this->p[Position > 4 ? 4 : Position]; } sfloat& San::Mathematics::SPOINT4::operator[](const uint32 Position) { return this->p[Position > 4 ? 4 : Position]; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; this->z = 0.0; this->w = 0.0; return *this; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; this->z = Point3.z; this->w = 0.0; return *this; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; this->z = Point4.z; this->w = Point4.w; /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ return *this; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator = (const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; this->z = 0.0; this->w = 0.0; return *this; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator = (const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; this->z = Vec3.z; this->w = 0.0; return *this; } San::Mathematics::SPOINT4& San::Mathematics::SPOINT4::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; this->z = Vec4.z; this->w = Vec4.w; return *this; } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator+(const SPOINT4 &Point4) const { /*SPOINT4 HomoPointSrc(*this); SPOINT4 HomoPointDesc(Point4);*/ return SPOINT4(this->x + Point4.x, this->y + Point4.y, this->z + Point4.z, this->w + Point4.w); } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator-(const SPOINT4 &Point4) const { /*SPOINT4 HomoPointSrc(*this); SPOINT4 HomoPointDesc(Point4);*/ return SPOINT4(this->x - Point4.x, this->y - Point4.y, this->z - Point4.z, this->w - Point4.w); } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator*(const SPOINT4 &Point4) const { /*SPOINT4 HomoPointSrc(*this); SPOINT4 HomoPointDesc(Point4);*/ return SPOINT4(this->x * Point4.x, this->y * Point4.y, this->z * Point4.z, this->w * Point4.w); } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator+(const sfloat Val) const { return SPOINT4(this->x + Val, this->y + Val, this->z + Val, this->w + Val); } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator-(const sfloat Val) const { return SPOINT4(this->x - Val, this->y - Val, this->z - Val, this->w - Val); } San::Mathematics::SPOINT4 San::Mathematics::SPOINT4::operator*(const sfloat Val) const { return SPOINT4(this->x * Val, this->y * Val, this->z * Val, this->w * Val); } bool San::Mathematics::SPOINT4::operator==(const SPOINT4 &Point4) const { if (!::gloIsFloatEqual(this->x, Point4.x)){ return false; } if (!::gloIsFloatEqual(this->y, Point4.y)){ return false; } if (!::gloIsFloatEqual(this->z, Point4.z)){ return false; } if (!::gloIsFloatEqual(this->w, Point4.w)){ return false; } return true; } bool San::Mathematics::SPOINT4::operator!=(const SPOINT4 &Point4) const { return !((*this) == Point4); } bool San::Mathematics::SPOINT4::operator<(const SPOINT4 &Point4) const { return (this->x < Point4.x) && (this->y < Point4.y) && (this->z < Point4.z) && (this->w < Point4.w); } bool San::Mathematics::SPOINT4::operator>(const SPOINT4 &Point4) const { return (this->x > Point4.x) && (this->y > Point4.y) && (this->z > Point4.z) && (this->w > Point4.w); } bool San::Mathematics::SPOINT4::operator<=(const SPOINT4 &Point4) const { return (this->x <= Point4.x) && (this->y <= Point4.y) && (this->z <= Point4.z) && (this->w <= Point4.w); } bool San::Mathematics::SPOINT4::operator>=(const SPOINT4 &Point4) const { return (this->x >= Point4.x) && (this->y >= Point4.y) && (this->z >= Point4.z) && (this->w >= Point4.w); } SPOINT4 San::Mathematics::SPOINT4::iGetHomogeneousPoint() const { if (::gloIsFloatEqual(this->w, 0.0)) { return SPOINT4(this->x, this->y, this->z, 1.0); } return SPOINT4(this->x / this->w, this->y / this->w, this->z / this->w, 1.0); } void San::Mathematics::SPOINT4::iHomogenzation() { if (::gloIsFloatEqual(this->w, 0.0)) { this->w = 1.0; } this->x = this->x / this->w; this->y = this->y / this->w; this->z = this->z / this->w; this->w = 1.0; } San::Mathematics::SVECTOR4::SVECTOR4(const sfloat Val) :stSPOINT4(Val, Val, Val, Val) { } San::Mathematics::SVECTOR4::SVECTOR4(const sfloat x, const sfloat y, const sfloat z, const sfloat w) :stSPOINT4(x, y, z, w) { /*if (!::gloIsFloatEqual(w, 1.0)) { if (!gloIsFloatEqual(w, 0.0)) { this->x = this->x / w; this->y = this->y / w; this->z = this->z / w; } }*/ } San::Mathematics::SVECTOR4::SVECTOR4(const sfloat* pArray) :stSPOINT4(0.0, 0.0, 0.0, 0.0) { if (pArray != nullptr) { this->x = pArray[0]; this->y = pArray[1]; this->z = pArray[2]; this->w = pArray[3]; } /*if (!::gloIsFloatEqual(pArray[3], 1.0)) { if (!gloIsFloatEqual(pArray[3], 0.0)) { this->x = this->x / pArray[3]; this->y = this->y / pArray[3]; this->z = this->z / pArray[3]; } }*/ } San::Mathematics::SVECTOR4::SVECTOR4(const SVECTOR4 &Vec4) :stSPOINT4(Vec4.x, Vec4.y, Vec4.z, Vec4.w) { } San::Mathematics::SVECTOR4::SVECTOR4(const SPOINT2 &Point2, const sfloat z, const sfloat w) :stSPOINT4(Point2.x, Point2.y, z, w) { } San::Mathematics::SVECTOR4::SVECTOR4(const SPOINT3 &Point3, const sfloat w) :stSPOINT4(Point3.x, Point3.y, Point3.z, w) { } San::Mathematics::SVECTOR4::SVECTOR4(const SPOINT4 &Point4) :stSPOINT4(Point4.x, Point4.y, Point4.z, Point4.w) { /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ } San::Mathematics::SVECTOR4::SVECTOR4(const SVECTOR2 &Vec2, const sfloat z, const sfloat w) :stSPOINT4(Vec2.x, Vec2.y, z, w) { } San::Mathematics::SVECTOR4::SVECTOR4(const SVECTOR3 &Vec3, const sfloat w) :stSPOINT4(Vec3.x, Vec3.y, Vec3.z, w) { } San::Mathematics::SVECTOR4::~SVECTOR4() { } const sfloat& San::Mathematics::SVECTOR4::operator[](const uint32 Position) const { return this->p[Position > 4 ? 4 : Position]; } sfloat& San::Mathematics::SVECTOR4::operator[](const uint32 Position) { return this->p[Position > 4 ? 4 : Position]; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SPOINT2 &Point2) { this->x = Point2.x; this->y = Point2.y; this->z = 0.0; this->w = 0.0; return *this; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SPOINT3 &Point3) { this->x = Point3.x; this->y = Point3.y; this->z = Point3.z; this->w = 0.0; return *this; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SPOINT4 &Point4) { this->x = Point4.x; this->y = Point4.y; this->z = Point4.z; this->w = Point4.w; /*if (!::gloIsFloatEqual(Point4.w, 1.0)) { if (!gloIsFloatEqual(Point4.w, 0.0)) { this->x = this->x / Point4.w; this->y = this->y / Point4.w; this->z = this->z / Point4.w; } }*/ return *this; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SVECTOR2 &Vec2) { this->x = Vec2.x; this->y = Vec2.y; this->z = 0.0; this->w = 0.0; return *this; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SVECTOR3 &Vec3) { this->x = Vec3.x; this->y = Vec3.y; this->z = Vec3.z; this->w = 0.0; return *this; } San::Mathematics::SVECTOR4& San::Mathematics::SVECTOR4::operator=(const SVECTOR4 &Vec4) { this->x = Vec4.x; this->y = Vec4.y; this->z = Vec4.z; this->w = Vec4.w; return *this; } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator+(const SVECTOR4 &Vec4) const { return SVECTOR4(this->x + Vec4.x, this->y + Vec4.y, this->z + Vec4.z, 0.0); } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator-(const SVECTOR4 &Vec4) const { return SVECTOR4(this->x - Vec4.x, this->y - Vec4.y, this->z - Vec4.z, 0.0); } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator*(const SVECTOR4 &Vec4) const { return SVECTOR4(this->x * Vec4.x, this->y * Vec4.y, this->z * Vec4.z, 0.0); } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator+(const sfloat Val) const { return SVECTOR4(this->x + Val, this->y + Val, this->z + Val, 0.0); } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator-(const sfloat Val) const { return SVECTOR4(this->x - Val, this->y - Val, this->z - Val, 0.0); } San::Mathematics::SVECTOR4 San::Mathematics::SVECTOR4::operator*(const sfloat Val) const { return SVECTOR4(this->x * Val, this->y * Val, this->z * Val, 0.0); } bool San::Mathematics::SVECTOR4::operator==(const SVECTOR4 &Vec4) const { if (!::gloIsFloatEqual(this->x, Vec4.x)){ return false; } if (!::gloIsFloatEqual(this->y, Vec4.y)){ return false; } if (!::gloIsFloatEqual(this->z, Vec4.z)){ return false; } if (!::gloIsFloatEqual(this->w, Vec4.w)){ return false; } return true; } bool San::Mathematics::SVECTOR4::operator!=(const SVECTOR4 &Vec4) const { return !((*this) == Vec4); } bool San::Mathematics::SVECTOR4::operator<(const SVECTOR4 &Vec4) const { return (this->x < Vec4.x) && (this->y < Vec4.y) && (this->z < Vec4.z) && (this->w < Vec4.w); } bool San::Mathematics::SVECTOR4::operator>(const SVECTOR4 &Vec4) const { return (this->x > Vec4.x) && (this->y > Vec4.y) && (this->z > Vec4.z) && (this->w > Vec4.w); } bool San::Mathematics::SVECTOR4::operator<=(const SVECTOR4 &Vec4) const { return (this->x <= Vec4.x) && (this->y <= Vec4.y) && (this->z <= Vec4.z) && (this->w <= Vec4.w); } bool San::Mathematics::SVECTOR4::operator>=(const SVECTOR4 &Vec4) const { return (this->x >= Vec4.x) && (this->y >= Vec4.y) && (this->z >= Vec4.z) && (this->w >= Vec4.w); } SVECTOR4 San::Mathematics::SVECTOR4::iGetHomogeneousVector() const { return SVECTOR4(this->x, this->y, this->z, 0.0); } void San::Mathematics::SVECTOR4::iHomogenzation() { this->w = 0.0; }
26.696809
105
0.666667
zxyinz
c767b18c7a6b51dd2930424a54034f3514980fcd
4,628
cpp
C++
src/2011-03-27_Median_of_Two_Sorted_Arrays.cpp
weizhenwei/leetcode
51386f7f2651ce0562b6f1a49eea7dddc5e02d2e
[ "BSD-3-Clause" ]
3
2015-02-12T01:11:37.000Z
2015-11-08T08:00:24.000Z
src/2011-03-27_Median_of_Two_Sorted_Arrays.cpp
weizhenwei/leetcode
51386f7f2651ce0562b6f1a49eea7dddc5e02d2e
[ "BSD-3-Clause" ]
null
null
null
src/2011-03-27_Median_of_Two_Sorted_Arrays.cpp
weizhenwei/leetcode
51386f7f2651ce0562b6f1a49eea7dddc5e02d2e
[ "BSD-3-Clause" ]
null
null
null
/* * * Copyright (c) 2014, weizhenwei * 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 of the {organization} nor the names of its * 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 HOLDER 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: 2011-03-27_Median_of_Two_Sorted_Arrays.cpp * * * Brief: https://oj.leetcode.com/problems/media-of-two-sorted-arrays/ * There are two sorted arrays A and B of size m and n respectively. Find the * median of the two sorted arrays. The overall run time complexity should be * O(log (m+n)). * * * Date: 2014.12.19 * * Author: weizhenwei <weizhenwei1988@gmail.com> * * ***************************************************************************** */ #include <stdio.h> #include <algorithm> using std::max; using std::min; // originates from:https://oj.leetcode.com/discuss/14689/share-my-c-solution class Solution_Median_of_Two_Sorted_Arrays { public: double findMedianSortedArrays(int A[], int m, int B[], int n) { if (m > n) { return findMedianSortedArrays(B, n, A, m); } int i = m / 2; int j = n / 2; int k = 0; if (A[i] <= B[j]) { if (m % 2 == 0) { k = min(i - 1, n - j - 1); } else { k = min(i, n - j - 1); } } else { if (m % 2 == 0) { k = min(m - i - 1, j - 1); } else { k = min(m - i - 1, j); } } if (m == 0) { return (n % 2 == 0) ? (B[j-1] + B[j]) / 2.0 : B[j]; } if (m == 1) { if (n == 1) { return (A[0] + B[0]) / 2.0; } else if (n % 2 == 0) { return medianOfThree(A[0], B[j-1], B[j]); } else { return medianOfFour(A[0], B[j-1], B[j], B[j+1]); } } if (m == 2) { if (n == 2) { return medianOfFour(A[0], A[1], B[0], B[1]); } else if (n % 2 == 0) { return medianOfFour(max(A[1],B[j-2]), B[j-1], B[j], min(A[0], B[j+1])); } else { return medianOfThree(max(A[1],B[j-1]), B[j], min(A[0], B[j+1])); } } if (A[i] <= B[j]) { return findMedianSortedArrays(A+k, m-k, B, n-k); } else { return findMedianSortedArrays(A, m-k, B+k, n-k); } } private: double medianOfThree(int a, int b, int c) { int maxI = max(max(a, b), c); int minI = min(min(a, b), c); return ( a + b + c - maxI - minI); } double medianOfFour(int a, int b, int c, int d) { int maxI = max(max(max(a, b), c), d); int minI = min(min(min(a, b), c), d); return (a + b + c + d - maxI - minI) / 2.0; } }; static void print_array(int A[], int n) { for (int i = 0; i < n; i++) { printf("%d ", A[i]); } printf("\n"); } int main(int argc, char *argv[]) { Solution_Median_of_Two_Sorted_Arrays solution; int A[3] = {1, 3, 4}; int B[5] = {1, 2, 3, 4, 5}; int m = 3; int n = 5; print_array(A, m); print_array(B, n); double median = solution.findMedianSortedArrays(A, m, B, n); printf("median = %f\n", median); return 0; }
32.363636
87
0.547753
weizhenwei
c76862bb4504fc81e9ee9f6ee533b12dda5a492d
7,416
cpp
C++
limbo/src/tests/test_kernel.cpp
yjjuan/automl_cplusplus
7c427584ed94915b549d31a2097f952c3cfdef36
[ "Apache-2.0" ]
2
2020-12-08T09:45:56.000Z
2021-09-27T17:52:18.000Z
limbo/src/tests/test_kernel.cpp
yjjuan/automl_cplusplus
7c427584ed94915b549d31a2097f952c3cfdef36
[ "Apache-2.0" ]
null
null
null
limbo/src/tests/test_kernel.cpp
yjjuan/automl_cplusplus
7c427584ed94915b549d31a2097f952c3cfdef36
[ "Apache-2.0" ]
null
null
null
//| Copyright Inria May 2015 //| This project has received funding from the European Research Council (ERC) under //| the European Union's Horizon 2020 research and innovation programme (grant //| agreement No 637972) - see http://www.resibots.eu //| //| Contributor(s): //| - Jean-Baptiste Mouret (jean-baptiste.mouret@inria.fr) //| - Antoine Cully (antoinecully@gmail.com) //| - Konstantinos Chatzilygeroudis (konstantinos.chatzilygeroudis@inria.fr) //| - Federico Allocati (fede.allocati@gmail.com) //| - Vaios Papaspyros (b.papaspyros@gmail.com) //| - Roberto Rama (bertoski@gmail.com) //| //| This software is a computer library whose purpose is to optimize continuous, //| black-box functions. It mainly implements Gaussian processes and Bayesian //| optimization. //| Main repository: http://github.com/resibots/limbo //| Documentation: http://www.resibots.eu/limbo //| //| This software is governed by the CeCILL-C license under French law and //| abiding by the rules of distribution of free software. You can use, //| modify and/ or redistribute the software under the terms of the CeCILL-C //| license as circulated by CEA, CNRS and INRIA at the following URL //| "http://www.cecill.info". //| //| As a counterpart to the access to the source code and rights to copy, //| modify and redistribute granted by the license, users are provided only //| with a limited warranty and the software's author, the holder of the //| economic rights, and the successive licensors have only limited //| liability. //| //| In this respect, the user's attention is drawn to the risks associated //| with loading, using, modifying and/or developing or reproducing the //| software by the user in light of its specific status of free software, //| that may mean that it is complicated to manipulate, and that also //| therefore means that it is reserved for developers and experienced //| professionals having in-depth computer knowledge. Users are therefore //| encouraged to load and test the software's suitability as regards their //| requirements in conditions enabling the security of their systems and/or //| data to be ensured and, more generally, to use and operate it in the //| same conditions as regards security. //| //| The fact that you are presently reading this means that you have had //| knowledge of the CeCILL-C license and that you accept its terms. //| #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE test_kernel #include <iostream> #include <boost/test/unit_test.hpp> #include <limbo/kernel/exp.hpp> #include <limbo/kernel/matern_five_halves.hpp> #include <limbo/kernel/matern_three_halves.hpp> #include <limbo/kernel/squared_exp_ard.hpp> #include <limbo/tools/macros.hpp> #include <limbo/tools/random_generator.hpp> using namespace limbo; struct Params { struct kernel : public defaults::kernel { BO_PARAM(double, noise, 0.0); }; struct kernel_squared_exp_ard { BO_DYN_PARAM(int, k); BO_PARAM(double, sigma_sq, 1); }; struct kernel_exp : public defaults::kernel_exp { }; struct kernel_maternthreehalves : public defaults::kernel_maternthreehalves { }; struct kernel_maternfivehalves : public defaults::kernel_maternfivehalves { }; }; struct ParamsNoise { struct kernel : public defaults::kernel { BO_PARAM(double, noise, 0.01); BO_PARAM(bool, optimize_noise, true); }; struct kernel_squared_exp_ard { BO_PARAM(int, k, 0); BO_PARAM(double, sigma_sq, 1); }; struct kernel_exp : public defaults::kernel_exp { }; struct kernel_maternthreehalves : public defaults::kernel_maternthreehalves { }; struct kernel_maternfivehalves : public defaults::kernel_maternfivehalves { }; }; BO_DECLARE_DYN_PARAM(int, Params::kernel_squared_exp_ard, k); Eigen::VectorXd make_v2(double x1, double x2) { Eigen::VectorXd v2(2); v2 << x1, x2; return v2; } // Check gradient via finite differences method template <typename Kernel> std::tuple<double, Eigen::VectorXd, Eigen::VectorXd> check_grad(const Kernel& kern, const Eigen::VectorXd& x, const Eigen::VectorXd& x1, const Eigen::VectorXd& x2, double e = 1e-4) { Eigen::VectorXd analytic_result, finite_diff_result; Kernel ke = kern; ke.set_h_params(x); analytic_result = ke.grad(x1, x2); finite_diff_result = Eigen::VectorXd::Zero(x.size()); for (int j = 0; j < x.size(); j++) { Eigen::VectorXd test1 = x, test2 = x; test1[j] -= e; test2[j] += e; Kernel k1 = kern; k1.set_h_params(test1); Kernel k2 = kern; k2.set_h_params(test2); double res1 = k1(x1, x2); double res2 = k2(x1, x2); finite_diff_result[j] = (res2 - res1) / (2.0 * e); } return std::make_tuple((analytic_result - finite_diff_result).norm(), analytic_result, finite_diff_result); } template <typename Kernel> void check_kernel(size_t N, size_t K, double e = 1e-6) { Kernel kern(N); for (size_t i = 0; i < K; i++) { Eigen::VectorXd hp = tools::random_vector(kern.h_params_size()).array() * 6. - 3.; double error; Eigen::VectorXd analytic, finite_diff; Eigen::VectorXd x1 = tools::random_vector(N).array() * 10. - 5.; Eigen::VectorXd x2 = tools::random_vector(N).array() * 10. - 5.; std::tie(error, analytic, finite_diff) = check_grad(kern, hp, x1, x2, e); // std::cout << error << ": " << analytic.transpose() << " vs " << finite_diff.transpose() << std::endl; BOOST_CHECK(error < 1e-5); } } BOOST_AUTO_TEST_CASE(test_grad_exp) { for (int i = 1; i <= 10; i++) { check_kernel<kernel::Exp<Params>>(i, 100); check_kernel<kernel::Exp<ParamsNoise>>(i, 100); } } BOOST_AUTO_TEST_CASE(test_grad_matern_three) { for (int i = 1; i <= 10; i++) { check_kernel<kernel::MaternThreeHalves<Params>>(i, 100); check_kernel<kernel::MaternThreeHalves<ParamsNoise>>(i, 100); } } BOOST_AUTO_TEST_CASE(test_grad_matern_five) { for (int i = 1; i <= 10; i++) { check_kernel<kernel::MaternFiveHalves<Params>>(i, 100); check_kernel<kernel::MaternFiveHalves<ParamsNoise>>(i, 100); } } BOOST_AUTO_TEST_CASE(test_grad_SE_ARD) { Params::kernel_squared_exp_ard::set_k(0); for (int i = 1; i <= 10; i++) { check_kernel<kernel::SquaredExpARD<Params>>(i, 100); check_kernel<kernel::SquaredExpARD<ParamsNoise>>(i, 100); } Params::kernel_squared_exp_ard::set_k(1); for (int i = 1; i <= 10; i++) { check_kernel<kernel::SquaredExpARD<Params>>(i, 100); } } BOOST_AUTO_TEST_CASE(test_kernel_SE_ARD) { Params::kernel_squared_exp_ard::set_k(0); kernel::SquaredExpARD<Params> se(2); Eigen::VectorXd hp = Eigen::VectorXd::Zero(se.h_params_size()); se.set_h_params(hp); Eigen::VectorXd v1 = make_v2(1, 1); BOOST_CHECK(std::abs(se(v1, v1) - 1) < 1e-6); Eigen::VectorXd v2 = make_v2(0, 1); double s1 = se(v1, v2); BOOST_CHECK(std::abs(s1 - std::exp(-0.5 * (v1.transpose() * v2)[0])) < 1e-5); hp(0) = 1; se.set_h_params(hp); double s2 = se(v1, v2); BOOST_CHECK(s1 < s2); Params::kernel_squared_exp_ard::set_k(1); se = kernel::SquaredExpARD<Params>(2); hp = Eigen::VectorXd::Zero(se.h_params_size()); se.set_h_params(hp); BOOST_CHECK(s1 == se(v1, v2)); }
32.96
180
0.674218
yjjuan
c76949b7596a99dac83e31edef8d490298f98b31
614
cpp
C++
Potion.cpp
DoesItEvenMatter123/PSIO_Project
469bd139999e082f758d4158da67aa3f5b7823fe
[ "MIT" ]
null
null
null
Potion.cpp
DoesItEvenMatter123/PSIO_Project
469bd139999e082f758d4158da67aa3f5b7823fe
[ "MIT" ]
null
null
null
Potion.cpp
DoesItEvenMatter123/PSIO_Project
469bd139999e082f758d4158da67aa3f5b7823fe
[ "MIT" ]
null
null
null
#include "Including.h" #include "Potion.h" Potion::Potion() { setTexture(); potion.setScale(2, 2); vy = 118; } Potion::~Potion() { } void Potion::setTexture() { if (!potionTexture.loadFromFile("red-potion.png")) { std::cout << "Error"; } potion.setTexture(potionTexture); } void Potion::Draw(sf::RenderWindow& window) { window.draw(potion); } void Potion::move() { potion.move(0, vy * clock.getElapsedTime().asSeconds()); clock.restart(); } void Potion::setPosition(float x, float y) { potion.setPosition(x, y); } sf::FloatRect Potion::getGlobalBounds() { return potion.getGlobalBounds(); }
13.347826
57
0.674267
DoesItEvenMatter123
c76c1ea3fc694b248492a124fa587e2365324771
10,783
cpp
C++
jabberbot.cpp
JonathanGuthrie/affirmation-bot
5cb955953ebfa0f0fe3ac59a88927568884b8ce3
[ "Apache-2.0" ]
null
null
null
jabberbot.cpp
JonathanGuthrie/affirmation-bot
5cb955953ebfa0f0fe3ac59a88927568884b8ce3
[ "Apache-2.0" ]
null
null
null
jabberbot.cpp
JonathanGuthrie/affirmation-bot
5cb955953ebfa0f0fe3ac59a88927568884b8ce3
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2010 Jonathan R. Guthrie * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // #include <iostream> #include "jabberbot.hpp" #include <fstream> #include <cstdlib> #include <sstream> #include <syslog.h> void JabberBot::Subscribe(const gloox::Message &stanza) { char keyValue[stanza.from().bare().size()+1]; stanza.from().bare().copy(keyValue, std::string::npos); keyValue[stanza.from().bare().size()] = '\0'; time_t last = 0; Dbt key(keyValue, stanza.from().bare().size()+1); Dbt data(&last, sizeof(time_t)); m_subscriptionDb.put(NULL, &key, &data, 0); m_subscriptionDb.sync(0); time_t now = time(NULL); time_t t1 = random() % ((m_eod - now)/2); time_t t2 = random() % ((m_eod - now)/2); Upcoming newEntry(stanza.from().bare(), now + t1 + t2); m_upcomingQueue.push(newEntry); gloox::Message message(stanza.subtype(), stanza.from(), "You have been subscribed"); m_client->send(message); } void JabberBot::Unsubscribe(const gloox::Message &stanza) { char keyValue[stanza.from().bare().size()+1]; stanza.from().bare().copy(keyValue, std::string::npos); keyValue[stanza.from().bare().size()] = '\0'; Dbt key(keyValue, stanza.from().bare().size()+1); m_subscriptionDb.del(NULL, &key, 0); m_subscriptionDb.sync(0); gloox::Message message(stanza.subtype(), stanza.from(), "You have been unsubscribed"); m_client->send(message); } void JabberBot::Affirmation(const gloox::Message &stanza) { AffirmationList::size_type which = random() % m_affirmations.size(); gloox::Message message(stanza.subtype(), stanza.from(), m_affirmations[which]); m_client->send(message); } void JabberBot::Status(const gloox::Message &stanza) { char keyValue[stanza.from().bare().size()+1]; stanza.from().bare().copy(keyValue, std::string::npos); keyValue[stanza.from().bare().size()] = '\0'; time_t last = 0; Dbt key(keyValue, stanza.from().bare().size()+1); Dbt data; data.set_data(&last); data.set_ulen(sizeof(time_t)); int result = m_subscriptionDb.get(NULL, &key, &data, 0); if (0 != result) { gloox::Message message(stanza.subtype(), stanza.from(), "You are not subscribed"); m_client->send(message); } else { gloox::Message message(stanza.subtype(), stanza.from(), "You are subscribed"); m_client->send(message); } } void JabberBot::DefaultCommand(const gloox::Message &stanza) { // I figure the best thing to do is to send the help message if it doesn't recognize the command sent gloox::Message message(stanza.subtype(), stanza.from(), "I know how to do these things:\nsubscribe - send affirmation to you once per day\nunsubscribe - stop sending you daily affirmations\nstatus - tell you whether or not you're subscribed\naffirmation - send a random affirmation right now\nhelp - send this message\n\nCommands are not case sensitive"); m_client->send(message); } CommandHandlerMap JabberBot::m_handlers; AffirmationList JabberBot::m_affirmations; JabberBot::JabberBot(const std::string &jid_string, const std::string &password, const std::string &affirmation_path, const std::string &db_path) : m_subscriptionDb(NULL, 0) { openlog("affirmations-bot", LOG_PID|LOG_CONS, LOG_DAEMON); Dbc *cursor; m_subscriptionDb.open(NULL, db_path.c_str(), NULL, DB_BTREE, DB_CREATE, 0); m_subscriptionDb.cursor(NULL, &cursor, 0); if (NULL != cursor) { Dbt key, data; time_t now = time(NULL); time_t bod = now - (now % 86400); m_eod = bod + 86400; while (0 == cursor->get(&key, &data, DB_NEXT)) { std::string user((char *)key.get_data()); time_t last = *((time_t*) data.get_data()); if (last < bod) { // He hasn't gotten an affirmation today time_t t1 = random() % ((m_eod - now)/2); time_t t2 = random() % ((m_eod - now)/2); Upcoming newEntry(user, now + t1 + t2); m_upcomingQueue.push(newEntry); } std::ostringstream message; message << "User " << user << " last got an affirmation at " << last; syslog(LOG_NOTICE, message.str().c_str()); } cursor->close(); } if (m_handlers.begin() == m_handlers.end()) { CommandHandler handler; handler.method = &JabberBot::Subscribe; m_handlers.insert(CommandHandlerMap::value_type("subscribe", handler)); handler.method = &JabberBot::Unsubscribe; m_handlers.insert(CommandHandlerMap::value_type("unsubscribe", handler)); handler.method = &JabberBot::Affirmation; m_handlers.insert(CommandHandlerMap::value_type("affirmation", handler)); handler.method = &JabberBot::Status; m_handlers.insert(CommandHandlerMap::value_type("status", handler)); } if (m_affirmations.empty()) { srand(time(NULL)); std::string line; std::ifstream a(affirmation_path.c_str()); while (getline(a, line)) { std::ostringstream message; message << "The line is \"" << line << "\"" << std::endl; syslog(LOG_DEBUG, message.str().c_str()); m_affirmations.push_back(line); } } // std::cout << "Creating the JID from the string \"" << jid_string << "\"" << std::endl; gloox::JID jid(jid_string); // std::cout << "Creating a client from the JID and the password \"" << password << "\"" << std::endl; m_client = new gloox::Client(jid, password); m_client->setServer("talk.google.com"); // std::cout << "Registering the handlers" << std::endl; m_client->registerMessageHandler(this); m_client->logInstance().registerLogHandler(gloox::LogLevelDebug, gloox::LogAreaAll, this); // std::cout << "Running connect" << std::endl; m_client->rosterManager()->registerRosterListener(this, true); m_continueRunning = true; m_sendThread = new boost::thread(SendThreadFunction, this); // Start the thread here m_client->connect(true); // std::cout << "returned from connect" << std::endl; // std::cout << "The connection state is " << ((int) m_client->state()) << std::endl; m_continueRunning = false; } JabberBot::~JabberBot(void) { m_continueRunning = false; m_sendThread->join(); std::ostringstream message; message << "Shutting down cleanly" << std::endl; syslog(LOG_NOTICE, message.str().c_str()); m_subscriptionDb.close(0); } void JabberBot::ProcessSendList(void) { // syslog(LOG_NOTICE, "In Process Send List"); bool updated = false; for (SendList::iterator i=m_sendList.begin(); i != m_sendList.end(); ++i) { gloox::RosterItem *ri = m_client->rosterManager()->getRosterItem(*i); if (nullptr != ri) { if (ri->online()) { AffirmationList::size_type which = random() % m_affirmations.size(); updated = true; gloox::Message message(gloox::Message::MessageType::Chat, *i, m_affirmations[which]); m_client->send(message); // syslog(LOG_NOTICE, "Updating the database"); time_t now = time(NULL); char keyValue[i->bare().size()+1]; i->bare().copy(keyValue, std::string::npos); keyValue[i->bare().size()] = '\0'; Dbt key(keyValue, i->bare().size()+1); Dbt data(&now, sizeof(time_t)); m_subscriptionDb.put(NULL, &key, &data, 0); // syslog(LOG_NOTICE, "Removing the user from the send list"); m_sendList.erase(i); } } } if (updated) { // syslog(LOG_NOTICE, "Updating the database"); m_subscriptionDb.sync(0); } } void JabberBot::ShutDown(void) { m_continueRunning = false; } void JabberBot::RunSession(void) { // syslog(LOG_INFO, "In RunSession"); while(m_continueRunning) { // syslog(LOG_INFO, "In continueRunning loop"); time_t now = time(NULL); while (!m_upcomingQueue.empty() && (now > m_upcomingQueue.top().Next())) { // std::ostringstream message; // message << "Appending " << m_upcomingQueue.top().User().bare() << " to the list of people who get messages now" << std::endl; // syslog(LOG_NOTICE, message.str().c_str()); m_sendList.insert(m_upcomingQueue.top().User()); m_upcomingQueue.pop(); } // syslog(LOG_INFO, "Calling ProcessSendList"); ProcessSendList(); if (m_eod < now) { time_t bod = m_eod; m_eod += 86400; m_sendList.clear(); while (!m_upcomingQueue.empty()) { m_upcomingQueue.pop(); } // syslog(LOG_INFO, "Updating the database"); Dbc *cursor; m_subscriptionDb.cursor(NULL, &cursor, 0); if (NULL != cursor) { Dbt key, data; m_eod = bod + 86400; while (0 == cursor->get(&key, &data, DB_NEXT)) { std::string user((char *)key.get_data()); time_t t1 = random() % 43200; time_t t2 = random() % 43200; Upcoming newEntry(user, bod + t1 + t2); m_upcomingQueue.push(newEntry); // std::ostringstream message; // message << "It is now " << now << " and user " << user << " will next get a message at " << bod + t1 + t2; // syslog(LOG_NOTICE, message.str().c_str()); } cursor->close(); } } // syslog(LOG_INFO, "Sleeping"); sleep(1); } // syslog(LOG_INFO, "Returning from RunSession"); } void *JabberBot::SendThreadFunction(void *instance) { // syslog(LOG_INFO, "In the SendThreadFunction"); JabberBot *self = (JabberBot *)instance; // syslog(LOG_INFO, "Running RunSession"); self->RunSession(); // syslog(LOG_INFO, "Exiting SendThreadFunction"); return nullptr; } void JabberBot::handleMessage(const gloox::Message &stanza, gloox::MessageSession *session) { // std::cout << "Message type: " << ((int) stanza.subtype()) << std::endl; if (0 < stanza.body().size()) { insensitiveString body(stanza.body().c_str()); CommandHandlerMap::iterator h = m_handlers.find(body); if (h != m_handlers.end()) { (this->*h->second.method)(stanza); } else { DefaultCommand(stanza); } } } void JabberBot::handleLog(gloox::LogLevel level, gloox::LogArea area, const std::string &message) { // std::cout << "Log: " << ((int)level) << ", " << ((int) area) << " \"" << message << "\"" << std::endl; // syslog(LOG_INFO, message.c_str()); } bool JabberBot::handleSubscriptionRequest(const gloox::JID &jid, const std::string &msg) { // std::cout << jid.bare() < " is attempting to subscribe with messge \"" << msg << "\"" << std::endl; return true; } bool JabberBot::handleUnsubscriptionRequest(const gloox::JID &jid, const std::string &msg) { // std::cout << jid.bare() < " is attempting to unsubscribe with messge \"" << msg << "\"" << std::endl; return true; }
34.450479
357
0.660855
JonathanGuthrie
c771696033451def3fbcbe3b6dde92cc98444e69
586
hpp
C++
include/Client/EntityDropGenerator.hpp
maximaximal/BomberPi
365c806e3feda7296fc10d5f9655ec696f0ab491
[ "Zlib" ]
null
null
null
include/Client/EntityDropGenerator.hpp
maximaximal/BomberPi
365c806e3feda7296fc10d5f9655ec696f0ab491
[ "Zlib" ]
null
null
null
include/Client/EntityDropGenerator.hpp
maximaximal/BomberPi
365c806e3feda7296fc10d5f9655ec696f0ab491
[ "Zlib" ]
null
null
null
#ifndef CLIENT_ENTITYDROPGENERATOR_HPP #define CLIENT_ENTITYDROPGENERATOR_HPP #include <map> #include <functional> #include <memory> #include <Client/EntityFactory.hpp> #include <glm/vec3.hpp> namespace Client { class EntityDropGenerator { public: EntityDropGenerator(EntityFactory *factory); virtual ~EntityDropGenerator(); void run(const glm::ivec3 &tilePos); void setChance(unsigned int chance); protected: unsigned int m_chance = 900; EntityFactory *m_entityFactory; }; } #endif
20.928571
56
0.663823
maximaximal
c7732b6b1531d2d7cd7a5f99629f040fb73dd2ab
771
cpp
C++
lib/src/cyber/mouse.cpp
yuri-sevatz/cyberpunk-cpp
b0c9a95c012660bfd21c24ac3a69287330d3b3bd
[ "BSD-2-Clause" ]
5
2021-06-12T10:29:58.000Z
2022-03-03T13:21:57.000Z
lib/src/cyber/mouse.cpp
yuri-sevatz/cyber_breach
b0c9a95c012660bfd21c24ac3a69287330d3b3bd
[ "BSD-2-Clause" ]
null
null
null
lib/src/cyber/mouse.cpp
yuri-sevatz/cyber_breach
b0c9a95c012660bfd21c24ac3a69287330d3b3bd
[ "BSD-2-Clause" ]
1
2021-02-21T09:45:37.000Z
2021-02-21T09:45:37.000Z
#include <cyber/mouse.hpp> #include <Windows.h> void mouse_move(cv::Point2l p) { std::array<INPUT,1> input; ZeroMemory(input.data(), sizeof(decltype(input)::value_type) * input.size()); input[0].type = INPUT_MOUSE; input[0].mi.dx = p.x; input[0].mi.dy = p.y; input[0].mi.dwFlags = MOUSEEVENTF_MOVE; SendInput(input.size(), input.data(), sizeof(decltype(input)::value_type)); } void mouse_press(bool press) { std::array<INPUT,1> input; ZeroMemory(input.data(), sizeof(decltype(input)::value_type) * input.size()); input[0].type = INPUT_MOUSE; input[0].mi.dwFlags = press ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP; SendInput(input.size(), input.data(), sizeof(decltype(input)::value_type)); }
30.84
82
0.651102
yuri-sevatz
c775ef9325ed8bfde5ebed6d84ba498222d00ef0
3,105
hpp
C++
apex_containers/include/apex_containers/set.hpp
ZhenshengLee/apex_containers
9c671dc5726961abb8cdf795c20215e62c88b2d7
[ "Apache-2.0" ]
null
null
null
apex_containers/include/apex_containers/set.hpp
ZhenshengLee/apex_containers
9c671dc5726961abb8cdf795c20215e62c88b2d7
[ "Apache-2.0" ]
null
null
null
apex_containers/include/apex_containers/set.hpp
ZhenshengLee/apex_containers
9c671dc5726961abb8cdf795c20215e62c88b2d7
[ "Apache-2.0" ]
null
null
null
// Copyright 2019 Apex.AI, Inc. // // 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. #ifndef APEX_CONTAINERS__SET_HPP_ #define APEX_CONTAINERS__SET_HPP_ #include <apex_containers/memory/common.hpp> #include <functional> #include <set> #include <utility> namespace apex { namespace containers { /// Defines a set type that only works with static allocators. Intended for more complicated /// use cases, such as those involving sets nested in a container template<typename Key, typename Comp = std::less<Key>, typename Mutex = memory::default_mutex> using set = std::set<Key, Comp, node_allocator<Key, Mutex>>; /// Defines set type which can accept multiple allocators which can be applied to different /// levels of nested data structures template<typename Key, typename Comp = std::less<Key>, typename Mutex = memory::default_mutex, typename ... InnerAlloc> using set_scoped_alloc = std::set<Key, Comp, scoped_node_allocator<Key, Mutex, InnerAlloc...>>; /// Defines a multiset type that only works with static allocators. Intended for more complicated /// use cases, such as those involving multisets nested in a container template<typename Key, typename Comp = std::less<Key>, typename Mutex = memory::default_mutex> using multiset = std::multiset<Key, Comp, node_allocator<Key, Mutex>>; /// Defines multiset type which can accept multiple allocators which can be applied to different /// levels of nested data structures template<typename Key, typename Comp = std::less<Key>, typename Mutex = memory::default_mutex, typename ... InnerAlloc> using multiset_scoped_alloc = std::multiset<Key, Comp, scoped_node_allocator<Key, Mutex, InnerAlloc...>>; namespace memory { /// Helper typedef for set node sizes template<typename T> using set_node_size = foonathan::memory::set_node_size<T>; /// These are just pass-through parameters to any std::set /// Specialization of node sizes for std::set template<typename Key, typename Comp, typename Mutex> struct NodeSize<set<Key, Comp, Mutex>> : std::integral_constant<std::size_t, set_node_size<Key>::value> { }; /// Helper typedef for multiset node sizes template<typename T> using multiset_node_size = foonathan::memory::multiset_node_size<T>; /// These are just pass-through parameters to any std::multiset /// Specialization of node sizes for std::multiset template<typename Key, typename Comp, typename Mutex> struct NodeSize<multiset<Key, Comp, Mutex>> : std::integral_constant<std::size_t, multiset_node_size<Key>::value> { }; } // namespace memory } // namespace containers } // namespace apex #endif // APEX_CONTAINERS__SET_HPP_
41.4
97
0.763285
ZhenshengLee
c775f25bc927067d2612dadea383cbe0805f1c0b
950
cc
C++
test/option_test.cc
bzEq/kl
92de2c1db5ca4bb6c38a632cda7a80d2c9823841
[ "BSD-3-Clause" ]
null
null
null
test/option_test.cc
bzEq/kl
92de2c1db5ca4bb6c38a632cda7a80d2c9823841
[ "BSD-3-Clause" ]
null
null
null
test/option_test.cc
bzEq/kl
92de2c1db5ca4bb6c38a632cda7a80d2c9823841
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 2017 Kai Luo <gluokai@gmail.com>. All rights reserved. // Use of this source code is governed by the BSD license that can be found in // the LICENSE file. #include <iostream> #include <memory> #include <string> #include "kl/option.h" #include "kl/testkit.h" namespace { class O {}; kl::Option<int> Foo() { return kl::Some(13); } kl::Option<int> Spam() { return kl::None(); } } TEST(O, foo) { auto foo = Foo(); ASSERT(foo); ASSERT(*foo == 13); } TEST(O, spam) { auto spam = Spam(); ASSERT(!spam); } struct Imfao { std::string s; }; kl::Option<std::string> Bar() { auto f = std::make_unique<Imfao>(); return f->s; } TEST(O, PassByValue) { auto f = Bar(); ASSERT(f); } class Foobar { public: int Value() { return 7; } std::string String() const { return "Foobar"; } }; TEST(O, MethodAccess) { auto f = kl::Some(Foobar()); ASSERT(f->Value() == 7); ASSERT(f->String() == "Foobar"); } // namespace
17.592593
78
0.612632
bzEq
c777d02bb828423ba2d2c9fca58fd18e396d3691
4,783
cc
C++
src/Router/patShortestPathGeneral.cc
godosou/smaroute
e2ccc9492dff54c8ef5c74d5309d2b06758ba342
[ "MIT" ]
4
2015-02-23T16:02:52.000Z
2021-03-26T17:58:53.000Z
src/Router/patShortestPathGeneral.cc
godosou/smaroute
e2ccc9492dff54c8ef5c74d5309d2b06758ba342
[ "MIT" ]
null
null
null
src/Router/patShortestPathGeneral.cc
godosou/smaroute
e2ccc9492dff54c8ef5c74d5309d2b06758ba342
[ "MIT" ]
5
2015-02-23T16:05:59.000Z
2017-05-04T16:13:16.000Z
/* * patShortestPathGeneral.cc * * Created on: Nov 1, 2011 * Author: jchen */ #include "patShortestPathGeneral.h" #include "patRoadBase.h" #include "patConst.h" #include "patGpsDDR.h" #include "patDisplay.h" #include "patMeasurementDDR.h" patShortestPathGeneral::patShortestPathGeneral(patNetworkBase* a_network ) : network(a_network), minimum_label(a_network->getMinimumLabel()) { //DEBUG_MESSAGE("minimum_label "<<minimum_label); } patShortestPathGeneral::~patShortestPathGeneral() { } bool patShortestPathGeneral::buildShortestPathTree(const patNode* root_node, double ceil) { set<const patNode*> root_nodes; root_nodes.insert(root_node); return buildShortestPathTree(root_nodes, NULL, NULL, ceil); } bool patShortestPathGeneral::buildShortestPathTree(const patNode* root_node, patMeasurementDDR* gps_ddr, set<pair<const patArc*, const patRoadBase*> >* ddr_arcs , double ceil ){ set<const patNode*> root_nodes; root_nodes.insert(root_node); return buildShortestPathTree(root_nodes, gps_ddr, ddr_arcs, ceil); } bool patShortestPathGeneral::buildShortestPathTree(set<const patNode*> root_nodes, patMeasurementDDR* gps_ddr, set<pair<const patArc*, const patRoadBase*> >* ddr_arcs, double ceil) { /** * Preprocessing, build the tree from the roots, set and roots' labels as 0.0. */ for (set<const patNode*>::iterator iter = root_nodes.begin(); iter != root_nodes.end(); ++iter) { m_list_of_nodes.push_back(*iter); shortest_path_tree.setLabel(*iter, 0.0); shortest_path_tree.insertRoot(*iter); } /** * Recursive process to deal with each node */ while (!m_list_of_nodes.empty()) { //Start from the first node in the list. const patNode* node_to_process = *m_list_of_nodes.begin(); m_list_of_nodes.pop_front(); /** * If the label exceeds the distance ceiling, i.e., we have reached the distance limit that we can climb in the tree. * Terminate the process. */ if (shortest_path_tree.getLabel(node_to_process) > ceil) { //DEBUG_MESSAGE("exceed length limit"); break; } //Deal with each outgoing road of the node. const unordered_map<const patNode*, set<const patRoadBase*> >* outgoing_map = network->getOutgoingIncidents(); unordered_map<const patNode*,set<const patRoadBase*> >::const_iterator find_out_going = outgoing_map->find(node_to_process); if(find_out_going==outgoing_map->end()){ continue; } for (set<const patRoadBase*>::const_iterator outgoing_road_iter = find_out_going->second.begin(); outgoing_road_iter != find_out_going->second.end(); ++outgoing_road_iter) { //implement RoadType::getDownNode(); const patNode* down_node = (*outgoing_road_iter)->getDownNode(); const double road_cost = (*outgoing_road_iter)->getLength(); double down_node_label = shortest_path_tree.getLabel(down_node); if (gps_ddr != NULL) { //If we deal with DDR vector<const patArc*> temp_arcs = (*outgoing_road_iter)->getArcList(); //A road may contain several arcs for (vector<const patArc*>::const_iterator arc_iter = temp_arcs.begin(); arc_iter != temp_arcs.end(); ++arc_iter) { if (!gps_ddr->isArcInDomain(*arc_iter,network->getTransportMode())) { if (gps_ddr->detArcDDR(*arc_iter,network->getTransportMode())) { ddr_arcs->insert( pair<const patArc*, const patRoadBase*>( *arc_iter, *outgoing_road_iter)); } } else { ddr_arcs->insert( pair<const patArc*, const patRoadBase*>( *arc_iter, *outgoing_road_iter)); } } if (down_node_label > shortest_path_tree.getLabel(node_to_process) + road_cost) { shortest_path_tree.setLabel( down_node, shortest_path_tree.getLabel(node_to_process) + road_cost); if (shortest_path_tree.getLabel(down_node) < minimum_label) { WARNING("NEGATIVE CYCLE DETECTED:"<<shortest_path_tree.getLabel(down_node)<<","<<minimum_label); return false; } shortest_path_tree.setPredecessor(down_node, *outgoing_road_iter); // shortest_path_tree.insertSuccessor(node_to_process, // *outgoing_road_iter); // Add the node following Bertsekas (1993) if (m_list_of_nodes.empty()) { //DEBUG_MESSAGE("add node to list"<<downNodeId); m_list_of_nodes.push_back(down_node); } else { double top_label = shortest_path_tree.getLabel( m_list_of_nodes.front()); if (down_node_label <= top_label) { m_list_of_nodes.push_front(down_node); } else { m_list_of_nodes.push_back(down_node); } } } } } //DEBUG_MESSAGE(theTree.predecessor[3893]); } return true; } patShortestPathTreeGeneral* patShortestPathGeneral::getTree() { return &shortest_path_tree; }
31.675497
126
0.703742
godosou
c77b1dddc26953ac10f3edd7acda8ab315f2317a
7,002
cpp
C++
CAD/Drawing.cpp
danheeks/PyCAD
711543aaa88c88a82d909f329b6ee36a9b96ae79
[ "BSD-3-Clause" ]
17
2018-07-30T17:38:02.000Z
2022-02-03T10:35:38.000Z
CAD/Drawing.cpp
danheeks/PyCAD
711543aaa88c88a82d909f329b6ee36a9b96ae79
[ "BSD-3-Clause" ]
2
2020-06-11T10:29:06.000Z
2020-06-11T15:42:00.000Z
CAD/Drawing.cpp
danheeks/PyCAD
711543aaa88c88a82d909f329b6ee36a9b96ae79
[ "BSD-3-Clause" ]
null
null
null
// Drawing.cpp // Copyright (c) 2009, Dan Heeks // This program is released under the BSD license. See the file COPYING for details. #include <stdafx.h> #include "Drawing.h" #include "HeeksObj.h" #include "HeeksColor.h" #include "Property.h" #include "DigitizeMode.h" #include "Viewport.h" #include "KeyCode.h" #include "Undoable.h" Drawing::Drawing(void): m_getting_position(false), m_inhibit_coordinate_change(false){ null_view = new ViewSpecific(0); SetView(0); } Drawing::~Drawing(void){ delete null_view; std::map<int, ViewSpecific*>::iterator It; for(It = view_map.begin(); It != view_map.end(); It++){ ViewSpecific *view = It->second; delete view; } ClearObjectsMade(); } HeeksObj* Drawing::TempObject() { if(m_temp_object_in_list.size() == 0)return NULL; return m_temp_object_in_list.back(); } void Drawing::AddToTempObjects(HeeksObj* object) { m_temp_object_in_list.push_back(object); } void Drawing::AddObjectsMade() { theApp->AddUndoably(m_temp_object_in_list,GetOwnerForDrawingObjects()); if(DragDoneWithXOR())theApp->DrawObjectsOnFront(m_temp_object_in_list, true); m_temp_object_in_list.clear(); } void Drawing::ClearObjectsMade() { for(std::list<HeeksObj*>::iterator It = m_temp_object_in_list.begin(); It != m_temp_object_in_list.end(); It++) { HeeksObj* object = *It; if (!object->NeverDelete())delete object; } m_temp_object_in_list.clear(); } void Drawing::ClearPrevObject() { m_prev_object = NULL; } void Drawing::RecalculateAndRedraw(const IPoint& point) { set_digitize_plane(); DigitizedPoint& end = theApp->Digitize(point); if(end.m_type == DigitizeNoItemType)return; if(is_a_draw_level(GetDrawStep())) { if(DragDoneWithXOR())theApp->EndDrawFront(); calculate_item(end); if(DragDoneWithXOR())theApp->DrawFront(); else theApp->Repaint(true); } } void Drawing::AddPoint() { // kill focus on control being typed into // theApp->m_frame->m_input_canvas->DeselectProperties(); // theApp->ProcessPendingEvents(); DigitizedPoint d = theApp->GetLastDigitizePoint(); if(d.m_type == DigitizeNoItemType)return; bool calculated = false; theApp->StartHistory(); if(is_an_add_level(GetDrawStep())){ calculated = calculate_item(d); if(calculated){ before_add_item(); m_prev_object = TempObject(); AddObjectsMade(); set_previous_direction(); } } ClearObjectsMade(); SetStartPosUndoable(d); theApp->UseDigitiedPointAsReference(); int next_step = GetDrawStep() + 1; if(next_step >= number_of_steps()){ next_step = step_to_go_to_after_last_step(); } SetDrawStepUndoable(next_step); theApp->EndHistory(); m_getting_position = false; m_inhibit_coordinate_change = false; theApp->OnInputModeTitleChanged(); } void Drawing::OnMouse( MouseEvent& event ) { bool event_used = false; if(LeftAndRightPressed(event, event_used)) { if(DragDoneWithXOR())theApp->EndDrawFront(); ClearObjectsMade(); theApp->RestoreInputMode(); } if(!event_used){ if(event.m_middleDown || event.GetWheelRotation() != 0) { // theApp->m_select_mode->OnMouse(event); } else{ if(event.LeftDown()){ if(!m_inhibit_coordinate_change) { button_down_point = theApp->Digitize(IPoint(event.GetX(), event.GetY())); } } else if(event.LeftUp()){ if(m_inhibit_coordinate_change){ m_inhibit_coordinate_change = false; } else{ set_digitize_plane(); theApp->SetLastDigitizedPoint(button_down_point); if(m_getting_position){ m_inhibit_coordinate_change = true; m_getting_position = false; } else{ AddPoint(); } } } else if(event.RightUp()){ // do context menu same as select mode // theApp->m_select_mode->OnMouse(event); } else if(event.Moving()){ if(!m_inhibit_coordinate_change){ RecalculateAndRedraw(IPoint(event.GetX(), event.GetY())); theApp->RefreshInputCanvas(); } } } } } bool Drawing::OnKeyDown(KeyCode key_code) { switch (key_code){ case K_F1: case K_RETURN: case K_ESCAPE: // end drawing mode ClearObjectsMade(); theApp->RestoreInputMode(); return true; default: break; } return false; } void Drawing::OnModeChange(void){ view_map.clear(); *null_view = ViewSpecific(0); current_view_stuff = null_view; if(!theApp->GetInputMode()->IsDrawing())SetDrawStepUndoable(0); } HeeksObj* Drawing::GetOwnerForDrawingObjects() { return theApp->GetObjPointer(); //Object always needs to be added somewhere } void Drawing::SetView(int v){ if(v == 0){ current_view_stuff = null_view; return; } if(v == GetView())return; std::map<int, ViewSpecific*>::iterator FindIt; FindIt = view_map.find(v); if(FindIt == view_map.end()){ current_view_stuff = new ViewSpecific(v); view_map.insert(std::pair<int, ViewSpecific*>(v, current_view_stuff)); } else{ current_view_stuff = FindIt->second; } } int Drawing::GetView(){ return current_view_stuff->view; } class SetDrawingDrawStep:public Undoable{ private: Drawing *drawing; int old_step; int step; public: SetDrawingDrawStep(Drawing *d, int s){drawing = d; old_step = drawing->GetDrawStep(); step = s;} // Tool's virtual functions const wchar_t* GetTitle(){return L"set_draw_step";} void Run(bool redo){drawing->set_draw_step_not_undoable(step);} void RollBack(){drawing->set_draw_step_not_undoable(old_step);} }; class SetDrawingPosition:public Undoable{ private: Drawing *drawing; DigitizedPoint prev_pos; DigitizedPoint next_pos; public: SetDrawingPosition(Drawing *d, const DigitizedPoint &pos){ drawing = d; prev_pos = d->GetStartPos(); next_pos = pos; } // Tool's virtual functions const wchar_t* GetTitle(){return L"set_position";} void Run(bool redo){drawing->set_start_pos_not_undoable(next_pos);} void RollBack(){drawing->set_start_pos_not_undoable(prev_pos);} }; void Drawing::SetDrawStepUndoable(int s){ theApp->DoUndoable(new SetDrawingDrawStep(this, s)); } void Drawing::SetStartPosUndoable(const DigitizedPoint& pos){ theApp->DoUndoable(new SetDrawingPosition(this, pos)); } void Drawing::OnFrontRender(){ if(DragDoneWithXOR() && GetDrawStep()){ for(std::list<HeeksObj*>::iterator It = m_temp_object_in_list.begin(); It != m_temp_object_in_list.end(); It++){ HeeksObj *object = *It; object->glCommands(false, false, true); } } theApp->GetDigitizing()->OnFrontRender(); } void Drawing::OnRender(){ if(!DragDoneWithXOR() && GetDrawStep()){ for(std::list<HeeksObj*>::iterator It = m_temp_object_in_list.begin(); It != m_temp_object_in_list.end(); It++){ HeeksObj *object = *It; object->glCommands(false, false, false); } } } void Drawing::GetProperties(std::list<Property *> *list){ theApp->GetObjPointer()->GetProperties(list); // x, y, z }
24.3125
115
0.687232
danheeks
c781ccd303a756ba70c178a55d4c162a1efcfeda
2,837
cpp
C++
src/option_parse.cpp
leapmotion/libuvcxx
c5aa8c6adad31baba9f067c3d8451b8483557334
[ "Apache-2.0" ]
10
2018-12-21T04:43:40.000Z
2021-12-17T00:41:39.000Z
src/option_parse.cpp
leapmotion/libuvcxx
c5aa8c6adad31baba9f067c3d8451b8483557334
[ "Apache-2.0" ]
5
2019-05-09T22:35:45.000Z
2021-03-12T17:23:44.000Z
src/option_parse.cpp
leapmotion/libuvcxx
c5aa8c6adad31baba9f067c3d8451b8483557334
[ "Apache-2.0" ]
13
2019-08-01T12:15:24.000Z
2022-02-09T07:09:29.000Z
// // option_parse.cpp - easy-to-use command-line parser // // Richard Cownie, Leap Motion, 2019-04-18 // // Copyright (c) Leap Motion 2019. All rights reserved. // #include "option_parse.h" #include <cstdio> #include <cstring> namespace leap { OptionParse::OptionParse(int argc, char** argv) : argc_(argc), argv_(argv), idx_(1), pos_(nullptr), nerr_(0) { } bool OptionParse::advance() { if (pos_ && (pos_ == argv_[idx_])) ++idx_; pos_ = nullptr; return true; } void OptionParse::err_bad_option() { fprintf(stderr, "ERROR: option '%s' not recognized\n", (idx_ < argc_) ? argv_[idx_] : "<nullptr>"); ++idx_; ++nerr_; } void OptionParse::err_no_value(const char* sname, const char* lname) { fprintf(stderr, "ERROR: option \"%s\" or \"%s\" has no value\n", sname, lname); ++nerr_; } bool OptionParse::have_option(const char* short_name, const char* long_name) { if (idx_ >= argc_) return false; auto a = argv_[idx_]; auto len = strlen(a); if ((len < 2) || (a[0] != '-')) return false; if (a[1] == short_name[1]) { if (len > 2) { ++idx_; pos_ = &a[2]; } else { ++idx_; pos_ = ((idx_ < argc_) ? argv_[idx_] : nullptr); } return true; } else if (!strcmp(a, long_name)) { ++idx_; pos_ = ((idx_ < argc_) ? argv_[idx_] : nullptr); return true; } return false; } static bool strcasediff(const char* pa, const char* pb) { for (;;) { char a = *pa++; char b = *pb++; if ((a == 0) && (b == 0)) return false; if (('A' <= a) && (a <= 'Z')) a += 'a'-'A'; if (('A' <= b) && (b <= 'Z')) b += 'a'-'A'; if (a != b) return true; } } template<> bool OptionParse::have_value(bool& val) { if (!pos_) return false; if (!strcasediff(pos_, "false") || !strcasediff(pos_, "off") || !strcasediff(pos_, "no")) { val = false; return advance(); } if (!strcasediff(pos_, "true") || !strcasediff(pos_, "on") || !strcasediff(pos_, "yes")) { val = true; return advance(); } return false; } template<> bool OptionParse::have_value(double& val) { if (!pos_) return false; char* endp = pos_; val = strtod(pos_, &endp); return ((endp > pos_) && (*endp == 0) && advance()); } template<> bool OptionParse::have_value(int& val) { if (!pos_) return false; char* endp = pos_; val = (int)strtol(pos_, &endp, 0); return ((endp > pos_) && (*endp == 0) && advance()); } template<> bool OptionParse::have_value(string& val) { if (!pos_) return false; val = std::string(pos_); return ((val.length() > 0) && advance()); } bool OptionParse::have_end() { return (idx_ >= argc_); } bool OptionParse::is_fail() { return (nerr_ > 0); } } // end leap
23.065041
82
0.546352
leapmotion
c787cb4307b3afb300cc30d5c66163cd911b1db1
1,137
hpp
C++
benchmarks/pantheios.hpp
ashgen/reckless
a50429f3819c92b1276c6023f3befafd90ab25b6
[ "MIT" ]
1
2021-07-09T11:21:46.000Z
2021-07-09T11:21:46.000Z
benchmarks/pantheios.hpp
dheeraj7r/reckless
d18804e0bd2c05cb1cb31bbf2eef8709e45455cc
[ "MIT" ]
null
null
null
benchmarks/pantheios.hpp
dheeraj7r/reckless
d18804e0bd2c05cb1cb31bbf2eef8709e45455cc
[ "MIT" ]
null
null
null
#include <pantheios/pantheios.hpp> #include <pantheios/frontends/fe.simple.h> #include <pantheios/backends/bec.file.h> #include <pantheios/inserters/character.hpp> #include <pantheios/inserters/integer.hpp> #include <pantheios/inserters/real.hpp> #ifdef LOG_ONLY_DECLARE #else extern "C" char const PANTHEIOS_FE_PROCESS_IDENTITY[] = "periodic_calls"; #endif #define LOG_INIT() \ pantheios_be_file_setFilePath("log.txt"); \ pantheios_fe_simple_setSeverityCeiling(PANTHEIOS_SEV_DEBUG) #define LOG_CLEANUP() #define LOG( c, i, f ) pantheios::log_INFORMATIONAL("Hello World! ", pantheios::character(c), " ", pantheios::integer(i), " ", pantheios::real(f)) #define LOG_FILE_WRITE(FileNumber, Percent) \ pantheios::log_INFORMATIONAL("file", pantheios::integer(FileNumber), " (", pantheios::real(Percent), "%)") #define LOG_MANDELBROT(Thread, X, Y, FloatX, FloatY, Iterations) \ pantheios::log_INFORMATIONAL("[T", pantheios::integer(Thread), "] " , pantheios::integer(X) , "," , pantheios::integer(Y) , "/" , pantheios::real(FloatX) , "," , pantheios::real(FloatY) , ": " , pantheios::integer(Iterations) , " iterations")
43.730769
246
0.728232
ashgen
c789913689e24b3a3d3509f22929c52bce923747
3,957
cpp
C++
deps/mozjs/src/jsapi-tests/testArgumentsObject.cpp
ktrzeciaknubisa/jxcore-binary-packaging
5759df084be10a259a4a4f1b38c214c6084a7c0f
[ "Apache-2.0" ]
2,494
2015-02-11T04:34:13.000Z
2022-03-31T14:21:47.000Z
deps/mozjs/src/jsapi-tests/testArgumentsObject.cpp
ktrzeciaknubisa/jxcore-binary-packaging
5759df084be10a259a4a4f1b38c214c6084a7c0f
[ "Apache-2.0" ]
685
2015-02-11T17:14:26.000Z
2021-04-13T09:58:39.000Z
deps/mozjs/src/jsapi-tests/testArgumentsObject.cpp
ktrzeciaknubisa/jxcore-binary-packaging
5759df084be10a259a4a4f1b38c214c6084a7c0f
[ "Apache-2.0" ]
442
2015-02-12T13:45:46.000Z
2022-03-21T05:28:05.000Z
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sts=4 et sw=4 tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "jsapi-tests/tests.h" #include "jsobjinlines.h" #include "vm/ArgumentsObject-inl.h" using namespace js; static const char NORMAL_ZERO[] = "function f() { return arguments; }"; static const char NORMAL_ONE[] = "function f(a) { return arguments; }"; static const char NORMAL_TWO[] = "function f(a, b) { return arguments; }"; static const char NORMAL_THREE[] = "function f(a, b, c) { return arguments; }"; static const char STRICT_ZERO[] = "function f() { 'use strict'; return arguments; }"; static const char STRICT_ONE[] = "function f() { 'use strict'; return arguments; }"; static const char STRICT_TWO[] = "function f() { 'use strict'; return arguments; }"; static const char STRICT_THREE[] = "function f() { 'use strict'; return arguments; }"; static const char * const CALL_CODES[] = { "f()", "f(0)", "f(0, 1)", "f(0, 1, 2)", "f(0, 1, 2, 3)", "f(0, 1, 2, 3, 4)" }; BEGIN_TEST(testArgumentsObject) { return ExhaustiveTest<0>(NORMAL_ZERO) && ExhaustiveTest<1>(NORMAL_ZERO) && ExhaustiveTest<2>(NORMAL_ZERO) && ExhaustiveTest<0>(NORMAL_ONE) && ExhaustiveTest<1>(NORMAL_ONE) && ExhaustiveTest<2>(NORMAL_ONE) && ExhaustiveTest<3>(NORMAL_ONE) && ExhaustiveTest<0>(NORMAL_TWO) && ExhaustiveTest<1>(NORMAL_TWO) && ExhaustiveTest<2>(NORMAL_TWO) && ExhaustiveTest<3>(NORMAL_TWO) && ExhaustiveTest<4>(NORMAL_TWO) && ExhaustiveTest<0>(NORMAL_THREE) && ExhaustiveTest<1>(NORMAL_THREE) && ExhaustiveTest<2>(NORMAL_THREE) && ExhaustiveTest<3>(NORMAL_THREE) && ExhaustiveTest<4>(NORMAL_THREE) && ExhaustiveTest<5>(NORMAL_THREE) && ExhaustiveTest<0>(STRICT_ZERO) && ExhaustiveTest<1>(STRICT_ZERO) && ExhaustiveTest<2>(STRICT_ZERO) && ExhaustiveTest<0>(STRICT_ONE) && ExhaustiveTest<1>(STRICT_ONE) && ExhaustiveTest<2>(STRICT_ONE) && ExhaustiveTest<3>(STRICT_ONE) && ExhaustiveTest<0>(STRICT_TWO) && ExhaustiveTest<1>(STRICT_TWO) && ExhaustiveTest<2>(STRICT_TWO) && ExhaustiveTest<3>(STRICT_TWO) && ExhaustiveTest<4>(STRICT_TWO) && ExhaustiveTest<0>(STRICT_THREE) && ExhaustiveTest<1>(STRICT_THREE) && ExhaustiveTest<2>(STRICT_THREE) && ExhaustiveTest<3>(STRICT_THREE) && ExhaustiveTest<4>(STRICT_THREE) && ExhaustiveTest<5>(STRICT_THREE); } static const size_t MAX_ELEMS = 6; template<size_t ArgCount> bool ExhaustiveTest(const char funcode[]) { RootedValue v(cx); EVAL(funcode, &v); EVAL(CALL_CODES[ArgCount], &v); Rooted<ArgumentsObject*> argsobj(cx, &v.toObjectOrNull()->as<ArgumentsObject>()); JS::AutoValueArray<MAX_ELEMS> elems(cx); for (size_t i = 0; i <= ArgCount; i++) { for (size_t j = 0; j <= ArgCount - i; j++) { ClearElements(elems); CHECK(argsobj->maybeGetElements(i, j, elems.begin())); for (size_t k = 0; k < j; k++) CHECK_SAME(elems[k], INT_TO_JSVAL(i + k)); for (size_t k = j; k < MAX_ELEMS - 1; k++) CHECK_SAME(elems[k], JSVAL_NULL); CHECK_SAME(elems[MAX_ELEMS - 1], INT_TO_JSVAL(42)); } } return true; } template <size_t N> static void ClearElements(JS::AutoValueArray<N> &elems) { for (size_t i = 0; i < elems.length() - 1; i++) elems[i].setNull(); elems[elems.length() - 1].setInt32(42); } END_TEST(testArgumentsObject)
34.710526
85
0.600202
ktrzeciaknubisa
c78baa675a8f0fd8123f7d851d3358c325d64cb8
1,276
cpp
C++
src/Private/AnimSceneActions/WaitForActionFinishedAction.cpp
heltena/KYEngine
4ccb89d0b20683feb245ffe85dd34b6ffdc42c8e
[ "MIT" ]
null
null
null
src/Private/AnimSceneActions/WaitForActionFinishedAction.cpp
heltena/KYEngine
4ccb89d0b20683feb245ffe85dd34b6ffdc42c8e
[ "MIT" ]
null
null
null
src/Private/AnimSceneActions/WaitForActionFinishedAction.cpp
heltena/KYEngine
4ccb89d0b20683feb245ffe85dd34b6ffdc42c8e
[ "MIT" ]
null
null
null
#include <KYEngine/SceneTimelineInfo.h> #include <KYEngine/Private/AnimSceneActions/WaitForActionFinishedAction.h> #include <KYEngine/Utility/TiXmlHelper.h> const std::string WaitForActionFinishedAction::XML_NODE = "wait-for-action-finished"; WaitForActionFinishedAction::WaitForActionFinishedAction() { } WaitForActionFinishedAction::~WaitForActionFinishedAction() { } WaitForActionFinishedAction* WaitForActionFinishedAction::readFromXml(TiXmlElement* node) { WaitForActionFinishedAction* action = new WaitForActionFinishedAction(); const std::string name = TiXmlHelper::readString(node, "name", false, "<<undefined>>"); const std::string actionRef = TiXmlHelper::readString(node, "action-ref", true); action->setName(name); action->setActionRef(actionRef); return action; } void WaitForActionFinishedAction::start(SceneTimelineInfo* info) { if (info->isActionFinished(m_actionRef)) m_isFinished = true; else { m_isFinished = false; info->waitForActionFinished(m_actionRef, this); } } bool WaitForActionFinishedAction::isBlocking() { return true; } bool WaitForActionFinishedAction::isFinished() { return m_isFinished; } void WaitForActionFinishedAction::update(const double elapsedTime, SceneTimelineInfo* info) { }
25.019608
91
0.775862
heltena
c78edeb424cd45f73309489e60109cc7f646de84
1,358
cc
C++
leetcode/78_subsets.cc
norlanliu/algorithm
1684db2631f259b4de567164b3ee866351e5b1b6
[ "MIT" ]
null
null
null
leetcode/78_subsets.cc
norlanliu/algorithm
1684db2631f259b4de567164b3ee866351e5b1b6
[ "MIT" ]
null
null
null
leetcode/78_subsets.cc
norlanliu/algorithm
1684db2631f259b4de567164b3ee866351e5b1b6
[ "MIT" ]
null
null
null
/* * ===================================================================================== * * Filename: 78_subsets.cc * * Description: * * Version: 1.0 * Created: 04/01/2015 10:09:16 PM * Revision: none * Compiler: gcc * * Author: (Qi Liu), liuqi.edward@gmail.com * Organization: antq.com * * ===================================================================================== */ #include<vector> #include<iostream> #include<algorithm> using namespace std; class Solution{ int _n; void EnumAll(vector<int>& instance, vector<int>& data, int start, int k, vector<vector<int> >& ans){ if(k == 0){ ans.push_back(instance); return; } for(int i = start; i < _n - k; ++i){ instance[k-1] = data[i]; EnumAll(instance, data, i+1, k-1, ans); } } public: vector<vector<int> > subsets(vector<int> &S){ vector<int> instance; vector<vector<int> > ans; _n = S.size() + 1; std::sort(S.begin(), S.end(), [](int a, int b){ return a > b; }); for(int i = 0; i < _n; ++i){ instance.resize(i); EnumAll(instance, S, 0, i, ans); } return ans; } }; int main(){ Solution sln; vector<int> s = {1,2, 3}; vector<vector<int> > ans = sln.subsets(s); for(auto & it : ans){ for(auto i : it){ cout<<i<<","; } cout<<endl; } return 0; }
21.555556
101
0.4757
norlanliu
c78fa936a91d02b8c3f3a3c7af6bafee5a607dc4
2,766
cc
C++
Estructuras/LazyST.cc
joaquingx/Competitive
09ddc7e06c4428c21bb9de31a846a8364ea038d1
[ "MIT" ]
1
2018-01-15T09:13:52.000Z
2018-01-15T09:13:52.000Z
Estructuras/LazyST.cc
joaquingx/Competitive
09ddc7e06c4428c21bb9de31a846a8364ea038d1
[ "MIT" ]
null
null
null
Estructuras/LazyST.cc
joaquingx/Competitive
09ddc7e06c4428c21bb9de31a846a8364ea038d1
[ "MIT" ]
1
2018-01-15T09:13:51.000Z
2018-01-15T09:13:51.000Z
#include <bits/stdc++.h> #define MAXN int(1e5) using namespace std; // Based on https://www.hackerearth.com/practice/notes/segment-tree-and-lazy-propagation/ int A[MAXN],tree[4*MAXN],lazy[4*MAXN]; void build(int node, int start, int end) { if(start == end) { // Leaf node will have a single element tree[node] = A[start]; } else { int mid = (start + end) / 2; // Recurse on the left child build(2*node, start, mid); // Recurse on the right child build(2*node+1, mid+1, end); // Internal node will have the sum of both of its children tree[node] = tree[2*node] + tree[2*node+1]; } } void updateRange(int node, int start, int end, int l, int r, int val) { if(lazy[node] != 0) { // This node needs to be updated tree[node] += (end - start + 1) * lazy[node]; // Update it if(start != end) { lazy[node*2] += lazy[node]; // Mark child as lazy lazy[node*2+1] += lazy[node]; // Mark child as lazy } lazy[node] = 0; // Reset it } if(start > end or start > r or end < l) // Current segment is not within range [l, r] return; if(start >= l and end <= r) { // Segment is fully within range tree[node] += (end - start + 1) * val; if(start != end) { // Not leaf node lazy[node*2] += val; lazy[node*2+1] += val; } return; } int mid = (start + end) / 2; updateRange(node*2, start, mid, l, r, val); // Updating left child updateRange(node*2 + 1, mid + 1, end, l, r, val); // Updating right child tree[node] = tree[node*2] + tree[node*2+1]; // Updating root with max value } int queryRange(int node, int start, int end, int l, int r) { if(start > end or start > r or end < l) return 0; // Out of range if(lazy[node] != 0) { // This node needs to be updated tree[node] += (end - start + 1) * lazy[node]; // Update it if(start != end) { lazy[node*2] += lazy[node]; // Mark child as lazy lazy[node*2+1] += lazy[node]; // Mark child as lazy } lazy[node] = 0; // Reset it } if(start >= l and end <= r) // Current segment is totally within range [l, r] return tree[node]; int mid = (start + end) / 2; int p1 = queryRange(node*2, start, mid, l, r); // Query left child int p2 = queryRange(node*2 + 1, mid + 1, end, l, r); // Query right child return (p1 + p2); } int main() { return 0; }
31.431818
102
0.497831
joaquingx
c79023a9fe05d4a6200b4ddc889e4239dc6498e9
717
cpp
C++
concurrency/call_once.cpp
miaogen123/daily-coding
5d7f463ad1fee5e512aeb36206526b53b9a781f6
[ "MIT" ]
19
2018-07-06T06:53:56.000Z
2022-01-01T16:36:26.000Z
concurrency/call_once.cpp
miaogen123/daily-coding
5d7f463ad1fee5e512aeb36206526b53b9a781f6
[ "MIT" ]
null
null
null
concurrency/call_once.cpp
miaogen123/daily-coding
5d7f463ad1fee5e512aeb36206526b53b9a781f6
[ "MIT" ]
17
2019-03-27T23:18:43.000Z
2021-01-18T11:17:57.000Z
#include<iostream> #include<thread> #include<mutex> #include<vector> #include<string> using namespace std; class TestCallOnce { public: TestCallOnce(){} void init(){ hello=new temp; std::cout<<"i'm initing\n"; } int getvi1(){ call_once(IsInitFlag, init, this); cout<<"1 out "<<hello->vi[1]; return hello->vi[1]; } int getvi2(){ call_once(IsInitFlag, init, this); cout<<"2 out "<<hello->vi[0]; return hello->vi[0]; } private: class temp{ public: std::vector<int> vi {100, 10}; }; temp* hello; std::once_flag IsInitFlag; }; int main(void) { TestCallOnce temp1; thread t1(TestCallOnce::getvi1, &temp1); thread t2(TestCallOnce::getvi2,&temp1); t1.join(); t2.join(); return 0; }
15.933333
41
0.65272
miaogen123
c79403c084bed9899b2cbdd2441962b0fdf49e2b
4,172
cpp
C++
third-party/Empirical/tests/tools/keyname_utils.cpp
koellingh/empirical-p53-simulator
aa6232f661e8fc65852ab6d3e809339557af521b
[ "MIT" ]
null
null
null
third-party/Empirical/tests/tools/keyname_utils.cpp
koellingh/empirical-p53-simulator
aa6232f661e8fc65852ab6d3e809339557af521b
[ "MIT" ]
null
null
null
third-party/Empirical/tests/tools/keyname_utils.cpp
koellingh/empirical-p53-simulator
aa6232f661e8fc65852ab6d3e809339557af521b
[ "MIT" ]
null
null
null
#define CATCH_CONFIG_MAIN #include "third-party/Catch/single_include/catch2/catch.hpp" #include "emp/tools/keyname_utils.hpp" #include <sstream> #include <iostream> #include <string> TEST_CASE("Test keyname_utils", "[tools]") { // test unpack emp::keyname::unpack_t goal{ {"seed", "100"}, {"foobar", "20"}, {"_hash", "asdf"}, {"ext", ".txt"} }; std::string name; name = "seed=100+foobar=20+_hash=asdf+ext=.txt"; goal["_"] = name; REQUIRE( emp::keyname::unpack(name) == goal ); // reorderings name = "foobar=20+seed=100+_hash=asdf+ext=.txt"; goal["_"] = name; REQUIRE( emp::keyname::unpack(name) == goal ); name = "_hash=asdf+foobar=20+seed=100+ext=.txt"; goal["_"] = name; REQUIRE( emp::keyname::unpack(name) == goal ); // should ignore path name = "path/seed=100+foobar=20+_hash=asdf+ext=.txt"; goal["_"] = name; REQUIRE( emp::keyname::unpack(name) == goal ); name = "~/more=path/+blah/seed=100+foobar=20+_hash=asdf+ext=.txt"; goal["_"] = name; REQUIRE( emp::keyname::unpack(name) == goal ); name = "just/a/regular/file.pdf"; REQUIRE( emp::keyname::unpack(name) == (emp::keyname::unpack_t{ {"file.pdf", ""}, {"_", "just/a/regular/file.pdf"} })); name = "key/with/no+=value/file+ext=.pdf"; REQUIRE( emp::keyname::unpack(name) == (emp::keyname::unpack_t{ {"file", ""}, {"ext", ".pdf"}, {"_", "key/with/no+=value/file+ext=.pdf"} })); name = "multiple/=s/file=biz=blah+ext=.pdf"; REQUIRE( emp::keyname::unpack(name) == (emp::keyname::unpack_t{ {"file", "biz=blah"}, {"ext", ".pdf"}, {"_", "multiple/=s/file=biz=blah+ext=.pdf"} })); // test pack // reorderings REQUIRE( (emp::keyname::pack({ {"seed", "100"}, {"foobar", "20"}, {"_hash", "asdf"}, {"ext", ".txt"} })) == "foobar=20+seed=100+_hash=asdf+ext=.txt" ); REQUIRE( (emp::keyname::pack({ {"_hash", "asdf"}, {"seed", "100"}, {"foobar", "20"}, {"ext", ".txt"} })) == "foobar=20+seed=100+_hash=asdf+ext=.txt" ); REQUIRE( (emp::keyname::pack({ {"_hash", "asdf"}, {"foobar", "20"}, {"ext", ".txt"}, {"seed", "100"} })) == "foobar=20+seed=100+_hash=asdf+ext=.txt" ); // different values REQUIRE( (emp::keyname::pack({ {"seed", "100"}, {"foobar", "blip"}, {"_hash", "asdf"}, {"ext", ".txt"} })) == "foobar=blip+seed=100+_hash=asdf+ext=.txt" ); REQUIRE( (emp::keyname::pack({ {"seed", "a100"}, {"foobar", "blip"}, {"_hash", "asdf"}, {"ext", ".txt"} })) == "foobar=blip+seed=a100+_hash=asdf+ext=.txt" ); REQUIRE( (emp::keyname::pack({ {"aseed", "a100"}, {"foobar", "blip"}, {"_hash", "asdf"}, {"ext", ".txt"} })) == "aseed=a100+foobar=blip+_hash=asdf+ext=.txt" ); // should ignore "_" key REQUIRE( (emp::keyname::pack({ {"seed", "100"}, {"foobar", "20"}, {"_hash", "asdf"}, {"ext", ".txt"}, {"_", "foobar=20+seed=100+_hash=asdf+ext=.txt"} })) == "foobar=20+seed=100+_hash=asdf+ext=.txt" ); REQUIRE( (emp::keyname::pack({ {"seed", "100"}, {"foobar", "20"}, {"_hash", "asdf"}, {"ext", ".txt"}, {"_", "path/seed=100+foobar=20+_hash=asdf+ext=.txt"} })) == "foobar=20+seed=100+_hash=asdf+ext=.txt" ); REQUIRE( (emp::keyname::pack({ {"seed", "100"}, {"foobar", "20"}, {"_hash", "asdf"}, {"ext", ".txt"}, {"_", "~/more=path/+blah/seed=100+foobar=20+_hash=asdf+ext=.txt"} })) == "foobar=20+seed=100+_hash=asdf+ext=.txt" ); REQUIRE( (emp::keyname::pack({ {"seed", "100"}, {"foobar", "20"}, {"_hash", "asdf"}, {"ext", ".txt"}, {"_", "\"whatever+=/\""} })) == "foobar=20+seed=100+_hash=asdf+ext=.txt" ); // missing extension REQUIRE( (emp::keyname::pack({ {"_hash", "asdf"}, {"foobar", "20"}, {"seed", "100"} })) == "foobar=20+seed=100+_hash=asdf" ); }
24.397661
72
0.495686
koellingh
c794aa85ee79c418bf6e8c73b90e98d7702b9495
1,133
cc
C++
caffe2/binaries/speed_benchmark.cc
123chengbo/caffe2
0a68778916f3280b5292fce0d74b73b70fb0f7e8
[ "BSD-3-Clause" ]
1
2017-03-13T01:38:16.000Z
2017-03-13T01:38:16.000Z
caffe2/binaries/speed_benchmark.cc
will001/caffe2
0a68778916f3280b5292fce0d74b73b70fb0f7e8
[ "BSD-3-Clause" ]
null
null
null
caffe2/binaries/speed_benchmark.cc
will001/caffe2
0a68778916f3280b5292fce0d74b73b70fb0f7e8
[ "BSD-3-Clause" ]
1
2020-03-19T08:48:39.000Z
2020-03-19T08:48:39.000Z
#include "caffe2/core/init.h" #include "caffe2/core/operator.h" #include "caffe2/proto/caffe2.pb.h" #include "caffe2/utils/proto_utils.h" #include "caffe2/core/logging.h" CAFFE2_DEFINE_string(net, "", "The given net to benchmark."); CAFFE2_DEFINE_string(init_net, "", "The given net to initialize any parameters."); CAFFE2_DEFINE_int(warmup, 0, "The number of iterations to warm up."); CAFFE2_DEFINE_int(iter, 10, "The number of iterations to run."); CAFFE2_DEFINE_bool(run_individual, false, "Whether to benchmark individual operators."); int main(int argc, char** argv) { caffe2::GlobalInit(&argc, &argv); std::unique_ptr<caffe2::Workspace> workspace(new caffe2::Workspace()); // Run initialization network. caffe2::NetDef net_def; CHECK(ReadProtoFromFile(caffe2::FLAGS_init_net, &net_def)); CHECK(workspace->RunNetOnce(net_def)); CHECK(ReadProtoFromFile(caffe2::FLAGS_net, &net_def)); caffe2::NetBase* net = workspace->CreateNet(net_def); CHECK_NOTNULL(net); CHECK(net->Run()); net->TEST_Benchmark(caffe2::FLAGS_warmup, caffe2::FLAGS_iter, caffe2::FLAGS_run_individual); return 0; }
40.464286
94
0.736981
123chengbo