blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
5
146
content_id
stringlengths
40
40
detected_licenses
listlengths
0
7
license_type
stringclasses
2 values
repo_name
stringlengths
6
79
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
4 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.07k
426M
star_events_count
int64
0
27
fork_events_count
int64
0
12
gha_license_id
stringclasses
3 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
6 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
1 class
length_bytes
int64
20
6.28M
extension
stringclasses
20 values
content
stringlengths
20
6.28M
authors
listlengths
1
16
author_lines
listlengths
1
16
09fbaa4b10175773a3961c1d1d5351e8fefd3c99
95a3e8914ddc6be5098ff5bc380305f3c5bcecb2
/src/FusionForever_lib/BeamFiringSection.cpp
554dd755ebbb54dab980d0551214793cf8d42034
[]
no_license
danishcake/FusionForever
8fc3b1a33ac47177666e6ada9d9d19df9fc13784
186d1426fe6b3732a49dfc8b60eb946d62aa0e3b
refs/heads/master
2016-09-05T16:16:02.040635
2010-04-24T11:05:10
2010-04-24T11:05:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,140
cpp
#include "StdAfx.h" #include "BeamFiringSection.h" #include "Ricochet.h" BeamFiringSection::BeamFiringSection(void) : Section() { beam_ = NULL; ltv_firing_ = false; beam_sum_time_ = 0; beam_charge_time_ = 0.5f; beam_cooldown_time_ = 0.5f; beam_fire_time_ = 2.0f; beam_deco_spawn_ = 0; beam_charge_.SetPosition(Vector3f(0, 4.0f, 0)); beam_energy_use_ = 5; charge_up_sound_ = ""; firing_sound_ = ""; //beam_sound_ = LoopingBuffer("fire1.wav"); } BeamFiringSection::~BeamFiringSection(void) { delete beam_; } void BeamFiringSection::Tick(float _timespan, std::vector<Projectile_ptr>& _spawn_prj, std::vector<Decoration_ptr>& _spawn_dec, Matrix4f _transform, std::vector<Core_ptr>& _enemies, ICollisionManager* _collision_manager) { beam_->SetFirer_ID(root_->GetSectionID()); Section::Tick(_timespan, _spawn_prj, _spawn_dec, _transform, _enemies, _collision_manager); if(firing_&& PowerRequirement(10)) { if(!beam_sound_.GetPlaying()) beam_sound_.Start(); beam_sum_time_ += _timespan; if(!ltv_firing_ && charge_up_sound_.length() != 0) SoundManager::Instance().PlaySample(charge_up_sound_); if(beam_sum_time_ < beam_charge_time_) { beam_charge_.SetScale(beam_sum_time_ / beam_charge_time_); PowerTick(-beam_energy_use_ * _timespan); } if(beam_sum_time_ >= beam_charge_time_ && beam_sum_time_ < beam_charge_time_ + beam_fire_time_) { beam_->Tick(_timespan, _spawn_dec, ltv_transform_, _enemies); beam_charge_.SetScale(Random::RandomRange(0.9f, 1.1f)); PowerTick(-beam_energy_use_ * _timespan); } if(beam_sum_time_ > beam_charge_time_ + beam_fire_time_ && beam_sum_time_ < beam_charge_time_ + beam_fire_time_ + beam_cooldown_time_) { beam_charge_.SetScale( 1.0f - ((beam_sum_time_ - beam_charge_time_ - beam_fire_time_) / beam_charge_time_)); PowerTick(-beam_energy_use_ * _timespan); } if(beam_sum_time_ >= beam_charge_time_ + beam_fire_time_ + beam_cooldown_time_) { beam_sum_time_ = 0; beam_charge_.SetScale(0); } } else { if(beam_sound_.GetPlaying()) beam_sound_.Stop(); if(ltv_firing_ && beam_sum_time_ > beam_cooldown_time_) beam_sum_time_ = beam_cooldown_time_; if(beam_sum_time_ > 0) beam_sum_time_-= _timespan; beam_charge_.SetScale(beam_sum_time_ / beam_cooldown_time_); } ltv_firing_ = firing_; beam_charge_.Tick(_timespan, ltv_transform_, _spawn_dec); } void BeamFiringSection::DrawSelf() { Section::DrawSelf(); //Now draw beam if firing if(firing_ && health_ > 0) { if(beam_sum_time_ >= beam_charge_time_ && beam_sum_time_ < beam_charge_time_ + beam_fire_time_) beam_->DrawSelf(); } if(health_ > 0) beam_charge_.DrawSelf(); } void BeamFiringSection::RegisterMetadata() { Section::RegisterMetadata(); SectionMetadata::RegisterSectionTag(section_type_, "Beam"); SectionMetadata::RegisterSectionTag(section_type_, "Weapon"); SectionMetadata::RegisterSectionKeyValue(section_type_, "Range", beam_->GetMaxDistance()); SectionMetadata::RegisterSectionKeyValue(section_type_, "BeamDPS", beam_->GetDPS()); }
[ "Edward Woolhouse@e6f1df29-e57c-d74d-9e6e-27e3b006b1a7", "[email protected]" ]
[ [ [ 1, 18 ], [ 20, 32 ], [ 36, 64 ], [ 67, 73 ], [ 75, 80 ], [ 82, 85 ], [ 98, 98 ] ], [ [ 19, 19 ], [ 33, 35 ], [ 65, 66 ], [ 74, 74 ], [ 81, 81 ], [ 86, 97 ] ] ]
e609db5ed30c53cc41ece81ea53bd2d20b77315d
38af8ef5939efeb9f98d77756fd54ff8a94985d1
/rzpctrl/src/rtsetpage.h
533961a8bc340c45963aee0bfaa7cbd800607011
[]
no_license
suda-ee/miscprojectsrepo
16658894d1a3ae5c5900395ce84f519cafc7fd8a
e29d56498910045d97ecc3fd3205b1add4080683
refs/heads/master
2021-01-18T15:29:33.618773
2011-01-12T06:26:06
2011-01-12T06:26:06
86,655,718
0
0
null
null
null
null
UTF-8
C++
false
false
536
h
#ifndef RTSETPAGE_H #define RTSETPAGE_H #include <QtGui/QWidget> #include "ui_rtsetpage.h" #include "rtsetmodel.h" #include "rtsetdelegate.h" QT_BEGIN_NAMESPACE class rtsetpage : public QWidget, public Ui::rtsetpage { Q_OBJECT public: rtsetpage(QWidget *parent = 0); ~rtsetpage(); rtsetmodel *model; rtsetdelegate *delegate; signals: void rtSetManu(bool checked = true); void rtSetAuto(bool checked = true); void sgSendRoute(); }; QT_END_NAMESPACE #endif // RTSETPAGE_H
[ "cai@localhost" ]
[ [ [ 1, 28 ] ] ]
312201ccbcf3bed7ff86adca72ac49e9a5e93939
3c6723c88064e74961ed26fbe8f70ef2e3856ebf
/dev2/macro/TTileCommRun/monocis_modified.cpp
3cbc60b30ba84e7c63a5fde3dc5b8e5a3af17063
[]
no_license
lauramoraes/WIS
534fa416c14a25ba618b7d85323f8bb062fe9be2
e7dbd4e456c4b93ea51d33d5d631263a60a6f3b9
refs/heads/master
2021-01-02T09:32:53.155405
2009-09-16T12:53:55
2009-09-16T12:53:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,447
cpp
////////////Main Code - You must add more lines if you want to run in WIS ///Modified RMS and Mean Code //// ////by Alexis Kalogeropoulos void monplots(TString runno, TString filename, TString module) { Double_t maxenerms = 1.5; Double_t maxpedrms = 0.8; TString defdir = "rfio:/castor/cern.ch/user/t/tilebeam/commissioning/"; TString deffile = "tiletb_"+TString(runno)+TString("_MonoCis.0.root"); if(filename == ""){ filename = defdir+deffile; } TFile *f = TFile::Open(filename); TTree *t = (TTree*)f->Get("TileRec/h1000"); Float_t efit[48], pedfit[48]; Int_t cispar[16]; TString vare = "Efit"+module; TString varp = "Pedfit"+module; TString varc = "Cispar"; t->SetBranchAddress(vare, &efit); t->SetBranchAddress(varp, &pedfit); t->SetBranchAddress(varc, &cispar); Int_t nevt = t->GetEntries(); Int_t i, j, k; t->GetEntry(i); Double_t charge = 2*4.096*cispar[6]*cispar[7]/1023; Double_t uphist = charge +20.0; Double_t minmean = charge - 10.0; TH1F *hene[48], *hped[48]; TString nene, tene, nped, tped; for(j=0;j<48;j++){ nene = "ene"; nene += j; tene = "Energy "; tene += j; hene[j]=new TH1F(nene, tene, 100, 0, uphist); nped = "ped"; nped += j; tped = "Pedestal "; tped += j; hped[j]=new TH1F(nped, tped, 100, 0, 100); } Double_t sumene[48]={0}, sqsumene[48]={0}, sumped[48]={0}, sqsumped[48]={0}; Double_t chan[48]={0}, meanene[48]={0}, rmsene[48]={0}, meanped[48]={0}, rmsped[48]={0}; vector<Int_t> bad; for(Int_t i=0;i<nevt;i++){ t->GetEntry(i); for(j=0;j<48;j++){ sumene[j] += efit[j]; sqsumene[j] += efit[j]**2; sumped[j] += pedfit[j]; sqsumped[j] += pedfit[j]**2; } } cout<<minmean<<"\t\t"<<maxenerms<<"\t\t"<<maxpedrms<<endl; for(j=0;j<48;j++){ chan[j]=j; if(j !=31 && j!=32 && j!=43){ meanene[j]=(Double_t) sumene[j]/nevt; rmsene[j]= sqrt((Double_t) sqsumene[j]/nevt-meanene[j]**2); meanped[j]=(Double_t) sumped[j]/nevt; rmsped[j]= sqrt((Double_t) sqsumped[j]/nevt-meanped[j]**2); cout<<j<<"\t\t"<<meanene[j]<<"\t\t"<<rmsene[j]<<"\t\t"<<rmsped[j]<<"\t\t"<<meanped[j]<<" "<<endl; ///Please, do not modify the next 2 lines you ll get crazy plots!!! //////////////////////////////////////////////////////////////// if ((minmean > meanene[j]) || ( rmsene[j] > maxenerms) || ( rmsped[j] > maxpedrms)) bad.push_back(j); /////////Lines below must change in order this code to work in the WIS interface ////////Refer to monocis.cpp for more info///////////// /////// End of modifications/////////////////////////// TLine *lmean = new TLine(0, minmean, 50, minmean); lmean->SetLineColor(2); TLine *lenerms = new TLine(0, maxenerms, 50, maxenerms); lenerms->SetLineColor(2); TLine *lpedrms = new TLine(0, maxpedrms, 50, maxpedrms); lpedrms->SetLineColor(2); TGraph *genemean = new TGraph(48, chan, meanene); genemean->SetMarkerStyle(21); genemean->SetTitle("Mean Energy"); genemean->GetXaxis()->SetTitle("Channel"); TGraph *generms = new TGraph(48, chan, rmsene); generms->SetMarkerStyle(21); generms->SetTitle("RMS Energy"); generms->GetXaxis()->SetTitle("Channel"); TGraph *gpedmean = new TGraph(48, chan, meanped); gpedmean->SetMarkerStyle(21); gpedmean->SetTitle("Mean Pedestal"); gpedmean->GetXaxis()->SetTitle("Channel"); TGraph *gpedrms = new TGraph(48, chan, rmsped); gpedrms->SetMarkerStyle(21); gpedrms->SetTitle("RMS Pedestal"); gpedrms->GetXaxis()->SetTitle("Channel"); } } TCanvas *c1 = new TCanvas("c1", "MonoCis", 700, 500); c1->Divide(2,2); c1->cd(1); genemean->Draw("AP"); lmean->Draw(); c1->cd(2); generms->Draw("AP"); lenerms->Draw(); c1->cd(3); gpedmean->Draw("AP"); c1->cd(4); gpedrms->Draw("AP"); lpedrms->Draw(); cout.precision(3); cout<<"Number of bad channels is "<<bad.size()<<endl; if(bad.size() > 0) cout<<"Channel"<<'\t'<<"Mean energy"<<'\t'<<"RMS energy"<<'\t'<<"RMS pedestal"<<'\t'<<"Mean pedestal "<<endl; for(i=0;i<bad.size();i++){ Int_t ch = bad.at(i); cout<<ch<<"\t"<<meanene[i]<<"\t\t"<<rmsene[i]<<"\t\t"<<rmsped[i]<<"\t\t"<<meanped[i]<<endl; } TString filenameps = "r"+runno+"_"+module+"_MonoCis.ps"; TString filenamepng = "r"+runno+"_"+module+"_MonoCis.png"; c1->Print(filenameps); c1->Print(filenamepng); }
[ [ [ 1, 152 ] ] ]
3331780bb3b871032915420781453b44c542d444
29792c63c345f87474136c8df87beb771f0a20a8
/server/gamemode/generic.h
3d85acb4c481685880a9457481dbadd55508b7d2
[]
no_license
uvbs/jvcmp
244ba6c2ab14ce0a757f3f6044b5982287b01fae
57225e1c52085216a0a4a9c4e33ed324c1c92d39
refs/heads/master
2020-12-29T00:25:39.180996
2009-06-24T14:52:39
2009-06-24T14:52:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
518
h
// File Author: kyeman #ifndef _GENERIC_H_ #define _GENERIC_H_ #include "../main.h" #define MAX_SPAWNS 100 class CGameModeGeneric { private: BOOL m_bGameStated; int m_iLastSpawnIssued; PLAYER_SPAWN_INFO m_AvailableSpawns[MAX_SPAWNS]; int m_iAvailableSpawnCount; public: int Init(); BOOL HandleSpawnClassRequest(BYTE bytePlayerID,int iSpawnType); CGameModeGeneric() { m_iLastSpawnIssued = 0; m_iAvailableSpawnCount = 0; }; ~CGameModeGeneric() {}; }; #endif
[ "jacks.mini.net@43d76e2e-6035-11de-a55d-e76e375ae706" ]
[ [ [ 1, 30 ] ] ]
6aa9de071e26b4c18cd7ae52a263b095dd952743
9e590d76ad900ef940486ccda8633bd79c6acd4e
/ki2key/core/Setting.cpp
4e257c34ea5d988a8de21c9c6bdfc3fcc950a624
[ "BSD-2-Clause" ]
permissive
szk/Ki2Key
f66ec830e61d14ddf3c42ac469cd88da2dcf9e03
9498f32df419f94acbbecdffefbef25dc083eecf
refs/heads/master
2020-05-16T23:11:19.061205
2011-12-07T15:45:21
2011-12-07T15:45:21
1,168,628
0
0
null
null
null
null
UTF-8
C++
false
false
7,384
cpp
/* * Copyright (c) 2011, Tatsuhiko Suzuki * 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. * 3. Neither the name of the copyright holders 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. */ #include "stdafx.h" #include "Setting.hpp" const Str SETTING_BASE(_T(APPNAME)); // For Actions const Str SETTING_ACTION(_T("Action")); // For Children of actions const Str SETTING_GESTURE(_T("Gesture")); const Str SETTING_TARGET(_T("Target")); const Str SETTING_TARGET_NAME(_T("name")); // attribute const Str SETTING_TARGET_CLASS(_T("Class")); const Str SETTING_TARGET_CLASS_ENABLED(_T("use")); // attribute const Str SETTING_COMMAND(_T("Command")); const Str SETTING_COMMAND_TYPE(_T("type")); // attribute const Str SETTING_COMMAND_CODE(_T("code")); // attribute const Str SETTING_SENDING_TYPE(_T("send")); // attribute // For sensors const Str SETTING_SENSOR(_T("Sensor")); const Str SETTING_SENSOR_DISPLAY(_T("pixels")); // attribute const Str SETTING_SENSOR_FPS(_T("fps")); // atribute Setting::Setting(void) { } Setting::~Setting(void) { } const bool Setting::load(const Str& filename_, ActMap& acts_) { acts_.clear(); if (!doc.read(filename_, SETTING_BASE)) { return false; } doc.set_root_el(); for (doc.set_first_child(); doc.is_correct_node(); doc.set_next_sibling()) { if (doc.cmp_el(SETTING_ACTION)) { Str gesture, target_name, target_class, cmd_name, cmd_type, send_type; Int32 cmd_code = 0; bool class_use = true; send_type = doc.get_att(SETTING_SENDING_TYPE); doc.push_node(); for (doc.set_first_child(); doc.is_correct_node(); doc.set_next_sibling()) { if (doc.cmp_el(SETTING_GESTURE)) { gesture = doc.get_content_txt(); } if (doc.cmp_el(SETTING_TARGET)) { target_name = doc.get_att(SETTING_TARGET_NAME); doc.push_node(); for (doc.set_first_child(); doc.is_correct_node(); doc.set_next_sibling()) { if (doc.cmp_el(SETTING_TARGET_CLASS)) { target_class = doc.get_content_txt(); class_use = doc.cmp_att(SETTING_TARGET_CLASS_ENABLED, _T(YES)); } } doc.pop_node(); } if (doc.cmp_el(SETTING_COMMAND)) { cmd_name = doc.get_content_txt(); cmd_type = doc.get_att(SETTING_COMMAND_TYPE); cmd_code = doc.get_att_int(SETTING_COMMAND_CODE); } } /* OutputDebugStr("load: %S, %S, %S, %S, %S, %d adv: %d %S,\n", gesture.c_str(), target_name.c_str(), target_class.c_str(), cmd_name.c_str(), cmd_type.c_str(), cmd_code, class_use, send_type); */ // FIXME: Add advanced option ActPair act = ActPair(gesture, Action(gesture, target_name, target_class, cmd_name, cmd_type, cmd_code)); // advanced option act.second.set_class_enabled(class_use); act.second.set_send_type(send_type); acts_.insert(act); doc.pop_node(); } } return true; } const bool Setting::save(const Str& filename_, const ActMap& acts_) { XML xml(SETTING_BASE); for (ActMap::const_iterator itr = acts_.begin(); acts_.end() != itr; ++itr) { const Action& act = itr->second; xml.push_node(); // begin Action xml.add_element(SETTING_ACTION); xml.push_node(); // begin Gesture xml.add_element(SETTING_GESTURE); xml.add_text(act.get_gesture()); xml.pop_node(); // end Gesture xml.push_node(); // begin Target xml.add_element(SETTING_TARGET); xml.set_attribute(SETTING_TARGET_NAME, act.get_target_name()); xml.add_element(SETTING_TARGET_CLASS); Str class_enabled = _T(NO); if (act.is_class_enabled()) { class_enabled = _T(YES); } xml.set_attribute(SETTING_TARGET_CLASS_ENABLED, class_enabled); xml.add_text(act.get_target_class()); xml.pop_node(); // end Target Str send_str; switch (act.get_send_type()) { case ACT_SEND_ONCE: send_str = _T(SEND_ONCE); break; case ACT_SEND_REPEAT: send_str = _T(SEND_REPEAT); break; case ACT_SEND_HOLD: send_str = _T(SEND_HOLD); break; } OutputDebugStr("sendtype: %S\n", send_str.c_str()); xml.set_attribute(SETTING_SENDING_TYPE, send_str); for (size_t i = 0; act.get_cmd_size() > i; ++i) { const Command& cmd = act.get_cmd(i); xml.push_node(); // begin Command xml.add_element(SETTING_COMMAND); xml.add_text(cmd.get_name()); switch (cmd.get_type()) { case CMD_KEY: xml.set_attribute(SETTING_COMMAND_TYPE, _T(CMD_TYPE_KEY)); break; case CMD_MOUSE: OutputDebugStr("save as mouse\n"); xml.set_attribute(SETTING_COMMAND_TYPE, _T(CMD_TYPE_MOUSE)); break; } xml.set_attribute(SETTING_COMMAND_CODE, cmd.get_code()); xml.pop_node(); // end Command } xml.pop_node(); // end Action } OutputDebugStr("Act finished: %s\n", xml.get_error_description().c_str()); return xml.write(filename_); }
[ [ [ 1, 187 ] ] ]
badef218317a2e054b2284b78e4001d0df2ed228
6c8c4728e608a4badd88de181910a294be56953a
/CommunicationModule/TelepathyIM/FarsightChannel.cpp
c1dc306dab425d9e35f2caf0ea2ffdfaabb0b493
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
caocao/naali
29c544e121703221fe9c90b5c20b3480442875ef
67c5aa85fa357f7aae9869215f840af4b0e58897
refs/heads/master
2021-01-21T00:25:27.447991
2010-03-22T15:04:19
2010-03-22T15:04:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
28,771
cpp
#include "StableHeaders.h" #include "DebugOperatorNew.h" #include "CoreException.h" #include "FarsightChannel.h" #include "CoreDefines.h" #include <TelepathyQt4/Farsight/Channel> #include <QFile> #include "MemoryLeakCheck.h" namespace TelepathyIM { FarsightChannel::FarsightChannel(const Tp::StreamedMediaChannelPtr &channel, const QString &audio_src_name, const QString &video_src_name, const QString &video_sink_name) : tp_channel_(channel), tf_channel_(0), bus_(0), pipeline_(0), audio_input_(0), video_input_(0), video_tee_(0), audio_volume_(0), audio_resample_(0), audio_in_src_pad_(0), video_in_src_pad_(0), audio_stream_in_clock_rate_(0), audio_capsfilter_(0), audio_convert_(0), audio_playback_bin_(0), locally_captured_video_widget_(0), received_video_widget_(0), on_closed_g_signal_(0), on_session_created_g_signal_(0), on_stream_created_g_signal_(0), bus_watch_(0), locally_captured_video_playback_element_(0), video_input_bin_(0), read_cursor_(0), write_cursor_(0), available_audio_data_length_(0), audio_supported_(false), video_supported_(false), video_sink_name_(video_sink_name) { connect(this, SIGNAL( SrcPadAdded(TfStream*, GstPad*, FsCodec*) ), SLOT( LinkIncomingSourcePad(TfStream*, GstPad*, FsCodec*) ), Qt::QueuedConnection ); try { CreateTfChannel(); CreatePipeline(); CreateAudioInputElement(audio_src_name); CreateAudioPlaybackElement(); } catch(Exception &e) { Close(); throw e; } audio_supported_ = true; if( video_src_name.length() != 0) { try { locally_captured_video_widget_ = new VideoWidget(bus_, 0, "captured_video", video_sink_name); locally_captured_video_playback_element_ = locally_captured_video_widget_->GetVideoPlaybackElement(); LogDebug("VideoPlaybackWidget created for locally captured video stream."); received_video_widget_ = new VideoWidget(bus_, 0, "received_video", video_sink_name_); received_video_playback_element_ = received_video_widget_->GetVideoPlaybackElement(); LogDebug("VideoPlaybackWidget created for received video stream."); CreateVideoInputElement(video_src_name); video_supported_ = true; } catch(Exception &/*e*/) { LogError("Cannot create video elements."); } } GstStateChangeReturn ret = gst_element_set_state(pipeline_, GST_STATE_PLAYING); if (ret == GST_STATE_CHANGE_FAILURE) { LogError("Cannot start pipeline."); } status_ = StatusConnecting; emit StatusChanged(status_); } FarsightChannel::~FarsightChannel() { Close(); } void FarsightChannel::Close() { StopPipeline(); if (locally_captured_video_widget_) { locally_captured_video_widget_->close(); SAFE_DELETE(locally_captured_video_widget_); } if (received_video_widget_) { received_video_widget_->close(); SAFE_DELETE(received_video_widget_); } if (tf_channel_) { g_signal_handler_disconnect(tf_channel_, on_closed_g_signal_); g_signal_handler_disconnect(tf_channel_, on_session_created_g_signal_); g_signal_handler_disconnect(tf_channel_, on_stream_created_g_signal_); tf_channel_ = 0; } if (bus_) { if (bus_watch_) g_source_remove(bus_watch_); g_object_unref(bus_); bus_ = 0; } if (video_input_bin_) { g_object_unref(video_input_bin_); video_input_bin_ = 0; } if (audio_input_) { audio_input_ = 0; } if (audio_playback_bin_) { audio_playback_bin_ = 0; } if (pipeline_) { g_object_unref(pipeline_); pipeline_ = 0; } } void FarsightChannel::StopPipeline() { if (pipeline_) gst_element_set_state(pipeline_, GST_STATE_NULL); } void FarsightChannel::CreateTfChannel() { try { tf_channel_ = createFarsightChannel(tp_channel_); } catch(...) { throw Exception("Cannot create TfChannel object!"); } if (!tf_channel_) { LogError("Unable to construct TfChannel"); return; } /* Set up the telepathy farsight channel */ on_closed_g_signal_ = g_signal_connect(tf_channel_, "closed", G_CALLBACK(&FarsightChannel::onClosed), this); on_session_created_g_signal_ = g_signal_connect(tf_channel_, "session-created", G_CALLBACK(&FarsightChannel::onSessionCreated), this); on_stream_created_g_signal_ = g_signal_connect(tf_channel_, "stream-created", G_CALLBACK(&FarsightChannel::onStreamCreated), this); } void FarsightChannel::CreatePipeline() { pipeline_ = gst_pipeline_new(NULL); if (!pipeline_) throw Exception("Cannot create GStreamer pipeline."); bus_ = gst_pipeline_get_bus(GST_PIPELINE(pipeline_)); if (!bus_) throw Exception("Cannot create GStreamer bus."); } void FarsightChannel::CreateAudioInputElement(const QString & name) { audio_input_ = setUpElement(name); if (!audio_input_) throw Exception("Cannot create GStreamer audio input element."); } void FarsightChannel::CreateAudioPlaybackElement() { audio_playback_bin_ = gst_bin_new("audio-output-bin"); if (audio_playback_bin_ == 0) throw Exception("Cannot create GStreamer bin for audio playback."); fake_audio_output_ = setUpElement("fakesink"); if (fake_audio_output_ == 0) throw Exception("Cannot create GStreamer fake audio output element."); else { g_signal_connect(fake_audio_output_, "handoff", G_CALLBACK(&FarsightChannel::OnFakeSinkHandoff), this); g_object_set(G_OBJECT(fake_audio_output_), "signal-handoffs", TRUE, NULL); } // audio modifications audio_resample_ = gst_element_factory_make("audioresample", NULL); if (audio_resample_ == 0) throw Exception("Cannot create GStreamer audio resample element."); audio_capsfilter_ = gst_element_factory_make("capsfilter", NULL); GstCaps *audio_caps = gst_caps_new_simple("audio/x-raw-int", "channels", G_TYPE_INT, 1, "width", G_TYPE_INT, 16, // "depth", G_TYPE_INT, 16, "rate", G_TYPE_INT, 16000, "signed", G_TYPE_BOOLEAN, true, // "endianess", G_TYPE_INT, 1234, NULL); g_object_set(G_OBJECT(audio_capsfilter_), "caps", audio_caps, NULL); //audio_convert_ = gst_element_factory_make("audioconvert", NULL); //if (audio_convert_ == 0) // throw Exception("Cannot create GStreamer audio convert element."); gst_bin_add_many(GST_BIN(audio_playback_bin_), audio_resample_, fake_audio_output_, NULL); gboolean ok = gst_element_link_many(audio_resample_, fake_audio_output_, NULL); if (!ok) { QString error_message = "Cannot link elements for audio playback bin."; LogError(error_message.toStdString()); throw Exception(error_message.toStdString().c_str()); } // add ghost pad to audio_bin_ GstPad *sink = gst_element_get_static_pad(audio_resample_, "sink"); audio_playback_bin_sink_pad_ = gst_ghost_pad_new("sink", sink); gst_element_add_pad(GST_ELEMENT(audio_playback_bin_), audio_playback_bin_sink_pad_); gst_object_unref(G_OBJECT(sink)); gst_object_ref(audio_playback_bin_); gst_object_sink(audio_playback_bin_); } void FarsightChannel::CreateVideoInputElement(const QString &video_src_name) { video_input_bin_ = gst_bin_new("video-input-bin"); if (!video_input_bin_) { QString error_message("Cannot create bin for video input"); LogError(error_message.toStdString()); throw(Exception(error_message.toStdString().c_str())); } GstElement *scale = gst_element_factory_make("videoscale", NULL); if (!scale) { QString error_message = "Cannot create scale element for video input"; LogError(error_message.toStdString()); throw(Exception(error_message.toStdString().c_str())); } GstElement *rate = gst_element_factory_make("videorate", NULL); if (!rate) { QString error_message = "Cannot create rate element for video input"; LogError(error_message.toStdString()); throw(Exception(error_message.toStdString().c_str())); } GstElement *colorspace = gst_element_factory_make("ffmpegcolorspace", NULL); if (!colorspace) { QString error_message = "Cannot create colorspace element for video input"; LogError(error_message.toStdString()); throw(Exception(error_message.toStdString().c_str())); } GstElement *capsfilter = gst_element_factory_make("capsfilter", NULL); if (!capsfilter) { QString error_message = "Cannot create capsfilter element for video input"; LogError(error_message.toStdString()); throw(Exception(error_message.toStdString().c_str())); } GstCaps *caps = gst_caps_new_simple("video/x-raw-yuv", //GstCaps *caps = gst_caps_new_simple("video/x-raw-rgb", "width", G_TYPE_INT, 320, "height", G_TYPE_INT, 240, NULL); g_object_set(G_OBJECT(capsfilter), "caps", caps, NULL); video_input_ = gst_element_factory_make(video_src_name.toStdString().c_str(), NULL); if (!video_input_) { QString error_message = "Cannot create video src element for video input"; LogError(error_message.toStdString()); throw(Exception(error_message.toStdString().c_str())); } // QString test = gst_element_get_name(video_input_); gst_bin_add_many(GST_BIN(video_input_bin_), video_input_, scale, rate, colorspace, capsfilter, NULL); bool ok = gst_element_link_many(video_input_, scale, rate, colorspace, capsfilter, NULL); if (!ok) { QString error_message = "Cannot link: video_input_ ! scale ! rate ! colorspace ! capsfilter "; LogError(error_message.toStdString()); throw(Exception(error_message.toStdString().c_str())); } GstPad *src = gst_element_get_static_pad(capsfilter, "src"); GstPad *ghost = gst_ghost_pad_new("src", src); if (!ghost || !src) { QString error_message = "Cannot create ghost bad for video_input_bin_"; LogError(error_message.toStdString()); throw(Exception(error_message.toStdString().c_str())); } ok = gst_element_add_pad(GST_ELEMENT(video_input_bin_), ghost); if (!ok) { QString error_message = "Cannot add ghost pad to video_input_bin_"; LogError(error_message.toStdString()); throw(Exception(error_message.toStdString().c_str())); } gst_object_unref(G_OBJECT(src)); gst_object_ref(video_input_bin_); gst_object_sink(video_input_bin_); video_tee_ = setUpElement("tee"); if (GST_ELEMENT(locally_captured_video_playback_element_)) { gst_bin_add_many(GST_BIN(pipeline_), video_input_bin_, video_tee_, locally_captured_video_playback_element_, NULL); ok = gst_element_link_many(video_input_bin_, video_tee_, locally_captured_video_playback_element_, NULL); if (!ok) { QString error_message = "Cannot link: video_input_bin_ ! video_tee_ ! locally_captured_video_playback_element_"; LogError(error_message.toStdString()); gst_bin_remove_many(GST_BIN(pipeline_), video_input_bin_, video_tee_, locally_captured_video_playback_element_, NULL); throw(Exception(error_message.toStdString().c_str())); } } else { QString error_message = "locally_captured_video_playback_element_ is NULL"; LogError(error_message.toStdString()); gst_bin_add_many(GST_BIN(pipeline_), video_input_bin_, video_tee_, NULL); ok = gst_element_link_many(video_input_bin_, video_tee_, NULL); if (!ok) { QString error_message = "Cannot link: video_input_bin_ ! video_tee_ "; LogError(error_message.toStdString()); gst_bin_remove_many(GST_BIN(pipeline_), video_input_bin_, video_tee_, NULL); throw(Exception(error_message.toStdString().c_str())); } } } void FarsightChannel::OnFakeSinkHandoff(GstElement *fakesink, GstBuffer *buffer, GstPad *pad, gpointer user_data) { FarsightChannel* self = (FarsightChannel*)user_data; static GStaticMutex mutex = G_STATIC_MUTEX_INIT; g_static_mutex_lock (&mutex); gst_buffer_ref(buffer); int rate = 0; int channels = 0; int width = 0; GstCaps *caps; GstStructure *structure; caps = gst_buffer_get_caps(buffer); structure = gst_caps_get_structure(caps, 0); gst_structure_get_int(structure, "rate", &rate); gst_structure_get_int(structure, "channels", &channels); gst_structure_get_int(structure, "width", &width); gst_caps_unref(caps); if (GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_PREROLL)) { LogInfo("Drop fakesink buffer: Preroll audio data packet."); gst_buffer_unref(buffer); g_static_mutex_unlock (&mutex); return; } if (GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_GAP)) { LogInfo("Drop fakesink buffer: Caps audio data packet."); gst_buffer_unref(buffer); g_static_mutex_unlock (&mutex); return; } if (GST_BUFFER_DURATION(buffer) == 0) { LogInfo("Drop fakesink buffer: Got audio data packet with 0 duration"); gst_buffer_unref(buffer); g_static_mutex_unlock (&mutex); return; } if (GST_BUFFER_IS_DISCONT(buffer)) { LogInfo("Drop fakesink buffer: Got disconnect audio data packet."); gst_buffer_unref(buffer); g_static_mutex_unlock (&mutex); return; } if (GST_BUFFER_OFFSET_IS_VALID(buffer)) { guint64 offset = GST_BUFFER_OFFSET (buffer); } if (GST_BUFFER_OFFSET_END_IS_VALID(buffer)) { guint64 offset = GST_BUFFER_OFFSET_END(buffer); } u8* data = GST_BUFFER_DATA(buffer); u32 size = GST_BUFFER_SIZE(buffer); self->HandleAudioData(data, size, rate, width, channels); gst_buffer_unref(buffer); g_static_mutex_unlock (&mutex); } void FarsightChannel::HandleAudioData(u8* data, int size, int rate, int width, int channels) { boost::mutex::scoped_lock lock(audio_queue_mutex_); int audio_buffer_size = AUDIO_BUFFER_SIZE_MS * channels * width / 8 * rate / 1000; if (audio_buffer_size > AUDIO_BUFFER_MAX_SIZE) audio_buffer_size = AUDIO_BUFFER_MAX_SIZE; int available_buffer_size = audio_buffer_size - available_audio_data_length_; if (width > 8 && available_buffer_size%2 == 1) available_buffer_size--; // Only full samples to audio buffer if (available_buffer_size < size) { emit AudioBufferOverflow( size - available_buffer_size ); size = available_buffer_size; } if (write_cursor_ + size >= AUDIO_BUFFER_MAX_SIZE) { // The data must be copied in to two sections int size_at_end_of_the_buffer = AUDIO_BUFFER_MAX_SIZE - write_cursor_; int size_at_begin_of_the_buffer = size - size_at_end_of_the_buffer; memcpy(audio_buffer_ + write_cursor_, data, size_at_end_of_the_buffer); write_cursor_ = (write_cursor_ + size_at_end_of_the_buffer) % AUDIO_BUFFER_MAX_SIZE; assert( write_cursor_ == 0 ); memcpy(audio_buffer_ + write_cursor_, data + size_at_end_of_the_buffer, size_at_begin_of_the_buffer); write_cursor_ = (write_cursor_ + size_at_begin_of_the_buffer ) % AUDIO_BUFFER_MAX_SIZE; } else { memcpy(audio_buffer_ + write_cursor_, data, size); write_cursor_ = (write_cursor_ + size) % AUDIO_BUFFER_MAX_SIZE; } received_sample_rate_ = rate; received_sample_width_ = width; received_channel_count_ = channels; available_audio_data_length_ += size; emit AudioDataAvailable(available_audio_data_length_); } GstElement* FarsightChannel::setUpElement(const QString &element_name) { GstElement* element = gst_element_factory_make(element_name.toStdString().c_str(), NULL); gst_object_ref(element); gst_object_sink(element); return element; } FarsightChannel::Status FarsightChannel::GetStatus() const { return status_; } void FarsightChannel::SetAudioPlaybackVolume(const double value) { if(value<0||value>1) { LogError("Trying to set volume out of range"); return; } double setValue = value*10; // range is from 0 to 10 //g_value_set_double(&volume_, setValue); //g_object_set_property (G_OBJECT(audio_volume_), "volume", &volume_); } void FarsightChannel::SetAudioRecordVolume(const double value) { if(value<0||value>1){ LogError("Trying to set record volume out of range"); return; } // todo: Implement } // Link bus events to tf_channel_ gboolean FarsightChannel::busWatch(GstBus *bus, GstMessage *message, FarsightChannel *self) { try { if(self->tf_channel_ == NULL) { LogWarning("CommunicationModule: receiving bus message when tf_channel_ is NULL"); return FALSE; } tf_channel_bus_message(self->tf_channel_, message); return TRUE; } catch(...) { LogWarning("CommunicationModule: passing gstreamer bus message to telepathy-farsight failed"); return FALSE; } } void FarsightChannel::onClosed(TfChannel *tfChannel, FarsightChannel *self) { self->status_ = StatusDisconnected; emit self->StatusChanged(self->status_); } void FarsightChannel::onSessionCreated(TfChannel *tfChannel, FsConference *conference, FsParticipant *participant, FarsightChannel *self) { self->bus_watch_ = gst_bus_add_watch(self->bus_, (GstBusFunc) &FarsightChannel::busWatch, self); gst_bin_add(GST_BIN(self->pipeline_), GST_ELEMENT(conference)); gst_element_set_state(GST_ELEMENT(conference), GST_STATE_PLAYING); } void FarsightChannel::onStreamCreated(TfChannel *tfChannel, TfStream *stream, FarsightChannel *self) { guint media_type; GstPad *sink; g_signal_connect(stream, "src-pad-added", G_CALLBACK(&FarsightChannel::onSrcPadAdded), self); g_signal_connect(stream, "request-resource", G_CALLBACK(&FarsightChannel::onRequestResource), NULL); g_object_get(stream, "media-type", &media_type, "sink-pad", &sink, NULL); GstPad *pad; switch (media_type) { case TP_MEDIA_STREAM_TYPE_AUDIO: gst_bin_add(GST_BIN(self->pipeline_), self->audio_input_); gst_element_set_state(self->audio_input_, GST_STATE_PLAYING); pad = gst_element_get_static_pad(self->audio_input_, "src"); gst_pad_link(pad, sink); break; case TP_MEDIA_STREAM_TYPE_VIDEO: pad = gst_element_get_request_pad(self->video_tee_, "src%d"); gst_pad_link(pad, sink); break; default: Q_ASSERT(false); } gst_object_unref(sink); } void FarsightChannel::onSrcPadAdded(TfStream *stream, GstPad *src_pad, FsCodec *codec, FarsightChannel *self) { self->LinkIncomingSourcePad(stream, src_pad, codec); } void FarsightChannel::LinkIncomingSourcePad(TfStream *stream, GstPad *src_pad, FsCodec *codec) { incoming_video_widget_mutex_.lock(); // todo: Check if source pad is already linked! gint clock_rate = codec->clock_rate; audio_stream_in_clock_rate_ = clock_rate; gint channel_count = codec->channels; guint media_type; g_object_get(stream, "media-type", &media_type, NULL); GstPad *output_pad; GstElement *output_element = 0; bool sink_already_linked = false; switch (media_type) { case TP_MEDIA_STREAM_TYPE_AUDIO: { output_element = audio_playback_bin_; if (audio_in_src_pad_) sink_already_linked = true; LogInfo("Got pad for incoming AUDIO stream."); break; } case TP_MEDIA_STREAM_TYPE_VIDEO: { if (!video_supported_) { LogInfo("Got incoming VIDEO stream but ignore that because lack of video support."); incoming_video_widget_mutex_.unlock(); return; } output_element = received_video_playback_element_; if (video_in_src_pad_) sink_already_linked = true; LogDebug("Got pad for incoming VIDEO stream."); break; } default: { Q_ASSERT(false); } } if (sink_already_linked) { LogInfo("FarsightChannel: another Src pad added with same type."); } else { if (!gst_bin_add(GST_BIN(pipeline_), output_element)) { LogWarning("Cannot and output element to GStreamer pipeline!"); } } output_pad = gst_element_get_static_pad(output_element, "sink"); if (!output_pad) { LogError("Cannot get sink pad from output element"); } switch (media_type) { case TP_MEDIA_STREAM_TYPE_AUDIO: { if (audio_in_src_pad_) { gst_pad_unlink(audio_in_src_pad_, output_pad); } audio_in_src_pad_ = src_pad; break; } case TP_MEDIA_STREAM_TYPE_VIDEO: { if (video_in_src_pad_) { gst_pad_unlink(video_in_src_pad_, output_pad); } video_in_src_pad_ = src_pad; break; } } if (gst_pad_link(src_pad, output_pad) != GST_PAD_LINK_OK) { LogWarning("Cannot link audio src to output element."); } gst_element_set_state(output_element, GST_STATE_PLAYING); incoming_video_widget_mutex_.unlock(); status_ = StatusConnected; emit StatusChanged(status_); switch (media_type) { case TP_MEDIA_STREAM_TYPE_AUDIO: emit AudioStreamReceived(); break; case TP_MEDIA_STREAM_TYPE_VIDEO: emit VideoStreamReceived(); break; } } gboolean FarsightChannel::onRequestResource(TfStream *stream, guint direction, gpointer data) { LogDebug("resource request"); return TRUE; } VideoWidget* FarsightChannel::GetLocallyCapturedVideoWidget() { if (!video_supported_) return 0; return locally_captured_video_widget_; } VideoWidget* FarsightChannel::GetReceivedVideoWidget() { if (!video_supported_) return 0; incoming_video_widget_mutex_.lock(); if (!video_in_src_pad_) // FIXME: Make this thread safe and use more sane variable { incoming_video_widget_mutex_.unlock(); return 0; } incoming_video_widget_mutex_.unlock(); return received_video_widget_; } int FarsightChannel::GetSampleRate() const { return received_sample_rate_; } int FarsightChannel::GetSampleWidth() const { return received_sample_width_; } int FarsightChannel::GetChannelCount() const { return received_channel_count_; } int FarsightChannel::GetAvailableAudioDataLength() const { return available_audio_data_length_; } int FarsightChannel::GetAudioData(u8* buffer, int max) { boost::mutex::scoped_lock lock(audio_queue_mutex_); int size = 0; if (available_audio_data_length_ <= max) size = available_audio_data_length_; else size = max; if (read_cursor_ + size >= AUDIO_BUFFER_MAX_SIZE) { // we have to copy audio data from two segments int size_at_end_of_buffer = AUDIO_BUFFER_MAX_SIZE - read_cursor_; int size_at_begin_of_buffer = size - size_at_end_of_buffer; memcpy(buffer , audio_buffer_ + read_cursor_, size_at_end_of_buffer); read_cursor_ = (read_cursor_ + size_at_end_of_buffer) % AUDIO_BUFFER_MAX_SIZE; assert( read_cursor_ == 0 ); memcpy(buffer + size_at_end_of_buffer, audio_buffer_ + read_cursor_, size_at_begin_of_buffer); read_cursor_ = (read_cursor_ + size_at_begin_of_buffer) % AUDIO_BUFFER_MAX_SIZE; } else { memcpy(buffer , audio_buffer_ + read_cursor_, size); read_cursor_ = (read_cursor_ +size ) % AUDIO_BUFFER_MAX_SIZE; } available_audio_data_length_ -= size; return size; } } // end of namespace: TelepathyIM
[ "jonnenau@5b2332b8-efa3-11de-8684-7d64432d61a3", "jujjyl@5b2332b8-efa3-11de-8684-7d64432d61a3", "matti_re@5b2332b8-efa3-11de-8684-7d64432d61a3", "mattiku@5b2332b8-efa3-11de-8684-7d64432d61a3", "[email protected]@5b2332b8-efa3-11de-8684-7d64432d61a3", "[email protected]@5b2332b8-efa3-11de-8684-7d64432d61a3", "Stinkfist0@5b2332b8-efa3-11de-8684-7d64432d61a3", "cadaver@5b2332b8-efa3-11de-8684-7d64432d61a3" ]
[ [ [ 1, 1 ], [ 33, 33 ], [ 134, 134 ], [ 138, 138 ], [ 154, 154 ], [ 219, 219 ], [ 334, 335 ], [ 473, 473 ], [ 475, 475 ], [ 594, 595 ], [ 598, 598 ], [ 600, 603 ], [ 613, 613 ], [ 615, 620 ], [ 642, 642 ], [ 645, 645 ], [ 647, 647 ], [ 651, 652 ], [ 654, 654 ], [ 656, 656 ], [ 659, 659 ] ], [ [ 2, 2 ], [ 4, 4 ], [ 6, 6 ], [ 10, 11 ] ], [ [ 3, 3 ], [ 7, 7 ], [ 186, 186 ], [ 209, 210 ], [ 237, 238 ], [ 242, 242 ], [ 246, 246 ], [ 256, 256 ], [ 474, 474 ], [ 477, 478 ], [ 483, 483 ], [ 490, 493 ], [ 500, 503 ], [ 507, 507 ], [ 521, 522 ], [ 687, 687 ] ], [ [ 5, 5 ], [ 8, 9 ], [ 12, 15 ], [ 18, 31 ], [ 34, 40 ], [ 48, 48 ], [ 64, 66 ], [ 90, 92 ], [ 94, 96 ], [ 102, 102 ], [ 105, 105 ], [ 110, 110 ], [ 113, 113 ], [ 115, 133 ], [ 136, 137 ], [ 140, 141 ], [ 146, 148 ], [ 155, 162 ], [ 164, 180 ], [ 182, 183 ], [ 185, 185 ], [ 187, 190 ], [ 192, 193 ], [ 195, 197 ], [ 199, 201 ], [ 203, 208 ], [ 211, 211 ], [ 213, 218 ], [ 220, 234 ], [ 236, 236 ], [ 239, 241 ], [ 243, 245 ], [ 247, 251 ], [ 253, 253 ], [ 255, 255 ], [ 257, 261 ], [ 263, 269 ], [ 271, 277 ], [ 279, 285 ], [ 287, 300 ], [ 302, 302 ], [ 304, 310 ], [ 312, 319 ], [ 321, 326 ], [ 328, 333 ], [ 336, 343 ], [ 345, 358 ], [ 360, 374 ], [ 380, 381 ], [ 383, 424 ], [ 426, 429 ], [ 431, 432 ], [ 436, 436 ], [ 441, 441 ], [ 444, 445 ], [ 451, 451 ], [ 455, 455 ], [ 460, 460 ], [ 463, 464 ], [ 468, 468 ], [ 471, 472 ], [ 476, 476 ], [ 479, 482 ], [ 484, 489 ], [ 494, 499 ], [ 504, 506 ], [ 508, 520 ], [ 523, 528 ], [ 530, 570 ], [ 576, 576 ], [ 579, 580 ], [ 582, 593 ], [ 599, 599 ], [ 621, 624 ], [ 626, 628 ], [ 633, 641 ], [ 643, 643 ], [ 649, 650 ], [ 658, 658 ], [ 660, 661 ], [ 666, 667 ], [ 681, 684 ], [ 686, 686 ], [ 688, 690 ], [ 693, 697 ], [ 708, 710 ], [ 762, 762 ] ], [ [ 16, 17 ], [ 41, 44 ], [ 93, 93 ], [ 103, 104 ], [ 194, 194 ], [ 303, 303 ], [ 425, 425 ], [ 430, 430 ], [ 433, 433 ], [ 440, 440 ], [ 442, 443 ], [ 447, 448 ], [ 450, 450 ], [ 452, 452 ], [ 454, 454 ], [ 456, 456 ], [ 458, 459 ], [ 461, 461 ], [ 465, 467 ], [ 469, 470 ], [ 529, 529 ], [ 629, 632 ], [ 662, 665 ], [ 672, 674 ], [ 676, 677 ], [ 679, 680 ], [ 685, 685 ], [ 711, 740 ], [ 742, 743 ], [ 745, 746 ], [ 748, 750 ], [ 752, 755 ], [ 757, 761 ] ], [ [ 32, 32 ], [ 45, 47 ], [ 49, 63 ], [ 67, 79 ], [ 81, 89 ], [ 97, 101 ], [ 107, 107 ], [ 111, 112 ], [ 114, 114 ], [ 142, 142 ], [ 144, 145 ], [ 252, 252 ], [ 254, 254 ], [ 262, 262 ], [ 270, 270 ], [ 278, 278 ], [ 286, 286 ], [ 301, 301 ], [ 311, 311 ], [ 320, 320 ], [ 327, 327 ], [ 344, 344 ], [ 359, 359 ], [ 434, 435 ], [ 437, 439 ], [ 446, 446 ], [ 449, 449 ], [ 453, 453 ], [ 457, 457 ], [ 462, 462 ], [ 571, 575 ], [ 577, 578 ], [ 581, 581 ], [ 596, 597 ], [ 604, 612 ], [ 614, 614 ], [ 625, 625 ], [ 644, 644 ], [ 646, 646 ], [ 648, 648 ], [ 653, 653 ], [ 655, 655 ], [ 657, 657 ], [ 668, 671 ], [ 675, 675 ], [ 678, 678 ], [ 691, 692 ], [ 698, 707 ], [ 741, 741 ], [ 744, 744 ], [ 747, 747 ], [ 751, 751 ], [ 756, 756 ] ], [ [ 80, 80 ], [ 106, 106 ], [ 108, 109 ], [ 135, 135 ], [ 139, 139 ], [ 143, 143 ], [ 149, 153 ], [ 375, 379 ], [ 382, 382 ] ], [ [ 163, 163 ], [ 181, 181 ], [ 184, 184 ], [ 191, 191 ], [ 198, 198 ], [ 202, 202 ], [ 212, 212 ], [ 235, 235 ] ] ]
f2a38f5c45a299c2cbef51a9651bff5f384bb828
a405cf24ef417f6eca00c688ceb9008d80f84e1a
/trunk/InsertBrickTask.cpp
c08835136d466b553b99fe35c42d2eb744f110b1
[]
no_license
BackupTheBerlios/nassiplugin-svn
186ac2b1ded4c0bf7994e6309150aa23bc70b644
abd9d809851d58d7206008b470680a23d0548ef6
refs/heads/master
2020-06-02T21:23:32.923994
2010-02-23T21:37:37
2010-02-23T21:37:37
40,800,406
0
0
null
null
null
null
UTF-8
C++
false
false
5,128
cpp
#include "InsertBrickTask.h" #include "GraphBricks.h" #include "RedLineDrawlet.h" #include "RedHatchDrawlet.h" #include "NassiFileContent.h" #include "commands.h" #include "NassiView.h" #include <wx/mstream.h> #if defined(__WXGTK__) #include "rc/ifcur_inv.xpm" #include "rc/whilecur_inv.xpm" #include "rc/dowhilecur_inv.xpm" #include "rc/instrcur_inv.xpm" #include "rc/forcur_inv.xpm" #include "rc/switchcur_inv.xpm" #include "rc/breakcur_inv.xpm" #include "rc/continuecur_inv.xpm" #include "rc/returncur_inv.xpm" #include "rc/blockcur_inv.xpm" #else #include "rc/ifcur.xpm" #include "rc/whilecur.xpm" #include "rc/dowhilecur.xpm" #include "rc/instrcur.xpm" #include "rc/forcur.xpm" #include "rc/switchcur.xpm" #include "rc/breakcur.xpm" #include "rc/continuecur.xpm" #include "rc/returncur.xpm" #include "rc/blockcur.xpm" #endif InsertBrickTask::InsertBrickTask(NassiView *view, NassiFileContent *nfc, NassiView::NassiTools tool): Task(), m_view(view), m_nfc(nfc), m_done(false), m_tool(tool) {} InsertBrickTask::~InsertBrickTask() {} wxCursor InsertBrickTask::Start() { switch ( m_tool ) { case NassiView::NASSI_TOOL_CONTINUE: return wxCursor(continuecur_xpm); case NassiView::NASSI_TOOL_BREAK: return wxCursor(breakcur_xpm); case NassiView::NASSI_TOOL_RETURN: return wxCursor(returncur_xpm); case NassiView::NASSI_TOOL_WHILE: return wxCursor(whilecur_xpm); case NassiView::NASSI_TOOL_DOWHILE: return wxCursor(dowhilecur_xpm); case NassiView::NASSI_TOOL_FOR: return wxCursor(forcur_xpm); case NassiView::NASSI_TOOL_BLOCK: return wxCursor(blockcur_xpm); case NassiView::NASSI_TOOL_IF: return wxCursor(wxImage(ifcur_xpm)); case NassiView::NASSI_TOOL_SWITCH: return wxCursor(switchcur_xpm); default: case NassiView::NASSI_TOOL_INSTRUCTION: return wxCursor(instrcur_xpm); } } bool InsertBrickTask::Done()const { return m_done; } // events from window: void InsertBrickTask::OnMouseLeftUp(wxMouseEvent &event, const wxPoint &position){} void InsertBrickTask::OnMouseLeftDown(wxMouseEvent &event, const wxPoint &position) { if ( !m_nfc->GetFirstBrick() ) { wxRect rect = m_view->GetEmptyRootRect(); if ( rect.Contains(position) ) m_nfc->GetCommandProcessor()->Submit( new NassiInsertFirstBrick(m_nfc, m_view->GenerateNewBrick(m_tool)) ); return; } GraphNassiBrick *gbrick = m_view->GetBrickAtPosition(position); if ( gbrick ) { GraphNassiBrick::Position p = gbrick->GetPosition(position); if ( p.pos == GraphNassiBrick::Position::bottom ) m_nfc->GetCommandProcessor()->Submit( new NassiInsertBrickAfter( m_nfc, gbrick->GetBrick(), m_view->GenerateNewBrick(m_tool) )); else if ( p.pos == GraphNassiBrick::Position::top ) m_nfc->GetCommandProcessor()->Submit( new NassiInsertBrickBefore(m_nfc, gbrick->GetBrick(), m_view->GenerateNewBrick(m_tool) )); else if ( p.pos == GraphNassiBrick::Position::child ) m_nfc->GetCommandProcessor()->Submit( new NassiInsertChildBrickCommand(m_nfc, gbrick->GetBrick(), m_view->GenerateNewBrick(m_tool), p.number)); else if ( p.pos == GraphNassiBrick::Position::childindicator ) m_nfc->GetCommandProcessor()->Submit( new NassiAddChildIndicatorCommand(m_nfc, gbrick->GetBrick(), m_view->GenerateNewBrick(m_tool), p.number)); } } void InsertBrickTask::OnMouseRightDown(wxMouseEvent &event, const wxPoint &position) { m_done = true; } void InsertBrickTask::OnMouseRightUp(wxMouseEvent& event, const wxPoint &position){} HooverDrawlet *InsertBrickTask::OnMouseMove(wxMouseEvent &event, const wxPoint &position) { if ( !m_nfc->GetFirstBrick() ) { wxRect rect = m_view->GetEmptyRootRect(); if ( rect.Contains(position) ) return new RedHatchDrawlet(rect); else return NULL; } GraphNassiBrick *gbrick = m_view->GetBrickAtPosition(position); if ( gbrick ) return gbrick->GetDrawlet(position, false); return NULL; } void InsertBrickTask::OnKeyDown(wxKeyEvent &event) { if ( event.GetKeyCode() == WXK_ESCAPE ) { m_done = true; return; } //event.Skip(); } void InsertBrickTask::OnChar(wxKeyEvent &event){} // events from frame(s) bool InsertBrickTask::CanEdit()const{ return false; } //bool InsertBrickTask::CanCopy()const{ return false; } //bool InsertBrickTask::CanCut()const{ return false; } bool InsertBrickTask::CanPaste()const{ return false; } bool InsertBrickTask::HasSelection()const{ return false; } void InsertBrickTask::DeleteSelection(){} void InsertBrickTask::Copy(){} void InsertBrickTask::Cut(){} void InsertBrickTask::Paste(){}
[ "danselmi@1ca45b2e-1973-0410-a226-9012aad761af" ]
[ [ [ 1, 147 ] ] ]
469eec695b4cce57d305547ca805530642853775
41371839eaa16ada179d580f7b2c1878600b718e
/UVa/Volume III/00350.cpp
39eb8b21a34316b4075b6f5d296ed3f7cc20b414
[]
no_license
marinvhs/SMAS
5481aecaaea859d123077417c9ee9f90e36cc721
2241dc612a653a885cf9c1565d3ca2010a6201b0
refs/heads/master
2021-01-22T16:31:03.431389
2009-10-01T02:33:01
2009-10-01T02:33:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
530
cpp
///////////////////////////////// // 00350 - Pseudo-Random Numbers ///////////////////////////////// #include<cstdio> unsigned int casen,f,i,l,length,m,z; unsigned int used[10000]; int main(void){ casen = 0; while(scanf("%u %u %u %u",&z,&i,&m,&l) && z){ casen++; printf("Case %u: ",casen); f = l; length = 1; for(int k = 0; k < m; used[k] = 0, k++); while(!used[l]){ used[l] = length; l = (z*l+i)%m; length++; } printf("%u\n",(l==f?length-1:length-used[f]-1)); } return 0; }
[ [ [ 1, 23 ] ] ]
209c5bbe35326e6080da2d8d24718ee20fa82544
694fa0f3f1e3f849228c289834bc0b3061146356
/Time.h
79a6a1ac1a2a16bdc2725232bce6e4c344b5009a
[]
no_license
cs247/a2q2
0a08efb52474bd49a95cc592ee440310d0e66847
c03e59d639b20158de6630aeaac0c831fca07ae1
refs/heads/master
2021-01-20T07:48:23.563770
2011-06-19T00:22:34
2011-06-19T00:22:34
1,917,719
0
0
null
null
null
null
UTF-8
C++
false
false
1,385
h
/* * Time.h * * * Created by Joanne Atlee on 18/05/11. * */ #ifndef TIME_H #define TIME_H #include <iostream> #include <string> class Time { public: Time(); // default constructor -- value == NOW explicit Time (int hour, int min=0, int sec=0); // constructor Time (const Time&); // copy constructor ~Time(); // destructor int hour() const; // accessor int min() const; // accessor int sec() const; // accessor Time& operator= ( const Time& t); // assignment private: struct Impl; Impl& time_; }; Time operator- (const Time&, const Time&); // computes the duration between args Time operator+ (const Time&, const Time&); // adds a duration to a Time value bool operator== (const Time&, const Time&); bool operator!= (const Time&, const Time&); bool operator< (const Time&, const Time&); bool operator<= (const Time&, const Time&); bool operator> (const Time&, const Time&); bool operator>= (const Time&, const Time&); std::istream& operator>> (std::istream&, Time&); std::ostream& operator<< (std::ostream&, const Time&); #endif
[ [ [ 1, 46 ] ] ]
0b588e9a714e22fe47f600a49002d76ed362deb1
87cfed8101402f0991cd2b2412a5f69da90a955e
/daq/daq/src/mwadvantech/advantechaout.h
d4aace22b4a45d2d8c70e01c97aebe1d8e9fc5df
[]
no_license
dedan/clock_stimulus
d94a52c650e9ccd95dae4fef7c61bb13fdcbd027
890ec4f7a205c8f7088c1ebe0de55e035998df9d
refs/heads/master
2020-05-20T03:21:23.873840
2010-06-22T12:13:39
2010-06-22T12:13:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,197
h
// advantechAout.h : Declaration of CadvantechOut class // Copyright 2002-2003 The MathWorks, Inc. // $Revision: 1.1.6.2 $ $Date: 2003/12/04 18:39:19 $ #ifndef __advantechOUT_H_ #define __advantechOUT_H_ #pragma warning(disable:4996) // no warnings: CComModule::UpdateRegistryClass was declared deprecated #include "stdafx.h" #include "resource.h" // main symbols #include "mwadvantech.h" #include "advantechpropdef.h" #include "advantechadapt.h" #include "advantechUtil.h" #include "advantecherr.h" #include "advantechBuffer.h" // Advantech circular buffer overload methods. #include "driver.h" #include <vector> class CadvAOBuffer : public CadvBuffer { public: HRESULT CopyIn(CBT *src,int size, bool initialLoad) { // DEBUG: ATLTRACE(_T("In CopyIn\n")); if (!m_driverHandle) return E_BUFDRVHANDLE; PT_FAOLoad ptFAOLoad; ptFAOLoad.ActiveBuf = 0; int size1,size2; CBT *ptr1, *ptr2; GetWritePointers(&ptr1, &size1, &ptr2, &size2); int points = min(size1, size); // Transfer first part? if (points > 0) { //DEBUG: ATLTRACE("\tPart 1: Transferring %d points from loc %d (m_Size is %d)\n", points, (ptr1-GetPtr()), m_Size); //DEBUG: ATLTRACE("\t\tm_WriteLoc: %d\tm_ReadLoc: %d\n", m_WriteLoc, m_ReadLoc); // Use memcpy if its the initial load as FAOLoad does not work // before the device is started if (initialLoad) { memcpy(ptr1, (CBT *)src, points*sizeof(CBT)); } else { ptFAOLoad.ActiveBuf = 0; // single buffer ptFAOLoad.DataBuffer = (CBT *)src; ptFAOLoad.start = (ULONG)(ptr1 - GetPtr()); ptFAOLoad.count = points; LRESULT loadError = DRV_FAOLoad(m_driverHandle, (LPT_FAOLoad)&ptFAOLoad); } m_WriteLoc+=points; if (m_WriteLoc>m_Size) m_WriteLoc=0; } // Transfer second part? if ((size2 > 0) && (points<size)) { //DEBUG: ATLTRACE("\t\tm_WriteLoc: %d\tm_ReadLoc: %d\n", m_WriteLoc, m_ReadLoc); points = min(size2, size-points); //DEBUG: ATLTRACE("\tPart 2: Transferring %d points from loc %d\n", points, (ptr2-GetPtr())); if (initialLoad) { memcpy(ptr2, (CBT *)src + size1, points*sizeof(CBT)); } else { ptFAOLoad.ActiveBuf = 0; // single buffer ptFAOLoad.DataBuffer = (CBT *)src + size1; ptFAOLoad.start = (ULONG)(ptr2 - GetPtr()); ptFAOLoad.count = points; LRESULT loadError = DRV_FAOLoad(m_driverHandle, (LPT_FAOLoad)&ptFAOLoad); } m_WriteLoc = points; } ////DEBUG: ATLTRACE("Pointer info: writeLoc = %d; read_Loc = %d", m_WriteLoc, m_ReadLoc); return S_OK; }; bool IsWriteUnderrun(int loc) // returns true for an underrun { if ((m_ReadLoc < m_WriteLoc)) { if ((loc < m_ReadLoc) || (loc >= m_WriteLoc)) { // Not reading from middel valid portion of circbuf return true; } } else if ((loc >= m_WriteLoc) && (loc < m_ReadLoc)) { // Not reading from outer valid portions of the circbuf return true; } return false; }; }; //This abstract class extends the CswClockedDevice class by a single pure virtual function PutSingleValue() class ATL_NO_VTABLE CadvantechAoutputBase: public CswClockedDevice { public: typedef short RawDataType; enum BitsEnum {Bits=16}; // bits must fit in rawdatatype virtual HRESULT PutSingleValue(int index,RawDataType Value)=0; }; ///////////////////////////////////////////////////////////////////////////// // CadvantechAout class declaration // // CadvantechAout is based on ImwDevice and ImwOutput via chains:.. //.. ImwDevice -> CmwDevice -> CswClockedDevice -> CadvantechAoutputBase ->.. //.. TADDevice -> CadvantechAout and.. //.. ImwOutput -> TADDevice -> CadvantechAout class ATL_NO_VTABLE CadvantechAout : public TDADevice<CadvantechAoutputBase>, //is based on ImwDevice public CComCoClass<CadvantechAout, &CLSID_advantechAout> // public IDispatchImpl<IadvantechOut, &IID_IadvantechOut, &LIBID_advantechLib> { typedef TDADevice<CadvantechAoutputBase> TBaseObj; public: DECLARE_REGISTRY( CadvantechAdapt, _T("advantech.advantechAout.1"), _T("advantech.advantechAout"), IDS_PROJNAME, THREADFLAGS_BOTH ) // This line is not needed if the program does not support aggregation DECLARE_PROTECT_FINAL_CONSTRUCT() // ATL macros internally implementing QueryInterface() for the mapped interfaces BEGIN_COM_MAP(CadvantechAout) // COM_INTERFACE_ENTRY(IadvantechAout) COM_INTERFACE_ENTRY(ImwDevice) COM_INTERFACE_ENTRY(ImwOutput) END_COM_MAP() public: CadvantechAout(); ~CadvantechAout(); STDMETHOD(Start)(); STDMETHOD(Trigger)(); STDMETHOD(Stop)(); STDMETHODIMP ChildChange(DWORD typeofchange, NESTABLEPROP *pChan); STDMETHODIMP SetChannelProperty(long UserVal, tagNESTABLEPROP *pChan, VARIANT *NewValue); STDMETHODIMP SetProperty(long User, VARIANT *NewValue); HRESULT FindRange(float low, float high, RANGE_INFO *&pRange); HRESULT SetDaqHwInfo(); HRESULT LoadINIInfo(); HRESULT Open(IUnknown *Interface,long ID); HRESULT PutSingleValue(int chan,RawDataType value); void GetMaxOutputRange(double *lowRange, double *highRange); HRESULT LoadOutputRanges(); Cadvantechadapt * GetParent() {return m_pParent;} void SetParent(Cadvantechadapt * parent) {m_pParent = parent;} TTimerCallback<CadvantechAout,HiResTimer> TimerObj; bool TimerRoutine() { return(SyncAndLoadData()==S_OK); } HRESULT SyncAndLoadData(); HRESULT StopDeviceIfRunning(); HRESULT LoadData(); private: // Methods double QuantiseValue(double rate); void RangeAndDefaultSR(bool UpdateVal); // Properties typedef TCircBuffer<unsigned short> CIRCBUFFER; CIRCBUFFER::CBT m_defaultChannelValue; // There is only one channel so we can use a single value! PolarityType m_polarity; // Variable to keep track of the current polarity bool m_swOutputRange; // 1 if software configurable, 0 if jumpered bool m_aoBipolar; // support for bipolar ranges Cadvantechadapt * m_pParent; long m_driverHandle; DEVFEATURES m_devFeatures; // Structure containing list of features eg. board ID, gainlist... WORD m_deviceID; CHAR m_deviceName[50]; short m_maxAOChl; // The number of analog output channels double m_maxSampleRate; // Maximum sampling rate for HW clocking double m_minSampleRate; // Minimum sample rate of HARDWARE CLOCK (not min settable in MATLAB object) int m_numUniqueJumperedOutputRanges; // Number of unique output ranges bool m_supportedRanges[3]; PT_FAOIntStart m_ptFAOIntStart; // FAOIntScanStart table PT_FAODmaStart m_ptFAODmaStart; // FAODmaScanStart table PT_FAOCheck m_ptFAOCheck; // The structure containing task status info USHORT m_gwActiveBuf; // Returned in FAOCheck structure USHORT m_gwOverrun; // Returned in FAOCheck structure USHORT m_gwStopped; // Returned in FAOCheck structure USHORT m_gwHalfReady; // Returned in FAOCheck structure ULONG m_posted; // Returned in FAOCheck structure ULONG m_prevPosted; // Previous count of points posted (from Adv) bool m_initialLoad; // TRUE: We are loading data before the output starts, FALSE: We are loading data during output CadvAOBuffer m_circBuff; __int64 m_pointsToAdvBuffer; // Total points sent to Advantech buffers __int64 m_pointsToHardware; // Total points sent to the hardware long m_engBuffSizePoints; // Size of engine buffer(s), as per CBI adaptor double m_timerPeriod; bool m_lastBufferLoaded; // True if we have posted the last Engine buffer to Advantech. short m_putStatus; // Status of a scan start. LONG m_DMABuffer; typedef std::vector<RANGE_INFO> RangeList_t; RangeList_t m_channelRanges; TRemoteProp<long> pClockSource; CachedEnumProp pTransferMode; CEnumProp pOutOfDataMode; }; #endif //__advantechOAOUT_H_ // advantechOut.cpp : Implementation of CadvantechAout
[ [ [ 1, 227 ] ] ]
cc6e07b15f40614f23285ead5bac3c3d56573d6f
81d3ba636ee63af055c917f13f6ebcb3b7e4717e
/MainComponent.h
4c201d816a60e42cb92e5e0b1f1bcd9a3f435fd9
[]
no_license
haibocheng/video_editor
cc68a4f02fc14756c2aa9369a536c8f49fef1334
40ab4a33642f70ea1c731f59aa062d82e7120bc7
refs/heads/master
2021-01-16T17:55:47.850527
2011-03-11T00:42:55
2011-03-11T00:42:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,388
h
#ifndef _MAINCOMPONENT_H_ #define _MAINCOMPONENT_H_ #include "MainAppWindow.h" #include "juce/juce.h" #include "timeline.h" #include "localization.h" #include "toolbox.h" #include "ContainerBox.h" #include "encodeVideo.h" #include "events.h" #include "taskTab.h" class AskJumpDestanation; class encodeVideo; using namespace localization; class MainAppWindow; class MainComponent : public Component, public MenuBarModel, public ApplicationCommandTarget, public Timer, public ButtonListener, public DragAndDropContainer, public SliderListener, public ScrollBarListener, public DragAndDropTarget { public: int mouse_x; int mouse_y; AskJumpDestanation *ask_jump_target; void changeFileName(String new_filename); TooltipWindow tooltipWindow; DrawableButton* playButton; DrawableButton* pauseButton; DrawableButton* stopButton; DrawableButton* nextFrameButton; DrawableButton* prevFrameButton; DrawableButton* zoomInButton; DrawableButton* zoomOutButton; void initImageButton(String pic_name,DrawableButton*& button); void SetVisibleButtons(bool visible); enum CommandIDs { commandOpen = 0x2000, commandSave = 0x2001, commandJump = 0x2003, commandSaveFrame = 0x2004, commandPlay = 0x2005, commandPause = 0x2006, commandStop = 0x2007, commandNextFrame = 0x2008, commandPrevFrame = 0x2009, commandNext5Frame = 0x200A, commandPrev5Frame = 0x200B, commandNextSecond = 0x200C, commandPrevSecond = 0x200D, commandRemoveMovie = 0x200E, commandSplit = 0x200F, commandRemoveSpaces = 0x2010, commandShowTasks = 0x2011 }; MainAppWindow* mainWindow; Timeline *timeline; Timeline *timeline_original; void buttonClicked (Button* button) ; MainComponent (MainAppWindow* mainWindow_); ~MainComponent (); void resized (); void paint (Graphics& g); int GetArrowPosition(int arrow_position); int GetCurrentPosition(); double GetSecond(int mouse); bool NeedDrawArrow(); void timerCallback(); void DrawSlider(Graphics& g); void DrawArrow(Graphics& g); void repaintSlider(); void mouseMove (const MouseEvent& e); void mouseDown (const MouseEvent& e); const StringArray getMenuBarNames(); const PopupMenu getMenuForIndex (int menuIndex, const String& menuName); void menuItemSelected (int menuItemID, int topLevelMenuIndex); bool perform (const InvocationInfo& info); ApplicationCommandTarget* getNextCommandTarget(); void getAllCommands (Array <CommandID>& commands); bool isVideoReady (); void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result); int64 miliseconds_start; bool video_playing; void StopVideo(); void StartVideo(); int GetMoviesBorder(); ContainerBox * movies_list; void ResizeViewport(); void AddMovieToList(Movie*movie); ScrollBar * timeline_scrollbar; double second_to_pixel; double timeline_position; Slider *scale_timeline; void sliderValueChanged(Slider* slider); void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,double newRangeStart); bool isInterestedInDragSource (const String& sourceDescription,Component* sourceComponent); void itemDropped (const String& sourceDescription,Component* sourceComponent,int x, int y); void itemDragMove (const String& sourceDescription,Component* sourceComponent,int x, int y); bool shouldDrawDragImageWhenOver(); int current_drag_x; int current_drag_y; double GetPositionSecond(int arrow_position); void mouseDrag (const MouseEvent& e); void mouseExit(const MouseEvent& e); void mouseMoveReaction(); void cleanAfterDrag(); int dragIntervalOffset; encodeVideo * encodeVideoWindow; EventList AfterChangePosition; void GotoSecondAndRead(double second); taskTab * tasks; }; #endif//_MAINCOMPONENT_H_
[ [ [ 1, 156 ] ] ]
cd427a381056ebbb189ef5145d57b2748e353b4f
cd0987589d3815de1dea8529a7705caac479e7e9
/webkit/WebKit/blackberry/Api/WebSettings.h
a5b193b39f72d37233a9346eeb3f9ff4e9af12e7
[ "BSD-2-Clause" ]
permissive
azrul2202/WebKit-Smartphone
0aab1ff641d74f15c0623f00c56806dbc9b59fc1
023d6fe819445369134dee793b69de36748e71d7
refs/heads/master
2021-01-15T09:24:31.288774
2011-07-11T11:12:44
2011-07-11T11:12:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,419
h
/* * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. */ #ifndef WebSettings_h #define WebSettings_h #include "BlackBerryGlobal.h" #include "WebString.h" namespace WTF { class String; } namespace WebCore { class FrameLoaderClientBlackBerry; class IntSize; class Page; } namespace Olympia { namespace WebKit { class WebString; class WebSettingsPrivate; class OLYMPIA_EXPORT WebSettings { public: enum TextReflowMode { TextReflowDisabled, TextReflowEnabled, TextReflowEnabledOnlyForBlockZoom }; static WebSettings* pageGroupSettings(const WebString& pageGroupName); // FIXME: Consider which settings below should be made static so as to enforce // that they apply to all pages or do we wish to maintain maximum flexibility? // FIXME: Need to find a way to provide getters for the settings that return // strings using some kind of thread safe copy... // XSS Auditor bool xssAuditorEnabled() const; void setXSSAuditorEnabled(bool); // Images bool loadsImagesAutomatically() const; void setLoadsImagesAutomatically(bool); bool shouldDrawBorderWhileLoadingImages() const; void setShouldDrawBorderWhileLoadingImages(bool); // JavaScript bool isJavaScriptEnabled() const; void setJavaScriptEnabled(bool); // Font sizes int defaultFixedFontSize() const; void setDefaultFixedFontSize(int); int defaultFontSize() const; void setDefaultFontSize(int); int minimumFontSize() const; void setMinimumFontSize(int); // Font families void setSerifFontFamily(const char*); void setFixedFontFamily(const char*); void setSansSerifFontFamily(const char*); void setStandardFontFamily(const char*); // User agent void setUserAgentString(const char*); // Default Text Encoding void setDefaultTextEncodingName(const char*); // Zooming bool isZoomToFitOnLoad() const; void setZoomToFitOnLoad(bool); // Text Reflow TextReflowMode textReflowMode() const; void setTextReflowMode(TextReflowMode); // Scrollbars bool isScrollbarsEnabled() const; void setScrollbarsEnabled(bool); // Javascript Popups // FIXME: Consider renaming this method upstream, where it is called javaScriptCanOpenWindowsAutomatically bool canJavaScriptOpenWindowsAutomatically() const; void setJavaScriptOpenWindowsAutomatically(bool); // Plugins bool arePluginsEnabled() const; void setPluginsEnabled(bool); // Geolocation bool isGeolocationEnabled() const; void setGeolocationEnabled(bool); // Context Info bool doesGetFocusNodeContext() const; void setGetFocusNodeContext(bool); // Style Sheet void setUserStyleSheetString(const char*); // External link handlers bool areLinksHandledExternally() const; void setAreLinksHandledExternally(bool); // BrowserField2 settings void setAllowCrossSiteRequests(bool allow); bool allowCrossSiteRequests() const; bool isUserScalable() const; void setUserScalable(bool userScalable); int viewportWidth() const; void setViewportWidth(int vp); double initialScale() const; void setInitialScale(double iniScale); // First Layout Delay int firstScheduledLayoutDelay() const; void setFirstScheduledLayoutDelay(int); // Whether to include pattern: in the list of string patterns bool shouldHandlePatternUrls() const; void setShouldHandlePatternUrls(bool); // Cache settings bool isCookieCacheEnabled() const; void setIsCookieCacheEnabled(bool); // Web storage settings bool isLocalStorageEnabled() const; void setIsLocalStorageEnabled(bool enable); bool isDatabasesEnabled() const; void setIsDatabasesEnabled(bool enable); bool isAppCacheEnabled() const; void setIsAppCacheEnabled(bool enable); unsigned long long localStorageQuota() const; void setLocalStorageQuota(unsigned long long quota); WebString localStoragePath() const; void setLocalStoragePath(const WebString& path); WebString databasePath() const; void setDatabasePath(const WebString& path); WebString appCachePath() const; void setAppCachePath(const WebString& path); WebString pageGroupName() const; // Object MIMEType static void addSupportedObjectPluginMIMEType(const char*); static bool isSupportedObjectMIMEType(const WTF::String& mimeType); static WebString getNormalizedMIMEType(const WebString&); int screenWidth(); int screenHeight(); WebCore::IntSize applicationViewSize(); bool isEmailMode() const; void setEmailMode(bool enable); bool shouldRenderAnimationsOnScroll() const; void setShouldRenderAnimationsOnScroll(bool enable); // OverZoom Background int overZoomColor() const; void setOverZoomColor(int); bool isWritingDirectionRTL() const; void setWritingDirectionRTL(bool); bool useWebKitCache() const; void setUseWebKitCache(bool use); // Frame flattening bool isFrameFlatteningEnabled() const; void setFrameFlatteningEnabled(bool enable); // Direct rendering to canvas bool isDirectRenderingToCanvasEnabled() const; void setDirectRenderingToCanvasEnabled(bool enable); // Plugin Maximum number unsigned maxPluginInstances() const; void setMaxPluginInstances(unsigned num); private: // These are set via WebPage void setScreenWidth(int width); void setScreenHeight(int height); void setApplicationViewSize(const WebCore::IntSize&); // These are for internal usage inside of WebKit so as not to cause a copy WTF::String serifFontFamily() const; WTF::String fixedFontFamily() const; WTF::String sansSerifFontFamily() const; WTF::String standardFontFamily() const; WTF::String userAgentString() const; friend class WebPage; friend class WebPagePrivate; friend class WebSettingsPrivate; friend class WebCore::FrameLoaderClientBlackBerry; WebSettings(const WebString&); WebSettings(WebCore::Page*, const WebString&); ~WebSettings(); WebSettingsPrivate* d; }; } } #endif // WebSettings_h
[ [ [ 1, 224 ] ] ]
ab93a41a80826e7015b426b81052ef81e9fea5ee
a84b013cd995870071589cefe0ab060ff3105f35
/webdriver/branches/chrome/jobbie/src/cpp/InternetExplorerDriver/ElementWrapper.cpp
cfced69cb53adb5f712f9d0029fd59f6a8da9115
[ "Apache-2.0" ]
permissive
vdt/selenium
137bcad58b7184690b8785859d77da0cd9f745a0
30e5e122b068aadf31bcd010d00a58afd8075217
refs/heads/master
2020-12-27T21:35:06.461381
2009-08-18T15:56:32
2009-08-18T15:56:32
13,650,409
1
0
null
null
null
null
UTF-8
C++
false
false
6,069
cpp
/* Copyright 2007-2009 WebDriver committers Copyright 2007-2009 Google Inc. Portions copyright 2007 ThoughtWorks, 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. */ #include "StdAfx.h" #include "errorcodes.h" #include "utils.h" #include "InternalCustomMessage.h" using namespace std; ElementWrapper::ElementWrapper(InternetExplorerDriver* ie, IHTMLElement *pElem) : pElement(pElem) { this->ie = ie; } ElementWrapper::~ElementWrapper() { } DataMarshaller& ElementWrapper::commandData() { return ie->p_IEthread->getCmdData(); } LPCWSTR ElementWrapper::getElementName() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_GETELEMENTNAME,) return data.output_string_.c_str(); } LPCWSTR ElementWrapper::getAttribute(LPCWSTR name) { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_GETATTRIBUTE, name) return data.output_string_.c_str(); } LPCWSTR ElementWrapper::getValue() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_GETVALUE,) return data.output_string_.c_str(); } int ElementWrapper::sendKeys(LPCWSTR newValue) { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_SENDKEYS, newValue) return data.error_code; } void ElementWrapper::clear() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_CLEAR,) } bool ElementWrapper::isSelected() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_ISSELECTED,) return data.output_bool_; } int ElementWrapper::setSelected() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_SETSELECTED,) return data.error_code; } bool ElementWrapper::isEnabled() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_ISENABLED,) return data.output_bool_; } bool ElementWrapper::isDisplayed() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_ISDISPLAYED,) return data.output_bool_; } int ElementWrapper::toggle(bool* result) { SCOPETRACER int res = click(); if (res != SUCCESS) { return res; } *result = isSelected(); return SUCCESS; } int ElementWrapper::getLocationWhenScrolledIntoView(HWND* hwnd, long* x, long* y) { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_GETLOCATIONONCESCROLLEDINTOVIEW,) VARIANT result = data.output_variant_; if (result.vt != VT_ARRAY) { *hwnd = NULL; *x = 0; *y = 0; return -EUNHANDLEDERROR; } SAFEARRAY* ary = result.parray; long index = 0; CComVariant hwndVariant; SafeArrayGetElement(ary, &index, (void*) &hwndVariant); *hwnd = (HWND) hwndVariant.llVal; index = 1; CComVariant xVariant; SafeArrayGetElement(ary, &index, (void*) &xVariant); *x = xVariant.lVal; index = 2; CComVariant yVariant; SafeArrayGetElement(ary, &index, (void*) &yVariant); *y = yVariant.lVal; SafeArrayDestroy(ary); return SUCCESS; } void ElementWrapper::getLocation(long* x, long* y) { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_GETLOCATION,) VARIANT result = data.output_variant_; if (result.vt != VT_ARRAY) { *x = 0; *y = 0; return; } SAFEARRAY* ary = result.parray; long index = 0; CComVariant xVariant; SafeArrayGetElement(ary, &index, (void*) &xVariant); *x = xVariant.lVal; CComVariant yVariant; index = 1; SafeArrayGetElement(ary, &index, (void*) &yVariant); *y = yVariant.lVal; SafeArrayDestroy(ary); } long ElementWrapper::getWidth() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_GETWIDTH,) return data.output_long_; } long ElementWrapper::getHeight() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_GETHEIGHT,) return data.output_long_; } LPCWSTR ElementWrapper::getValueOfCssProperty(LPCWSTR propertyName) { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_GETVALUEOFCSSPROP, propertyName) return data.output_string_.c_str(); } LPCWSTR ElementWrapper::getText() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_GETTEXT,) return data.output_string_.c_str(); } int ElementWrapper::click() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_CLICK,) return data.error_code; } void ElementWrapper::submit() { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_SUBMIT,) } std::vector<ElementWrapper*>* ElementWrapper::getChildrenWithTagName(LPCWSTR tagName) { SCOPETRACER SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_GETCHILDRENWTAGNAME, tagName) std::vector<IHTMLElement*> &allElems = data.output_list_html_element_; std::vector<ElementWrapper*> *toReturn = new std::vector<ElementWrapper*>(); std::vector<IHTMLElement*>::const_iterator cur, end = allElems.end(); for(cur = allElems.begin();cur < end; cur++) { IHTMLElement* elem = *cur; toReturn->push_back(new ElementWrapper(ie, elem)); } return toReturn; } void ElementWrapper::releaseInterface() { ///// TODO !!! return; SEND_MESSAGE_WITH_MARSHALLED_DATA(_WD_ELEM_RELEASE,) } ///////////////////////////////////////////////////////////////////// DataMarshaller& ElementWrapper::prepareCmData() { DataMarshaller& data = commandData(); data.input_html_element_ = pElement; return data; } DataMarshaller& ElementWrapper::prepareCmData(LPCWSTR str) { DataMarshaller& data = prepareCmData(); data.input_string_ = str; return data; } bool ElementWrapper::sendThreadMsg(UINT msg, DataMarshaller& data) { return ie->sendThreadMsg(msg, data); }
[ "simon.m.stewart@07704840-8298-11de-bf8c-fd130f914ac9", "amorujao@07704840-8298-11de-bf8c-fd130f914ac9" ]
[ [ [ 1, 8 ], [ 10, 10 ], [ 12, 17 ], [ 19, 21 ], [ 23, 25 ], [ 29, 30 ], [ 36, 36 ], [ 40, 40 ], [ 42, 42 ], [ 45, 45 ], [ 47, 49 ], [ 52, 52 ], [ 54, 56 ], [ 59, 59 ], [ 61, 63 ], [ 67, 67 ], [ 69, 71 ], [ 76, 77 ], [ 82, 84 ], [ 87, 87 ], [ 89, 91 ], [ 94, 94 ], [ 96, 98 ], [ 103, 105 ], [ 108, 108 ], [ 110, 113 ], [ 115, 116 ], [ 119, 119 ], [ 121, 122 ], [ 124, 131 ], [ 133, 137 ], [ 139, 142 ], [ 144, 147 ], [ 149, 149 ], [ 151, 151 ], [ 154, 154 ], [ 156, 157 ], [ 159, 159 ], [ 161, 163 ], [ 167, 171 ], [ 173, 176 ], [ 178, 178 ], [ 181, 181 ], [ 183, 185 ], [ 188, 188 ], [ 190, 192 ], [ 195, 195 ], [ 197, 199 ], [ 202, 202 ], [ 204, 206 ], [ 209, 209 ], [ 211, 212 ], [ 214, 214 ], [ 217, 217 ], [ 219, 220 ], [ 224, 224 ], [ 226, 227 ], [ 229, 229 ], [ 233, 237 ], [ 241, 241 ], [ 244, 244 ], [ 246, 248 ], [ 251, 253 ], [ 255, 257 ], [ 260, 260 ], [ 262, 264 ], [ 267, 267 ], [ 269, 270 ] ], [ [ 9, 9 ], [ 11, 11 ], [ 18, 18 ], [ 22, 22 ], [ 26, 28 ], [ 31, 35 ], [ 37, 39 ], [ 41, 41 ], [ 43, 44 ], [ 46, 46 ], [ 50, 51 ], [ 53, 53 ], [ 57, 58 ], [ 60, 60 ], [ 64, 66 ], [ 68, 68 ], [ 72, 75 ], [ 78, 81 ], [ 85, 86 ], [ 88, 88 ], [ 92, 93 ], [ 95, 95 ], [ 99, 102 ], [ 106, 107 ], [ 109, 109 ], [ 114, 114 ], [ 117, 118 ], [ 120, 120 ], [ 123, 123 ], [ 132, 132 ], [ 138, 138 ], [ 143, 143 ], [ 148, 148 ], [ 150, 150 ], [ 152, 153 ], [ 155, 155 ], [ 158, 158 ], [ 160, 160 ], [ 164, 166 ], [ 172, 172 ], [ 177, 177 ], [ 179, 180 ], [ 182, 182 ], [ 186, 187 ], [ 189, 189 ], [ 193, 194 ], [ 196, 196 ], [ 200, 201 ], [ 203, 203 ], [ 207, 208 ], [ 210, 210 ], [ 213, 213 ], [ 215, 216 ], [ 218, 218 ], [ 221, 223 ], [ 225, 225 ], [ 228, 228 ], [ 230, 232 ], [ 238, 240 ], [ 242, 243 ], [ 245, 245 ], [ 249, 250 ], [ 254, 254 ], [ 258, 259 ], [ 261, 261 ], [ 265, 266 ], [ 268, 268 ], [ 271, 272 ] ] ]
d6c9ce430a9a9fb8fb2a7bb072634fa561272dda
21da454a8f032d6ad63ca9460656c1e04440310e
/src/net/worldscale/pimap/wscPimapDecoder.h
ff51953f7adb329d13aef8def4a03438aecb1a01
[]
no_license
merezhang/wcpp
d9879ffb103513a6b58560102ec565b9dc5855dd
e22eb48ea2dd9eda5cd437960dd95074774b70b0
refs/heads/master
2021-01-10T06:29:42.908096
2009-08-31T09:20:31
2009-08-31T09:20:31
46,339,619
0
0
null
null
null
null
UTF-8
C++
false
false
615
h
#pragma once #include "wsiPimapDecoder.h" #include <wcpp/lang/wscObject.h> #define WS_ClassName_OF_wscPimapDecoder "net.worldscale.pimap.wscPimapDecoder" class wscPimapDecoder : public wscObject , public wsiPimapDecoder { WS_IMPL_QUERY_INTERFACE_BEGIN( wscPimapDecoder ) WS_IMPL_QUERY_INTERFACE_BODY( wsiPimapDecoder ) WS_IMPL_QUERY_INTERFACE_END() public: static const ws_char * const s_class_name; public: wscPimapDecoder(void); ~wscPimapDecoder(void); public: WS_METHOD( ws_result , Decode )( wsiDatagramPacket * src , wsiPimapPacket * dest ); };
[ "xukun0217@98f29a9a-77f1-11de-91f8-ab615253d9e8" ]
[ [ [ 1, 23 ] ] ]
3be5445270946f4bf712779ad7b76d8cc4006f95
cd07acbe92f87b59260478f62a6f8d7d1e218ba9
/src/CombinationAnalyseDlg.cpp
374c381f53f4a79d2e8e053fbe254753e955ac30
[]
no_license
niepp/sperm-x
3a071783e573d0c4bae67c2a7f0fe9959516060d
e8f578c640347ca186248527acf82262adb5d327
refs/heads/master
2021-01-10T06:27:15.004646
2011-09-24T03:33:21
2011-09-24T03:33:21
46,690,957
1
1
null
null
null
null
GB18030
C++
false
false
22,648
cpp
// CombinationAnalyseDlg.cpp : implementation file // #include "stdafx.h" #include "sperm.h" #include "CombinationAnalyseDlg.h" #include "PrinteDlg.h" #include "AllFunction.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CCombinationAnalyseDlg dialog extern CString theStrPathApp; extern _ConnectionPtr theConnection; void CCombinationAnalyseDlg::ClearVar() { m_strEditShape = _T(""); m_strEditSpermVolume = _T(""); m_strEditSmell = _T(""); m_strEditPH = _T(""); m_strEditDilutionRatio = _T(""); m_strEditLiquifyTime = _T(""); m_strEditThickness = _T(""); m_strEditCohension = _T(""); m_strEditLiquifyState = _T(""); m_strEditRoomTempera = _T(""); m_strEditInputPatientNO = _T(""); m_strEditInputName = _T(""); m_strEditInputRptDoc = _T(""); m_InputDateTime = COleDateTime::GetCurrentTime(); m_chk_datetime = FALSE; strName = _T(""); } CCombinationAnalyseDlg::CCombinationAnalyseDlg(CWnd* pParent /*=NULL*/) : CDialog(CCombinationAnalyseDlg::IDD, pParent) { //{{AFX_DATA_INIT(CCombinationAnalyseDlg) m_strEditInputPatientNO = _T(""); m_strEditInputName = _T(""); m_strEditInputRptDoc = _T(""); m_InputDateTime = COleDateTime::GetCurrentTime(); m_chk_datetime = FALSE; m_midu = 0.0; m_huolv = 0.0; m_fanyinlv = 0.0; m_wanzhenglv = 0.0; m_xingtailv = 0.0; m_sudu = 0.0; m_strDiagnostic = _T("\ 男性生育力指数FI是反映男性生育能力的重要参考,FI越大表明生育能力越好:\r\n\ FI > 1 表明男性生育能力正常;\r\n\ FI = 0 表明完全没有生育能力;\r\n\ 0 < FI < 1 表明存在不同程度的生育障碍.\n"); //}}AFX_DATA_INIT m_shtPropertySheet.AddPage(&m_WndActiveResultPropPage); m_shtPropertySheet.AddPage(&m_WndMophyResultPropPage); m_shtPropertySheet.AddPage(&m_WndFluoreResultPropPage); m_dGenerateIndex = 0.0; m_bmidu = false; m_bhuolv = false; m_bsudu = false; m_bxingtailv = false; m_dzhishu = 0.0; } void CCombinationAnalyseDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCombinationAnalyseDlg) DDX_Text(pDX, IDC_EDIT_INPUTPATIENTNO, m_strEditInputPatientNO); DDX_Text(pDX, IDC_EDIT_INPUTNAME, m_strEditInputName); DDX_Text(pDX, IDC_EDIT_RPT_DOC, m_strEditInputRptDoc); DDX_DateTimeCtrl(pDX, IDC_INPUT_DATETIMEPICKER, m_InputDateTime); DDX_Check(pDX, IDC_CHECK_DATETIME, m_chk_datetime); DDX_Text(pDX, IDC_EDIT_MIDU, m_midu); DDV_MinMaxDouble(pDX, m_midu, 0., 1000.); DDX_Text(pDX, IDC_EDIT_HUOLV, m_huolv); DDV_MinMaxDouble(pDX, m_huolv, 0., 100.); DDX_Text(pDX, IDC_EDIT_FANYINLV, m_fanyinlv); DDV_MinMaxDouble(pDX, m_fanyinlv, 0., 100.); DDX_Text(pDX, IDC_EDIT_WANZHENGLV, m_wanzhenglv); DDV_MinMaxDouble(pDX, m_wanzhenglv, 0., 100.); DDX_Text(pDX, IDC_EDIT_XINGTAILV, m_xingtailv); DDV_MinMaxDouble(pDX, m_xingtailv, 0., 100.); DDX_Text(pDX, IDC_EDIT_SUDU, m_sudu); DDV_MinMaxDouble(pDX, m_sudu, 0., 10000.); DDX_Text(pDX, IDC_EDIT_STR_DIAGNOSTIC, m_strDiagnostic); DDV_MaxChars(pDX, m_strDiagnostic, 1000); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CCombinationAnalyseDlg, CDialog) //{{AFX_MSG_MAP(CCombinationAnalyseDlg) ON_BN_CLICKED(IDC_BUTTON_INQUERY, OnBtnInquery) ON_BN_CLICKED(IDC_BTN_COMBIN_ANALYSE, OnBtnCombinAnalyse) ON_WM_CLOSE() ON_BN_CLICKED(IDC_CHECK_DATETIME, OnCheckDatetime) ON_EN_CHANGE(IDC_EDIT_INPUTPATIENTNO, OnChangeEditInputpatientno) ON_WM_KILLFOCUS() ON_EN_CHANGE(IDC_EDIT_INPUTNAME, OnChangeEditInputname) ON_BN_CLICKED(IDC_BTN_COMPUT, OnBtnComput) ON_WM_CTLCOLOR() ON_EN_CHANGE(IDC_EDIT_MIDU, OnChangeEditMidu) ON_EN_CHANGE(IDC_EDIT_HUOLV, OnChangeEditHuolv) ON_EN_CHANGE(IDC_EDIT_SUDU, OnChangeEditSudu) ON_EN_CHANGE(IDC_EDIT_XINGTAILV, OnChangeEditXingtailv) ON_BN_CLICKED(IDC_BTN_RPT_PRINT, OnBtnRptPrint) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCombinationAnalyseDlg message handlers BOOL CCombinationAnalyseDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CWnd* pWnd= GetDlgItem(IDC_SHEET_POS_STATIC); pWnd->ModifyStyleEx(0,WS_EX_CONTROLPARENT); m_shtPropertySheet.Create(pWnd,WS_CHILD|WS_VISIBLE,WS_EX_CONTROLPARENT); CRect rect; pWnd->GetClientRect(rect); m_shtPropertySheet.SetWindowPos( pWnd, 0, 0, rect.Width(), rect.Height(), SWP_NOZORDER |SWP_NOACTIVATE ); GetDlgItem(IDC_BTN_COMPUT)->EnableWindow(FALSE); GetDlgItem(IDC_BTN_RPT_PRINT)->EnableWindow(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } double CCombinationAnalyseDlg::ComputeGenerateIndex() { double FI = 0.0; if( abs(100-m_MophyData.spermTotalNormalRatio) <= 1e-3 ) return FI = 0.0; FI = m_ActiveData.moveSpermRatio*0.01 * m_ActiveData.spermTotalDensity*1000000 * m_ActiveData.movespeed*0.001 \ / ( 1000000 * (100-m_MophyData.spermTotalNormalRatio)*0.01 ); return FI; } void CCombinationAnalyseDlg::OnBtnInquery() { // TODO: Add your control notification handler code here // 基本理化指标 CString strSQLCreateViewBasicData; strSQLCreateViewBasicData.Format("\ create table BasicData \ as select \ BasicInfo.pName, BasicInfo.pCaseNO, BasicInfo.pDetectDateTime, \ SpermChait.pShape, SpermChait.pSpermVolume, SpermChait.pSmell, SpermChait.pPH, SpermChait.pDilutionRatio, \ SpermChait.pLiquifyTime, SpermChait.pThickness, SpermChait.pCohesion, SpermChait.pLiquifyState, SpermChait.pRoomTempera \ from BasicInfo, SpermChait \ where BasicInfo.pDetectNO = SpermChait.pDetectNO \ and BasicInfo.pCaseNO = '%s' ", m_strEditInputPatientNO); // 常规分析数据 CString strSQLCreateViewActiveData; strSQLCreateViewActiveData.Format("\ create table ActiveData(pName, pCaseNO, pDetectDateTime, pSpermTotalDensity, pMoveSpermRatio, pFrontSpermRatio, pMoveSpeed) \ as select \ BasicInfo.pName, \ BasicInfo.pCaseNO, \ BasicInfo.pDetectDateTime, \ SpermNumStatics.pSpermTotalDensity, \ SpermNumStatics.pMoveSpermRatio*100, \ SpermNumStatics.pFrontSpermRatio*100, \ spermmovitypara.pVAP \ from BasicInfo, SpermNumStatics, spermmovitypara \ where BasicInfo.pDetectNO = SpermNumStatics.pDetectNO \ and SpermNumStatics.pDetectNO = spermmovitypara.pDetectNO \ and BasicInfo.pCaseNO = '%s' ", m_strEditInputPatientNO); // 形态学分析数据 CString strSQLCreateViewMophyData; strSQLCreateViewMophyData.Format("\ create table MophyData(pName, pCaseNO, pDetectDateTime, pTotalNormalRatio) \ as select \ BasicInfo.pName, \ BasicInfo.pCaseNO, \ BasicInfo.pDetectDateTime, \ MorphaPartialRes.dTotalNormalRatio*100 \ from BasicInfo, MorphaPartialRes \ where BasicInfo.pDetectNO = MorphaPartialRes.pDetectNO \ and BasicInfo.pCaseNO = '%s' ", m_strEditInputPatientNO); // 荧光染色分析数据 CString strSQLCreateViewFluoreData; strSQLCreateViewFluoreData.Format(" \ create table FluoreData(pName, pCaseNO, pDetectDateTime, pBeforeNormalRatio, pAfterNormalRatio) \ as select \ BasicInfo.pName, \ BasicInfo.pCaseNO, \ BasicInfo.pDetectDateTime, \ CASE \ WHEN FResult.BeforeNormalSpermNumbers=0 THEN CAST(0 as decimal(5,2)) \ ELSE 100*(CAST(FResult.BeforeNormalSpermNumbers as decimal(5,2))) / ( CAST(FResult.BeforeNormalSpermNumbers as decimal(5,2))) \ END , \ CASE \ WHEN FResult.AfterNormalSpermNumbers=0 THEN CAST(0 as decimal(5,2)) \ ELSE 100*(CAST(FResult.AfterNormalSpermNumbers as decimal(5,2))) / ( CAST(FResult.AfterNormalSpermNumbers as decimal(5,2))) \ END \ from BasicInfo, FResult \ where BasicInfo.pDetectNO = FResult.pDetectNO \ and BasicInfo.pCaseNO = '%s' ", m_strEditInputPatientNO); try { if( IsTableExist(theConnection,"BasicData") ) theConnection->Execute((LPCTSTR)("drop table BasicData"), NULL, adCmdText); if( IsTableExist(theConnection,"ActiveData") ) theConnection->Execute((LPCTSTR)("drop table ActiveData"), NULL, adCmdText); if( IsTableExist(theConnection,"MophyData") ) theConnection->Execute((LPCTSTR)("drop table MophyData"), NULL, adCmdText); if( IsTableExist(theConnection,"FluoreData") ) theConnection->Execute((LPCTSTR)("drop table FluoreData"), NULL, adCmdText); } catch (_com_error& e) { MessageBox(e.Description()); return; } try { theConnection->Execute((LPCTSTR)strSQLCreateViewBasicData, NULL, adCmdText); theConnection->Execute((LPCTSTR)strSQLCreateViewActiveData, NULL, adCmdText); theConnection->Execute((LPCTSTR)strSQLCreateViewMophyData, NULL, adCmdText); theConnection->Execute((LPCTSTR)strSQLCreateViewFluoreData, NULL, adCmdText); } catch (_com_error& e) { MessageBox(e.Description()); return; } CString strSQLQueryActiveData; CString strSQLQueryMophyData; CString strSQLQueryFluoreData; UpdateData(TRUE); if( m_chk_datetime == TRUE ) { strSQLQueryActiveData.Format("select * from ActiveData \ where pName = '%s' \ and pCaseNO = '%s' \ and YEAR(pDetectDateTime) = '%d'\ and MONTH(pDetectDateTime) = '%d'\ and DAY(pDetectDateTime) = '%d'", m_strEditInputName, m_strEditInputPatientNO, m_InputDateTime.GetYear(), m_InputDateTime.GetMonth(), m_InputDateTime.GetDay()); strSQLQueryMophyData.Format("select * from MophyData \ where pName = '%s' \ and pCaseNO = '%s' \ and YEAR(pDetectDateTime) = '%d'\ and MONTH(pDetectDateTime) = '%d'\ and DAY(pDetectDateTime) = '%d'", m_strEditInputName, m_strEditInputPatientNO, m_InputDateTime.GetYear(), m_InputDateTime.GetMonth(), m_InputDateTime.GetDay()); strSQLQueryFluoreData.Format("select * from FluoreData \ where pName = '%s' \ and pCaseNO = '%s' \ and YEAR(pDetectDateTime) = '%d'\ and MONTH(pDetectDateTime) = '%d'\ and DAY(pDetectDateTime) = '%d'", m_strEditInputName, m_strEditInputPatientNO, m_InputDateTime.GetYear(), m_InputDateTime.GetMonth(), m_InputDateTime.GetDay()); } else { strSQLQueryActiveData.Format("select * from ActiveData \ where pName = '%s' \ and pCaseNO = '%s'", m_strEditInputName, m_strEditInputPatientNO); strSQLQueryMophyData.Format("select * from MophyData \ where pName = '%s' \ and pCaseNO = '%s'", m_strEditInputName, m_strEditInputPatientNO); strSQLQueryFluoreData.Format("select * from FluoreData \ where pName = '%s' \ and pCaseNO = '%s'", m_strEditInputName, m_strEditInputPatientNO); } try { _RecordsetPtr rs; m_shtPropertySheet.SetActivePage(&m_WndFluoreResultPropPage); rs = theConnection->Execute((LPCTSTR)strSQLQueryFluoreData, NULL, adCmdText); m_WndFluoreResultPropPage.m_FluoreResultList.SetListCtrlData(rs); m_shtPropertySheet.SetActivePage(&m_WndMophyResultPropPage); rs = theConnection->Execute((LPCTSTR)strSQLQueryMophyData, NULL, adCmdText); m_WndMophyResultPropPage.m_MophyResultList.SetListCtrlData(rs); m_shtPropertySheet.SetActivePage(&m_WndActiveResultPropPage); rs = theConnection->Execute((LPCTSTR)strSQLQueryActiveData, NULL, adCmdText); m_WndActiveResultPropPage.m_ActiveResultList.SetListCtrlData(rs); } catch (_com_error& e) { MessageBox(e.Description()); return; } } extern CString GetConnectIP(); void CCombinationAnalyseDlg::OnBtnCombinAnalyse() { // TODO: Add your control notification handler code here if( ( m_WndActiveResultPropPage.m_nActiveResultListIndex >=0 ) && ( m_WndMophyResultPropPage.m_nMophyResultListIndex >=0 ) ) { m_dGenerateIndex = ComputeGenerateIndex(); UpdateData(TRUE); // 写到数据库 CString strSQLCombinationResult(" \ create table CombinationResult( \ pCaseNO varchar(20) Not Null, \ pName varchar(20), \ pRptDoctor varchar(20),\ pDensitye decimal(20,3), \ pMoveRatio decimal(20,3), \ pFrontRatio decimal(20,3), \ pMoveSpeed decimal(20,3), \ pNormalRatio decimal(20,3), \ pBeforeNormalRatio decimal(20,3), \ pAfterNormalRatio decimal(20,3), \ pGenerateIndex decimal(20,3), \ pDiagnostic char(1000))"); CString strDate; strDate.Format("%d/%d/%d", m_InputDateTime.GetMonth(), m_InputDateTime.GetDay(), m_InputDateTime.GetYear()); CString strSQLRecord; strSQLRecord.Format(" \ insert into CombinationResult values( \ '%s', \ '%s', \ '%s', \ '%lf', \ '%lf', \ '%lf', \ '%lf', \ '%lf', \ '%lf', \ '%lf', \ '%lf', \ '%s')", m_strEditInputPatientNO, m_strEditInputName, m_strEditInputRptDoc, m_ActiveData.spermTotalDensity, m_ActiveData.moveSpermRatio, m_ActiveData.frontSpermRatio, m_ActiveData.movespeed, m_MophyData.spermTotalNormalRatio, m_FluoreData.spermBeforeNormalRatio, m_FluoreData.spermAfterNormalRatio, m_dGenerateIndex, m_strDiagnostic); if(m_strEditInputPatientNO=="" || m_strEditInputName=="") { MessageBox("样本号和姓名不能为空!","错误",MB_ICONWARNING); return; } if( IsTableExist(theConnection,"CombinationResult") ) { try { theConnection->Execute((LPCTSTR)("drop table CombinationResult"), NULL, adCmdText); } catch (_com_error& e) { MessageBox(e.Description()); return; } } try { theConnection->Execute((LPCTSTR)strSQLCombinationResult, NULL, adCmdText); theConnection->Execute((LPCTSTR)strSQLRecord, NULL, adCmdText); } catch (_com_error& e) { MessageBox(e.Description()); return; } int reportype = 0; // 0 综合分析 1 多头 2 活力 CString strdetect(m_strEditInputPatientNO); crxparm parm; parm.ipadd = TEXT( GetConnectIP() ); parm.database = TEXT("data"); parm.username = TEXT(""); parm.passwd = TEXT(""); CPrinteDlg cpld(reportype,parm,strdetect); cpld.DoModal(); } else{ if( m_WndActiveResultPropPage.m_nActiveResultListIndex < 0 ) { MessageBox("缺少活力分析的数据"); } else if( m_WndMophyResultPropPage.m_nMophyResultListIndex < 0 ) { MessageBox("缺少形态学分析的数据"); } } } void CCombinationAnalyseDlg::OnClose() { // TODO: Add your message handler code here and/or call default ClearVar(); DestroyWindow(); CDialog::OnClose(); } void CCombinationAnalyseDlg::OnCancel() { // TODO: Add extra cleanup here OnClose(); } void CCombinationAnalyseDlg::OnCheckDatetime() { // TODO: Add your control notification handler code here if( m_chk_datetime == FALSE ) m_chk_datetime = TRUE; else m_chk_datetime = FALSE; } void CCombinationAnalyseDlg::OnChangeEditInputpatientno() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here UpdateData(TRUE); CString strSQLQuery; strSQLQuery.Format("select * from ActiveData \ where pCaseNO = '%s' ", m_strEditInputPatientNO); if( IsTableExist(theConnection,"ActiveData") ) { try { _variant_t var; _RecordsetPtr rs = theConnection->Execute((LPCTSTR)strSQLQuery, NULL, adCmdText); if(!rs->EndOfFile) { var = rs->GetCollect("pName"); strName = m_strEditInputName = (char*)(_bstr_t)var; UpdateData(FALSE); } else { strName = m_strEditInputName = _T(""); UpdateData(FALSE); } } catch(_com_error& e) { AfxMessageBox(e.Description()); return; } } } void CCombinationAnalyseDlg::OnChangeEditInputname() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here UpdateData(TRUE); if( strName != _T("") && strName != m_strEditInputName ) { if( MessageBox(_T("姓名输入有误,使用数据库中的姓名?"), TEXT("提示"), MB_YESNO | MB_ICONEXCLAMATION ) == IDYES ) { m_strEditInputName = strName; UpdateData(FALSE); } } } void CCombinationAnalyseDlg::OnKillFocus(CWnd* pNewWnd) { CDialog::OnKillFocus(pNewWnd); // TODO: Add your message handler code heres } void CCombinationAnalyseDlg::OnBtnComput() { // TODO: Add your control notification handler code here UpdateData(TRUE); double v = 0; if(abs(100-m_xingtailv)<1e-3) v = 0; else v = (m_huolv*0.01) * (m_midu * 1000000) * (m_sudu*0.001) / ((100-m_xingtailv)*0.01 * 1000000); m_dzhishu = v; CString cs; cs.Format("%.2lf", v); SetDlgItemText(IDC_STATIC_ZHISHU, cs); GetDlgItem(IDC_BTN_RPT_PRINT)->EnableWindow(TRUE); } void CCombinationAnalyseDlg::OnBtnRptPrint() { // TODO: Add your control notification handler code here UpdateData(TRUE); // 写到数据库 CString strSQLCombinationResult(" \ create table CombinationResult( \ pCaseNO varchar(20) Not Null, \ pName varchar(20),\ pRptDoctor varchar(20),\ pDensitye decimal(20,3), \ pMoveRatio decimal(20,3), \ pMoveSpeed decimal(20,3), \ pNormalRatio decimal(20,3), \ pBeforeNormalRatio decimal(20,3), \ pAfterNormalRatio decimal(20,3), \ pGenerateIndex decimal(20,3), \ pDiagnostic char(1000))"); CString strSQLRecord; strSQLRecord.Format(" \ insert into CombinationResult values( \ '%s', \ '%s', \ '%s', \ '%lf', \ '%lf', \ '%lf', \ '%lf', \ '%lf', \ '%lf', \ '%lf', \ '%s')", m_strEditInputPatientNO, m_strEditInputName, m_strEditInputRptDoc, m_midu, m_huolv, m_sudu, m_xingtailv, m_wanzhenglv, m_fanyinlv, m_dzhishu, m_strDiagnostic); if( IsTableExist(theConnection,"CombinationResult") ) { try { theConnection->Execute((LPCTSTR)("drop table CombinationResult"), NULL, adCmdText); } catch (_com_error& e) { MessageBox(e.Description()); return; } } try { theConnection->Execute((LPCTSTR)strSQLCombinationResult, NULL, adCmdText); theConnection->Execute((LPCTSTR)strSQLRecord, NULL, adCmdText); } catch (_com_error& e) { MessageBox(e.Description()); return; } int reportype = 0; // 0 综合分析 1 多头 2 活力 CString strdetect(m_strEditInputPatientNO); crxparm parm; parm.ipadd = TEXT( GetConnectIP() ); parm.database = TEXT("data"); parm.username = TEXT(""); parm.passwd = TEXT(""); CPrinteDlg cpld(reportype,parm,strdetect); cpld.DoModal(); } HBRUSH CCombinationAnalyseDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here if(nCtlColor == CTLCOLOR_STATIC) { COLORREF color = RGB(255,0,0); UINT IDArray[] = { IDC_STATIC_1, IDC_STATIC_2, IDC_STATIC_3, IDC_STATIC_4, IDC_STATIC_5 }; for(int k=0; k<sizeof(IDArray)/sizeof(UINT); k++) { if( pWnd->GetDlgCtrlID() == IDArray[k] ) { pDC->SetTextColor(color); } } } // TODO: Return a different brush if the default is not desired return hbr; } void CCombinationAnalyseDlg::OnChangeEditMidu() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here m_bmidu = true; if(m_bmidu && m_bhuolv && m_bsudu && m_bxingtailv) GetDlgItem(IDC_BTN_COMPUT)->EnableWindow(TRUE); } void CCombinationAnalyseDlg::OnChangeEditHuolv() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here m_bhuolv = true; if(m_bmidu && m_bhuolv && m_bsudu && m_bxingtailv) GetDlgItem(IDC_BTN_COMPUT)->EnableWindow(TRUE); } void CCombinationAnalyseDlg::OnChangeEditSudu() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here m_bsudu = true; if(m_bmidu && m_bhuolv && m_bsudu && m_bxingtailv) GetDlgItem(IDC_BTN_COMPUT)->EnableWindow(TRUE); } void CCombinationAnalyseDlg::OnChangeEditXingtailv() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here m_bxingtailv = true; if(m_bmidu && m_bhuolv && m_bsudu && m_bxingtailv) GetDlgItem(IDC_BTN_COMPUT)->EnableWindow(TRUE); }
[ "harithchen@e030fd90-5f31-5877-223c-63bd88aa7192", "happynp@e030fd90-5f31-5877-223c-63bd88aa7192" ]
[ [ [ 1, 423 ], [ 427, 612 ], [ 616, 701 ] ], [ [ 424, 426 ], [ 613, 615 ] ] ]
463fcd835ddb36f95021576ff41e27fdcef0fe46
c7120eeec717341240624c7b8a731553494ef439
/src/cplusplus/freezone-samp/src/vehicles_t.hpp
575425e9511d6df4b50789f839d36b2a0f8fa2f7
[]
no_license
neverm1ndo/gta-paradise-sa
d564c1ed661090336621af1dfd04879a9c7db62d
730a89eaa6e8e4afc3395744227527748048c46d
refs/heads/master
2020-04-27T22:00:22.221323
2010-09-04T19:02:28
2010-09-04T19:02:28
174,719,907
1
0
null
2019-03-09T16:44:43
2019-03-09T16:44:43
null
WINDOWS-1251
C++
false
false
22,873
hpp
#ifndef VEHICLES_T_HPP #define VEHICLES_T_HPP #include <string> #include <vector> #include <set> #include <istream> #include <ostream> #include <boost/lexical_cast.hpp> #include <boost/algorithm/string.hpp> #include "basic_types.hpp" #include "checkpoints_t.hpp" #include "core/serialization/configuradable.hpp" struct vehicle_def_t { enum type_e { type_unknown = 0 //Неизвесные ,type_bike //Мотоциклы ,type_bicycle //Велосипеды ,type_airplane //Самолеты ,type_helicopter //Вертолеты ,type_boat //Лодки ,type_service //Служебные машины ,type_offroad //Внедорожники ,type_train //Поезда ,type_rc //Радио управляемы модели ,type_lowrider //Лоурайдеры ,type_trailer //Прицепы ,type_industrial //Промышленный транспорт ,type_sport //Спортивные автомобили ,type_unique //Редкое авто ,type_saloon //Седаны ,type_cabriolet //Кабриолеты ,type_estate //Универсалы }; enum modification_e { modification_none = 0 //не модифицируются ,modification_transfender //Transfender ,modification_loco_low_co //Loco Low Co ,modification_wheel_arch_angels //Wheel Arch Angels }; struct color_item_t { int color1; int color2; color_item_t(int color1, int color2): color1(color1), color2(color2) {} }; std::string sys_name; std::string game_type; bool valid; std::string name; std::string real_name; type_e type; modification_e modification; int colors; int seats; float z_delta; std::string comment; std::vector<int> paintjobs; std::set<std::string> components; std::vector<color_item_t> color_items; bool can_attach_trailer; bool can_change_plate; vehicle_def_t() :valid(false) ,type(type_unknown) ,modification(modification_none) ,colors(0) ,seats(0) ,z_delta(0.0f) ,can_attach_trailer(false) ,can_change_plate(false) {} }; template <class char_t, class traits_t> inline std::basic_istream<char_t, traits_t>& operator>>(std::basic_istream<char_t, traits_t>& is, vehicle_def_t& def) { try { std::string valid_str; std::string type_str; std::string modification_str; std::string colors_str; std::string seats_str; std::string z_delta_str; std::string paintjobs_str; std::string components_str; std::string color_items_str; std::string can_attach_trailer_str; std::string can_change_plate_str; std::getline(is, def.sys_name, ';'); boost::trim(def.sys_name); std::getline(is, def.game_type, ';'); boost::trim(def.game_type); std::getline(is, valid_str, ';'); boost::trim(valid_str); std::getline(is, def.name, ';'); boost::trim(def.name); std::getline(is, def.real_name, ';'); boost::trim(def.real_name); std::getline(is, type_str, ';'); boost::trim(type_str); std::getline(is, modification_str, ';'); boost::trim(modification_str); std::getline(is, colors_str, ';'); boost::trim(colors_str); std::getline(is, seats_str, ';'); boost::trim(seats_str); std::getline(is, z_delta_str, ';'); boost::trim(z_delta_str); std::getline(is, def.comment, ';'); boost::trim(def.comment); std::getline(is, paintjobs_str, ';'); boost::trim(paintjobs_str); std::getline(is, components_str, ';'); boost::trim(components_str); std::getline(is, color_items_str, ';'); boost::trim(color_items_str); std::getline(is, can_attach_trailer_str, ';'); boost::trim(can_attach_trailer_str); std::getline(is, can_change_plate_str); boost::trim(can_change_plate_str); if (is.eof() && !is.fail()) { def.valid = boost::iequals(valid_str, "true"); if (boost::iequals(type_str, "bike")) def.type = vehicle_def_t::type_bike; else if (boost::iequals(type_str, "bicycle")) def.type = vehicle_def_t::type_bicycle; else if (boost::iequals(type_str, "airplane")) def.type = vehicle_def_t::type_airplane; else if (boost::iequals(type_str, "helicopter")) def.type = vehicle_def_t::type_helicopter; else if (boost::iequals(type_str, "boat")) def.type = vehicle_def_t::type_boat; else if (boost::iequals(type_str, "service")) def.type = vehicle_def_t::type_service; else if (boost::iequals(type_str, "offroad")) def.type = vehicle_def_t::type_offroad; else if (boost::iequals(type_str, "train")) def.type = vehicle_def_t::type_train; else if (boost::iequals(type_str, "rc")) def.type = vehicle_def_t::type_rc; else if (boost::iequals(type_str, "lowrider")) def.type = vehicle_def_t::type_lowrider; else if (boost::iequals(type_str, "trailer")) def.type = vehicle_def_t::type_trailer; else if (boost::iequals(type_str, "industrial")) def.type = vehicle_def_t::type_industrial; else if (boost::iequals(type_str, "sport")) def.type = vehicle_def_t::type_sport; else if (boost::iequals(type_str, "unique")) def.type = vehicle_def_t::type_unique; else if (boost::iequals(type_str, "saloon")) def.type = vehicle_def_t::type_saloon; else if (boost::iequals(type_str, "cabriolet")) def.type = vehicle_def_t::type_cabriolet; else if (boost::iequals(type_str, "estate")) def.type = vehicle_def_t::type_estate; else def.type = vehicle_def_t::type_unknown; if (boost::iequals(modification_str, "transfender")) def.modification = vehicle_def_t::modification_transfender; else if (boost::iequals(modification_str, "loco_low_co")) def.modification = vehicle_def_t::modification_loco_low_co; else if (boost::iequals(modification_str, "wheel_arch_angels")) def.modification = vehicle_def_t::modification_wheel_arch_angels; else def.modification = vehicle_def_t::modification_none; def.colors = boost::lexical_cast<int>(colors_str); if (def.colors > 2 || def.colors < 0) def.colors = 0; def.seats = boost::lexical_cast<int>(seats_str); if (def.seats > 10 || def.seats < 0) def.seats = 0; def.z_delta = boost::lexical_cast<float>(z_delta_str); def.can_attach_trailer = boost::iequals(can_attach_trailer_str, "true"); def.can_change_plate = boost::iequals(can_change_plate_str, "true"); for (boost::split_iterator<std::string::iterator> paintjobs_it = boost::make_split_iterator(paintjobs_str, boost::token_finder(boost::is_any_of(", "), boost::token_compress_on)), end; paintjobs_it != end; ++paintjobs_it) { std::string paintjob = boost::copy_range<std::string>(*paintjobs_it); if (!paintjob.empty()) { def.paintjobs.push_back(boost::lexical_cast<int>(paintjob)); } } for (boost::split_iterator<std::string::iterator> components_it = boost::make_split_iterator(components_str, boost::token_finder(boost::is_any_of(", "), boost::token_compress_on)), end; components_it != end; ++components_it) { std::string component = boost::copy_range<std::string>(*components_it); if (!component.empty()) { def.components.insert(component); } } for (boost::split_iterator<std::string::iterator> color_items_it = boost::make_split_iterator(color_items_str, boost::token_finder(boost::is_any_of(", "), boost::token_compress_on)), end;;) { if (color_items_it == end) break; std::string color1_str = boost::copy_range<std::string>(*color_items_it); ++color_items_it; if (color_items_it == end) break; std::string color2_str = boost::copy_range<std::string>(*color_items_it); ++color_items_it; try { def.color_items.push_back(vehicle_def_t::color_item_t(boost::lexical_cast<int>(color1_str), boost::lexical_cast<int>(color2_str))); } catch (boost::bad_lexical_cast &) { assert(false); } } } } catch (boost::bad_lexical_cast &) { assert(false); is.setstate(std::ios_base::failbit); } return is; } #include "core/serialization/is_streameble.hpp" namespace serialization { template <> struct is_streameble_read <vehicle_def_t>: std::tr1::true_type {}; } // namespace serialization { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct vehicle_component_def_t { typedef std::vector<int> ids_t; int slot; int price; ids_t ids; std::string group; std::string name; vehicle_component_def_t(): slot(0), price(0) {} }; template <class char_t, class traits_t> inline std::basic_istream<char_t, traits_t>& operator>>(std::basic_istream<char_t, traits_t>& is, vehicle_component_def_t& def) { std::string slot_str; std::string price_str; std::string ids_str; std::getline(is, slot_str, ';'); boost::trim(slot_str); std::getline(is, price_str, ';'); boost::trim(price_str); std::getline(is, ids_str, ';'); boost::trim(ids_str); std::getline(is, def.group, ';'); boost::trim(def.group); std::getline(is, def.name); boost::trim(def.name); try { if (is.eof() && !is.fail()) { def.slot = boost::lexical_cast<int>(slot_str); def.price = boost::lexical_cast<int>(price_str); for (boost::split_iterator<std::string::iterator> ids_it = boost::make_split_iterator(ids_str, boost::token_finder(boost::is_any_of(", "), boost::token_compress_on)), end; ids_it != end; ++ids_it) { def.ids.push_back(boost::lexical_cast<int>(boost::copy_range<std::string>(*ids_it))); } } } catch (boost::bad_lexical_cast &) { is.setstate(std::ios_base::failbit); } return is; } #include "core/serialization/is_streameble.hpp" namespace serialization { template <> struct is_streameble_read <vehicle_component_def_t>: std::tr1::true_type {}; } // namespace serialization { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct pos_vehicle: public pos4 { int model_id; int color1; int color2; int respawn_delay; // Время респавна, секунды pos_vehicle(int model_id = 0, float x = .0f, float y = .0f, float z = .0f, int interior = 0, int world = 0, float rz =.0f, int color1 = 0, int color2 = 0, int respawn_delay = 10 * 60) :model_id(model_id), color1(color1), color2(color2), respawn_delay(respawn_delay) ,pos4(x, y, z, interior, world, rz) {} bool operator==(pos_vehicle const& right) const { return model_id == right.model_id && color1 == right.color1 && color2 == right.color2 && respawn_delay == right.respawn_delay && pos4::operator==(right) ; } bool operator<(pos_vehicle const& right) const { if (model_id == right.model_id) { // Цвета и время респавна не учитываем при сверке return pos4::operator<(right); } return model_id < right.model_id; } }; template <class char_t, class traits_t> inline std::basic_istream<char_t, traits_t>& operator>>(std::basic_istream<char_t, traits_t>& is, pos_vehicle& pos) { return is>>pos.model_id>>pos.x>>pos.y>>pos.z>>pos.interior>>pos.world>>pos.rz>>pos.color1>>pos.color2>>pos.respawn_delay; } template <class char_t, class traits_t> inline std::basic_ostream<char_t, traits_t>& operator<<(std::basic_ostream<char_t, traits_t>& os, pos_vehicle const& pos) { return os<<pos.model_id<<" "<<pos.x<<" "<<pos.y<<" "<<pos.z<<" "<<pos.interior<<" "<<pos.world<<" "<<pos.rz<<" "<<pos.color1<<" "<<pos.color2<<" "<<pos.respawn_delay; } #include "core/serialization/is_streameble.hpp" namespace serialization { template <> struct is_streameble_read <pos_vehicle>: std::tr1::true_type {}; template <> struct is_streameble_write<pos_vehicle>: std::tr1::true_type {}; } // namespace serialization { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct vehicle_color_t { int id; int color; std::string name; vehicle_color_t(): id(0), color(0) {} }; template <class char_t, class traits_t> inline std::basic_istream<char_t, traits_t>& operator>>(std::basic_istream<char_t, traits_t>& is, vehicle_color_t& color) { is>>color.id>>color.color; std::getline(is, color.name); boost::trim(color.name); return is; } template <class char_t, class traits_t> inline std::basic_ostream<char_t, traits_t>& operator<<(std::basic_ostream<char_t, traits_t>& os, vehicle_color_t const& color) { return os<<color.id<<" "<<color.color; } #include "core/serialization/is_streameble.hpp" namespace serialization { template <> struct is_streameble_read <vehicle_color_t>: std::tr1::true_type {}; } // namespace serialization { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct mod_garage_item_t: checkpoint_t { std::string sys_name; // Служебное название, для логов float mapicon_radius; // Радиус отрисовки иконки на радаре mod_garage_item_t(): mapicon_radius(0.0f) {} bool operator==(mod_garage_item_t const& right) const { return sys_name == right.sys_name && mapicon_radius == right.mapicon_radius && checkpoint_t::operator==(right) ; } bool operator<(mod_garage_item_t const& right) const { if (sys_name == right.sys_name) { if (mapicon_radius == right.mapicon_radius) { return checkpoint_t::operator<(right); } return mapicon_radius < right.mapicon_radius; } return sys_name < right.sys_name; } }; template <class char_t, class traits_t> inline std::basic_istream<char_t, traits_t>& operator>>(std::basic_istream<char_t, traits_t>& is, mod_garage_item_t& garage) { return is>>garage.x>>garage.y>>garage.z>>garage.interior>>garage.world>>garage.radius>>garage.size>>garage.sys_name>>garage.mapicon_radius; } #include "core/serialization/is_streameble.hpp" namespace serialization { template <> struct is_streameble_read <mod_garage_item_t>: std::tr1::true_type {}; } // namespace serialization { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct repair_garage_item_t: checkpoint_t { std::string sys_name; // Служебное название, для логов float mapicon_radius; // Радиус отрисовки иконки на радаре int limit_player_count; // Сколько может воспользоваться один игрок. Если = 0 - то без лимита int limit_player_time; // Время действия ограничения, секунды int limit_global_count; // Если = 0 - то без лимита int limit_global_time; // repair_garage_item_t(): mapicon_radius(0.0f), limit_player_count(0), limit_player_time(0), limit_global_count(0), limit_global_time(0) {} bool operator==(repair_garage_item_t const& right) const { return sys_name == right.sys_name && mapicon_radius == right.mapicon_radius && limit_player_count == right.limit_player_count && limit_player_time == right.limit_player_time && limit_global_count == right.limit_global_count && limit_global_time == right.limit_global_time && checkpoint_t::operator==(right) ; } bool operator<(repair_garage_item_t const& right) const { if (sys_name == right.sys_name) { if (mapicon_radius == right.mapicon_radius) { if (limit_player_count == right.limit_player_count) { if (limit_player_time == right.limit_player_time) { if (limit_global_count == right.limit_global_count) { if (limit_global_time == right.limit_global_time) { return checkpoint_t::operator<(right); } return limit_global_time < right.limit_global_time; } return limit_global_count < right.limit_global_count; } return limit_player_time < right.limit_player_time; } return limit_player_count < right.limit_player_count; } return mapicon_radius < right.mapicon_radius; } return sys_name < right.sys_name; } }; template <class char_t, class traits_t> inline std::basic_istream<char_t, traits_t>& operator>>(std::basic_istream<char_t, traits_t>& is, repair_garage_item_t& repair_item) { return is>>repair_item.x>>repair_item.y>>repair_item.z>>repair_item.interior>>repair_item.world>>repair_item.radius>>repair_item.size>>repair_item.sys_name>>repair_item.mapicon_radius>>repair_item.limit_player_count>>repair_item.limit_player_time>>repair_item.limit_global_count>>repair_item.limit_global_time; } #include "core/serialization/is_streameble.hpp" namespace serialization { template <> struct is_streameble_read <repair_garage_item_t>: std::tr1::true_type {}; } // namespace serialization { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct mod_garage_t: public configuradable { public: // configuradable virtual void configure_pre() {} virtual void configure(buffer::ptr const& buff, def_t const& def) { SERIALIZE_ITEM(name); SERIALIZE_ITEM(sys_name); SERIALIZE_ITEM(mapicon_marker_type); SERIALIZE_DELIMITED_ITEM(valid_vehicles); SERIALIZE_ITEM(items); } virtual void configure_post() {} public: // auto_name SERIALIZE_MAKE_CLASS_NAME(mod_garage); public: mod_garage_t():mapicon_marker_type(0) {} public: typedef std::set<std::string> valid_vehicles_t; typedef std::vector<mod_garage_item_t> mod_garage_items_t; std::string name; std::string sys_name; int mapicon_marker_type; valid_vehicles_t valid_vehicles; mod_garage_items_t items; bool operator==(mod_garage_t const& right) const { return name == right.name && sys_name == right.sys_name && mapicon_marker_type == right.mapicon_marker_type && valid_vehicles == right.valid_vehicles && items == right.items ; } bool operator<(mod_garage_t const& right) const { if (name == right.name) { if (sys_name == right.sys_name) { if (mapicon_marker_type == right.mapicon_marker_type) { if (valid_vehicles == right.valid_vehicles) { return items < right.items; } return valid_vehicles < right.valid_vehicles; } return mapicon_marker_type < right.mapicon_marker_type; } return sys_name < right.sys_name; } return name < right.name; } }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct garage_val_t { int checkpoint_id; mod_garage_t const* mod_garage_ptr; mod_garage_item_t const* garage_ptr; int mapicon_id; garage_val_t(): mod_garage_ptr(0), garage_ptr(0), mapicon_id(-1), checkpoint_id(-1) {} }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct repair_garage_t: public configuradable { public: // configuradable virtual void configure_pre() {} virtual void configure(buffer::ptr const& buff, def_t const& def) { SERIALIZE_ITEM(name); SERIALIZE_ITEM(sys_name); SERIALIZE_ITEM(mapicon_marker_type); SERIALIZE_ITEM(valid_vehicles); SERIALIZE_ITEM(price); SERIALIZE_ITEM(items); } virtual void configure_post() {} public: // auto_name SERIALIZE_MAKE_CLASS_NAME(repair_garage); public: repair_garage_t(): mapicon_marker_type(0), price(0) {} public: typedef std::set<std::string> valid_vehicles_t; typedef std::vector<repair_garage_item_t> repair_garage_items_t; std::string name; std::string sys_name; int mapicon_marker_type; valid_vehicles_t valid_vehicles; int price; repair_garage_items_t items; }; typedef vehicle_def_t const* vehicle_def_cptr_t; typedef vehicle_def_t const& vehicle_def_cref_t; #endif // VEHICLES_T_HPP
[ "dimonml@19848965-7475-ded4-60a4-26152d85fbc5" ]
[ [ [ 1, 505 ] ] ]
bb205418d6180c9e6c5f3333954fcc8b1126ad62
206177d643cb88d0339f6130e764daba1376f4a7
/cplusplus_code/sources/buffer.cpp
75c8c86a7e252f29db90227cbd1d45d0a11701f9
[]
no_license
mwollenweber/rebridge
aae8b9dfbf985d3264d7e3874079e1f068cda4c1
4ca787dd545e8064c926811dc81772a6a8c356d1
refs/heads/master
2020-12-24T13:20:11.572283
2010-08-01T05:37:02
2010-08-01T05:37:02
775,487
5
0
null
null
null
null
UTF-8
C++
false
false
5,456
cpp
/* Source for collabreate IdaPro plugin File: buffer.cpp Copyright (c) 2005,2006 Chris Eagle This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * this file was derived from similar code in the ida-x86emu project */ #include <string.h> // added to remove the IDA Pro Dependencies #include <stdlib.h> #include <winsock.h> //#include <pro.h> //#include <kernwin.hpp> #include "buffer.h" #define BLOCK_SIZE 0x100 //keep this a power of two Buffer::Buffer() { init(BLOCK_SIZE); } Buffer::Buffer(const void *data, unsigned int len) { init(len); write(data, len); } void Buffer::init(unsigned int size) { bptr = (unsigned char *)malloc(size); sz = bptr ? size : 0; rptr = 0; wptr = 0; error = bptr == NULL; } Buffer::Buffer(unsigned int size) { init(size); } Buffer::~Buffer() { free(bptr); } void Buffer::readBufferToString(std::string &buf){ buf = std::string((char *)(rptr+bptr), wptr-rptr); } void Buffer::append(Buffer &b) { write(b.bptr, b.wptr); } Buffer &Buffer::operator<<(Buffer &b) { append(b); return *this; } bool Buffer::read(void *data, unsigned int len) { if ((rptr + len) <= wptr) { memcpy(data, bptr + rptr, len); rptr += len; return true; } error = true; return false; } unsigned long long Buffer::readLong() { unsigned long long val = 0; int *p = (int*)&val; p[1] = readInt(); p[0] = readInt(); //msg("Buffer::readLong p[0] is %08.8x, and p[1] is %08.8x\n", p[0], p[1]); return val; } int Buffer::readInt() { int val = 0; read(&val, sizeof(val)); return ntohl(val); } short Buffer::readShort() { short val = 0; read(&val, sizeof(val)); return ntohs(val); } unsigned char Buffer::read() { unsigned char val = 0; read(&val, sizeof(val)); return val; } bool Buffer::readString(std::string &str){ unsigned int len = readInt(); char *_data = (char *)malloc(len); if(read(_data,len)){ str = std::string(_data,len); free(_data); return true; } free(_data); return false; } //This does not adhere strictly to the UTF8 encoding standard //this is more like pascal style 16-bit length + content strings char *Buffer::readUTF8() { //must free this unsigned short len = readShort(); char *str = NULL; if (!error) { str = (char*)malloc(len + 1); if (str && read(str, len)) { str[len] = 0; } else { free(str); str = NULL; } } return str; } bool Buffer::rewind(unsigned int amt) { if (rptr >= amt) { rptr -= amt; return true; } return false; } bool Buffer::seek(unsigned int amt) { if (rptr+amt < wptr) { rptr += amt; return true; } return false; } bool Buffer::reset() { rptr = 0; wptr = 0; error = false; return true; } bool Buffer::write(const void *data, unsigned int len) { if (!check_size(wptr + len)) { memcpy(bptr + wptr, data, len); wptr += len; return true; } error = true; return false; } bool Buffer::writeLong(unsigned long long val) { int *p = (int*)&val; writeInt(p[1]); return writeInt(p[0]); } bool Buffer::writeInt(int val) { val = htonl(val); return write(&val, sizeof(val)); } bool Buffer::writeShort(int val) { short s = (short)val; s = htons(s); return write(&s, sizeof(s)); } bool Buffer::write(int val) { char c = (char)val; return write(&c, sizeof(c)); } bool Buffer::writeString(std::string data) { if(writeInt(data.size())){ return write(data.c_str(), data.size()); } return false; } //This does not adhere strictly to the UTF8 encoding standard //this is more like pascal style 16-bit length + content strings bool Buffer::writeUTF8(const char *data) { unsigned short len = data ? strlen(data) : 0; if (writeShort(len)) { return write(data, len); } return false; } //write a null termianted string as a null terminated //wdie character (16-bit) string bool Buffer::writeWide(const char *data) { short val = 0; do { val = *data++; if (!write(&val, sizeof(val))) return false; } while (val); return true; } const unsigned char *Buffer::get_buf() { // *(int*)bptr = htonl(wptr); return bptr; } int Buffer::check_size(unsigned int max) { if (max < sz) return 0; max = (max + BLOCK_SIZE) & ~(BLOCK_SIZE - 1); //round up to next BLOCK_SIZE unsigned char *tmp = (unsigned char *)realloc(bptr, max); if (tmp) { bptr = tmp; sz = max; return 0; } error = true; return 1; }
[ [ [ 1, 239 ] ] ]
54ece9281235fd37ac46e4139b7c276104fcd662
fd4a071ba9d8f0abf82e7a4d2cb41f48b9339b51
/DataProvider.cpp
e4151c6f2c25674530730ba809e29bd755ebd6d0
[]
no_license
rafalka/rs232testng
c4a6e4c1777ee92b2d67056739b2524569f5be5d
634d38cf8745841cf0509fb10c1faf6943516cbc
refs/heads/master
2020-05-18T17:14:51.166302
2011-01-12T22:00:01
2011-01-12T22:00:01
37,258,102
0
0
null
null
null
null
UTF-8
C++
false
false
599
cpp
/****************************************************************************** * @file DataProvider.cpp * * @brief * * @date 01-12-2010 * @author Rafal Kukla ****************************************************************************** * Copyright (C) 2010 Rafal Kukla ( [email protected] ) * This file is a part of rs232testng project and is released * under the terms of the license contained in the file LICENSE ****************************************************************************** */ #include "DataProvider.h"
[ "rkdevel@ef62a7f8-4c9b-1a64-55d9-32abd1026911" ]
[ [ [ 1, 16 ] ] ]
699bed529a53639b0023b1b2f6a0e2f4104a147f
6f796044ae363f9ca58c66423c607e3b59d077c7
/source/Utils/XmlWriter.cpp
b01ed5564b7884a7823ca1cbb1f47217a9eb8a01
[]
no_license
Wiimpathy/bluemsx-wii
3a68d82ac82268a3a1bf1b5ca02115ed5e61290b
fde291e57fe93c0768b375a82fc0b62e645bd967
refs/heads/master
2020-05-02T22:46:06.728000
2011-10-06T20:57:54
2011-10-06T20:57:54
178,261,485
2
0
null
2019-03-28T18:32:30
2019-03-28T18:32:30
null
ISO-8859-1
C++
false
false
2,926
cpp
// xmlwriter.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung. // #include "xmlwriter.h" #include <stdarg.h> #include "../Arch/ArchFile.h" XmlWriter::XmlWriter(string sTmp) { sXmlFile = sTmp; fp = NULL; iLevel = 0; fp = archFileOpen(sXmlFile.c_str(),"w"); if(fp == NULL) { printf("Unable to open output file\n"); return; } else { fprintf(fp,"<?xml version=\"1.0\" encoding=\"UTF-8\" \?>"); } } XmlWriter::~XmlWriter() { if(fp != NULL) fclose(fp); vectAttrData.clear(); } void XmlWriter::CreateTag(string sTag, bool bClose) { fprintf(fp,"\r\n"); //Indent properly for(int iTmp =0;iTmp<iLevel;iTmp++) fprintf(fp," "); fprintf(fp,"<%s",sTag.c_str()); //Add Attributes while(0 < vectAttrData.size()/2) { string sTmp = vectAttrData.back(); fprintf(fp," %s=", sTmp.c_str()); vectAttrData.pop_back(); sTmp = vectAttrData.back(); fprintf(fp,"\"%s\"", sTmp.c_str()); vectAttrData.pop_back(); } vectAttrData.clear(); if( bClose ) { fprintf(fp,"/>"); }else{ fprintf(fp,">"); sTagStack.push(sTag); iLevel++; } } void XmlWriter::CloseLastTag() { fprintf(fp,"\r\n"); iLevel--; //Indent properly for(int iTmp =0;iTmp<iLevel;iTmp++) fprintf(fp," "); fprintf(fp,"</%s>",sTagStack.top().c_str()); sTagStack.pop();//pop out the last tag return; } void XmlWriter::CloseAllTags() { while(sTagStack.size() != 0) { fprintf(fp,"\r\n"); iLevel--; //Indent properly for(int iTmp =0;iTmp<iLevel;iTmp++) fprintf(fp," "); fprintf(fp,"</%s>",sTagStack.top().c_str()); sTagStack.pop();//pop out the last tag } return; } void XmlWriter::CreateChild(string sTag,string sValue) { fprintf(fp,"\r\n"); //Indent properly for(int iTmp =0;iTmp<iLevel;iTmp++) fprintf(fp," "); fprintf(fp,"<%s",sTag.c_str()); //Add Attributes while(0 < vectAttrData.size()/2) { string sTmp = vectAttrData.back(); fprintf(fp," %s=", sTmp.c_str()); vectAttrData.pop_back(); sTmp = vectAttrData.back(); fprintf(fp,"\"%s\"", sTmp.c_str()); vectAttrData.pop_back(); } vectAttrData.clear(); //add value and close tag fprintf(fp,">%s</%s>",sValue.c_str(),sTag.c_str()); } void XmlWriter::AddAtributes(string sKey, string sVal) { vectAttrData.push_back(sVal); vectAttrData.push_back(sKey); } void XmlWriter::AddComment(string sComment) { fprintf(fp,"\r\n"); //Indent properly for(int iTmp =0;iTmp<iLevel;iTmp++) fprintf(fp," "); fprintf(fp,"<!--%s-->",sComment.c_str()); }
[ "timbrug@c2eab908-c631-11dd-927d-974589228060", "[email protected]" ]
[ [ [ 1, 6 ], [ 10, 14 ], [ 16, 17 ], [ 19, 124 ] ], [ [ 7, 9 ], [ 15, 15 ], [ 18, 18 ] ] ]
0cb354c8f7aa851a6138d0f344fdfd715ddb5fd9
7b379862f58f587d9327db829ae4c6493b745bb1
/JuceLibraryCode/modules/juce_core/xml/juce_XmlElement.h
0e1e60df069632d9e38fb69bf2412eba7b774759
[]
no_license
owenvallis/Nomestate
75e844e8ab68933d481640c12019f0d734c62065
7fe7c06c2893421a3c77b5180e5f27ab61dd0ffd
refs/heads/master
2021-01-19T07:35:14.301832
2011-12-28T07:42:50
2011-12-28T07:42:50
2,950,072
2
0
null
null
null
null
UTF-8
C++
false
false
30,771
h
/* ============================================================================== This file is part of the JUCE library - "Jules' Utility Class Extensions" Copyright 2004-11 by Raw Material Software Ltd. ------------------------------------------------------------------------------ JUCE can be redistributed and/or modified under the terms of the GNU General Public License (Version 2), as published by the Free Software Foundation. A copy of the license is included in the JUCE distribution, or can be found online at www.gnu.org/licenses. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.rawmaterialsoftware.com/juce for more information. ============================================================================== */ #ifndef __JUCE_XMLELEMENT_JUCEHEADER__ #define __JUCE_XMLELEMENT_JUCEHEADER__ #include "../text/juce_String.h" #include "../streams/juce_OutputStream.h" #include "../files/juce_File.h" #include "../containers/juce_LinkedListPointer.h" //============================================================================== /** A handy macro to make it easy to iterate all the child elements in an XmlElement. The parentXmlElement should be a reference to the parent XML, and the childElementVariableName will be the name of a pointer to each child element. E.g. @code XmlElement* myParentXml = createSomeKindOfXmlDocument(); forEachXmlChildElement (*myParentXml, child) { if (child->hasTagName ("FOO")) doSomethingWithXmlElement (child); } @endcode @see forEachXmlChildElementWithTagName */ #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \ \ for (juce::XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \ childElementVariableName != nullptr; \ childElementVariableName = childElementVariableName->getNextElement()) /** A macro that makes it easy to iterate all the child elements of an XmlElement which have a specified tag. This does the same job as the forEachXmlChildElement macro, but only for those elements that have a particular tag name. The parentXmlElement should be a reference to the parent XML, and the childElementVariableName will be the name of a pointer to each child element. The requiredTagName is the tag name to match. E.g. @code XmlElement* myParentXml = createSomeKindOfXmlDocument(); forEachXmlChildElementWithTagName (*myParentXml, child, "MYTAG") { // the child object is now guaranteed to be a <MYTAG> element.. doSomethingWithMYTAGElement (child); } @endcode @see forEachXmlChildElement */ #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \ \ for (juce::XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \ childElementVariableName != nullptr; \ childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName)) //============================================================================== /** Used to build a tree of elements representing an XML document. An XML document can be parsed into a tree of XmlElements, each of which represents an XML tag structure, and which may itself contain other nested elements. An XmlElement can also be converted back into a text document, and has lots of useful methods for manipulating its attributes and sub-elements, so XmlElements can actually be used as a handy general-purpose data structure. Here's an example of parsing some elements: @code // check we're looking at the right kind of document.. if (myElement->hasTagName ("ANIMALS")) { // now we'll iterate its sub-elements looking for 'giraffe' elements.. forEachXmlChildElement (*myElement, e) { if (e->hasTagName ("GIRAFFE")) { // found a giraffe, so use some of its attributes.. String giraffeName = e->getStringAttribute ("name"); int giraffeAge = e->getIntAttribute ("age"); bool isFriendly = e->getBoolAttribute ("friendly"); } } } @endcode And here's an example of how to create an XML document from scratch: @code // create an outer node called "ANIMALS" XmlElement animalsList ("ANIMALS"); for (int i = 0; i < numAnimals; ++i) { // create an inner element.. XmlElement* giraffe = new XmlElement ("GIRAFFE"); giraffe->setAttribute ("name", "nigel"); giraffe->setAttribute ("age", 10); giraffe->setAttribute ("friendly", true); // ..and add our new element to the parent node animalsList.addChildElement (giraffe); } // now we can turn the whole thing into a text document.. String myXmlDoc = animalsList.createDocument (String::empty); @endcode @see XmlDocument */ class JUCE_API XmlElement { public: //============================================================================== /** Creates an XmlElement with this tag name. */ explicit XmlElement (const String& tagName) noexcept; /** Creates a (deep) copy of another element. */ XmlElement (const XmlElement& other); /** Creates a (deep) copy of another element. */ XmlElement& operator= (const XmlElement& other); #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS XmlElement (XmlElement&& other) noexcept; XmlElement& operator= (XmlElement&& other) noexcept; #endif /** Deleting an XmlElement will also delete all its child elements. */ ~XmlElement() noexcept; //============================================================================== /** Compares two XmlElements to see if they contain the same text and attiributes. The elements are only considered equivalent if they contain the same attiributes with the same values, and have the same sub-nodes. @param other the other element to compare to @param ignoreOrderOfAttributes if true, this means that two elements with the same attributes in a different order will be considered the same; if false, the attributes must be in the same order as well */ bool isEquivalentTo (const XmlElement* other, bool ignoreOrderOfAttributes) const noexcept; //============================================================================== /** Returns an XML text document that represents this element. The string returned can be parsed to recreate the same XmlElement that was used to create it. @param dtdToUse the DTD to add to the document @param allOnOneLine if true, this means that the document will not contain any linefeeds, so it'll be smaller but not very easy to read. @param includeXmlHeader whether to add the "<?xml version..etc" line at the start of the document @param encodingType the character encoding format string to put into the xml header @param lineWrapLength the line length that will be used before items get placed on a new line. This isn't an absolute maximum length, it just determines how lists of attributes get broken up @see writeToStream, writeToFile */ String createDocument (const String& dtdToUse, bool allOnOneLine = false, bool includeXmlHeader = true, const String& encodingType = "UTF-8", int lineWrapLength = 60) const; /** Writes the document to a stream as UTF-8. @param output the stream to write to @param dtdToUse the DTD to add to the document @param allOnOneLine if true, this means that the document will not contain any linefeeds, so it'll be smaller but not very easy to read. @param includeXmlHeader whether to add the "<?xml version..etc" line at the start of the document @param encodingType the character encoding format string to put into the xml header @param lineWrapLength the line length that will be used before items get placed on a new line. This isn't an absolute maximum length, it just determines how lists of attributes get broken up @see writeToFile, createDocument */ void writeToStream (OutputStream& output, const String& dtdToUse, bool allOnOneLine = false, bool includeXmlHeader = true, const String& encodingType = "UTF-8", int lineWrapLength = 60) const; /** Writes the element to a file as an XML document. To improve safety in case something goes wrong while writing the file, this will actually write the document to a new temporary file in the same directory as the destination file, and if this succeeds, it will rename this new file as the destination file (overwriting any existing file that was there). @param destinationFile the file to write to. If this already exists, it will be overwritten. @param dtdToUse the DTD to add to the document @param encodingType the character encoding format string to put into the xml header @param lineWrapLength the line length that will be used before items get placed on a new line. This isn't an absolute maximum length, it just determines how lists of attributes get broken up @returns true if the file is written successfully; false if something goes wrong in the process @see createDocument */ bool writeToFile (const File& destinationFile, const String& dtdToUse, const String& encodingType = "UTF-8", int lineWrapLength = 60) const; //============================================================================== /** Returns this element's tag type name. E.g. for an element such as \<MOOSE legs="4" antlers="2">, this would return "MOOSE". @see hasTagName */ inline const String& getTagName() const noexcept { return tagName; } /** Tests whether this element has a particular tag name. @param possibleTagName the tag name you're comparing it with @see getTagName */ bool hasTagName (const String& possibleTagName) const noexcept; //============================================================================== /** Returns the number of XML attributes this element contains. E.g. for an element such as \<MOOSE legs="4" antlers="2">, this would return 2. */ int getNumAttributes() const noexcept; /** Returns the name of one of the elements attributes. E.g. for an element such as \<MOOSE legs="4" antlers="2">, then getAttributeName(1) would return "antlers". @see getAttributeValue, getStringAttribute */ const String& getAttributeName (int attributeIndex) const noexcept; /** Returns the value of one of the elements attributes. E.g. for an element such as \<MOOSE legs="4" antlers="2">, then getAttributeName(1) would return "2". @see getAttributeName, getStringAttribute */ const String& getAttributeValue (int attributeIndex) const noexcept; //============================================================================== // Attribute-handling methods.. /** Checks whether the element contains an attribute with a certain name. */ bool hasAttribute (const String& attributeName) const noexcept; /** Returns the value of a named attribute. @param attributeName the name of the attribute to look up */ const String& getStringAttribute (const String& attributeName) const noexcept; /** Returns the value of a named attribute. @param attributeName the name of the attribute to look up @param defaultReturnValue a value to return if the element doesn't have an attribute with this name */ String getStringAttribute (const String& attributeName, const String& defaultReturnValue) const; /** Compares the value of a named attribute with a value passed-in. @param attributeName the name of the attribute to look up @param stringToCompareAgainst the value to compare it with @param ignoreCase whether the comparison should be case-insensitive @returns true if the value of the attribute is the same as the string passed-in; false if it's different (or if no such attribute exists) */ bool compareAttribute (const String& attributeName, const String& stringToCompareAgainst, bool ignoreCase = false) const noexcept; /** Returns the value of a named attribute as an integer. This will try to find the attribute and convert it to an integer (using the String::getIntValue() method). @param attributeName the name of the attribute to look up @param defaultReturnValue a value to return if the element doesn't have an attribute with this name @see setAttribute */ int getIntAttribute (const String& attributeName, int defaultReturnValue = 0) const; /** Returns the value of a named attribute as floating-point. This will try to find the attribute and convert it to an integer (using the String::getDoubleValue() method). @param attributeName the name of the attribute to look up @param defaultReturnValue a value to return if the element doesn't have an attribute with this name @see setAttribute */ double getDoubleAttribute (const String& attributeName, double defaultReturnValue = 0.0) const; /** Returns the value of a named attribute as a boolean. This will try to find the attribute and interpret it as a boolean. To do this, it'll return true if the value is "1", "true", "y", etc, or false for other values. @param attributeName the name of the attribute to look up @param defaultReturnValue a value to return if the element doesn't have an attribute with this name */ bool getBoolAttribute (const String& attributeName, bool defaultReturnValue = false) const; /** Adds a named attribute to the element. If the element already contains an attribute with this name, it's value will be updated to the new value. If there's no such attribute yet, a new one will be added. Note that there are other setAttribute() methods that take integers, doubles, etc. to make it easy to store numbers. @param attributeName the name of the attribute to set @param newValue the value to set it to @see removeAttribute */ void setAttribute (const String& attributeName, const String& newValue); /** Adds a named attribute to the element, setting it to an integer value. If the element already contains an attribute with this name, it's value will be updated to the new value. If there's no such attribute yet, a new one will be added. Note that there are other setAttribute() methods that take integers, doubles, etc. to make it easy to store numbers. @param attributeName the name of the attribute to set @param newValue the value to set it to */ void setAttribute (const String& attributeName, int newValue); /** Adds a named attribute to the element, setting it to a floating-point value. If the element already contains an attribute with this name, it's value will be updated to the new value. If there's no such attribute yet, a new one will be added. Note that there are other setAttribute() methods that take integers, doubles, etc. to make it easy to store numbers. @param attributeName the name of the attribute to set @param newValue the value to set it to */ void setAttribute (const String& attributeName, double newValue); /** Removes a named attribute from the element. @param attributeName the name of the attribute to remove @see removeAllAttributes */ void removeAttribute (const String& attributeName) noexcept; /** Removes all attributes from this element. */ void removeAllAttributes() noexcept; //============================================================================== // Child element methods.. /** Returns the first of this element's sub-elements. see getNextElement() for an example of how to iterate the sub-elements. @see forEachXmlChildElement */ XmlElement* getFirstChildElement() const noexcept { return firstChildElement; } /** Returns the next of this element's siblings. This can be used for iterating an element's sub-elements, e.g. @code XmlElement* child = myXmlDocument->getFirstChildElement(); while (child != nullptr) { ...do stuff with this child.. child = child->getNextElement(); } @endcode Note that when iterating the child elements, some of them might be text elements as well as XML tags - use isTextElement() to work this out. Also, it's much easier and neater to use this method indirectly via the forEachXmlChildElement macro. @returns the sibling element that follows this one, or zero if this is the last element in its parent @see getNextElement, isTextElement, forEachXmlChildElement */ inline XmlElement* getNextElement() const noexcept { return nextListItem; } /** Returns the next of this element's siblings which has the specified tag name. This is like getNextElement(), but will scan through the list until it finds an element with the given tag name. @see getNextElement, forEachXmlChildElementWithTagName */ XmlElement* getNextElementWithTagName (const String& requiredTagName) const; /** Returns the number of sub-elements in this element. @see getChildElement */ int getNumChildElements() const noexcept; /** Returns the sub-element at a certain index. It's not very efficient to iterate the sub-elements by index - see getNextElement() for an example of how best to iterate. @returns the n'th child of this element, or 0 if the index is out-of-range @see getNextElement, isTextElement, getChildByName */ XmlElement* getChildElement (int index) const noexcept; /** Returns the first sub-element with a given tag-name. @param tagNameToLookFor the tag name of the element you want to find @returns the first element with this tag name, or 0 if none is found @see getNextElement, isTextElement, getChildElement */ XmlElement* getChildByName (const String& tagNameToLookFor) const noexcept; //============================================================================== /** Appends an element to this element's list of children. Child elements are deleted automatically when their parent is deleted, so make sure the object that you pass in will not be deleted by anything else, and make sure it's not already the child of another element. @see getFirstChildElement, getNextElement, getNumChildElements, getChildElement, removeChildElement */ void addChildElement (XmlElement* newChildElement) noexcept; /** Inserts an element into this element's list of children. Child elements are deleted automatically when their parent is deleted, so make sure the object that you pass in will not be deleted by anything else, and make sure it's not already the child of another element. @param newChildNode the element to add @param indexToInsertAt the index at which to insert the new element - if this is below zero, it will be added to the end of the list @see addChildElement, insertChildElement */ void insertChildElement (XmlElement* newChildNode, int indexToInsertAt) noexcept; /** Creates a new element with the given name and returns it, after adding it as a child element. This is a handy method that means that instead of writing this: @code XmlElement* newElement = new XmlElement ("foobar"); myParentElement->addChildElement (newElement); @endcode ..you could just write this: @code XmlElement* newElement = myParentElement->createNewChildElement ("foobar"); @endcode */ XmlElement* createNewChildElement (const String& tagName); /** Replaces one of this element's children with another node. If the current element passed-in isn't actually a child of this element, this will return false and the new one won't be added. Otherwise, the existing element will be deleted, replaced with the new one, and it will return true. */ bool replaceChildElement (XmlElement* currentChildElement, XmlElement* newChildNode) noexcept; /** Removes a child element. @param childToRemove the child to look for and remove @param shouldDeleteTheChild if true, the child will be deleted, if false it'll just remove it */ void removeChildElement (XmlElement* childToRemove, bool shouldDeleteTheChild) noexcept; /** Deletes all the child elements in the element. @see removeChildElement, deleteAllChildElementsWithTagName */ void deleteAllChildElements() noexcept; /** Deletes all the child elements with a given tag name. @see removeChildElement */ void deleteAllChildElementsWithTagName (const String& tagName) noexcept; /** Returns true if the given element is a child of this one. */ bool containsChildElement (const XmlElement* possibleChild) const noexcept; /** Recursively searches all sub-elements to find one that contains the specified child element. */ XmlElement* findParentElementOf (const XmlElement* elementToLookFor) noexcept; //============================================================================== /** Sorts the child elements using a comparator. This will use a comparator object to sort the elements into order. The object passed must have a method of the form: @code int compareElements (const XmlElement* first, const XmlElement* second); @endcode ..and this method must return: - a value of < 0 if the first comes before the second - a value of 0 if the two objects are equivalent - a value of > 0 if the second comes before the first To improve performance, the compareElements() method can be declared as static or const. @param comparator the comparator to use for comparing elements. @param retainOrderOfEquivalentItems if this is true, then items which the comparator says are equivalent will be kept in the order in which they currently appear in the array. This is slower to perform, but may be important in some cases. If it's false, a faster algorithm is used, but equivalent elements may be rearranged. */ template <class ElementComparator> void sortChildElements (ElementComparator& comparator, bool retainOrderOfEquivalentItems = false) { const int num = getNumChildElements(); if (num > 1) { HeapBlock <XmlElement*> elems (num); getChildElementsAsArray (elems); sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems); reorderChildElements (elems, num); } } //============================================================================== /** Returns true if this element is a section of text. Elements can either be an XML tag element or a secton of text, so this is used to find out what kind of element this one is. @see getAllText, addTextElement, deleteAllTextElements */ bool isTextElement() const noexcept; /** Returns the text for a text element. Note that if you have an element like this: @code<xyz>hello</xyz>@endcode then calling getText on the "xyz" element won't return "hello", because that is actually stored in a special text sub-element inside the xyz element. To get the "hello" string, you could either call getText on the (unnamed) sub-element, or use getAllSubText() to do this automatically. Note that leading and trailing whitespace will be included in the string - to remove if, just call String::trim() on the result. @see isTextElement, getAllSubText, getChildElementAllSubText */ const String& getText() const noexcept; /** Sets the text in a text element. Note that this is only a valid call if this element is a text element. If it's not, then no action will be performed. If you're trying to add text inside a normal element, you probably want to use addTextElement() instead. */ void setText (const String& newText); /** Returns all the text from this element's child nodes. This iterates all the child elements and when it finds text elements, it concatenates their text into a big string which it returns. E.g. @code<xyz>hello <x>there</x> world</xyz>@endcode if you called getAllSubText on the "xyz" element, it'd return "hello there world". Note that leading and trailing whitespace will be included in the string - to remove if, just call String::trim() on the result. @see isTextElement, getChildElementAllSubText, getText, addTextElement */ String getAllSubText() const; /** Returns all the sub-text of a named child element. If there is a child element with the given tag name, this will return all of its sub-text (by calling getAllSubText() on it). If there is no such child element, this will return the default string passed-in. @see getAllSubText */ String getChildElementAllSubText (const String& childTagName, const String& defaultReturnValue) const; /** Appends a section of text to this element. @see isTextElement, getText, getAllSubText */ void addTextElement (const String& text); /** Removes all the text elements from this element. @see isTextElement, getText, getAllSubText, addTextElement */ void deleteAllTextElements() noexcept; /** Creates a text element that can be added to a parent element. */ static XmlElement* createTextElement (const String& text); //============================================================================== private: struct XmlAttributeNode { XmlAttributeNode (const XmlAttributeNode&) noexcept; XmlAttributeNode (const String& name, const String& value) noexcept; LinkedListPointer<XmlAttributeNode> nextListItem; String name, value; bool hasName (const String&) const noexcept; private: XmlAttributeNode& operator= (const XmlAttributeNode&); }; friend class XmlDocument; friend class LinkedListPointer <XmlAttributeNode>; friend class LinkedListPointer <XmlElement>; friend class LinkedListPointer <XmlElement>::Appender; LinkedListPointer <XmlElement> nextListItem; LinkedListPointer <XmlElement> firstChildElement; LinkedListPointer <XmlAttributeNode> attributes; String tagName; XmlElement (int) noexcept; void copyChildrenAndAttributesFrom (const XmlElement&); void writeElementAsText (OutputStream&, int indentationLevel, int lineWrapLength) const; void getChildElementsAsArray (XmlElement**) const noexcept; void reorderChildElements (XmlElement**, int) noexcept; JUCE_LEAK_DETECTOR (XmlElement); }; #endif // __JUCE_XMLELEMENT_JUCEHEADER__
[ "ow3nskip" ]
[ [ [ 1, 729 ] ] ]
e0f75f08669446e30b16caf074d223cc1c27fe63
14298a990afb4c8619eea10988f9c0854ec49d29
/PowerBill四川电信专用版本/ibill_source/MainFrm.cpp
0e147bd7d902fdc99fcb0a435131e075fc5215a7
[]
no_license
sridhar19091986/xmlconvertsql
066344074e932e919a69b818d0038f3d612e6f17
bbb5bbaecbb011420d701005e13efcd2265aa80e
refs/heads/master
2021-01-21T17:45:45.658884
2011-05-30T12:53:29
2011-05-30T12:53:29
42,693,560
0
0
null
null
null
null
GB18030
C++
false
false
31,241
cpp
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "MainFrm.h" #include <stdio.h> #include <Math.hpp> #include "StrUtils.hpp" #include "OptionFrm.h" #include "RegisterFrm.h" #ifdef SCTELE_COM_VERSION #include "cpuinfo.h" #endif #include "IniFiles.hpp" #include "DBConfigFrm.h" #include "BillConfigFrm.h" #include "BillFileFrm.h" #include "FTPConfigFrm.h" #include "AboutFrm.h" #include "ViewBillFrm.h" #include "SelBillNameFrm.h" //#include "Registry.hpp" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "RzListVw" #pragma link "RzPanel" #pragma link "RzTabs" #pragma link "RzGroupBar" #pragma link "CWGIFImage" #pragma link "RzPrgres" #pragma link "RzStatus" #pragma link "CWGIFImage" #pragma resource "*.dfm" TfrmMain *frmMain; AnsiString HelpFilePath; //--------------------------------------------------------------------------- #ifdef SCTELE_COM_VERSION void GetWmiInfo(TStrings *lpList, WideString wsClass) { IWbemLocator *pWbemLocator = NULL; if(CoCreateInstance(CLSID_WbemAdministrativeLocator, NULL, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, IID_IUnknown, (void**)&pWbemLocator) == S_OK) { IWbemServices *pWbemServices = NULL; WideString wsNamespace = (L"root\\cimv2"); if(pWbemLocator->ConnectServer(wsNamespace, NULL, NULL, NULL, 0, NULL, NULL, &pWbemServices) == S_OK) { IEnumWbemClassObject *pEnumClassObject = NULL; WideString wsWQL=L"WQL", wsQuery=WideString(L"Select * from ")+wsClass; if(pWbemServices->ExecQuery(wsWQL, wsQuery, WBEM_FLAG_RETURN_IMMEDIATELY,NULL, &pEnumClassObject) == S_OK) { IWbemClassObject *pClassObject = NULL; ULONG uCount = 1, uReturned; if(pEnumClassObject->Reset() == S_OK) { int iEnumIdx = 0; while(pEnumClassObject->Next(WBEM_INFINITE, uCount, &pClassObject, &uReturned) == S_OK) { lpList->Add("---------------- ["+IntToStr(iEnumIdx)+"] -----------------"); SAFEARRAY *pvNames = NULL; if(pClassObject->GetNames(NULL, WBEM_FLAG_ALWAYS | WBEM_MASK_CONDITION_ORIGIN, NULL, &pvNames) == S_OK) { long vbl, vbu; SafeArrayGetLBound(pvNames, 1, &vbl); SafeArrayGetUBound(pvNames, 1, &vbu); for(long idx=vbl; idx<=vbu; idx++) { long aidx = idx; wchar_t *wsName = 0; VARIANT vValue; VariantInit(&vValue); SafeArrayGetElement(pvNames, &aidx, &wsName); BSTR bs = SysAllocString(wsName); HRESULT hRes = pClassObject->Get(bs, 0, &vValue, NULL, 0); SysFreeString(bs); if(hRes == S_OK) { AnsiString s; Variant v = *(Variant*)&vValue; if(v.IsArray()) { for(int i=v.ArrayLowBound(); i<=v.ArrayHighBound(); i++) { Variant a = v.GetElement(i); if(!s.IsEmpty()) s+=", "; s+=VarToStr(a); } } else { s = VarToStr(v); } lpList->Add(AnsiString(wsName)+"="+s); } VariantClear(&vValue); SysFreeString(wsName); } } if(pvNames)SafeArrayDestroy(pvNames); iEnumIdx++; } } if(pClassObject)pClassObject->Release(); } if(pEnumClassObject)pEnumClassObject->Release(); } if(pWbemServices)pWbemServices->Release(); } if(pWbemLocator)pWbemLocator->Release(); } #endif bool __fastcall TfrmMain::IsRegisted() { return EncryRegisteCode(RegistUserName).SubString(1,25) == SerialNumber; } void __fastcall TfrmMain::WriteFirstRunDate() { TIniFile * IniFile; try { IniFile = new TIniFile(ExtractFilePath(Application->ExeName) + "ibill.ini"); IniFile->WriteString("System","Key",FirstRunDate); delete IniFile; } catch(...) { delete IniFile; ShowErrorMessage(Handle,"写配置文件失败",true,4); ExitProcess(99); return; } } void __fastcall TfrmMain::ShowInitializeStatus(AnsiString StatusText) { if(!SlentMode && frmAbout != NULL) { frmAbout->Label4->Caption = StatusText; frmAbout->Update(); } } __fastcall TfrmMain::TfrmMain(TComponent* Owner) : TForm(Owner) { frmAbout = NULL; if(!SlentMode) { frmAbout = new TfrmAbout(this); frmAbout->Show(); ShowInitializeStatus("正在初始化应用程序,请稍侯..."); //frmAbout->Update(); } if(ExtractFilePath(Application->ExeName).Pos(" ") > 0 && !SlentMode) { //ShowErrorMessage(Handle,"为了让数据能被成功导入Oracle数据库,建议将程序PowerBill放在不包含空格的路径下!",false,0); MessageBox(Handle,"为了让数据能被成功导入Oracle数据库,建议将程序PowerBill放在不包含空格的路径下!","提示",MB_OK | MB_ICONINFORMATION); } /* #ifdef SCTELE_COM_VERSION //四川电信专用版,用BIOS序列号和CPU信息信为注册号 TStringList * BIOSInfoList = new TStringList; CoInitialize(NULL); AnsiString BIOSSerialNumber; if(CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0) != S_OK) { ShowErrorMessage(Handle,"无法获取权限",true,4); ExitProcess(99); return; } GetWmiInfo(BIOSInfoList,DecrySysInfo(WIN32_BIOS_STRING)); for(int n = 0;n < BIOSInfoList->Count;n++) { if(BIOSInfoList->Strings[n].UpperCase().SubString(1,13) == DecrySysInfo(SERIALNUMBER)) { BIOSSerialNumber = BIOSInfoList->Strings[n].UpperCase().SubString(14,BIOSInfoList->Strings[n].Length() - 13); break; } } delete BIOSInfoList; char cpuname[128],temp[128]; CCPUInfo *MyCpu=new CCPUInfo(); MyCpu->GetName(cpuname); BIOSSerialNumber += ";" + String(cpuname) + ";"; BIOSSerialNumber += IntToStr(MyCpu->GetSpeed()) + ";"; MyCpu->GetTypeName(temp); BIOSSerialNumber += String(temp) = ";"; if(MyCpu->hasFPU()) BIOSSerialNumber += "YES;"; else BIOSSerialNumber += "NO;"; if(MyCpu->withMMX()) BIOSSerialNumber += "YES;"; else BIOSSerialNumber += "NO;"; delete MyCpu; #endif */ HelpFilePath = ExtractFilePath(Application->ExeName) + "help\\"; frmOpenDialog = new TfrmOpenDialog(this); frmOpenDialog->lvFiles->Folder->CSIDL = csidlDesktop; frmOpenDialog->cbxFolder->SelectedFolder->CSIDL = csidlDesktop; frmOpenFTPDialog = new TfrmOpenFTPDialog(this); TIniFile * IniFile = NULL; ShowInitializeStatus("正在读取初始化配置文件..."); DBConfig = new TDBConfig(); FTPConfig = new TFTPConfig(); try { IniFile = new TIniFile(ExtractFilePath(Application->ExeName) + "ibill.ini"); //SerialNumber = IniFile->ReadString("System","SerialNumber","");/*要求注册的版本_20071229删去*/ #ifndef SCTELE_COM_VERSION //通用版,以用户名作为序列号 RegistUserName = IniFile->ReadString("System","RegisterUserName",""); #else //RegistUserName = EncrySysInfo(BIOSSerialNumber).SubString(1,25); RegistUserName = EncrySysInfo("中国电信").SubString(1,25); #endif FirstRunDate = IniFile->ReadString("System","Key",""); SerialNumber = EncryRegisteCode(RegistUserName).SubString(1,25);/*免注册版本_20071229*/ int Days; if(FirstRunDate == "") { FirstRunDate = EncrySysInfo(FormatDateTime("yyyy-mm-dd hh:nn:ss",Now())); WriteFirstRunDate(); Days = 40; } else { try { Days = 40 - abs(DaysBetween(StrToDateTime(DecrySysInfo(FirstRunDate)),Now())); if(Days < 0) Days = 0; } catch(...) { delete IniFile; ShowErrorMessage(Handle,"外部文件错误",true,4); ExitProcess(99); return; } } if(EncryRegisteCode(RegistUserName).SubString(1,25) != SerialNumber) { if(!InCmdMode) { AnsiString Message; if(Days == 0) { Message = "您使用的是本软件的未注册副本.试用期已过,必须经过注册才能继续使用.是否立即注册?"; } else { Message = "您使用的是本软件的未注册副本.您还有" + IntToStr(Days) + "天的试用期.是否立即注册?"; } if(MessageBox(Handle,Message.c_str(),"提示",MB_YESNO | MB_ICONQUESTION) == IDYES) { TfrmRegister * frmRegister = new TfrmRegister(this); frmRegister->ShowModal(); delete frmRegister; } } if(!IsRegisted() && Days <= 0) { ShowErrorMessage(Handle,"软件已过期,请注册",true,4); ExitProcess(99); return; } } else { #ifndef SCTELE_COM_VERSION Caption = "Power Bill 通用话单查询转换系统 V2.0 授权给 " + RegistUserName + " 使用"; #else Caption = "Power Bill 通用话单查询转换系统 V2.0"; #endif } AnsiString s = IniFile->ReadString("Global","LastDirectory",""); ShowInitializeStatus("正在打开最后一次操作的文件夹..."); if(s == "") { frmOpenDialog->lvFiles->Folder->CSIDL = csidlDesktop; frmOpenDialog->cbxFolder->SelectedFolder->CSIDL = csidlDesktop; } else { frmOpenDialog->lvFiles->Folder->PathName = s; frmOpenDialog->cbxFolder->SelectedFolder->PathName = s; } if(IniFile->ReadString("Global","FirstRun","1") != "0" && !InCmdMode &&MessageBox(Handle,"第一次运行本程序,您需要设定一些参数选项,是否现在就设置?","欢迎",MB_YESNO | MB_ICONQUESTION) == IDYES) { FTPTimeout = 0; TfrmOption * frmOption = new TfrmOption(this); frmOption->ShowModal(); delete frmOption; IniFile->WriteString("Global","FirstRun","0"); } s = IniFile->ReadString("Global","RecursionListDir","0"); frmOpenFTPDialog->Recursion = s != "0"; s = IniFile->ReadString("Global","SearchFileDir","0"); OpenDialog1->InitialDir = s; SortConfirm = IniFile->ReadInteger("Global","SortConfirm",10000); if(FTPTimeout < 0) FTPTimeout = IniFile->ReadInteger("FTP","Timeout",60); AnsiString LastBillName = IniFile->ReadString("Global","LastBillName",""); AnsiString LastFTPBillName = IniFile->ReadString("Global","LastFTPBillName",""); RetryCount = IniFile->ReadInteger("Global","AutoRetry",0); TempDirectory = IniFile->ReadString("Global","TempDir",""); if(TempDirectory == "" || TempDirectory.Pos(" " ) > 0) TempDirectory = ExtractFilePath(Application->ExeName) + "Temp"; if(!DirectoryExists(TempDirectory)) { if(!DirectoryExists(TempDirectory)) { if(!CreateDir(TempDirectory)) { TempDirectory = ExtractFilePath(Application->ExeName) + "Temp"; if(!DirectoryExists(TempDirectory)) if(!CreateDir(TempDirectory)) throw new Exception("无法创建立临时文件夹 " + TempDirectory); } } } if(TempDirectory.SubString(TempDirectory.Length(),1) != "\\") TempDirectory = TempDirectory + "\\"; BillConfigFile = IniFile->ReadString("Global","BillConfig",""); AnsiString DBConfigFile = IniFile->ReadString("Global","DBConfig",""); AnsiString FTPConfigFile = IniFile->ReadString("Global","FTPConfig",""); BCPExePath = IniFile->ReadString("ExternalTools","bcppath",""); SQLLDRExePath = IniFile->ReadString("ExternalTools","sqlldrpath",""); MySQLImportExePath = IniFile->ReadString("ExternalTools","mysqlimportpath",""); delete IniFile; IniFile = NULL; if(BillConfigFile == "") { TOpenDialog * OpenDialog = new TOpenDialog(this); OpenDialog->Filter = "话单格式配置文件|*.xml"; if(!OpenDialog->Execute()) { delete OpenDialog; throw new Exception("没有指定话单格式配置文件,程序无法继续运行."); } BillConfigFile = OpenDialog->FileName; delete OpenDialog; } else if(BillConfigFile.AnsiPos("\\") < 1) { BillConfigFile = ExtractFilePath(Application->ExeName) + BillConfigFile; } ShowInitializeStatus("正在载入话单格式配置信息..."); BillConfig = new TBillConfig(BillConfigFile); ShowInitializeStatus("正在载入数据库配置信息..."); if(DBConfigFile != "") { if(!DBConfig->LoadConfig(DBConfigFile)) { if(SlentMode) throw new Exception(DBConfig->LastErrorMessage + " 不能打开数据库配置文件."); else MessageBox(Handle,(DBConfig->LastErrorMessage + " 不能打开数据库配置文件.").c_str(),"警告", MB_OK | MB_ICONWARNING); } } frmOpenDialog->cbxFileFormat->Items->Assign(BillConfig->BillNameList); frmOpenFTPDialog->cbxFileFormat->Items->Assign(frmOpenDialog->cbxFileFormat->Items); ShowInitializeStatus("正在载入FTP配置信息..."); if(FTPConfigFile != "") { if(!FTPConfig->LoadConfig(FTPConfigFile)) { if(SlentMode) throw new Exception(FTPConfig->LastErrorMessage + " 不能打开FTP服务器配置文件."); else MessageBox(Handle,(FTPConfig->LastErrorMessage + " 不能打开FTP服务器配置文件.").c_str(),"警告", MB_OK | MB_ICONWARNING); } } if(LastBillName != "") { frmOpenDialog->cbxFileFormat->ItemIndex = frmOpenDialog->cbxFileFormat->Items->IndexOf(LastBillName); } else { frmOpenDialog->cbxFileFormat->ItemIndex = 0; } if(LastFTPBillName != "") { frmOpenFTPDialog->cbxFileFormat->ItemIndex = frmOpenFTPDialog->cbxFileFormat->Items->IndexOf(LastFTPBillName); } else { frmOpenFTPDialog->cbxFileFormat->ItemIndex = 0; } RzStatusPane1->Caption = "当前配置文件:" + BillConfigFile; } catch(Exception * E) { if(BillConfig != NULL) { delete BillConfig; BillConfig = NULL; } if(IniFile != NULL) { delete IniFile; IniFile = NULL; } ShowErrorMessage(Handle,E->Message.c_str(),true,4); } if(!SlentMode) { try { delete frmAbout; } catch(...) { } } } __fastcall TfrmMain::~TfrmMain() { #ifdef SCTELE_COM_VERSION CoUninitialize(); #endif } void __fastcall TfrmMain::AddFormToPageControl(TForm * AForm) { if(!RzPageControl1->Visible) RzPageControl1->Visible = true; TRzTabSheet * TabSheet = new TRzTabSheet(this); TabSheet->PageControl = RzPageControl1; TabSheet->Caption = AForm->Caption; AForm->Parent = TabSheet; AForm->Align=alClient; AForm->BorderStyle = Forms::bsNone; TabSheet->Tag = (int)AForm; AForm->Tag = (int)TabSheet; RzPageControl1->ActivePage = TabSheet; RzPageControl1->ShowCloseButton = RzPageControl1->PageCount > 0; /* TMenuItem * MenuItem = new TMenuItem(this); MenuItem->Caption = AForm->Caption; MenuItem->RadioItem = true; MenuItem->GroupIndex = 1000; MenuItem->Tag = (int)TabSheet; menuWindows->Add(MenuItem); if(!menuWindows->Enabled) menuWindows->Enabled = true; MenuItem->Checked = true; */ AForm->Show(); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::FormDestroy(TObject *Sender) { delete frmOpenDialog; delete frmOpenFTPDialog; } //--------------------------------------------------------------------------- void __fastcall TfrmMain::ToolButton10Click(TObject *Sender) { Close(); } TForm * __fastcall TfrmMain::IsFormCreated(AnsiString FormClassName) { TForm * Form; for(int n = 0;n < RzPageControl1->PageCount;n++) { Form = (TForm *)RzPageControl1->Pages[n]->Tag; if(Form != NULL&&Form->ClassNameIs(FormClassName)) { return Form; } } return NULL; } //--------------------------------------------------------------------------- void __fastcall TfrmMain::RzPageControl1Close(TObject *Sender, bool &AllowClose) { TRzTabSheet * TabSheet = RzPageControl1->ActivePage; if(TabSheet == NULL) return; int Index = TabSheet->TabIndex; AllowClose = CloseAChildForm(TabSheet); if(!AllowClose) return; if(RzPageControl1->PageCount > 0) { if(RzPageControl1->PageCount > Index) RzPageControl1->ActivePageIndex = Index; else RzPageControl1->ActivePageIndex = Index - 1; } if(RzPageControl1->PageCount == 1) { RzPageControl1->Visible = false; } } //--------------------------------------------------------------------------- bool __fastcall TfrmMain::CloseAChildForm(TRzTabSheet * TabSheet) { if(TabSheet->Tag == 0) return true; TForm * Form = (TForm *)TabSheet->Tag; try { Form->Close(); } catch(Exception * E) { if(!SlentMode && E->Message != "") MessageBox(Handle,E->Message.c_str(),"提示",MB_OK | MB_ICONWARNING); return false; } delete Form; TabSheet->Tag = 0; return true; } void __fastcall TfrmMain::FormClose(TObject *Sender, TCloseAction &Action) { for(int n =RzPageControl1->PageCount - 1;n > -1 ;n--) { if(!CloseAChildForm(RzPageControl1->Pages[n])) { Action = caNone; return; } else { delete RzPageControl1->Pages[n]; } } TIniFile * IniFile = NULL; try { IniFile = new TIniFile(ExtractFilePath(Application->ExeName) + "ibill.ini"); IniFile->WriteString("Global","LastDirectory",frmOpenDialog->lvFiles->Folder->PathName); IniFile->WriteString("Global","LastBillName",frmOpenDialog->cbxFileFormat->Text); IniFile->WriteString("Global","LastFTPBillName",frmOpenFTPDialog->cbxFileFormat->Text); if(OpenDialog1->FileName != "") IniFile->WriteString("Global","SearchFileDir",ExtractFilePath(OpenDialog1->FileName)); if(frmOpenFTPDialog->Recursion) IniFile->WriteString("Global","RecursionListDir","1"); else IniFile->WriteString("Global","RecursionListDir","0"); /*if(btnShowLeftBar->Down) IniFile->WriteString("Global","ShowLeftBar","1"); else IniFile->WriteString("Global","ShowLeftBar","0");*/ delete IniFile; IniFile = NULL; } catch(...) { if(IniFile != NULL) { delete IniFile; IniFile = NULL; } } } //--------------------------------------------------------------------------- void __fastcall TfrmMain::Action1Execute(TObject *Sender) { TRzTabSheet * TabSheet = RzPageControl1->ActivePage; if(TabSheet == NULL || TabSheet->Tag == 0) return; TForm * Form = (TForm *)TabSheet->Tag; SendMessage(Form->Handle,MSG_CUSTOMER_KEYDOWN,1,'A'); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::Action2Execute(TObject *Sender) { TRzTabSheet * TabSheet = RzPageControl1->ActivePage; if(TabSheet == NULL || TabSheet->Tag == 0) return; TForm * Form = (TForm *)TabSheet->Tag; SendMessage(Form->Handle,MSG_CUSTOMER_KEYDOWN,0,127); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::Action3Execute(TObject *Sender) { TRzTabSheet * TabSheet = RzPageControl1->ActivePage; if(TabSheet == NULL || TabSheet->Tag == 0) return; TForm * Form = (TForm *)TabSheet->Tag; SendMessage(Form->Handle,MSG_CUSTOMER_KEYDOWN,1,'C'); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::Action4Execute(TObject *Sender) { TRzTabSheet * TabSheet = RzPageControl1->ActivePage; if(TabSheet == NULL || TabSheet->Tag == 0) return; TForm * Form = (TForm *)TabSheet->Tag; SendMessage(Form->Handle,MSG_CUSTOMER_KEYDOWN,1,'E'); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::btnOpenBillConfigInIEClick(TObject *Sender) { ShellExecute(NULL,"open","iexplore.exe",BillConfigFile.c_str(),"",SW_SHOW); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::btnCloseClick(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::btnBillFileClick(TObject *Sender) { AddFormToPageControl(new TfrmBillFile(this)); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::btnDBLinkConfigClick(TObject *Sender) { TfrmDBConfig * frmDBConfig = (TfrmDBConfig *)IsFormCreated("TfrmDBConfig"); if(frmDBConfig == NULL) { frmDBConfig = new TfrmDBConfig(this); AddFormToPageControl(frmDBConfig); } else { TRzTabSheet * TabSheet = (TRzTabSheet *)frmDBConfig->Tag; RzPageControl1->ActivePage = TabSheet; } } //--------------------------------------------------------------------------- void __fastcall TfrmMain::btnBillConfigClick(TObject *Sender) { TfrmBillConfig * frmBillConfig = (TfrmBillConfig *)IsFormCreated("TfrmBillConfig"); if(frmBillConfig == NULL) { frmBillConfig = new TfrmBillConfig(this); AddFormToPageControl(frmBillConfig); } else { TRzTabSheet * TabSheet = (TRzTabSheet *)frmBillConfig->Tag; RzPageControl1->ActivePage = TabSheet; } } //--------------------------------------------------------------------------- void __fastcall TfrmMain::btnFTPConfigClick(TObject *Sender) { TfrmFTPConfig * frmFTPConfig = (TfrmFTPConfig *)IsFormCreated("TfrmFTPConfig"); if(frmFTPConfig == NULL) { frmFTPConfig = new TfrmFTPConfig(this); AddFormToPageControl(frmFTPConfig); } else { TRzTabSheet * TabSheet = (TRzTabSheet *)frmFTPConfig->Tag; RzPageControl1->ActivePage = TabSheet; } } //--------------------------------------------------------------------------- void __fastcall TfrmMain::SaveDialog1TypeChange(TObject *Sender) { switch(SaveDialog1->FilterIndex) { case 1: SaveDialog1->DefaultExt = "dbf"; break; case 2: SaveDialog1->DefaultExt = "csv"; break; case 3: SaveDialog1->DefaultExt = "txt"; break; case 4: SaveDialog1->DefaultExt = "bil"; break; } } //--------------------------------------------------------------------------- void __fastcall TfrmMain::menuExitClick(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::menuOptionClick(TObject *Sender) { TfrmOption * frmOption = new TfrmOption(this); frmOption->ShowModal(); delete frmOption; } //--------------------------------------------------------------------------- void __fastcall TfrmMain::menuAboutClick(TObject *Sender) { TfrmAbout * frmAbout = new TfrmAbout(this); frmAbout->ShowModal(); delete frmAbout; } //--------------------------------------------------------------------------- void __fastcall TfrmMain::btnOpenSearchResultClick(TObject *Sender) { if(!OpenDialog1->Execute()) return; AnsiString FileName = OpenDialog1->FileName; //读取文件头部信息 FILE * file = fopen(FileName.c_str(),"r+b"); if(file == NULL) { MessageBox(Handle,"无法打开文件!","错误",MB_OK | MB_ICONSTOP); return; } SearchResultFileHead srfh = {0}; if(fread(&srfh,sizeof(srfh),1,file) != 1) { fclose(file); MessageBox(Handle,"文件格式不正确!","错误",MB_OK | MB_ICONSTOP); return; } AnsiString BillName = srfh.BillName; if(BillConfig->GetBillNode(BillName) == NULL) { TfrmSelBillName * frmSelBillName = new TfrmSelBillName(this,ExtractFileName(FileName)); frmSelBillName->Label1->Caption = "该文件中的话单格式是 " + BillName + " .但在当前的话单配置中找不到这个话单类型."\ "您需要选择一种话单类型来打开此文件."; if(frmSelBillName->ShowModal() == mrOk) { memset(&srfh.BillName[0],0,256); strcpy(&srfh.BillName[0],frmSelBillName->lvBillTypes->Selected->SubItems->Strings[0].c_str()); fseek(file,SEEK_SET,0); fwrite(&srfh,sizeof(srfh),1,file); delete frmSelBillName; } else { fclose(file); delete frmSelBillName; return; } } fclose(file); TfrmViewBill * frmViewBill = new TfrmViewBill(this,BillConfig); if(frmViewBill->OpenBillFile(SR_BILL_FORMAT_STR,"",ExtractFilePath(FileName),ExtractFileName(FileName),GetLocalFileSize(FileName))) { frmViewBill->Caption = "话单查询结果 " + ExtractFileName(FileName); AddFormToPageControl(frmViewBill); TRzTabSheet * TabSheet = (TRzTabSheet *)frmViewBill->Tag; frmMain->RzPageControl1->ActivePage = TabSheet; } else { delete frmViewBill; } } //--------------------------------------------------------------------------- bool __fastcall TfrmMain::ShowOpenFileDialog(AnsiString BillName) { AnsiString s = frmOpenDialog->cbxFileFormat->Text; frmOpenDialog->cbxFileFormat->Items->Assign(BillConfig->BillNameList); if(BillName != "") { frmOpenDialog->cbxFileFormat->ItemIndex = frmOpenDialog->cbxFileFormat->Items->IndexOf(BillName); if(frmOpenDialog->cbxFileFormat->ItemIndex > -1) frmOpenDialog->cbxFileFormat->Enabled = false; else frmOpenDialog->cbxFileFormat->Enabled = true; } else { frmOpenDialog->cbxFileFormat->Enabled = true; frmOpenDialog->cbxFileFormat->ItemIndex = frmOpenDialog->cbxFileFormat->Items->IndexOf(s); } return frmOpenDialog->Execute(); } bool __fastcall TfrmMain::ShowOpenFTPDialog(AnsiString BillName) { AnsiString s = frmOpenFTPDialog->cbxFileFormat->Text; frmOpenFTPDialog->cbxFileFormat->Items->Assign(BillConfig->BillNameList); frmOpenFTPDialog->cbxServer->Items->Clear(); for(int n = 0;n < FTPConfig->GetFTPCount();n++) { frmOpenFTPDialog->cbxServer->Items->Add(FTPConfig->GetFTPName(n)); } if(BillName != "") { frmOpenFTPDialog->cbxFileFormat->ItemIndex = frmOpenFTPDialog->cbxFileFormat->Items->IndexOf(BillName);//lvFileList->Items->Item[0]->SubItems->Strings[1]); if(frmOpenFTPDialog->cbxFileFormat->ItemIndex > -1) frmOpenFTPDialog->cbxFileFormat->Enabled = false; else frmOpenFTPDialog->cbxFileFormat->Enabled = true; } else { frmOpenFTPDialog->cbxFileFormat->Enabled = true; frmOpenFTPDialog->cbxFileFormat->ItemIndex = frmOpenFTPDialog->cbxFileFormat->Items->IndexOf(s); } return frmOpenFTPDialog->Execute(); } void __fastcall TfrmMain::btnOpenFileClick(TObject *Sender) { if(!ShowOpenFileDialog()) return; TfrmBillFile * frmBillFile = new TfrmBillFile(this); frmBillFile->menuAddFileClick(NULL); AddFormToPageControl(frmBillFile); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::btnOpenFTPFileClick(TObject *Sender) { if(!ShowOpenFTPDialog()) return; TfrmBillFile * frmBillFile = new TfrmBillFile(this); frmBillFile->btnAddFTPFileClick(NULL); AddFormToPageControl(frmBillFile); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::RzPageControl1Change(TObject *Sender) { if(RzPageControl1->ActivePage->Tag != 0) { TForm * Form = (TForm *)RzPageControl1->ActivePage->Tag; if(Form->ClassNameIs("TfrmViewBill")) { frmViewBill = (TfrmViewBill *)Form; } } } //--------------------------------------------------------------------------- void __fastcall TfrmMain::Action5Execute(TObject *Sender) { TRzTabSheet * TabSheet = RzPageControl1->ActivePage; if(TabSheet == NULL || TabSheet->Tag == 0) return; TForm * Form = (TForm *)TabSheet->Tag; SendMessage(Form->Handle,MSG_CUSTOMER_KEYDOWN,1,'F'); } //--------------------------------------------------------------------------- void __fastcall TfrmMain::OnFTPWorkBegin(TMessage Message) { RzStatusPane2->Caption = "正在下载文件" + AnsiString((const char *)Message.WParam); RzProgressBar1->TotalParts = Message.LParam; RzProgressBar1->PartsComplete = 0; } void __fastcall TfrmMain::OnFTPWork(TMessage Message) { RzProgressBar1->PartsComplete = Message.LParam; } void __fastcall TfrmMain::OnSetProcessMaxCount(TMessage Message) { RzStatusPane2->Font->Color = clBlack; RzGlyphStatus1->ImageIndex = -1; RzStatusPane2->Caption = "正在打开文件" + AnsiString((const char *)Message.LParam); RzProgressBar1->TotalParts = Message.WParam; RzProgressBar1->PartsComplete = 0; } void __fastcall TfrmMain::OnSetProcessPos(TMessage Message) { RzProgressBar1->PartsComplete = Message.WParam; } void __fastcall TfrmMain::OnThreadTerminate(TMessage Message) { RzProgressBar1->TotalParts = 0; RzProgressBar1->PartsComplete = 0; RzStatusPane2->Caption = ""; } void __fastcall TfrmMain::OnOpenFileError(TMessage Message) { RzStatusPane2->Font->Color = clRed; RzGlyphStatus1->ImageIndex = 74; RzStatusPane2->Caption = "打开文件 " + AnsiString((const char *)Message.WParam) + " 出错:" + AnsiString((const char *)Message.LParam); } void __fastcall TfrmMain::menuHelpClick(TObject *Sender) { #ifdef SCTELE_COM_VERSION if((int)ShellExecute(NULL,"open","hh.exe", (ExtractFilePath(Application->ExeName)+"Help\\ibillsc.chm").c_str(),"",SW_SHOWNORMAL)<32) MessageBox(Handle,"打开帮助文档出错!请检查文件是否存在.","系统帮助",MB_OK | MB_ICONWARNING); #else if((int)ShellExecute(NULL,"open","hh.exe", (ExtractFilePath(Application->ExeName)+"Help\\ibill.chm").c_str(),"",SW_SHOWNORMAL)<32) MessageBox(Handle,"打开帮助文档出错!请检查文件是否存在.","系统帮助",MB_OK | MB_ICONWARNING); #endif } //---------------------------------------------------------------------------
[ "cn.wei.hp@e7bd78f4-57e5-8052-e4e7-673d445fef99" ]
[ [ [ 1, 929 ] ] ]
5e6c07151cca69e679ba4299915219781ab792b3
31a5e7570148149f0f7d8626274c22e15454a71f
/Simcraft/Simcraft/sc_raid_event.cpp
cc4716fd4a25c5a42947de7db0347841b58b3e91
[]
no_license
imclab/SimcraftGearOptimizer
b54575e9fc330c97070168ade5bbd46a2de0627a
b5c1f82b2bf7579389d23b769e520a6b0968fc98
refs/heads/master
2021-01-22T13:37:15.010740
2010-05-04T00:46:44
2010-05-04T00:46:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
16,049
cpp
// ========================================================================== // Dedmonwakeen's Raid DPS/TPS Simulator. // Send questions to [email protected] // ========================================================================== #include "simulationcraft.h" // ========================================================================== // Raid Events // ========================================================================== // Adds ===================================================================== struct adds_event_t : public raid_event_t { int count; adds_event_t( sim_t* s, const std::string& options_str ) : raid_event_t( s, "adds" ), count(1) { option_t options[] = { { "count", OPT_INT, &count }, { NULL, OPT_UNKNOWN, NULL } }; parse_options( options, options_str ); } virtual void start() { target_t* t = sim -> target; raid_event_t::start(); t -> adds_nearby += count; } virtual void finish() { target_t* t = sim -> target; t -> adds_nearby -= count; raid_event_t::finish(); } }; // Casting ================================================================== struct casting_event_t : public raid_event_t { casting_event_t( sim_t* s, const std::string& options_str ) : raid_event_t( s, "casting" ) { parse_options( NULL, options_str ); } virtual void start() { target_t* t = sim -> target; raid_event_t::start(); t -> debuffs.casting -> increment(); } virtual void finish() { target_t* t = sim -> target; t -> debuffs.casting -> decrement(); raid_event_t::finish(); } }; // Distraction ============================================================== struct distraction_event_t : public raid_event_t { double skill; distraction_event_t( sim_t* s, const std::string& options_str ) : raid_event_t( s, "distraction" ), skill( 0.2 ) { option_t options[] = { { "skill", OPT_FLT, &skill }, { NULL, OPT_UNKNOWN, NULL } }; parse_options( options, options_str ); } virtual void start() { raid_event_t::start(); int num_affected = ( int )affected_players.size(); for ( int i=0; i < num_affected; i++ ) { player_t* p = affected_players[ i ]; p -> skill -= skill; } } virtual void finish() { int num_affected = ( int ) affected_players.size(); for ( int i=0; i < num_affected; i++ ) { player_t* p = affected_players[ i ]; p -> skill += skill; } raid_event_t::finish(); } }; // Invulnerable ============================================================= struct invulnerable_event_t : public raid_event_t { invulnerable_event_t( sim_t* s, const std::string& options_str ) : raid_event_t( s, "invulnerable" ) { parse_options( NULL, options_str ); } virtual void start() { target_t* t = sim -> target; raid_event_t::start(); for ( player_t* p = sim -> player_list; p; p = p -> next ) { if ( p -> sleeping ) continue; p -> interrupt(); p -> clear_debuffs(); // FIXME! this is really just clearing DoTs at the moment } t -> debuffs.invulnerable -> increment(); } virtual void finish() { target_t* t = sim -> target; t -> debuffs.invulnerable -> decrement(); if ( ! t -> debuffs.invulnerable -> check() ) { // FIXME! restoring optimal_raid target debuffs? } raid_event_t::finish(); } }; // Movement ================================================================= struct movement_event_t : public raid_event_t { double move_to; int players_only; movement_event_t( sim_t* s, const std::string& options_str ) : raid_event_t( s, "movement" ), move_to( 0 ), players_only( 0 ) { option_t options[] = { { "to", OPT_FLT, &move_to }, { "players_only", OPT_BOOL, &players_only }, { NULL, OPT_UNKNOWN, NULL } }; parse_options( options, options_str ); } virtual void start() { raid_event_t::start(); int num_affected = ( int )affected_players.size(); for ( int i=0; i < num_affected; i++ ) { player_t* p = affected_players[ i ]; if ( p -> is_pet() && players_only ) continue; p -> buffs.moving -> increment(); if ( p -> sleeping ) continue; p -> interrupt(); } } virtual void finish() { int num_affected = ( int ) affected_players.size(); for ( int i=0; i < num_affected; i++ ) { player_t* p = affected_players[ i ]; if ( p -> is_pet() && players_only ) continue; p -> buffs.moving -> decrement(); if ( p -> sleeping ) continue; } raid_event_t::finish(); } }; // Stun ===================================================================== struct stun_event_t : public raid_event_t { stun_event_t( sim_t* s, const std::string& options_str ) : raid_event_t( s, "stun" ) { parse_options( NULL, options_str ); } virtual void start() { raid_event_t::start(); int num_affected = ( int ) affected_players.size(); for ( int i=0; i < num_affected; i++ ) { player_t* p = affected_players[ i ]; p -> buffs.stunned -> increment(); if ( p -> sleeping ) continue; p -> interrupt(); } } virtual void finish() { int num_affected = ( int ) affected_players.size(); for ( int i=0; i < num_affected; i++ ) { player_t* p = affected_players[ i ]; p -> buffs.stunned -> decrement(); if ( p -> sleeping ) continue; if ( ! p -> buffs.stunned -> check() ) { p -> schedule_ready(); } } raid_event_t::finish(); } }; // Damage =================================================================== struct damage_event_t : public raid_event_t { double amount; double amount_stddev; damage_event_t( sim_t* s, const std::string& options_str ) : raid_event_t( s, "damage" ), amount( 1 ), amount_stddev( 0 ) { option_t options[] = { { "amount", OPT_FLT, &amount }, { "amount_stddev", OPT_FLT, &amount_stddev }, { NULL, OPT_UNKNOWN, NULL } }; parse_options( options, options_str ); assert( duration == 0 ); } virtual void start() { raid_event_t::start(); int num_affected = ( int ) affected_players.size(); for ( int i=0; i < num_affected; i++ ) { player_t* p = affected_players[ i ]; if ( p -> sleeping ) continue; if ( sim -> log ) log_t::output( sim, "%s takes raid damage.", p -> name() ); p -> resource_loss( RESOURCE_HEALTH, rng -> gauss( amount, amount_stddev ) ); } } }; // Vulnerable =============================================================== struct vulnerable_event_t : public raid_event_t { vulnerable_event_t( sim_t* s, const std::string& options_str ) : raid_event_t( s, "vulnerable" ) { parse_options( NULL, options_str ); } virtual void start() { target_t* t = sim -> target; raid_event_t::start(); t -> debuffs.vulnerable -> increment(); } virtual void finish() { target_t* t = sim -> target; t -> debuffs.vulnerable -> decrement(); raid_event_t::finish(); } }; // raid_event_t::raid_event_t =============================================== raid_event_t::raid_event_t( sim_t* s, const char* n ) : sim( s ), name_str( n ), num_starts( 0 ), first( 0 ), last( 0 ), cooldown( 0 ), cooldown_stddev( 0 ), cooldown_min( 0 ), cooldown_max( 0 ), duration( 0 ), duration_stddev( 0 ), duration_min( 0 ), duration_max( 0 ), distance_min( 0 ), distance_max( 0 ) { rng = ( sim -> deterministic_roll ) ? sim -> deterministic_rng : sim -> rng; } // raid_event_t::cooldown_time ============================================== double raid_event_t::cooldown_time() SC_CONST { double time; if ( num_starts == 0 ) { time = cooldown / 2; if ( first > 0 || cooldown_stddev > 0 ) { time = first + fabs( rng -> gauss( cooldown, cooldown_stddev ) - cooldown ); } } else { time = rng -> gauss( cooldown, cooldown_stddev ); if ( time < cooldown_min ) time = cooldown_min; if ( time > cooldown_max ) time = cooldown_max; } return time; } // raid_event_t::duration_time ============================================== double raid_event_t::duration_time() SC_CONST { double time = rng -> gauss( duration, duration_stddev ); if ( time < duration_min ) time = duration_min; if ( time > duration_max ) time = duration_max; return time; } // raid_event_t::start ====================================================== void raid_event_t::start() { if ( sim -> log ) log_t::output( sim, "Raid event %s starts (%x).", name(), (void*) this ); num_starts++; affected_players.clear(); for ( player_t* p = sim -> player_list; p; p = p -> next ) { if ( distance_min && distance_min > p -> distance ) continue; if ( distance_max && distance_max < p -> distance ) continue; affected_players.push_back( p ); } } // raid_event_t::finish ===================================================== void raid_event_t::finish() { if ( sim -> log ) log_t::output( sim, "Raid event %s finishes (%x).", name(), (void*) this ); } // raid_event_t::schedule =================================================== void raid_event_t::schedule() { if ( sim -> debug ) log_t::output( sim, "Scheduling raid event: %s", name() ); struct duration_event_t : public event_t { raid_event_t* raid_event; duration_event_t( sim_t* s, raid_event_t* re, double time ) : event_t( s ), raid_event( re ) { name = re -> name_str.c_str(); sim -> add_event( this, time ); } virtual void execute() { raid_event -> finish(); } }; struct cooldown_event_t : public event_t { raid_event_t* raid_event; cooldown_event_t( sim_t* s, raid_event_t* re, double time ) : event_t( s ), raid_event( re ) { name = re -> name_str.c_str(); sim -> add_event( this, time ); } virtual void execute() { raid_event -> start(); double dt = raid_event -> duration_time(); double ct = raid_event -> cooldown_time(); if ( ct <= dt ) ct = dt + 0.01; if ( dt > 0 ) { new ( sim ) duration_event_t( sim, raid_event, dt ); } else raid_event -> finish(); if ( raid_event -> last <= 0 || raid_event -> last > ( sim -> current_time + ct ) ) { new ( sim ) cooldown_event_t( sim, raid_event, ct ); } } }; new ( sim ) cooldown_event_t( sim, this, cooldown_time() ); } // raid_event_t::reset ====================================================== void raid_event_t::reset() { num_starts = 0; if ( cooldown_min == 0 ) cooldown_min = cooldown * 0.5; if ( cooldown_max == 0 ) cooldown_max = cooldown * 1.5; if ( duration_min == 0 ) duration_min = duration * 0.5; if ( duration_max == 0 ) duration_max = duration * 1.5; affected_players.clear(); } // raid_event_t::parse_options ============================================== void raid_event_t::parse_options( option_t* options, const std::string& options_str ) { if ( options_str.empty() ) return; if ( options_str.size() == 0 ) return; option_t base_options[] = { { "first", OPT_FLT, &first }, { "last", OPT_FLT, &last }, { "period", OPT_FLT, &cooldown }, { "cooldown", OPT_FLT, &cooldown }, { "cooldown_stddev", OPT_FLT, &cooldown_stddev }, { "cooldown>", OPT_FLT, &cooldown_min }, { "cooldown<", OPT_FLT, &cooldown_max }, { "duration", OPT_FLT, &duration }, { "duration_stddev", OPT_FLT, &duration_stddev }, { "duration>", OPT_FLT, &duration_min }, { "duration<", OPT_FLT, &duration_max }, { "distance>", OPT_FLT, &distance_min }, { "distance<", OPT_FLT, &distance_max }, { NULL, OPT_UNKNOWN, NULL } }; std::vector<option_t> merged_options; if ( options ) for ( int i=0; options[ i ].name; i++ ) merged_options.push_back( options[ i ] ); for ( int i=0; base_options[ i ].name; i++ ) merged_options.push_back( base_options[ i ] ); if ( ! option_t::parse( sim, name(), merged_options, options_str ) ) { sim -> errorf( "Raid Event %s: Unable to parse options str '%s'.\n", name(), options_str.c_str() ); sim -> cancel(); } if( cooldown > 0 && cooldown_stddev == 0 ) cooldown_stddev = 0.10 * cooldown; if( duration > 0 && duration_stddev == 0 ) duration_stddev = 0.10 * duration; } // raid_event_t::create ===================================================== raid_event_t* raid_event_t::create( sim_t* sim, const std::string& name, const std::string& options_str ) { if ( name == "adds" ) return new adds_event_t( sim, options_str ); if ( name == "casting" ) return new casting_event_t( sim, options_str ); if ( name == "distraction" ) return new distraction_event_t( sim, options_str ); if ( name == "invul" ) return new invulnerable_event_t( sim, options_str ); if ( name == "invulnerable" ) return new invulnerable_event_t( sim, options_str ); if ( name == "movement" ) return new movement_event_t( sim, options_str ); if ( name == "moving" ) return new movement_event_t( sim, options_str ); if ( name == "damage" ) return new damage_event_t( sim, options_str ); if ( name == "stun" ) return new stun_event_t( sim, options_str ); if ( name == "vulnerable" ) return new vulnerable_event_t( sim, options_str ); return 0; } // raid_event_t::init ======================================================= void raid_event_t::init( sim_t* sim ) { sim -> auras.celerity = new buff_t( sim, "celerity", 1 ); std::vector<std::string> splits; int num_splits = util_t::string_split( splits, sim -> raid_events_str, "/\\" ); for ( int i=0; i < num_splits; i++ ) { std::string name = splits[ i ]; std::string options = ""; if ( sim -> debug ) log_t::output( sim, "Creating raid event: %s", name.c_str() ); std::string::size_type cut_pt = name.find_first_of( "," ); if ( cut_pt != name.npos ) { options = name.substr( cut_pt + 1 ); name = name.substr( 0, cut_pt ); } raid_event_t* e = create( sim, name, options ); if ( ! e ) { sim -> errorf( "Unknown raid event: %s\n", splits[ i ].c_str() ); sim -> cancel(); continue; } assert( e -> cooldown > 0 ); assert( e -> cooldown > e -> cooldown_stddev ); assert( e -> cooldown > e -> duration ); sim -> raid_events.push_back( e ); } } // raid_event_t::reset ====================================================== void raid_event_t::reset( sim_t* sim ) { int num_events = ( int ) sim -> raid_events.size(); for ( int i=0; i < num_events; i++ ) { sim -> raid_events[ i ] -> reset(); } } // raid_event_t::combat_begin =============================================== void raid_event_t::combat_begin( sim_t* sim ) { if ( sim -> overrides.celerity ) sim -> auras.celerity -> override(); int num_events = ( int ) sim -> raid_events.size(); for ( int i=0; i < num_events; i++ ) { sim -> raid_events[ i ] -> schedule(); } }
[ [ [ 1, 555 ] ] ]
2218e5ef4c79b3723c55e1ac773a6e2d8f10249d
e192bb584e8051905fc9822e152792e9f0620034
/tags/sources_0_1/univers/implantation/etoile.cpp
646eae046a545bbeefeed3f944fb8527d63cf9d6
[]
no_license
BackupTheBerlios/projet-univers-svn
708ffadce21f1b6c83e3b20eb68903439cf71d0f
c9488d7566db51505adca2bc858dab5604b3c866
refs/heads/master
2020-05-27T00:07:41.261961
2011-07-31T20:55:09
2011-07-31T20:55:09
40,817,685
0
0
null
null
null
null
UTF-8
C++
false
false
1,682
cpp
/*************************************************************************** * Copyright (C) 2004 by Equipe Projet Univers * * [email protected] * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "etoile.h" namespace ProjetUnivers { namespace Univers { //////////////////// // Constructeur. Etoile::Etoile() {} } }
[ "rogma@fb75c231-3be1-0310-9bb4-c95e2f850c73" ]
[ [ [ 1, 39 ] ] ]
8dae924999220a8c723449a70a9870207f72eed4
fceff9260ff49d2707060241b6f9b927b97db469
/ZombieGentlemen_SeniorProject/entity.h
4734c49e6bba94fee8c536786b2996ee0169daac
[]
no_license
EddyReyes/gentlemen-zombies-senior-project
9f5a6be90f0459831b3f044ed17ef2f085bec679
d88458b716c6eded376b3d44b5385c80deeb9a16
refs/heads/master
2021-05-29T12:13:47.506314
2011-07-04T17:20:38
2011-07-04T17:20:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,032
h
#pragma once #include "object.h" #include "imageManager.h" enum entityType{none, entityPlayer, entityTurret, entityGoomba, entityZiggy, entityObstacle, entityTroll, entityProjectile}; class entity { protected: object * m_object; entityType type; bool alive, armor; D3DXVECTOR3 defaultPos; // entitys will also require a state public: // constructor destructor entity(); ~entity(); //virtual functions (for child classes) virtual void update(float) = 0; virtual void animate() = 0; virtual void reset() = 0; virtual void flip() = 0; virtual void setDirection(char) = 0; // member functions void setPosition(float x, float y); void setPosition(D3DXVECTOR3); void setDefaultPos(D3DXVECTOR3 * pos); void setDefaultPos(float x, float y); void moveToDefaultPos(); // mutators void setObject(object * a_object); void entityDead(); void entityAlive(); void setArmor(bool); //accessors object * getObject(); bool isAlive(); bool hasArmor(); int getType(); };
[ "[email protected]@66a8e42f-0ee8-26ea-976e-e3172d02aab5", "[email protected]@66a8e42f-0ee8-26ea-976e-e3172d02aab5" ]
[ [ [ 1, 29 ], [ 31, 46 ] ], [ [ 30, 30 ] ] ]
faa0046543d781fc411b3a75d51a5bc47a77790b
f9774f8f3c727a0e03c170089096d0118198145e
/传奇mod/Mir2ExCode/Mir2/WindHorn/WHDefProcess.h
5ca76f7b93e4ccbc68f5c18a9f1ee178a4b074f5
[]
no_license
sdfwds4/fjljfatchina
62a3bcf8085f41d632fdf83ab1fc485abd98c445
0503d4aa1907cb9cf47d5d0b5c606df07217c8f6
refs/heads/master
2021-01-10T04:10:34.432964
2010-03-07T09:43:28
2010-03-07T09:43:28
48,106,882
1
1
null
null
null
null
UTF-8
C++
false
false
782
h
/****************************************************************************************************************** CWHDXGraphicWindow Class Declaration *******************************************************************************************************************/ #ifndef _WINDHORN_DEFPROCESS #define _WINDHORN_DEFPROCESS class CWHDefProcess { public: CWHDefProcess(); ~CWHDefProcess(); VOID* m_pxDXGWnd; HRESULT Clear(DWORD dwColor); virtual VOID OnConnectToServer() = 0; virtual char* OnMessageReceive(CHAR* pszPacketMsg) = 0; virtual VOID ShowStatus(INT nStartX, INT nStartY); //Default Message Process virtual LRESULT DefMainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); }; #endif //_WINDHORN_DEFPROCESS
[ "fjljfat@4a88d1ba-22b1-11df-8001-4f4b503b426e" ]
[ [ [ 1, 31 ] ] ]
efb8a13c8ba4a5e15a6160c5fbbb88c791e86004
f7d5fcb47d370751163d253ac0d705d52bd3c5d5
/trunk/Sources/source/hapticgraphclasses/Node.h
03fb39fd79409a597f42af66ca775252f89d4cb7
[]
no_license
BackupTheBerlios/phantom-graphs-svn
b830eadf54c49ccecf2653e798e3a82af7e0e78d
6a585ecde8432394c732a72e4860e136d68cc4b4
refs/heads/master
2021-01-02T09:21:18.231965
2006-02-06T08:44:57
2006-02-06T08:44:57
40,820,960
0
0
null
null
null
null
ISO-8859-1
C++
false
false
11,778
h
//******************************************************************************* /// @file Node.h /// @author Katharina Greiner, Matr.-Nr. 943471 /// @date Erstellt am 30.12.2005 /// @date Letzte Änderung 05.02.2006 //******************************************************************************* // Änderungen: // 03.01.06 - Methode translate() hinzugefügt // 08.01.06 - Attribute m_Width und m_Height und entsprechende Getter und Setter // hinzugefügt // 27.01.06 - Incoming- und Outgoing Edges und dazugehörige Methoden hinzugefügt. // 28.01.06 - Membervariable m_rUnitInfo zur Einheitenkonvertierung hinzugefügt, // Konstruktor entsprechend angepasst. // 05.02.06 - Doku vervollständigt. #ifndef _NODE_H_ #define _NODE_H_ // wird von gl.h benötigt #include <windows.h> // OpenGL includes #include <GL/gl.h> // STL includes #include <list> // eigene includes #include "HapticObject.h" #include "Edge.h" #include "Utilities.h" #include "HapticEffect.h" #include "../businesslogic/IObserver.h" #include "../businesslogic/IBusinessAdapter.h" using std::list; //............................................................................... /// @author Katharina Greiner, Matr.-Nr. 943471 /// /// @brief Haptisches Objekt, das einen Knoten in einem Graphen als Rechteck darstellt. /// /// Der Node lässt sich mit verschieden starken Restriktionen bewegen, je /// nach Definition der Businesslogik: /// - Frei bewegbar /// - eingeschränkt bewegbar /// - gar nicht bewegbar /// In der Rolle des Observers beobachtet der Node sein Businesslogik-Objekt /// und reagiert auf dessen Änderungen. /// @todo Der Effekt für "gar nicht bewegbar" muss noch richtig eingestellt werden. //............................................................................... class Node : public HapticObject, public IObserver { protected: //....................................................................... /// @brief Breite des Node in View-Koordinaten. //....................................................................... float m_Width; //....................................................................... /// @brief Höhe des Node in View-Koordinaten. //....................................................................... float m_Height; //....................................................................... /// @brief Zeiger auf ein Businesslogik-Objekt, das der Node darstellen soll. /// Die Eigenschaften und das Verhalten des Node werden von diesem /// Objekt abgefragt. Wird NICHT vom Node freigegeben! //....................................................................... IBusinessAdapter * m_pBusinessObject; //....................................................................... /// @brief Referenz auf das Einheitenobjekt auf dessen Basis der Node /// dargestellt werden soll. Wird NICHT vom Node freigegeben! //....................................................................... UnitConversionInfo & m_rUnitInfo; //....................................................................... /// @brief Effekt, der aktiviert wird, wenn sich der Node nur eingeschränkt /// bewegen lassen soll. /// Wird vom Node erzeugt und freigegeben. //....................................................................... HapticEffect * m_pHardToMoveEffect; //....................................................................... /// @brief Effekt, der aktiviert wird, wenn sich der Node gar nicht /// bewegen lassen soll. /// Wird vom Node erzeugt und freigegeben. //....................................................................... HapticEffect * m_pImpossibleToMoveEffect; //....................................................................... /// @brief Liste von Verbindungen zu Vorgängerknoten. //....................................................................... list<Edge *> m_IncomingEdges; //....................................................................... /// @brief Liste von Verbindungen zu Nachfolgerknoten. //....................................................................... list<Edge *> m_OutgoingEdges; //....................................................................... /// @brief Setzt den Endpunkt einer eingehenden Kante neu. /// @param pEdge Edge, deren Endpunkt verändert werden soll. //....................................................................... void updateIncomingEdge(Edge * pEdge); //....................................................................... /// @brief Setzt den Anfangspunkt einer ausgehenden Kante neu. /// @param pEdge Edge, deren Anfangspunkt verändert werden soll. //....................................................................... void updateOutgoingEdge(Edge * pEdge); //....................................................................... /// @brief Aktualisiert die Anfangs- und Endpunkte der Kanten, die mit /// dem Knoten verbunden sind. //....................................................................... void updateEdges(); //....................................................................... /// @brief ID der OpenGL-Displayliste, mit der der Node gezeichnet wird. //....................................................................... GLuint m_DisplayList; //....................................................................... /// @brief Gibt die Displayliste frei und weist ihr einen ungültigen Wert zu. //....................................................................... void releaseDisplayList(); public: //....................................................................... /// @brief Konstruktor: Initialisiert das Objekt mit dem dazugehörigen /// Business-Objekt. Alle Darstellungsinformationen werden vom /// Business-Objekt angefordert. /// @param businessObj Zeiger auf ein Businesslogik-Objekt, das der Node /// darstellen soll. Wird NICHT vom Node freigegeben! /// @param unitInfo Referenz auf das Einheitenobjekt auf dessen Basis /// der Node dargestellt werden soll. Wird NICHT vom Node freigegeben! //....................................................................... Node( IBusinessAdapter * businessObj, UnitConversionInfo & unitInfo ); //....................................................................... /// @brief Destruktor: Gibt die Ressourcen des Objektes frei. //....................................................................... virtual ~Node(); //....................................................................... /// @brief Ändert die Breite des Node. /// @param value Neue Breite des Node. //....................................................................... void setWidth( float value ); //....................................................................... /// @brief Ändert die Höhe des Node. /// @param value Neue Höhe des Node. //....................................................................... void setHeight( float value ); //....................................................................... /// @brief Gibt die aktuelle Breite des Node zurück. /// @return Die aktuelle Breite des Node. //....................................................................... float getWidth(); //....................................................................... /// @brief Gibt die aktuelle Höhe des Node zurück. /// @return Die aktuelle Höhe des Node. //....................................................................... float getHeight(); //....................................................................... /// @brief Weist dem Node einen neuen Effekt für das Verhindern von /// Bewegung zu. /// @param value Zeiger auf den neuen Effekt für das Verhindern von /// Bewegung. Wird vom Node freigegeben. //....................................................................... void setImpossibleToMoveEffect( HapticEffect* value ); //....................................................................... /// @brief Weist dem Node einen neuen Effekt für die eigeschränkte /// Bewegung zu. /// @param value Zeiger auf den neuen Effekt für die eigeschränkte /// Bewegung. Wird vom Node freigegeben. //....................................................................... void setHardToMoveEffect( HapticEffect* value ); //....................................................................... /// @brief Fügt dem Knoten eine eingehende Kante hinzu. /// @param pEdge Kante, die dem Knoten hinzugefügt werden soll. /// Die Kante wird beim Löschen des Knotens nicht freigegeben! //....................................................................... void addIncomingEdge( Edge * pEdge ); //....................................................................... /// @brief Fügt dem Knoten eine ausgehende Kante hinzu. /// @param pEdge Kante, die dem Knoten hinzugefügt werden soll. /// Die Kante wird beim Löschen des Knotens nicht freigegeben! //....................................................................... void addOutgoingEdge( Edge * pEdge ); //======================================================================= // Von HapticObject geerbte Methoden //======================================================================= //....................................................................... /// @brief Legt die Geometrie aller Objekte dieser Klasse fest. //....................................................................... virtual void renderShape(); //....................................................................... /// @brief Verschiebt den Node um den Vektor [x, y, z] unter Beachtung /// durch die Businesslogik definierten Restriktionen. /// @param x x-Koordinate des Translationsvektors. /// @param y y-Koordinate des Translationsvektors. /// @param z z-Koordinate des Translationsvektors. //....................................................................... virtual void translate(const double x, const double y, const double z); //....................................................................... /// @brief Platziert das Objekt an der Stelle mit dem Ortsvektor [x, y, z], /// falls das Business-Objekt es erlaubt. Ansonsten wird der Node /// an einer vom Business-Objekt berechneten Position platziert. /// @param x x-Koordinate des Ortsvektors. /// @param y y-Koordinate des Ortsvektors. /// @param z z-Koordinate des Ortsvektors. //....................................................................... virtual void setPosition(const double x, const double y, const double z); //======================================================================= //======================================================================= // Von IObserver geerbte Methoden //======================================================================= //....................................................................... /// @brief Veranlasst den Observer, sich die benötigten Informationen /// vom Observable zu holen. //....................................................................... virtual void Update( Observable * pObservable ); //======================================================================= }; #endif // _NODE_H_
[ "frosch@a1b688d3-ce07-0410-8a3f-c797401f78de" ]
[ [ [ 1, 251 ] ] ]
30b9951cf7dc0ede2bad12dcefc78c5005dc4108
ce262ae496ab3eeebfcbb337da86d34eb689c07b
/SEFoundation/SEIntersection/SEIntrSegment3Sphere3.cpp
a2eb86b14fd928ade9ba87da8c741de9ec101066
[]
no_license
pizibing/swingengine
d8d9208c00ec2944817e1aab51287a3c38103bea
e7109d7b3e28c4421c173712eaf872771550669e
refs/heads/master
2021-01-16T18:29:10.689858
2011-06-23T04:27:46
2011-06-23T04:27:46
33,969,301
0
0
null
null
null
null
GB18030
C++
false
false
9,392
cpp
// Swing Engine Version 1 Source Code // Most of techniques in the engine are mainly based on David Eberly's // Wild Magic 4 open-source code.The author of Swing Engine learned a lot // from Eberly's experience of architecture and algorithm. // Several sub-systems are totally new,and others are re-implimented or // re-organized based on Wild Magic 4's sub-systems. // Copyright (c) 2007-2010. All Rights Reserved // // Eberly's permission: // Geometric Tools, Inc. // http://www.geometrictools.com // Copyright (c) 1998-2006. All Rights Reserved // // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation; either version 2.1 of the License, or (at // your option) any later version. The license is available for reading at // the location: // http://www.gnu.org/copyleft/lgpl.html #include "SEFoundationPCH.h" #include "SEIntrSegment3Sphere3.h" using namespace Swing; //---------------------------------------------------------------------------- SEIntrSegment3Sphere3f::SEIntrSegment3Sphere3f(const SESegment3f& rSegment, const SESphere3f& rSphere) : m_pSegment(&rSegment), m_pSphere(&rSphere) { m_iCount = 0; ZeroThreshold = SEMath<float>::ZERO_TOLERANCE; } //---------------------------------------------------------------------------- const SESegment3f& SEIntrSegment3Sphere3f::GetSegment() const { return *m_pSegment; } //---------------------------------------------------------------------------- const SESphere3f& SEIntrSegment3Sphere3f::GetSphere() const { return *m_pSphere; } //---------------------------------------------------------------------------- bool SEIntrSegment3Sphere3f::Test() { SEVector3f vec3fDiff = m_pSegment->Origin - m_pSphere->Center; float fA0 = vec3fDiff.Dot(vec3fDiff) - m_pSphere->Radius*m_pSphere->Radius; float fA1 = m_pSegment->Direction.Dot(vec3fDiff); float fDiscr = fA1*fA1 - fA0; if( fDiscr < 0.0f ) { return false; } float fTmp0 = m_pSegment->Extent*m_pSegment->Extent + fA0; float fTmp1 = 2.0f*fA1*m_pSegment->Extent; float fQM = fTmp0 - fTmp1; float fQP = fTmp0 + fTmp1; if( fQM*fQP <= 0.0f ) { return true; } return fQM > 0.0f && SEMath<float>::FAbs(fA1) < m_pSegment->Extent; } //---------------------------------------------------------------------------- bool SEIntrSegment3Sphere3f::Find() { // 待检查. // 线段端点在球上的情况过于复杂. SEVector3f vec3fDiff = m_pSegment->Origin - m_pSphere->Center; float fA0 = vec3fDiff.Dot(vec3fDiff) - m_pSphere->Radius*m_pSphere->Radius; float fA1 = m_pSegment->Direction.Dot(vec3fDiff); float fDiscr = fA1*fA1 - fA0; if( fDiscr < 0.0f ) { // 判别式小于零,线段所在直线与球没有交点. m_iCount = 0; return false; } float fTmp0 = m_pSegment->Extent*m_pSegment->Extent + fA0; float fTmp1 = 2.0f*fA1*m_pSegment->Extent; float fQM = fTmp0 - fTmp1; float fQP = fTmp0 + fTmp1; float fQMmQP = fQM*fQP; float fRoot; if( fQMmQP < 0.0f ) { // 线段两端点一个在球内一个在球外,必与球有一个交点. fRoot = SEMath<float>::Sqrt(fDiscr); m_afSegmentT[0] = (fQM > 0.0f ? -fA1 - fRoot : -fA1 + fRoot); m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_iCount = 1; return true; } if( fQMmQP == 0.0f ) { // 线段两端点至少有一个在球上,至少与球有一个交点. if( fQM == 0.0f && fQP == 0.0f ) { m_afSegmentT[0] = -m_pSegment->Extent; m_afSegmentT[1] = m_pSegment->Extent; m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_aPoint[1] = m_pSegment->Origin + m_afSegmentT[1] * m_pSegment->Direction; m_iCount = 2; } else if( fQM == 0.0f ) { if( fQP < 0.0f ) { m_afSegmentT[0] = -m_pSegment->Extent; m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_iCount = 1; } else { if( fDiscr >= ZeroThreshold ) { if( fA1 < m_pSegment->Extent ) { fRoot = SEMath<float>::Sqrt(fDiscr); m_afSegmentT[0] = -m_pSegment->Extent; m_afSegmentT[1] = -fA1 + fRoot; m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_aPoint[1] = m_pSegment->Origin + m_afSegmentT[1] * m_pSegment->Direction; m_iCount = 2; } else { m_afSegmentT[0] = -m_pSegment->Extent; m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_iCount = 1; } } else { m_afSegmentT[0] = -m_pSegment->Extent; m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_iCount = 1; } } } else // fQP == 0.0f { if( fQM < 0.0f ) { m_afSegmentT[0] = m_pSegment->Extent; m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_iCount = 1; } else { if( fDiscr >= ZeroThreshold ) { if( -fA1 < m_pSegment->Extent ) { fRoot = SEMath<float>::Sqrt(fDiscr); m_afSegmentT[0] = -fA1 - fRoot; m_afSegmentT[1] = m_pSegment->Extent; m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_aPoint[1] = m_pSegment->Origin + m_afSegmentT[1] * m_pSegment->Direction; m_iCount = 2; } else { m_afSegmentT[0] = m_pSegment->Extent; m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_iCount = 1; } } else { m_afSegmentT[0] = m_pSegment->Extent; m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_iCount = 1; } } } return true; } if( fQM > 0.0f && SEMath<float>::FAbs(fA1) < m_pSegment->Extent ) { // 线段两端点都在球外,且二次曲线极小值对应的t值在线段上. if( fDiscr >= ZeroThreshold ) { fRoot = SEMath<float>::Sqrt(fDiscr); m_afSegmentT[0] = -fA1 - fRoot; m_afSegmentT[1] = -fA1 + fRoot; m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_aPoint[1] = m_pSegment->Origin + m_afSegmentT[1] * m_pSegment->Direction; m_iCount = 2; } else { m_afSegmentT[0] = -fA1; m_aPoint[0] = m_pSegment->Origin + m_afSegmentT[0] * m_pSegment->Direction; m_iCount = 1; } } else { m_iCount = 0; } return m_iCount > 0; } //---------------------------------------------------------------------------- bool SEIntrSegment3Sphere3f::Test(float, const SEVector3f&, const SEVector3f&) { // 待实现. return false; } //---------------------------------------------------------------------------- bool SEIntrSegment3Sphere3f::Find(float, const SEVector3f&, const SEVector3f&) { // 待实现. return false; } //---------------------------------------------------------------------------- int SEIntrSegment3Sphere3f::GetCount() const { return m_iCount; } //---------------------------------------------------------------------------- const SEVector3f& SEIntrSegment3Sphere3f::GetPoint(int i) const { SE_ASSERT( 0 <= i && i < m_iCount ); return m_aPoint[i]; } //---------------------------------------------------------------------------- float SEIntrSegment3Sphere3f::GetSegmentT(int i) const { SE_ASSERT( 0 <= i && i < m_iCount ); return m_afSegmentT[i]; } //----------------------------------------------------------------------------
[ "[email protected]@876e9856-8d94-11de-b760-4d83c623b0ac" ]
[ [ [ 1, 267 ] ] ]
9f5ff5a62e97cf0aea10eab095ead2a6d2605426
580738f96494d426d6e5973c5b3493026caf8b6a
/Include/Vcl/treeintf.hpp
0fb9a8115717ac7020464e4d36965232a9274659
[]
no_license
bravesoftdz/cbuilder-vcl
6b460b4d535d17c309560352479b437d99383d4b
7b91ef1602681e094a6a7769ebb65ffd6f291c59
refs/heads/master
2021-01-10T14:21:03.726693
2010-01-11T11:23:45
2010-01-11T11:23:45
48,485,606
2
1
null
null
null
null
UTF-8
C++
false
false
24,736
hpp
// Borland C++ Builder // Copyright (c) 1995, 2002 by Borland Software Corporation // All rights reserved // (DO NOT EDIT: machine generated header) 'TreeIntf.pas' rev: 6.00 #ifndef TreeIntfHPP #define TreeIntfHPP #pragma delphiheader begin #pragma option push -w- #pragma option push -Vx #include <ImgList.hpp> // Pascal unit #include <Menus.hpp> // Pascal unit #include <IniFiles.hpp> // Pascal unit #include <Contnrs.hpp> // Pascal unit #include <TypInfo.hpp> // Pascal unit #include <DesignMenus.hpp> // Pascal unit #include <DesignEditors.hpp> // Pascal unit #include <DesignIntf.hpp> // Pascal unit #include <ComCtrls.hpp> // Pascal unit #include <ExtCtrls.hpp> // Pascal unit #include <Dialogs.hpp> // Pascal unit #include <Forms.hpp> // Pascal unit #include <Controls.hpp> // Pascal unit #include <Graphics.hpp> // Pascal unit #include <Classes.hpp> // Pascal unit #include <SysUtils.hpp> // Pascal unit #include <Messages.hpp> // Pascal unit #include <Windows.hpp> // Pascal unit #include <SysInit.hpp> // Pascal unit #include <System.hpp> // Pascal unit //-- user supplied ----------------------------------------------------------- namespace Treeintf { //-- type declarations ------------------------------------------------------- typedef TMetaClass*TSprigClass; class DELPHICLASS TSprig; typedef void __fastcall (__closure *TSprigAction)(TSprig* AItem); typedef TMetaClass*TRootSprigClass; __interface ISprigCollection; typedef System::DelphiInterface<ISprigCollection> _di_ISprigCollection; class DELPHICLASS TRootSprig; __interface ISprigDesigner; typedef System::DelphiInterface<ISprigDesigner> _di_ISprigDesigner; __interface INTERFACE_UUID("{0B6ABAEE-E1A4-4DAC-8E20-C6B741A5082D}") ISprigCollection : public IInterface { public: virtual bool __fastcall RootSprigAssigned(void) = 0 ; virtual TRootSprig* __fastcall RootSprig(void) = 0 ; virtual _di_ISprigDesigner __fastcall GetSprigDesigner(void) = 0 ; virtual void __fastcall SetSprigDesigner(const _di_ISprigDesigner ASprigDesigner) = 0 ; __property _di_ISprigDesigner SprigDesigner = {read=GetSprigDesigner, write=SetSprigDesigner}; }; __interface INTERFACE_UUID("{6AC141E3-2FBE-425E-B299-AB29E7DF3FBB}") ISprigDesigner : public IInterface { public: virtual Comctrls::TCustomTreeView* __fastcall GetTreeView(void) = 0 ; virtual void __fastcall BeforeItemsModified(void) = 0 ; virtual void __fastcall AfterItemsModified(void) = 0 ; virtual TRootSprig* __fastcall GetRootSprig(void) = 0 ; virtual void __fastcall SetRootSprig(TRootSprig* ARootSprig) = 0 ; __property TRootSprig* RootSprig = {read=GetRootSprig, write=SetRootSprig}; }; class DELPHICLASS TInformant; class PASCALIMPLEMENTATION TInformant : public System::TObject { typedef System::TObject inherited; private: Classes::TList* FNotifyList; int FDisableNotify; bool FNotifyNeeded; bool FDestroying; protected: virtual void __fastcall Changed(TInformant* AObj); public: virtual void __fastcall BeforeDestruction(void); __fastcall virtual ~TInformant(void); __property bool Destroying = {read=FDestroying, nodefault}; void __fastcall DisableNotify(void); void __fastcall EnableNotify(void); void __fastcall Notification(void); void __fastcall Notify(TInformant* AObj); void __fastcall Unnotify(TInformant* AObj); public: #pragma option push -w-inl /* TObject.Create */ inline __fastcall TInformant(void) : System::TObject() { } #pragma option pop }; #pragma option push -b- enum TSprigDeleteStyle { dsNormal, dsIgnore, dsAbort, dsCustom }; #pragma option pop class PASCALIMPLEMENTATION TSprig : public TInformant { typedef TInformant inherited; public: TSprig* operator[](int Index) { return Items[Index]; } private: TRootSprig* FRoot; TSprig* FParent; Contnrs::TObjectList* FList; Classes::TPersistent* FItem; Comctrls::TTreeNode* FTreeNode; Imglist::TImageIndex FImageIndex; AnsiString FCaption; bool FExpanded; bool FInvalid; bool FCollectionsDone; bool FHidden; bool FHiddenTested; void __fastcall SetExpanded(const bool Value); protected: TSprig* __fastcall GetItem(int Index); virtual AnsiString __fastcall UniqueName(); AnsiString __fastcall CaptionFor(const AnsiString AName, const AnsiString ALabel = "", const AnsiString AClass = ""); void __fastcall ReparentChildren(void); virtual void __fastcall SelectItems(const Classes::TPersistent* * AItems, const int AItems_Size, bool ARuntimeChange = true); virtual void __fastcall RuntimeChange(void); virtual void __fastcall DesigntimeChange(void); virtual TSprig* __fastcall FindItem(Classes::TPersistent* AItem, bool Recurse); virtual TSprig* __fastcall FindItemByName(const AnsiString AName, TMetaClass* AClass, bool Recurse); virtual TSprig* __fastcall FindItemByPath(const AnsiString APath, bool Recurse = true); virtual bool __fastcall GetDesigner(/* out */ Designintf::_di_IDesigner &ADesigner); virtual Imglist::TImageIndex __fastcall GetImageIndex(void); virtual void __fastcall SetImageIndex(const Imglist::TImageIndex Value); virtual Imglist::TImageIndex __fastcall GetStateIndex(void); virtual void __fastcall BeginUpdate(void); virtual void __fastcall EnsureUpdate(void); virtual void __fastcall EndUpdate(void); virtual AnsiString __fastcall GetAddType(int Index); public: __fastcall virtual TSprig(Classes::TPersistent* AItem)/* overload */; __fastcall virtual ~TSprig(void); void __fastcall Invalidate(void); virtual bool __fastcall Transient(void); virtual bool __fastcall AnyProblems(void); __property bool Invalid = {read=FInvalid, nodefault}; __property Classes::TPersistent* Item = {read=FItem}; virtual bool __fastcall Hidden(void); virtual bool __fastcall Ghosted(void); virtual Classes::TPersistent* __fastcall FocusItem(void); virtual TMetaClass* __fastcall ItemClass(void); virtual TSprig* __fastcall Owner(void); virtual void __fastcall VisualRefresh(void); virtual Comctrls::TTreeNode* __fastcall TreeNodeFor(Comctrls::TCustomTreeView* ATreeView); __property Comctrls::TTreeNode* TreeNode = {read=FTreeNode}; __property bool Expanded = {read=FExpanded, write=SetExpanded, nodefault}; __property Imglist::TImageIndex ImageIndex = {read=GetImageIndex, write=SetImageIndex, nodefault}; __property Imglist::TImageIndex StateIndex = {read=GetStateIndex, nodefault}; void __fastcall ClearTreeNode(void)/* overload */; void __fastcall ClearTreeNode(bool ARecurse, bool AFreeNode = true)/* overload */; virtual AnsiString __fastcall Name(); virtual AnsiString __fastcall Caption(); virtual AnsiString __fastcall Hint(); virtual void __fastcall PrepareMenu(const Designmenus::_di_IMenuItems AItems); virtual bool __fastcall ShowRegisteredMenus(void); TMetaClass* __fastcall DragClass(void); virtual bool __fastcall DragOver(TSprig* AItem); virtual bool __fastcall DragOverTo(TSprig* AParent); virtual bool __fastcall DragDrop(TSprig* AItem); virtual bool __fastcall DragDropTo(TSprig* AParent); virtual bool __fastcall PaletteOver(TMetaClass* ASprigClass, TMetaClass* AClass); /* virtual class method */ virtual bool __fastcall PaletteOverTo(TMetaClass* vmt, TSprig* AParent, TMetaClass* AClass); TSprig* __fastcall Add(TSprig* AItem); TSprig* __fastcall Find(Classes::TPersistent* AItem, bool Recurse = true)/* overload */; TSprig* __fastcall Find(const AnsiString AName, bool Recurse = true)/* overload */; TSprig* __fastcall Find(const AnsiString AName, TMetaClass* AClass, bool Recurse = true)/* overload */; TSprig* __fastcall FindPath(const AnsiString APath, bool Recurse = true); int __fastcall IndexOf(TSprig* AItem); void __fastcall ForEach(TSprigAction ABefore, TSprigAction AAfter = 0x0); void __fastcall ClearUnneededSprigs(void); virtual TSprigDeleteStyle __fastcall DeleteStyle(void); virtual bool __fastcall CustomDelete(void); virtual bool __fastcall CanMove(bool AUp); virtual bool __fastcall Move(bool AUp); virtual bool __fastcall CanAdd(void); virtual int __fastcall AddTypeCount(void); __property AnsiString AddTypes[int Index] = {read=GetAddType}; virtual void __fastcall AddType(int Index); virtual void __fastcall SortItems(void); virtual bool __fastcall SortByIndex(void); virtual bool __fastcall IncludeIndexInCaption(void); virtual int __fastcall ItemIndex(void); virtual bool __fastcall CopyGlyph(Graphics::TBitmap* ABitmap); __property TRootSprig* Root = {read=FRoot}; __property TSprig* Parent = {read=FParent}; bool __fastcall Parents(TSprig* ASprig); AnsiString __fastcall Path(); __property TSprig* Items[int Index] = {read=GetItem/*, default*/}; int __fastcall Count(void); int __fastcall Index(void); virtual void __fastcall Reparent(void); virtual Classes::TComponent* __fastcall Construct(TMetaClass* AClass); TSprig* __fastcall SeekParent(Classes::TPersistent* AItem, bool Recurse = true)/* overload */; TSprig* __fastcall SeekParent(const AnsiString AName, bool Recurse = true)/* overload */; TSprig* __fastcall SeekParent(const AnsiString AName, TMetaClass* AClass, bool Recurse = true)/* overload */; /* virtual class method */ virtual AnsiString __fastcall ParentProperty(TMetaClass* vmt); virtual void __fastcall FigureParent(void); virtual void __fastcall FigureChildren(void); }; class DELPHICLASS TAbstractSprig; class PASCALIMPLEMENTATION TAbstractSprig : public TSprig { typedef TSprig inherited; public: virtual bool __fastcall Ghosted(void); public: #pragma option push -w-inl /* TSprig.Create */ inline __fastcall virtual TAbstractSprig(Classes::TPersistent* AItem)/* overload */ : TSprig(AItem) { } #pragma option pop #pragma option push -w-inl /* TSprig.Destroy */ inline __fastcall virtual ~TAbstractSprig(void) { } #pragma option pop }; class DELPHICLASS TTransientSprig; class PASCALIMPLEMENTATION TTransientSprig : public TAbstractSprig { typedef TAbstractSprig inherited; public: virtual bool __fastcall Transient(void); public: #pragma option push -w-inl /* TSprig.Create */ inline __fastcall virtual TTransientSprig(Classes::TPersistent* AItem)/* overload */ : TAbstractSprig(AItem) { } #pragma option pop #pragma option push -w-inl /* TSprig.Destroy */ inline __fastcall virtual ~TTransientSprig(void) { } #pragma option pop }; class DELPHICLASS TAbstractCollectionSprig; class PASCALIMPLEMENTATION TAbstractCollectionSprig : public TAbstractSprig { typedef TAbstractSprig inherited; public: __fastcall virtual TAbstractCollectionSprig(Classes::TPersistent* AItem)/* overload */; public: #pragma option push -w-inl /* TSprig.Destroy */ inline __fastcall virtual ~TAbstractCollectionSprig(void) { } #pragma option pop }; class DELPHICLASS TTransientCollectionSprig; class PASCALIMPLEMENTATION TTransientCollectionSprig : public TTransientSprig { typedef TTransientSprig inherited; public: __fastcall virtual TTransientCollectionSprig(Classes::TPersistent* AItem)/* overload */; public: #pragma option push -w-inl /* TSprig.Destroy */ inline __fastcall virtual ~TTransientCollectionSprig(void) { } #pragma option pop }; class DELPHICLASS TPersistentSprig; class PASCALIMPLEMENTATION TPersistentSprig : public TSprig { typedef TSprig inherited; public: #pragma option push -w-inl /* TSprig.Create */ inline __fastcall virtual TPersistentSprig(Classes::TPersistent* AItem)/* overload */ : TSprig(AItem) { } #pragma option pop #pragma option push -w-inl /* TSprig.Destroy */ inline __fastcall virtual ~TPersistentSprig(void) { } #pragma option pop }; class DELPHICLASS TComponentSprig; class PASCALIMPLEMENTATION TComponentSprig : public TPersistentSprig { typedef TPersistentSprig inherited; private: TSprig* FOwner; public: __fastcall virtual TComponentSprig(Classes::TPersistent* AItem)/* overload */; __fastcall TComponentSprig(Classes::TPersistent* AItem, TSprig* AOwner)/* overload */; virtual AnsiString __fastcall UniqueName(); virtual TSprig* __fastcall Owner(void); public: #pragma option push -w-inl /* TSprig.Destroy */ inline __fastcall virtual ~TComponentSprig(void) { } #pragma option pop }; typedef TMetaClass*TComponentSprigClass; class DELPHICLASS TSprigIndex; class PASCALIMPLEMENTATION TSprigIndex : public System::TObject { typedef System::TObject inherited; private: Contnrs::TObjectList* FList; public: __fastcall TSprigIndex(void); __fastcall virtual ~TSprigIndex(void); void __fastcall Add(TSprig* ASprig); void __fastcall Remove(TSprig* ASprig); TSprig* __fastcall Find(Classes::TPersistent* AItem); }; class PASCALIMPLEMENTATION TRootSprig : public TPersistentSprig { typedef TPersistentSprig inherited; private: TSprigIndex* FIndex; Classes::TList* FNamedItems; Classes::TList* FPathedItems; bool FRepopulating; bool FParentChanges; _di_ISprigDesigner FSprigDesigner; Designintf::_di_IDesigner FDesigner; bool FRepopulateNeeded; bool FNeedUpdate; int FUpdateLocks; void __fastcall ValidateParent(TSprig* AItem); void __fastcall PreRefreshTreeView(TSprig* AItem); void __fastcall PostRefreshTreeView(TSprig* AItem); void __fastcall DepopulateTreeView(TSprig* AItem); void __fastcall RestoreExpandState(TSprig* AItem); void __fastcall StoreExpandState(TSprig* AItem); void __fastcall SetSprigDesigner(const _di_ISprigDesigner ASprigDesigner); void __fastcall SelectionSurvey(/* out */ TSprigDeleteStyle &ADeleteStyle, /* out */ bool &AAllVisible); protected: virtual TSprig* __fastcall FindItem(Classes::TPersistent* AItem, bool Recurse = true); virtual TSprig* __fastcall FindItemByName(const AnsiString AName, TMetaClass* AClass, bool Recurse); virtual TSprig* __fastcall FindItemByPath(const AnsiString APath, bool Recurse = true); void __fastcall AddItem(TSprig* ASprig); void __fastcall RemoveItem(TSprig* ASprig); virtual bool __fastcall GetDesigner(/* out */ Designintf::_di_IDesigner &ADesigner); virtual AnsiString __fastcall GetAddType(int Index); bool __fastcall SelectedSprig(TSprig* &ASprig); public: __fastcall virtual TRootSprig(Classes::TPersistent* AItem)/* overload */; __fastcall virtual ~TRootSprig(void); virtual void __fastcall FigureParent(void); __property _di_ISprigDesigner SprigDesigner = {read=FSprigDesigner, write=SetSprigDesigner}; __property Designintf::_di_IDesigner Designer = {read=FDesigner, write=FDesigner}; __property bool Repopulating = {read=FRepopulating, nodefault}; bool __fastcall Repopulate(void); Comctrls::TCustomTreeView* __fastcall TreeView(void); void __fastcall RefreshTreeView(void); void __fastcall StoreTreeState(void); virtual void __fastcall BeginUpdate(void); virtual void __fastcall EnsureUpdate(void); virtual void __fastcall EndUpdate(void); void __fastcall ItemDeleted(Classes::TPersistent* AItem); void __fastcall ItemInserted(void); void __fastcall ItemsModified(bool AForceRepopulate = true); virtual void __fastcall RuntimeChange(void); virtual void __fastcall DesigntimeChange(void); virtual void __fastcall SelectItems(const Classes::TPersistent* * AItems, const int AItems_Size, bool ARuntimeChange = true); virtual bool __fastcall CanMove(bool AUp); virtual bool __fastcall Move(bool AUp); virtual bool __fastcall CanAdd(void); virtual void __fastcall AddType(int Index); virtual int __fastcall AddTypeCount(void); bool __fastcall EditAction(Designintf::TEditAction Action); Designintf::TEditState __fastcall GetEditState(void); virtual TSprigDeleteStyle __fastcall DeleteStyle(void); virtual bool __fastcall PaletteOver(TMetaClass* ASprigClass, TMetaClass* AClass); virtual bool __fastcall AcceptsClass(TMetaClass* AClass); __property bool RepopulateNeeded = {read=FRepopulateNeeded, write=FRepopulateNeeded, nodefault}; }; class DELPHICLASS TSprigTreeNode; class PASCALIMPLEMENTATION TSprigTreeNode : public Comctrls::TTreeNode { typedef Comctrls::TTreeNode inherited; public: __fastcall virtual ~TSprigTreeNode(void); public: #pragma option push -w-inl /* TTreeNode.Create */ inline __fastcall TSprigTreeNode(Comctrls::TTreeNodes* AOwner) : Comctrls::TTreeNode(AOwner) { } #pragma option pop }; class DELPHICLASS TPropertySprig; class PASCALIMPLEMENTATION TPropertySprig : public TPersistentSprig { typedef TPersistentSprig inherited; public: virtual bool __fastcall Ghosted(void); virtual TSprigDeleteStyle __fastcall DeleteStyle(void); public: #pragma option push -w-inl /* TSprig.Create */ inline __fastcall virtual TPropertySprig(Classes::TPersistent* AItem)/* overload */ : TPersistentSprig(AItem) { } #pragma option pop #pragma option push -w-inl /* TSprig.Destroy */ inline __fastcall virtual ~TPropertySprig(void) { } #pragma option pop }; class DELPHICLASS TCollectionSprig; class PASCALIMPLEMENTATION TCollectionSprig : public TPropertySprig { typedef TPropertySprig inherited; private: AnsiString FPropName; TSprig* FOwner; protected: virtual AnsiString __fastcall GetAddType(int Index); public: __fastcall virtual TCollectionSprig(Classes::TPersistent* AItem)/* overload */; virtual AnsiString __fastcall Name(); virtual AnsiString __fastcall Caption(); virtual void __fastcall FigureParent(void); virtual void __fastcall FigureChildren(void); virtual TSprig* __fastcall Owner(void); virtual bool __fastcall SortByIndex(void); virtual void __fastcall AddType(int Index); virtual int __fastcall AddTypeCount(void); virtual TSprigDeleteStyle __fastcall DeleteStyle(void); virtual bool __fastcall CustomDelete(void); public: #pragma option push -w-inl /* TSprig.Destroy */ inline __fastcall virtual ~TCollectionSprig(void) { } #pragma option pop }; class DELPHICLASS TCollectionItemSprig; class PASCALIMPLEMENTATION TCollectionItemSprig : public TPersistentSprig { typedef TPersistentSprig inherited; private: TSprig* FOwner; protected: virtual AnsiString __fastcall GetAddType(int Index); public: virtual AnsiString __fastcall Name(); virtual void __fastcall FigureParent(void); virtual TSprig* __fastcall Owner(void); virtual bool __fastcall Ghosted(void); virtual int __fastcall ItemIndex(void); virtual bool __fastcall IncludeIndexInCaption(void); virtual bool __fastcall DragOverTo(TSprig* AParent); virtual bool __fastcall DragDropTo(TSprig* AParent); virtual void __fastcall AddType(int Index); virtual int __fastcall AddTypeCount(void); public: #pragma option push -w-inl /* TSprig.Create */ inline __fastcall virtual TCollectionItemSprig(Classes::TPersistent* AItem)/* overload */ : TPersistentSprig(AItem) { } #pragma option pop #pragma option push -w-inl /* TSprig.Destroy */ inline __fastcall virtual ~TCollectionItemSprig(void) { } #pragma option pop }; class DELPHICLASS TSprigType; class PASCALIMPLEMENTATION TSprigType : public System::TObject { typedef System::TObject inherited; private: int FGroup; TMetaClass*FClass; TMetaClass*FSprigClass; public: __fastcall TSprigType(const TMetaClass* AClass, const TMetaClass* ASprigClass); int __fastcall Score(const TMetaClass* AClass); __property TMetaClass* SprigClass = {read=FSprigClass}; public: #pragma option push -w-inl /* TObject.Destroy */ inline __fastcall virtual ~TSprigType(void) { } #pragma option pop }; typedef DynamicArray<GUID > TGUIDArray; class DELPHICLASS TSprigIntfType; class PASCALIMPLEMENTATION TSprigIntfType : public System::TObject { typedef System::TObject inherited; private: int FGroup; DynamicArray<GUID > FInterfaces; TMetaClass*FSprigClass; public: __fastcall TSprigIntfType(const TGUIDArray AInterfaces, const TMetaClass* ASprigClass); bool __fastcall Match(const TMetaClass* AClass); __property TMetaClass* SprigClass = {read=FSprigClass}; public: #pragma option push -w-inl /* TObject.Destroy */ inline __fastcall virtual ~TSprigIntfType(void) { } #pragma option pop }; class DELPHICLASS TSprigTypeList; class PASCALIMPLEMENTATION TSprigTypeList : public System::TObject { typedef System::TObject inherited; private: Contnrs::TObjectList* FList; TMetaClass*FLastClass; TMetaClass*FLastSprigClass; Contnrs::TObjectList* FInterfaceList; protected: void __fastcall ClearCache(void); TMetaClass* __fastcall MatchCache(const TMetaClass* AClass); TMetaClass* __fastcall MatchClass(const TMetaClass* AClass); public: __fastcall TSprigTypeList(void); __fastcall virtual ~TSprigTypeList(void); TMetaClass* __fastcall Match(const TMetaClass* AClass); void __fastcall Add(const TMetaClass* AClass, const TMetaClass* ASprigClass)/* overload */; void __fastcall Add(const TGUIDArray AInterfaces, const TMetaClass* ASprigClass)/* overload */; void __fastcall FreeEditorGroup(int AGroup); }; class DELPHICLASS TDragSprigs; class PASCALIMPLEMENTATION TDragSprigs : public Controls::TDragControlObjectEx { typedef Controls::TDragControlObjectEx inherited; private: Classes::TList* FSprigs; TSprig* __fastcall GetSprig(int Index); public: __fastcall virtual TDragSprigs(Controls::TControl* AControl); __fastcall virtual ~TDragSprigs(void); void __fastcall Add(TSprig* ASprig); int __fastcall Count(void); __property TSprig* Sprigs[int Index] = {read=GetSprig}; }; class DELPHICLASS TRootSprigList; class PASCALIMPLEMENTATION TRootSprigList : public System::TObject { typedef System::TObject inherited; private: Contnrs::TBucketList* FList; public: __fastcall TRootSprigList(void); __fastcall virtual ~TRootSprigList(void); bool __fastcall FindRoot(const Designintf::_di_IDesigner ADesigner, /* out */ TRootSprig* &ARootSprig); void __fastcall DesignerClosed(const Designintf::_di_IDesigner ADesigner, bool AGoingDormant); void __fastcall DesignerOpened(const Designintf::_di_IDesigner ADesigner, bool AResurrecting); void __fastcall ItemDeleted(const Designintf::_di_IDesigner ADesigner, Classes::TPersistent* AItem); void __fastcall ItemInserted(const Designintf::_di_IDesigner ADesigner, Classes::TPersistent* AItem); void __fastcall ItemsModified(const Designintf::_di_IDesigner ADesigner); }; typedef bool __fastcall (__closure *TCopySprigGlyphFunc)(TSprig* ASprig, Graphics::TBitmap* ABitmap); //-- var, const, procedure --------------------------------------------------- extern PACKAGE bool GShowClassNameInTreeView; static const Shortint CFakeSprigImage = 0x0; static const Shortint CFakeCollectionSprigImage = 0x1; static const Shortint CPersistentSprigImage = 0x2; static const Shortint CCollectionSprigImage = 0x3; static const Shortint CComponentSprigImage = 0x4; static const Shortint CDataModuleSprigImage = 0x5; static const Shortint CControlSprigImage = 0x6; static const Shortint CUIControlSprigImage = 0x7; static const Shortint CUIContainerSprigImage = 0x8; static const Shortint CFormSprigImage = 0x9; static const Shortint CGhostedOffset = 0xa; static const Shortint CNoStateImage = 0x0; static const Shortint CCheckOutStateImage = 0x1; #define CCollectionName "<Collection.%s>" extern PACKAGE int CUIControlImageIndex[2]; extern PACKAGE TCopySprigGlyphFunc CopySprigGlyphFunc; extern PACKAGE void __fastcall RegisterSprigType(const TMetaClass* AClass, TMetaClass* ASprigClass)/* overload */; extern PACKAGE void __fastcall RegisterSprigType(const TGUIDArray AInterfaces, TMetaClass* ASprigClass)/* overload */; extern PACKAGE TMetaClass* __fastcall FindBestSprigClass(TMetaClass* AClass)/* overload */; extern PACKAGE TMetaClass* __fastcall FindBestSprigClass(TMetaClass* AClass, TMetaClass* AMinimumSprigClass)/* overload */; extern PACKAGE void __fastcall RegisterRootSprigType(const TMetaClass* AClass, TMetaClass* ASprigClass)/* overload */; extern PACKAGE void __fastcall RegisterRootSprigType(const TGUIDArray AInterfaces, TMetaClass* ASprigClass)/* overload */; extern PACKAGE TMetaClass* __fastcall FindBestRootSprigClass(TMetaClass* AClass)/* overload */; extern PACKAGE TMetaClass* __fastcall FindBestRootSprigClass(TMetaClass* AClass, TMetaClass* AMinimumSprigClass)/* overload */; extern PACKAGE TRootSprigList* __fastcall RootSprigList(void); } /* namespace Treeintf */ using namespace Treeintf; #pragma option pop // -w- #pragma option pop // -Vx #pragma delphiheader end. //-- end unit ---------------------------------------------------------------- #endif // TreeIntf
[ "bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b" ]
[ [ [ 1, 659 ] ] ]
0cb2be6ff18dbc880a53e0354871a2b617563704
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/python/test/list.cpp
a9d14bf0528b06f96bb790f0589de39f9fc59fe4
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
UTF-8
C++
false
false
2,947
cpp
// Copyright David Abrahams 2002. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include <boost/python/module.hpp> #include <boost/python/def.hpp> #include <boost/python/class.hpp> #include <boost/python/list.hpp> #include <boost/python/make_function.hpp> #include <boost/lexical_cast.hpp> #include <boost/assert.hpp> #include "test_class.hpp" using namespace boost::python; object new_list() { return list(); } list listify(object x) { return list(x); } object listify_string(char const* s) { return list(s); } std::string x_rep(test_class<> const& x) { return "X(" + boost::lexical_cast<std::string>(x.value()) + ")"; } object apply_object_list(object f, list x) { return f(x); } list apply_list_list(object f, list x) { return call<list>(f.ptr(), x); } void append_object(list& x, object y) { x.append(y); } void append_list(list& x, list const& y) { x.append(y); } typedef test_class<> X; int notcmp(object const& x, object const& y) { return y < x ? -1 : y > x ? 1 : 0; } void exercise(list x, object y, object print) { x.append(y); x.append(5); x.append(X(3)); print("after append:"); print(x); print("number of", y, "instances:", x.count(y)); print("number of 5s:", x.count(5)); x.extend("xyz"); print("after extend:"); print(x); print("index of", y, "is:", x.index(y)); print("index of 'l' is:", x.index("l")); x.insert(4, 666); print("after inserting 666:"); print(x); print("inserting with object as index:"); x.insert(x[x.index(5)], "---"); print(x); print("popping..."); x.pop(); print(x); x.pop(x[x.index(5)]); print(x); x.pop(x.index(5)); print(x); print("removing", y); x.remove(y); print(x); print("removing", 666); x.remove(666); print(x); print("reversing..."); x.reverse(); print(x); print("sorted:"); x.pop(2); // make sorting predictable x.sort(); print(x); print("reverse sorted:"); x.sort(&notcmp); print(x); list w; w.append(5); w.append(6); w += "hi"; BOOST_ASSERT(w[0] == 5); BOOST_ASSERT(w[1] == 6); BOOST_ASSERT(w[2] == 'h'); BOOST_ASSERT(w[3] == 'i'); } BOOST_PYTHON_MODULE(list_ext) { def("new_list", new_list); def("listify", listify); def("listify_string", listify_string); def("apply_object_list", apply_object_list); def("apply_list_list", apply_list_list); def("append_object", append_object); def("append_list", append_list); def("exercise", exercise); class_<X>("X", init<int>()) .def( "__repr__", x_rep) ; }
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 145 ] ] ]
af847539e9de9a6a9f843e0e3bb95eebb0b57188
6dac9369d44799e368d866638433fbd17873dcf7
/src/branches/01032005/vfs/jpeg/VFSPlugin_JPEG.h
77d706935ee088a4fc3712ff489227de20f42f46
[]
no_license
christhomas/fusionengine
286b33f2c6a7df785398ffbe7eea1c367e512b8d
95422685027bb19986ba64c612049faa5899690e
refs/heads/master
2020-04-05T22:52:07.491706
2006-10-24T11:21:28
2006-10-24T11:21:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
709
h
#ifndef _VFSPLUGIN_JPEG_H_ #define _VFSPLUGIN_JPEG_H_ #include <vfs/VirtualFS.h> #include <jpeglib.h> class VFSPlugin_JPEG: public VFSPlugin{ protected: /** @var ImageFileInfo *m_fileinfo * @brief Structure to store the image data */ ImageFileInfo *m_fileinfo; jpeg_decompress_struct m_cinfo; jpeg_error_mgr m_jerr; virtual void Setup (void); virtual bool Decode (void); public: VFSPlugin_JPEG (); virtual ~VFSPlugin_JPEG (); virtual FileInfo * Read (unsigned char *buffer, unsigned int length); virtual char * Write (FileInfo *data, unsigned int &length); virtual std::string Type (void); }; #endif // #ifndef _VFSPLUGIN_JPEG_H_
[ "chris_a_thomas@1bf15c89-c11e-0410-aefd-b6ca7aeaabe7" ]
[ [ [ 1, 31 ] ] ]
73e00e38027702a2822193c73666ccc8949ed271
33b5565fb265463ed201c31f38ba3bd305a4e5d9
/FLHook/trunk/src/source/HkUserCmd.cpp
760956c692f765040c10d4d257a1233e70694dfc
[]
no_license
HeIIoween/FLHook-And-88-Flak-m0tah
be1ee2fa0e240c24160dda168b8b23ad6aec2b48
3f0737f7456ef3eed5dd67cfec1b838d32b8b5e1
refs/heads/master
2021-05-07T14:00:34.880461
2011-01-28T00:21:41
2011-01-28T00:21:41
109,712,726
1
0
null
null
null
null
UTF-8
C++
false
false
67,051
cpp
#include "hook.h" #define PRINT_ERROR() { for(uint i = 0; (i < sizeof(wscError)/sizeof(wstring)); i++) PrintUserCmdText(iClientID, wscError[i]); return; } #define PRINT_ERROR_NORETURN() { for(uint i = 0; (i < sizeof(wscError)/sizeof(wstring)); i++) PrintUserCmdText(iClientID, wscError[i]); } #define PRINT_OK() PrintUserCmdText(iClientID, L"OK"); #define PRINT_DISABLED() PrintUserCmdText(iClientID, L"Command disabled"); #define GET_USERFILE(a) string a; { CAccount *acc = Players.FindAccountFromClientID(iClientID); wstring wscDir; HkGetAccountDirName(acc, wscDir); a = scAcctPath + wstos(wscDir) + "\\flhookuser.ini"; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// typedef void (*_UserCmdProc)(uint, wstring); struct USERCMD { wchar_t *wszCmd; _UserCmdProc proc; }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void PrintUserCmdText(uint iClientID, wstring wscText, ...) { wchar_t wszBuf[1024*8] = L""; va_list marker; va_start(marker, wscText); _vsnwprintf(wszBuf, sizeof(wszBuf)-1, wscText.c_str(), marker); wstring wscXML = L"<TRA data=\"" + set_wscUserCmdStyle + L"\" mask=\"-1\"/><TEXT>" + XMLText(wszBuf) + L"</TEXT>"; HkFMsg(iClientID, wscXML); } void PrintUserCmdText(wstring wscCharName, wstring wscText, ...) { wchar_t wszBuf[1024*8] = L""; va_list marker; va_start(marker, wscText); _vsnwprintf(wszBuf, sizeof(wszBuf)-1, wscText.c_str(), marker); wstring wscXML = L"<TRA data=\"" + set_wscUserCmdStyle + L"\" mask=\"-1\"/><TEXT>" + XMLText(wszBuf) + L"</TEXT>"; HkFMsg(wscCharName, wscXML); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void PrintUniverseText(wstring wscText, ...) { wchar_t wszBuf[1024*8] = L""; va_list marker; va_start(marker, wscText); _vsnwprintf(wszBuf, sizeof(wszBuf)-1, wscText.c_str(), marker); wstring wscXML = L"<TRA data=\"" + set_wscAdminCmdStyle + L"\" mask=\"-1\"/><TEXT>" + XMLText(wszBuf) + L"</TEXT>"; HkFMsgU(wscXML); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_SetDieMsg(uint iClientID, wstring wscParam) { if(!set_bUserCmdSetDieMsg) { PRINT_DISABLED(); return; } wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /set diemsg <param>", L"<param>: all,system,self or none", }; wstring wscDieMsg = ToLower(GetParam(wscParam, ' ', 0));; DIEMSGTYPE dieMsg; if(!wscDieMsg.compare(L"all")) dieMsg = DIEMSG_ALL; else if(!wscDieMsg.compare(L"system")) dieMsg = DIEMSG_SYSTEM; else if(!wscDieMsg.compare(L"none")) dieMsg = DIEMSG_NONE; else if(!wscDieMsg.compare(L"self")) dieMsg = DIEMSG_SELF; else PRINT_ERROR(); // save to ini GET_USERFILE(scUserFile); IniWrite(scUserFile, "settings", "DieMsg", itos(dieMsg)); // save in ClientInfo ClientInfo[iClientID].dieMsg = dieMsg; // send confirmation msg PRINT_OK(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_SetDieMsgSize(uint iClientID, wstring wscParam) { if(!set_bUserCmdSetDieMsgSize) { PRINT_DISABLED(); return; } wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /set diemsgsize <size>", L"<size>: small, default", }; wstring wscDieMsgSize = ToLower(GetParam(wscParam, ' ', 0)); // wstring wscDieMsgStyle = ToLower(GetParam(wscParam, ' ', 1)); CHATSIZE dieMsgSize; if(!wscDieMsgSize.compare(L"small")) dieMsgSize = CS_SMALL; else if(!wscDieMsgSize.compare(L"default")) dieMsgSize = CS_DEFAULT; else PRINT_ERROR(); /* CHATSTYLE dieMsgStyle; if(!wscDieMsgStyle.compare(L"default")) dieMsgStyle = CST_DEFAULT; else if(!wscDieMsgStyle.compare(L"bold")) dieMsgStyle = CST_BOLD; else if(!wscDieMsgStyle.compare(L"italic")) dieMsgStyle = CST_ITALIC; else if(!wscDieMsgStyle.compare(L"underline")) dieMsgStyle = CST_UNDERLINE; else PRINT_ERROR(); */ // save to ini GET_USERFILE(scUserFile); IniWrite(scUserFile, "Settings", "DieMsgSize", itos(dieMsgSize)); // IniWrite(scUserFile, "Settings", "DieMsgStyle", itos(dieMsgStyle)); // save in ClientInfo ClientInfo[iClientID].dieMsgSize = dieMsgSize; // ClientInfo[iClientID].dieMsgStyle = dieMsgStyle; // send confirmation msg PRINT_OK(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_SetChatFont(uint iClientID, wstring wscParam) { if(!set_bUserCmdSetChatFont) { PRINT_DISABLED(); return; } wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /set chatfont <size> <style>", L"<size>: small, default or big", L"<style>: default, bold, italic or underline", }; wstring wscChatSize = ToLower(GetParam(wscParam, ' ', 0)); wstring wscChatStyle = ToLower(GetParam(wscParam, ' ', 1)); CHATSIZE chatSize; if(!wscChatSize.compare(L"small")) chatSize = CS_SMALL; else if(!wscChatSize.compare(L"default")) chatSize = CS_DEFAULT; else if(!wscChatSize.compare(L"big")) chatSize = CS_BIG; else PRINT_ERROR(); CHATSTYLE chatStyle; if(!wscChatStyle.compare(L"default")) chatStyle = CST_DEFAULT; else if(!wscChatStyle.compare(L"bold")) chatStyle = CST_BOLD; else if(!wscChatStyle.compare(L"italic")) chatStyle = CST_ITALIC; else if(!wscChatStyle.compare(L"underline")) chatStyle = CST_UNDERLINE; else PRINT_ERROR(); // save to ini GET_USERFILE(scUserFile); IniWrite(scUserFile, "settings", "ChatSize", itos(chatSize)); IniWrite(scUserFile, "settings", "ChatStyle", itos(chatStyle)); // save in ClientInfo ClientInfo[iClientID].chatSize = chatSize; ClientInfo[iClientID].chatStyle = chatStyle; // send confirmation msg PRINT_OK(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_Ignore(uint iClientID, wstring wscParam) { if(!set_bUserCmdIgnore) { PRINT_DISABLED(); return; } wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /ignore <charname> [<flags>]", L"<charname>: character name which should be ignored(case insensitive)", L"<flags>: combination of the following flags:", L" p - only affect private chat", L" i - <charname> may match partially", L"Examples:", L"\"/ignore SomeDude\" ignores all chatmessages from SomeDude", L"\"/ignore PlayerX p\" ignores all private-chatmessages from PlayerX", L"\"/ignore idiot i\" ignores all chatmessages from players whose charname contain \"idiot\" (e.g. \"[XYZ]IDIOT\", \"MrIdiot\", etc)", L"\"/ignore Fool pi\" ignores all private-chatmessages from players whose charname contain \"fool\"", }; wstring wscAllowedFlags = L"pi"; wstring wscCharname = GetParam(wscParam, ' ', 0); wstring wscFlags = ToLower(GetParam(wscParam, ' ', 1)); if(!wscCharname.length()) PRINT_ERROR(); // check if flags are valid for(uint i = 0; (i < wscFlags.length()); i++) { if(wscAllowedFlags.find_first_of(wscFlags[i]) == -1) PRINT_ERROR(); } if(ClientInfo[iClientID].lstIgnore.size() > set_iUserCmdMaxIgnoreList) { PrintUserCmdText(iClientID, L"Error: Too many entries in the ignore list, please delete an entry first!"); return; } // save to ini GET_USERFILE(scUserFile); IniWriteW(scUserFile, "IgnoreList", itos((int)ClientInfo[iClientID].lstIgnore.size() + 1), (wscCharname + L" " + wscFlags)); // save in ClientInfo IGNORE_INFO ii; ii.wscCharname = wscCharname; ii.wscFlags = wscFlags; ClientInfo[iClientID].lstIgnore.push_back(ii); // send confirmation msg PRINT_OK(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_IgnoreID(uint iClientID, wstring wscParam) { if(!set_bUserCmdIgnore) { PRINT_DISABLED(); return; } wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /ignoreid <client-id> [<flags>]", L"<client-id>: client-id of character which should be ignored", L"<flags>: if \"p\"(without quotation marks) then only affect private chat", }; wstring wscClientID = GetParam(wscParam, ' ', 0); wstring wscFlags = ToLower(GetParam(wscParam, ' ', 1)); if(!wscClientID.length()) PRINT_ERROR(); if(wscFlags.length() && wscFlags.compare(L"p") != 0) PRINT_ERROR(); if(ClientInfo[iClientID].lstIgnore.size() > set_iUserCmdMaxIgnoreList) { PrintUserCmdText(iClientID, L"Error: Too many entries in the ignore list, please delete an entry first!"); return; } uint iClientIDTarget = ToInt(wscClientID); if(!HkIsValidClientID(iClientIDTarget) || HkIsInCharSelectMenu(iClientIDTarget)) { PrintUserCmdText(iClientID, L"Error: Invalid client-id"); return; } wstring wscCharname = Players.GetActiveCharacterName(iClientIDTarget); // save to ini GET_USERFILE(scUserFile); IniWriteW(scUserFile, "IgnoreList", itos((int)ClientInfo[iClientID].lstIgnore.size() + 1), (wscCharname + L" " + wscFlags)); // save in ClientInfo IGNORE_INFO ii; ii.wscCharname = wscCharname; ii.wscFlags = wscFlags; ClientInfo[iClientID].lstIgnore.push_back(ii); // send confirmation msg PrintUserCmdText(iClientID, L"OK, \"%s\" added to ignore list", wscCharname.c_str()); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_IgnoreList(uint iClientID, wstring wscParam) { if(!set_bUserCmdIgnore) { PRINT_DISABLED(); return; } PrintUserCmdText(iClientID, L"ID | Charactername | Flags"); int i = 1; foreach(ClientInfo[iClientID].lstIgnore, IGNORE_INFO, it) { PrintUserCmdText(iClientID, L"%.2u | %s | %s", i, it->wscCharname.c_str(), it->wscFlags.c_str()); i++; } // send confirmation msg PRINT_OK(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_DelIgnore(uint iClientID, wstring wscParam) { if(!set_bUserCmdIgnore) { PRINT_DISABLED(); return; } wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /delignore <id> [<id2> <id3> ...]", L"<id>: id of ignore-entry(see /ignorelist) or *(delete all)", }; wstring wscID = GetParam(wscParam, ' ', 0); if(!wscID.length()) PRINT_ERROR(); GET_USERFILE(scUserFile); if(!wscID.compare(L"*")) { // delete all IniDelSection(scUserFile, "IgnoreList"); ClientInfo[iClientID].lstIgnore.clear(); PRINT_OK(); return; } list<uint> lstDelete; for(uint j = 1; wscID.length(); j++) { uint iID = _wtoi(wscID.c_str()); if(!iID || (iID > ClientInfo[iClientID].lstIgnore.size())) { PrintUserCmdText(iClientID, L"Error: Invalid ID"); return; } lstDelete.push_back(iID); wscID = GetParam(wscParam, ' ', j); } lstDelete.sort(greater<uint>()); ClientInfo[iClientID].lstIgnore.reverse(); foreach(lstDelete, uint, it) { uint iCurID = (uint)ClientInfo[iClientID].lstIgnore.size(); foreach(ClientInfo[iClientID].lstIgnore, IGNORE_INFO, it2) { if(iCurID == (*it)) { ClientInfo[iClientID].lstIgnore.erase(it2); break; } iCurID--; } } ClientInfo[iClientID].lstIgnore.reverse(); // send confirmation msg IniDelSection(scUserFile, "IgnoreList"); int i = 1; foreach(ClientInfo[iClientID].lstIgnore, IGNORE_INFO, it3) { IniWriteW(scUserFile, "IgnoreList", itos(i), ((*it3).wscCharname + L" " + (*it3).wscFlags)); i++; } PRINT_OK(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_AutoBuy(uint iClientID, wstring wscParam) { if(!set_bUserCmdAutoBuy) { PRINT_DISABLED(); return; } wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /autobuy <on|off>", }; wscParam = ToLower(Trim(wscParam)); if(wscParam == L"off") { GET_USERFILE(scUserFile); wstring wscFilename; HkGetCharFileName(ARG_CLIENTID(iClientID), wscFilename); string scSection = "autobuy_" + wstos(wscFilename); ClientInfo[iClientID].lstAutoBuyItems.clear(); IniDelSection(scUserFile, scSection); PRINT_OK(); } else if(wscParam == L"on") { GET_USERFILE(scUserFile); wstring wscFilename; HkGetCharFileName(ARG_CLIENTID(iClientID), wscFilename); string scSection = "autobuy_" + wstos(wscFilename); ClientInfo[iClientID].lstAutoBuyItems.clear(); IniDelSection(scUserFile, scSection); list<CARGO_INFO> lstCargo; HkEnumCargo(ARG_CLIENTID(iClientID), lstCargo, 0); list<AUTOBUY_CARTITEM> lstItems; foreach(lstCargo, CARGO_INFO, cargo) { if(!cargo->bMounted) { //check for item in list so far bool bFoundItem = false; foreach(lstItems, AUTOBUY_CARTITEM, item) { if(item->iArchID == cargo->iArchID) { item->iCount++; IniWrite(scUserFile, scSection, utos(item->iArchID), utos(item->iCount)); bFoundItem = true; break; } } if(!bFoundItem) //Not in existing list { IniWrite(scUserFile, scSection, utos(cargo->iArchID), utos(cargo->iCount)); AUTOBUY_CARTITEM item; item.iArchID = cargo->iArchID; item.iCount = cargo->iCount; lstItems.push_back(item); } } } if(lstItems.size()) { ClientInfo[iClientID].lstAutoBuyItems = lstItems; PRINT_OK(); } else PrintUserCmdText(iClientID, L"Error: no unmounted items found"); } else PRINT_ERROR(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_IDs(uint iClientID, wstring wscParam) { wchar_t wszLine[128] = L""; list<HKPLAYERINFO> lstPlayers = HkGetPlayers(); foreach(lstPlayers, HKPLAYERINFO, i) { wchar_t wszBuf[1024]; swprintf(wszBuf, L"%s = %u | ", (*i).wscCharname.c_str(), (*i).iClientID); if((wcslen(wszBuf) + wcslen(wszLine)) >= sizeof(wszLine)/2) { PrintUserCmdText(iClientID, L"%s", wszLine); wcscpy(wszLine, wszBuf); } else wcscat(wszLine, wszBuf); } if(wcslen(wszLine)) PrintUserCmdText(iClientID, L"%s", wszLine); PrintUserCmdText(iClientID, L"OK"); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_ID(uint iClientID, wstring wscParam) { PrintUserCmdText(iClientID, L"Your client-id: %u", iClientID); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_Invite(uint iClientID, wstring wscParam) { HK_ERROR inviteError = HkInviteToGroup(wscParam, ARG_CLIENTID(iClientID)); if(!HKHKSUCCESS(inviteError)) { PrintUserCmdText(iClientID, L"Error: " + HkErrGetText(inviteError)); } } void UserCmd_InviteID(uint iClientID, wstring wscParam) { wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /i$ <client-id>", }; wstring wscClientID = GetParam(wscParam, ' ', 0); if(!wscClientID.length()) PRINT_ERROR(); uint iClientIDTarget = ToInt(wscClientID); if(!HkIsValidClientID(iClientIDTarget) || HkIsInCharSelectMenu(iClientIDTarget)) { PrintUserCmdText(iClientID, L"Error: Invalid client-id"); return; } HK_ERROR inviteError = HkInviteToGroup(ARG_CLIENTID(iClientIDTarget), ARG_CLIENTID(iClientID)); if(!HKHKSUCCESS(inviteError)) { PrintUserCmdText(iClientID, L"Error: " + HkErrGetText(inviteError)); } } void UserCmd_InviteAll(uint iClientID, wstring wscParam) { wstring wscError[] = { L"Error: No players found", L"Usage: /ia [name part]", }; //wstring wscCharname = Players.GetActiveCharacterName(iClientID); uint iGroupID, iNumInvites = 0; HkGetGroupID(ARG_CLIENTID(iClientID), iGroupID); if(wscParam.length()) //part of a name has been passed { struct PlayerData *pPD = 0; while(pPD = Players.traverse_active(pPD)) { uint iClientIDinvite = HkGetClientIdFromPD(pPD); const wchar_t *wszCharname = Players.GetActiveCharacterName(iClientIDinvite); if(!wszCharname) continue; wstring wscCharnameInvite = wszCharname; if(ToLower(wscCharnameInvite).find(ToLower(wscParam)) != -1) { uint iGroupIDinvite; HkGetGroupID(wscCharnameInvite, iGroupIDinvite); if((!iGroupIDinvite || iGroupIDinvite!=iGroupID) && iClientID!=iClientIDinvite) { HK_ERROR inviteError = HkInviteToGroup(wscCharnameInvite, ARG_CLIENTID(iClientID)); if(!HKHKSUCCESS(inviteError)) { PrintUserCmdText(iClientID, HkErrGetText(inviteError) + L" on inviting " + wscCharnameInvite); } else { iNumInvites++; } } } } } else //invite all players on server { struct PlayerData *pPD = 0; while(pPD = Players.traverse_active(pPD)) { uint iClientIDinvite = HkGetClientIdFromPD(pPD); const wchar_t *wszCharname = Players.GetActiveCharacterName(iClientIDinvite); if(!wszCharname) continue; wstring wscCharnameInvite = wszCharname; uint iGroupIDinvite; HkGetGroupID(wscCharnameInvite, iGroupIDinvite); if((!iGroupIDinvite || iGroupIDinvite!=iGroupID) && iClientID!=iClientIDinvite) { HK_ERROR inviteError = HkInviteToGroup(wscCharnameInvite, ARG_CLIENTID(iClientID)); if(!HKHKSUCCESS(inviteError)) { PrintUserCmdText(iClientID, HkErrGetText(inviteError) + L" on inviting " + wscCharnameInvite); } else { iNumInvites++; } } } } if(!iNumInvites) PRINT_ERROR(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_Cloak(uint iClientID, wstring wscParam) { uint iShip = 0; pub::Player::GetShip(iClientID, iShip); if(!iShip) { PrintUserCmdText(iClientID, L"Error: You are docked."); return; } if (ClientInfo[iClientID].bCanCloak) { mstime tmTimeNow = timeInMS(); if (!ClientInfo[iClientID].bCloaked && !ClientInfo[iClientID].bIsCloaking) { if(ClientInfo[iClientID].bWantsCloak) PrintUserCmdText(iClientID, L"Time remaining until cloak: %i seconds", (int)((ClientInfo[iClientID].iCloakWarmup - (tmTimeNow - ClientInfo[iClientID].tmCloakTime))/1000.0f+0.5f)); else if((tmTimeNow - ClientInfo[iClientID].tmCloakTime) > ClientInfo[iClientID].iCloakCooldown) { ClientInfo[iClientID].tmCloakTime = tmTimeNow; ClientInfo[iClientID].bWantsCloak = true; PrintUserCmdText(iClientID, L"Preparing to cloak..."); if(set_bDropShieldsCloak) pub::SpaceObj::DrainShields(Players[iClientID].iSpaceObjID); } else PrintUserCmdText(iClientID, L"Your cloak has not cooled down. Time remaining: %i seconds", (int)((ClientInfo[iClientID].iCloakCooldown - (tmTimeNow - ClientInfo[iClientID].tmCloakTime))/1000.0f+0.5f)); } else PrintUserCmdText(iClientID, L"You are already cloaked. Time remaining: %i seconds", ClientInfo[iClientID].iCloakingTime ? (int)((ClientInfo[iClientID].iCloakingTime - (tmTimeNow - ClientInfo[iClientID].tmCloakTime))/1000.0f+0.5f) : 0); } else PrintUserCmdText(iClientID, L"Error: Your ship does not have a Cloaking Device."); } void UserCmd_UnCloak(uint iClientID, wstring wscParam) { uint iShip = 0; pub::Player::GetShip(iClientID, iShip); if(!iShip) { PrintUserCmdText(iClientID, L"Error: You are docked."); return; } if (ClientInfo[iClientID].bCanCloak) { if (!HKHKSUCCESS(HkUnCloak(iClientID))) PrintUserCmdText(iClientID, L"Error."); } else PrintUserCmdText(iClientID, L"Error: Your ship does not have a Cloaking Device."); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_Rename(uint iClientID, wstring wscParam) { wchar_t wszChargeAmount[72]; swprintf(wszChargeAmount, L"Renames are subject to a %i credit charge", set_iRenameCmdCharge); wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /rename <new charname>", wszChargeAmount, }; if(set_iRenameCmdCharge == -1)//Command has been disabled { PRINT_DISABLED(); return; } if(!wscParam.length())//User hasn't entered any params { PRINT_ERROR(); return; } wstring wscCharName = (Players.GetActiveCharacterName(iClientID)); int cashAmount=0; HkGetCash(ARG_CLIENTID(iClientID), cashAmount); if(cashAmount>=set_iRenameCmdCharge) { if(wscParam.find(' ',0)!=-1) { PrintUserCmdText(iClientID, L"Error: Character names must not have spaces in them."); return; } HK_ERROR renameError = HkRename(ARG_CLIENTID(iClientID), wscParam, false); if(!HKHKSUCCESS(renameError)) { if(renameError==HKE_CHARNAME_ALREADY_EXISTS) { PrintUserCmdText(iClientID, L"Error: Specified character already exists. Choose a different name."); } else if(renameError==HKE_CHARNAME_TOO_LONG) { PrintUserCmdText(iClientID, L"Error: Specified character name is too lomg. Choose a different name."); } else if(renameError==HKE_CHARNAME_TOO_SHORT) { PrintUserCmdText(iClientID, L"Error: Specified character name is too short. Choose a different name."); } else { PRINT_ERROR(); } } else { HkAddCash(wscParam, -set_iRenameCmdCharge); PrintUniverseText(wscCharName + L" is now known as " + wscParam); } } else { PrintUserCmdText(iClientID, L"Error: Not enough cash, 500,000 credits required for rename."); } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_SendCash(uint iClientID, wstring wscParam) { if(set_fSendCashTax == -1.0f)//command has been disabled { PRINT_DISABLED(); return; } wchar_t wszTaxAmount[72]; swprintf(wszTaxAmount, L"Transfers are subject to a %f percent tax paid by the sender", set_fSendCashTax); wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /sendcash <charname> <amount>", wszTaxAmount, }; uint iTimePlayed; if(!HKHKSUCCESS(HkGetTimePlayed(ARG_CLIENTID(iClientID), iTimePlayed))) { PrintUserCmdText(iClientID, L"Error: could not get time played"); return; } if(set_iSendCashTime>0 && iTimePlayed<(uint)set_iSendCashTime*60) { PrintUserCmdText(iClientID, L"Error: you must play for at least %i minutes before being able to use /sendcash", set_iSendCashTime); return; } wstring targetChar = GetParam(wscParam, ' ', 0); wstring amountS = GetParam(wscParam, ' ', 1); if(!targetChar.length() || !amountS.length()) { PRINT_ERROR(); } else { wstring wscCharName = (Players.GetActiveCharacterName(iClientID)); int amount = ToInt(amountS); if(amount<=0) { PrintUserCmdText(iClientID, L"Error: You cannot transfer negative or zero amounts of money."); return; } int availCash = 0; HK_ERROR cashError = HkGetCash(ARG_CLIENTID(iClientID), availCash); if(!HKHKSUCCESS(cashError)) { PrintUserCmdText(iClientID, L"Error: Cannot check amount of cash available."); } else { if(amount*(1.0f+(set_fSendCashTax/100.0f)) > availCash) { PrintUserCmdText(iClientID, L"Error: You do not have the necessary funds available for the transfer."); } else { cashError = HkAddCash(targetChar, amount); if(!HKHKSUCCESS(cashError)) { if(cashError==HKE_NO_CHAR_SELECTED) { PrintUserCmdText(iClientID, L"Error: The target account is at the character selection screen. Try again when they have completely logged on."); } else if(cashError==HKE_CHAR_DOES_NOT_EXIST) { PrintUserCmdText(iClientID, L"Error: The specified character does not exist."); } else if(cashError==HKE_COULD_NOT_DECODE_CHARFILE) { PrintUserCmdText(iClientID, L"Error: The specified character's file could not be decoded."); } else { PrintUserCmdText(iClientID, L"Error: unspecified."); } } else { cashError = HkAddCash(ARG_CLIENTID(iClientID), (int)(-(amount*(1.0f+(set_fSendCashTax/100.0f))))); if(!HKHKSUCCESS(cashError)) { PrintUserCmdText(iClientID, L"Error: The money could not be subtracted from your balance. Oh noes!"); //This really shouldn't happen, but if it does, retract the money sent to the other char. cashError = HkAddCash(targetChar, -amount); PrintUserCmdText(targetChar, wscCharName + L" tried to send you money but the transfer failed."); PrintUserCmdText(iClientID, L"Transfer failed."); } else { PRINT_OK(); PrintUserCmdText(targetChar, L"You have been sent %u credit(s) by " + wscCharName + L".", amount); } } } } } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_SendCashID(uint iClientID, wstring wscParam) { if(set_fSendCashTax == -1.0f)//command has been disabled { PRINT_DISABLED(); return; } wchar_t wszTaxAmount[72]; swprintf(wszTaxAmount, L"Transfers are subject to a %f percent tax paid by the sender", set_fSendCashTax); wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /sendcash <charname> <amount>", wszTaxAmount, }; wstring targetChar = GetParam(wscParam, ' ', 0); wstring amountS = GetParam(wscParam, ' ', 1); if(!targetChar.length() || !amountS.length()) { PRINT_ERROR(); } else { wstring wscCharName = (Players.GetActiveCharacterName(iClientID)); int amount = ToInt(amountS); if(amount<=0) { PrintUserCmdText(iClientID, L"Error: You cannot transfer negative or zero amounts of money."); return; } if(!HkIsValidClientID(ToInt(targetChar))) { PrintUserCmdText(iClientID, L"Error: Invalid client-id specified."); return; } targetChar = (Players.GetActiveCharacterName(ToInt(targetChar))); int availCash = 0; HK_ERROR cashError = HkGetCash(ARG_CLIENTID(iClientID), availCash); if(!HKHKSUCCESS(cashError)) { PrintUserCmdText(iClientID, L"Error: Cannot check amount of cash available."); } else { if(amount*(1.0f+(set_fSendCashTax/100.0f)) > availCash) { PrintUserCmdText(iClientID, L"Error: You do not have the necessary funds available for the transfer."); } else { cashError = HkAddCash(targetChar, amount); if(!HKHKSUCCESS(cashError)) { if(cashError==HKE_NO_CHAR_SELECTED) { PrintUserCmdText(iClientID, L"Error: The target account is at the character selection screen. Try again when they have completely logged on."); } else if(cashError==HKE_CHAR_DOES_NOT_EXIST) { PrintUserCmdText(iClientID, L"Error: The specified character does not exist."); } else if(cashError==HKE_COULD_NOT_DECODE_CHARFILE) { PrintUserCmdText(iClientID, L"Error: The specified character's file could not be decoded."); } else { PrintUserCmdText(iClientID, L"Error: unspecified."); } } else { cashError = HkAddCash(ARG_CLIENTID(iClientID), (int)(-(amount*(1.0f+(set_fSendCashTax/100.0f))))); if(!HKHKSUCCESS(cashError)) { PrintUserCmdText(iClientID, L"Error: The money could not be subtracted from your balance. Oh noes!"); //This really shouldn't happen, but if it does, retract the money sent to the other char. cashError = HkAddCash(targetChar, -amount); PrintUserCmdText(targetChar, wscCharName + L" tried to send you money but the transfer failed."); PrintUserCmdText(iClientID, L"Transfer failed."); } else { PRINT_OK(); PrintUserCmdText(targetChar, L"You have been sent %u credit(s) by " + wscCharName + L".", amount); } } } } } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_Afk(uint iClientID, wstring wscParam) { if(wscParam.length()) { ClientInfo[iClientID].wscAfkMsg = wscParam; PrintUserCmdText(iClientID, L"AFK message set"); } else { if(!ClientInfo[iClientID].wscAfkMsg.size()) { ClientInfo[iClientID].wscAfkMsg = L"I'm away from my keyboard right now."; PrintUserCmdText(iClientID, L"AFK message set"); } else { ClientInfo[iClientID].wscAfkMsg = L""; PrintUserCmdText(iClientID, L"AFK message unset"); } } ClientInfo[iClientID].iSentIds.clear(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_ShieldsDown(uint iClientID, wstring wscParam) { uint iShip; pub::Player::GetShip(iClientID, iShip); bool bHasShields; float fShieldHealth, fMaxShieldHealth; pub::SpaceObj::GetShieldHealth(iShip, fShieldHealth, fMaxShieldHealth, bHasShields); if(!bHasShields) { PrintUserCmdText(iClientID, L"Error: no shields present"); return; } if(!fShieldHealth) { PrintUserCmdText(iClientID, L"Error: shields already down"); return; } ClientInfo[iClientID].fShieldHealth = fShieldHealth; pub::SpaceObj::DrainShields(iShip); ClientInfo[iClientID].tmShieldsDownCmd = timeInMS(); PRINT_OK(); } void UserCmd_ShieldsUp(uint iClientID, wstring wscParam) { if(!ClientInfo[iClientID].fShieldHealth) { PrintUserCmdText(iClientID, L"Error: shields down command not previously used"); return; } if(timeInMS()-ClientInfo[iClientID].tmShieldsDownCmd > ((mstime)set_iShieldsUpTime)*1000) { PrintUserCmdText(iClientID, L"Error: you must use the shieldsup command within %u seconds of using the shieldsdown command", set_iShieldsUpTime); return; } uint iShip; pub::Player::GetShip(iClientID, iShip); HkSetShieldHealth(iShip, DC_HOOK, ClientInfo[iClientID].fShieldHealth); ClientInfo[iClientID].fShieldHealth = 0.0f; PRINT_OK(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_MarkObj(uint iClientID, wstring wscParam) { uint iShip, iTargetShip; pub::Player::GetShip(iClientID, iShip); pub::SpaceObj::GetTarget(iShip, iTargetShip); char err = HkMarkObject(iClientID, iTargetShip); switch(err) { case 0: //PRINT_OK() break; case 1: PrintUserCmdText(iClientID, L"Error: you must have something targeted to mark it."); break; case 2: PrintUserCmdText(iClientID, L"Error: you cannot mark cloaked ships."); break; case 3: PrintUserCmdText(iClientID, L"Error: object is already marked."); default: break; } } void UserCmd_UnMarkObj(uint iClientID, wstring wscParam) { uint iShip, iTargetShip; pub::Player::GetShip(iClientID, iShip); pub::SpaceObj::GetTarget(iShip, iTargetShip); char err = HkUnMarkObject(iClientID, iTargetShip); switch(err) { case 0: //PRINT_OK() break; case 1: PrintUserCmdText(iClientID, L"Error: you must have something targeted to unmark it."); break; case 2: PrintUserCmdText(iClientID, L"Error: object is not marked."); default: break; } } void UserCmd_UnMarkAllObj(uint iClientID, wstring wscParam) { HkUnMarkAllObjects(iClientID); //PRINT_OK() } void UserCmd_MarkObjGroup(uint iClientID, wstring wscParam) { uint iShip, iTargetShip; pub::Player::GetShip(iClientID, iShip); pub::SpaceObj::GetTarget(iShip, iTargetShip); if(!iTargetShip) { PrintUserCmdText(iClientID, L"Error: you must have something targeted to mark it."); return; } vector<uint> vMembers; char szBuf[1024] = ""; pub::Player::GetGroupMembers(iClientID, *((vector<uint>*)szBuf)); vMembers = *((vector<uint>*)szBuf); for(uint i = 0 ; (i < vMembers.size()); i++) { if(ClientInfo[vMembers[i]].bIgnoreGroupMark) continue; uint iClientShip; pub::Player::GetShip(vMembers[i], iClientShip); if(iClientShip == iTargetShip) continue; HkMarkObject(vMembers[i], iTargetShip); } //PRINT_OK() } void UserCmd_UnMarkObjGroup(uint iClientID, wstring wscParam) { uint iShip, iTargetShip; pub::Player::GetShip(iClientID, iShip); pub::SpaceObj::GetTarget(iShip, iTargetShip); if(!iTargetShip) { PrintUserCmdText(iClientID, L"Error: you must have something targeted to mark it."); return; } vector<uint> vMembers; char szBuf[1024] = ""; pub::Player::GetGroupMembers(iClientID, *((vector<uint>*)szBuf)); vMembers = *((vector<uint>*)szBuf); for(uint i = 0 ; (i < vMembers.size()); i++) { HkUnMarkObject(vMembers[i], iTargetShip); } //PRINT_OK() } void UserCmd_SetIgnoreGroupMark(uint iClientID, wstring wscParam) { wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /ignoregroupmarks <on|off>", }; if(ToLower(wscParam) == L"off") { ClientInfo[iClientID].bIgnoreGroupMark = false; wstring wscDir, wscFilename; CAccount *acc = Players.FindAccountFromClientID(iClientID); if(HKHKSUCCESS(HkGetCharFileName(ARG_CLIENTID(iClientID), wscFilename)) && HKHKSUCCESS(HkGetAccountDirName(acc, wscDir))) { string scUserFile = scAcctPath + wstos(wscDir) + "\\flhookuser.ini"; string scSection = "general_" + wstos(wscFilename); IniWrite(scUserFile, scSection, "automarkenabled", "no"); PrintUserCmdText(iClientID, L"Accepting marks from the group"); } } else if(ToLower(wscParam) == L"on") { ClientInfo[iClientID].bIgnoreGroupMark = true; wstring wscDir, wscFilename; CAccount *acc = Players.FindAccountFromClientID(iClientID); if(HKHKSUCCESS(HkGetCharFileName(ARG_CLIENTID(iClientID), wscFilename)) && HKHKSUCCESS(HkGetAccountDirName(acc, wscDir))) { string scUserFile = scAcctPath + wstos(wscDir) + "\\flhookuser.ini"; string scSection = "general_" + wstos(wscFilename); IniWrite(scUserFile, scSection, "automarkenabled", "yes"); PrintUserCmdText(iClientID, L"Ignoring marks from the group"); } } else { PRINT_ERROR(); } } void UserCmd_AutoMark(uint iClientID, wstring wscParam) { if(set_fAutoMarkRadius<=0.0f) //automarking disabled { PRINT_DISABLED(); return; } wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /automark <on|off> [radius in KM]", }; wstring wscEnabled = ToLower(GetParam(wscParam, ' ', 0)); if(!wscParam.length() || (wscEnabled!=L"on" && wscEnabled!=L"off")) { PRINT_ERROR(); return; } wstring wscRadius = GetParam(wscParam, ' ', 1); float fRadius = 0.0f; if(wscRadius.length()) { fRadius = ToFloat(wscRadius); } //I think this section could be done better, but I can't think of it now.. if(!ClientInfo[iClientID].bMarkEverything) { if(wscRadius.length()) ClientInfo[iClientID].fAutoMarkRadius = fRadius*1000; if(wscEnabled==L"on") //AutoMark is being enabled { ClientInfo[iClientID].bMarkEverything = true; CAccount *acc = Players.FindAccountFromClientID(iClientID); wstring wscDir, wscFilename; if(HKHKSUCCESS(HkGetCharFileName(ARG_CLIENTID(iClientID), wscFilename)) && HKHKSUCCESS(HkGetAccountDirName(acc, wscDir))) { string scUserFile = scAcctPath + wstos(wscDir) + "\\flhookuser.ini"; string scSection = "general_" + wstos(wscFilename); IniWrite(scUserFile, scSection, "automark", "yes"); if(wscRadius.length()) IniWrite(scUserFile, scSection, "automarkradius", ftos(ClientInfo[iClientID].fAutoMarkRadius)); } PrintUserCmdText(iClientID, L"Automarking turned on within a %g KM radius", ClientInfo[iClientID].fAutoMarkRadius/1000); } else if(wscRadius.length()) { CAccount *acc = Players.FindAccountFromClientID(iClientID); wstring wscDir, wscFilename; if(HKHKSUCCESS(HkGetCharFileName(ARG_CLIENTID(iClientID), wscFilename)) && HKHKSUCCESS(HkGetAccountDirName(acc, wscDir))) { string scUserFile = scAcctPath + wstos(wscDir) + "\\flhookuser.ini"; string scSection = "general_" + wstos(wscFilename); IniWrite(scUserFile, scSection, "automarkradius", ftos(ClientInfo[iClientID].fAutoMarkRadius)); } PrintUserCmdText(iClientID, L"Radius changed to %g KMs", fRadius); } } else { if(wscRadius.length()) ClientInfo[iClientID].fAutoMarkRadius = fRadius*1000; if(wscEnabled==L"off") //AutoMark is being disabled { ClientInfo[iClientID].bMarkEverything = false; CAccount *acc = Players.FindAccountFromClientID(iClientID); wstring wscDir, wscFilename; if(HKHKSUCCESS(HkGetCharFileName(ARG_CLIENTID(iClientID), wscFilename)) && HKHKSUCCESS(HkGetAccountDirName(acc, wscDir))) { string scUserFile = scAcctPath + wstos(wscDir) + "\\flhookuser.ini"; string scSection = "general_" + wstos(wscFilename); IniWrite(scUserFile, scSection, "automark", "no"); if(wscRadius.length()) IniWrite(scUserFile, scSection, "automarkradius", ftos(ClientInfo[iClientID].fAutoMarkRadius)); } if(wscRadius.length()) PrintUserCmdText(iClientID, L"Automarking turned off; radius changed to %g KMs", ClientInfo[iClientID].fAutoMarkRadius/1000); else PrintUserCmdText(iClientID, L"Automarking turned off"); } else if(wscRadius.length()) { CAccount *acc = Players.FindAccountFromClientID(iClientID); wstring wscDir, wscFilename; if(HKHKSUCCESS(HkGetCharFileName(ARG_CLIENTID(iClientID), wscFilename)) && HKHKSUCCESS(HkGetAccountDirName(acc, wscDir))) { string scUserFile = scAcctPath + wstos(wscDir) + "\\flhookuser.ini"; string scSection = "general_" + wstos(wscFilename); IniWrite(scUserFile, scSection, "automarkradius", ftos(ClientInfo[iClientID].fAutoMarkRadius)); } PrintUserCmdText(iClientID, L"Radius changed to %g KMs", fRadius); } } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_BotCombat(uint iClientID, wstring wscParam) { wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /botcombat <on|off>", }; if(!set_bFlakVersion) { PRINT_DISABLED(); } else { wscParam = Trim(wscParam); if(ToLower(wscParam)==L"on") { HkSetRep(ARG_CLIENTID(iClientID), L"fc_uk_grp", -0.9f); PRINT_OK(); } else if(ToLower(wscParam)==L"off") { HkSetRep(ARG_CLIENTID(iClientID), L"fc_uk_grp", 0.9f); PRINT_OK(); } else { PRINT_ERROR(); } } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_Dock(uint iClientID, wstring wscParam) { if(set_iMobileDockRadius == -1) { PRINT_DISABLED(); return; } wstring wscError[] = { L"Error: Could not dock", L"Usage: /dock", }; uint iShip, iDockTarget; pub::Player::GetShip(iClientID, iShip); if(!iShip) { PrintUserCmdText(iClientID, L"Error: you are already docked"); return; } pub::SpaceObj::GetTarget(iShip, iDockTarget); if(((uint)(iDockTarget/1000000000))) //trying to dock at solar { PrintUserCmdText(iClientID, L"Error: you must use /dock on players"); return; } pub::Player::SendNNMessage(iClientID, pub::GetNicknameId("dock")); HkIServerImpl::RequestEvent(0, iShip, iDockTarget, 0, 0, iClientID); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_Transfer(uint iClientID, wstring wscParam) { if(set_iTransferCmdCharge == -1) { PRINT_DISABLED(); return; } wchar_t wszChargeAmount[72]; swprintf(wszChargeAmount, L"Transfers are subject to a %i credit charge", set_iTransferCmdCharge); wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /transfer <charname> <item>", wszChargeAmount, }; wstring wscTargetChar = GetParam(wscParam, ' ', 0); wstring wscItem = GetParamToEnd(wscParam, ' ', 1); if(!wscTargetChar.length() || !wscItem.length()) { PRINT_ERROR(); } else { int iCash; HkGetCash(ARG_CLIENTID(iClientID), iCash); if(set_iTransferCmdCharge > iCash) { PrintUserCmdText(iClientID, L"Error: you do not have enough cash for the transfer"); return; } uint iTargetClientID = ToUint(wscTargetChar); ushort iItemID = ToUint(wscItem); list<CARGO_INFO> lstCargo; HkEnumCargo(ARG_CLIENTID(iClientID), lstCargo, 0); bool bFoundItem = false; if(iItemID) { foreach(lstCargo, CARGO_INFO, cargo) { if(!cargo->bMounted && cargo->iID == iItemID) { const GoodInfo *gi = GoodList::find_by_id(cargo->iArchID); bool bMultiCount; memcpy(&bMultiCount, (char*)gi + 0x70, 1); if(!bMultiCount) { UINT_WRAP uw = UINT_WRAP(cargo->iArchID); if(set_btNoTrade->Find(&uw)) { PrintUserCmdText(iClientID, L"Error: item is not intended to be traded."); } else { wstring wscCargo = L""; HK_ERROR errAdd = HkAddCargo(wscTargetChar, cargo->iArchID, 1, false); switch(errAdd) { case HKE_OK: wscCargo = HkGetWStringFromIDS(gi->iIDS); HkRemoveCargo(ARG_CLIENTID(iClientID), cargo->iID, 1); HkAddCash(ARG_CLIENTID(iClientID), -set_iTransferCmdCharge); PRINT_OK(); PrintUserCmdText(wscTargetChar, L"You have received " + wstring(wscCargo[0]==L'A' || wscCargo[0]==L'E' || wscCargo[0]==L'I' || wscCargo[0]==L'O' || wscCargo[0]==L'U' ? L"an " : L"a ") + wscCargo + L" from " + Players.GetActiveCharacterName(iClientID) + L"."); break; case HKE_CHAR_DOES_NOT_EXIST: PrintUserCmdText(iClientID, L"Error: specified character does not exist"); break; case HKE_NO_CHAR_SELECTED: PrintUserCmdText(iClientID, L"Error: specified player is at the login screen - wait until they completely log in"); break; case HKE_CARGO_WONT_FIT: PrintUserCmdText(iClientID, L"Error: specified character does not have enough room in their cargo hold to accomodate the item"); break; default: PrintUserCmdText(iClientID, L"Error: unknown"); } } bFoundItem = true; break; } } } } else { wscItem = ToLower(wscItem); foreach(lstCargo, CARGO_INFO, cargo) { if(!cargo->bMounted) { const GoodInfo *gi = GoodList::find_by_id(cargo->iArchID); bool bMultiCount; memcpy(&bMultiCount, (char*)gi + 0x70, 1); if(!bMultiCount) { wstring wscCargo = HkGetWStringFromIDS(gi->iIDS); if(wscItem == ToLower(wscCargo)) { UINT_WRAP uw = UINT_WRAP(cargo->iArchID); if(set_btNoTrade->Find(&uw)) { PrintUserCmdText(iClientID, L"Error: item is not intended to be traded."); } else { HK_ERROR errAdd = HkAddCargo(wscTargetChar, cargo->iArchID, 1, false); switch(errAdd) { case HKE_OK: HkRemoveCargo(ARG_CLIENTID(iClientID), cargo->iID, 1); HkAddCash(ARG_CLIENTID(iClientID), -set_iTransferCmdCharge); PRINT_OK(); PrintUserCmdText(wscTargetChar, L"You have received " + wstring(wscCargo[0]==L'A' || wscCargo[0]==L'E' || wscCargo[0]==L'I' || wscCargo[0]==L'O' || wscCargo[0]==L'U' ? L"an " : L"a ") + wscCargo + L" from " + Players.GetActiveCharacterName(iClientID) + L"."); break; case HKE_CHAR_DOES_NOT_EXIST: PrintUserCmdText(iClientID, L"Error: specified character does not exist"); break; case HKE_NO_CHAR_SELECTED: PrintUserCmdText(iClientID, L"Error: specified player is at the login screen - wait until they completely log in"); break; case HKE_CARGO_WONT_FIT: PrintUserCmdText(iClientID, L"Error: specified character does not have enough room in their cargo hold to accomodate the item"); break; default: PrintUserCmdText(iClientID, L"Error: unknown"); } } bFoundItem = true; break; } } } } } if(!bFoundItem) { PrintUserCmdText(iClientID, L"Error: could not find specified item. Use /enumcargo to show a list of transferrable cargo and codes for use with /transfer."); } } } void UserCmd_TransferID(uint iClientID, wstring wscParam) { if(set_iTransferCmdCharge == -1) { PRINT_DISABLED(); return; } wchar_t wszChargeAmount[72]; swprintf(wszChargeAmount, L"Transfers are subject to a %i credit charge", set_iTransferCmdCharge); wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /transfer$ <client-id> <item>", wszChargeAmount, }; wstring wscTargetChar = GetParam(wscParam, ' ', 0); wstring wscItem = GetParamToEnd(wscParam, ' ', 1); if(!wscTargetChar.length() || !wscItem.length()) { PRINT_ERROR(); } else { int iCash; HkGetCash(ARG_CLIENTID(iClientID), iCash); if(set_iTransferCmdCharge > iCash) { PrintUserCmdText(iClientID, L"Error: you do not have enough cash for the transfer"); return; } uint iTargetClientID = ToUint(wscTargetChar); ushort iItemID = ToUint(wscItem); list<CARGO_INFO> lstCargo; HkEnumCargo(ARG_CLIENTID(iClientID), lstCargo, 0); bool bFoundItem = false; if(iItemID) { foreach(lstCargo, CARGO_INFO, cargo) { if(!cargo->bMounted && cargo->iID == iItemID) { const GoodInfo *gi = GoodList::find_by_id(cargo->iArchID); bool bMultiCount; memcpy(&bMultiCount, (char*)gi + 0x70, 1); if(!bMultiCount) { UINT_WRAP uw = UINT_WRAP(cargo->iArchID); if(set_btNoTrade->Find(&uw)) { PrintUserCmdText(iClientID, L"Error: item is not intended to be traded."); } else { wstring wscCargo = L""; HK_ERROR errAdd = HkAddCargo(ARG_CLIENTID(iTargetClientID), cargo->iArchID, 1, false); switch(errAdd) { case HKE_OK: wscCargo = HkGetWStringFromIDS(gi->iIDS); HkRemoveCargo(ARG_CLIENTID(iClientID), cargo->iID, 1); HkAddCash(ARG_CLIENTID(iClientID), -set_iTransferCmdCharge); PRINT_OK(); PrintUserCmdText(iTargetClientID, L"You have received " + wstring(wscCargo[0]==L'A' || wscCargo[0]==L'E' || wscCargo[0]==L'I' || wscCargo[0]==L'O' || wscCargo[0]==L'U' ? L"an " : L"a ") + wscCargo + L" from " + Players.GetActiveCharacterName(iClientID) + L"."); break; case HKE_CHAR_DOES_NOT_EXIST: PrintUserCmdText(iClientID, L"Error: specified character does not exist"); break; case HKE_NO_CHAR_SELECTED: PrintUserCmdText(iClientID, L"Error: specified player is at the login screen - wait until they completely log in"); break; case HKE_CARGO_WONT_FIT: PrintUserCmdText(iClientID, L"Error: specified character does not have enough room in their cargo hold to accomodate the item"); break; default: PrintUserCmdText(iClientID, L"Error: unknown"); } } bFoundItem = true; break; } } } } else { wscItem = ToLower(wscItem); foreach(lstCargo, CARGO_INFO, cargo) { if(!cargo->bMounted) { const GoodInfo *gi = GoodList::find_by_id(cargo->iArchID); bool bMultiCount; memcpy(&bMultiCount, (char*)gi + 0x70, 1); if(!bMultiCount) { wstring wscCargo = HkGetWStringFromIDS(gi->iIDS); if(wscItem == ToLower(wscCargo)) { UINT_WRAP uw = UINT_WRAP(cargo->iArchID); if(set_btNoTrade->Find(&uw)) { PrintUserCmdText(iClientID, L"Error: item is not intended to be traded."); } else { HK_ERROR errAdd = HkAddCargo(ARG_CLIENTID(iTargetClientID), cargo->iArchID, 1, false); switch(errAdd) { case HKE_OK: HkRemoveCargo(ARG_CLIENTID(iClientID), cargo->iID, 1); HkAddCash(ARG_CLIENTID(iClientID), -set_iTransferCmdCharge); PRINT_OK(); PrintUserCmdText(iTargetClientID, L"You have received " + wstring(wscCargo[0]==L'A' || wscCargo[0]==L'E' || wscCargo[0]==L'I' || wscCargo[0]==L'O' || wscCargo[0]==L'U' ? L"an " : L"a ") + wscCargo + L" from " + Players.GetActiveCharacterName(iClientID) + L"."); break; case HKE_CHAR_DOES_NOT_EXIST: PrintUserCmdText(iClientID, L"Error: specified character does not exist"); break; case HKE_NO_CHAR_SELECTED: PrintUserCmdText(iClientID, L"Error: specified player is at the login screen - wait until they completely log in"); break; case HKE_CARGO_WONT_FIT: PrintUserCmdText(iClientID, L"Error: specified character does not have enough room in their cargo hold to accomodate the item"); break; default: PrintUserCmdText(iClientID, L"Error: unknown"); } } bFoundItem = true; break; } } } } } if(!bFoundItem) { PrintUserCmdText(iClientID, L"Error: could not find specified item. Use /enumcargo to show a list of transferrable cargo and codes for use with /transfer."); } } } void UserCmd_EnumCargo(uint iClientID, wstring wscParam) { list<CARGO_INFO> lstCargo; HkEnumCargo(ARG_CLIENTID(iClientID), lstCargo, 0); uint iNum = 0; foreach(lstCargo, CARGO_INFO, it) { const GoodInfo *gi = GoodList::find_by_id(it->iArchID); if(!gi) continue; bool bMultiCount; memcpy(&bMultiCount, (char*)gi + 0x70, 1); if(!it->bMounted && !bMultiCount && gi->iIDS) { PrintUserCmdText(iClientID, L"%u: %s", it->iID, HkGetWStringFromIDS(gi->iIDS).c_str()); iNum++; } } if(!iNum) PrintUserCmdText(iClientID, L"Error: you have no unmounted equipment"); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_DeathPenalty(uint iClientID, wstring wscParam) { wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /dp [on|off]", }; if(!set_fDeathPenalty) { PRINT_DISABLED(); return; } wscParam = ToLower(Trim(wscParam)); if(wscParam.length()) //Arguments passed { if(wscParam == L"off") { ClientInfo[iClientID].bDisplayDPOnLaunch = false; wstring wscDir, wscFilename; CAccount *acc = Players.FindAccountFromClientID(iClientID); if(HKHKSUCCESS(HkGetCharFileName(ARG_CLIENTID(iClientID), wscFilename)) && HKHKSUCCESS(HkGetAccountDirName(acc, wscDir))) { string scUserFile = scAcctPath + wstos(wscDir) + "\\flhookuser.ini"; string scSection = "general_" + wstos(wscFilename); IniWrite(scUserFile, scSection, "DPnotice", "no"); } PRINT_OK(); } else if(wscParam == L"on") { ClientInfo[iClientID].bDisplayDPOnLaunch = true; wstring wscDir, wscFilename; CAccount *acc = Players.FindAccountFromClientID(iClientID); if(HKHKSUCCESS(HkGetCharFileName(ARG_CLIENTID(iClientID), wscFilename)) && HKHKSUCCESS(HkGetAccountDirName(acc, wscDir))) { string scUserFile = scAcctPath + wstos(wscDir) + "\\flhookuser.ini"; string scSection = "general_" + wstos(wscFilename); IniWrite(scUserFile, scSection, "DPnotice", "yes"); } PRINT_OK(); } else PRINT_ERROR(); } else { PrintUserCmdText(iClientID, L"The death penalty is charged immediately when you die."); UINT_WRAP uw = UINT_WRAP(Players[iClientID].iShipArchID); if(!set_btNoDeathPenalty->Find(&uw)) { float fValue; pub::Player::GetAssetValue(iClientID, fValue); int iOwed = (int)(fValue * set_fDeathPenalty); PrintUserCmdText(iClientID, L"The death penalty for your ship will be " + ToMoneyStr(iOwed) + L" credits."); list<wstring> lstItems = HkGetDeathPenaltyItems(iClientID); if(lstItems.size()) { if(lstItems.size() == 1) { PrintUserCmdText(iClientID, L"The following item may be taken from your ship if you do not have enough money: %s.", lstItems.front().c_str()); } else { wstring wscItems = L""; list<wstring>::iterator wscItem = lstItems.begin(); list<wstring>::iterator wscItemEnd = lstItems.end(); --wscItemEnd; for(;wscItem != wscItemEnd; wscItem++) { wscItems += *wscItem + L", "; } wscItems += L"and/or " + lstItems.back(); PrintUserCmdText(iClientID, L"The following items may be taken from your ship if you do not have enough money: %s.", wscItems.c_str()); } } PrintUserCmdText(iClientID, L"If you would like to turn off the death penalty notices, run this command with the argument \"off\"."); } else { Archetype::Ship *ship = Archetype::GetShip(uw.val); if(ship->iIDSName) { wstring wscShip = HkGetWStringFromIDS(ship->iIDSName); PrintUserCmdText(iClientID, L"You don't have to pay the death penalty because you are flying " + wstring(wscShip[0]==L'A'||wscShip[0]==L'E'||wscShip[0]==L'I'||wscShip[0]==L'O'||wscShip[0]==L'U' ? L"an " : L"a ") + wscShip + L'.'); } else { PrintUserCmdText(iClientID, L"You don't have to pay the death penalty because you are flying a specific ship."); } } } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_IgnoreUniverse(uint iClientID, wstring wscParam) { wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /ignoreuniverse <on|off>", }; if(!set_bUserCmdIgnore) { PRINT_DISABLED(); return; } if(ToLower(wscParam) == L"on") { ClientInfo[iClientID].bIgnoreUniverse = true; GET_USERFILE(scUserFile); IniWrite(scUserFile, "settings", "IgnoreUniverse", "yes"); } else if(ToLower(wscParam) == L"off") { ClientInfo[iClientID].bIgnoreUniverse = false; GET_USERFILE(scUserFile); IniWrite(scUserFile, "settings", "IgnoreUniverse", "no"); } else { PRINT_ERROR(); return; } PRINT_OK(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_Mission(uint iClientID, wstring wscParam) { if (ControllerActive == true) { PrintUserCmdText(iClientID, L"Error: Mission in use."); return; } uint pAddress = (uint)hModContent + 0x114388; pub::Controller::CreateParms params = {pAddress, iClientID}; ClientInfo[iClientID].iControllerID = ControllerCreate("Content.dll", "Mission_09", &params, (pub::Controller::PRIORITY)2); ControllerSend(ClientInfo[iClientID].iControllerID, 0x1000, 0); PRINT_OK(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_Ping(uint iClientID, wstring wscParam) { HKPLAYERINFO pi; HkGetPlayerInfo(iClientID, pi, false); PrintUserCmdText(iClientID, L"ping=%u", pi.ci.dwRoundTripLatencyMS); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// void UserCmd_Tag(uint iClientID, wstring wscParam) { wstring wscError[] = { L"Error: Invalid parameters", L"Usage: /tag <faction name>" }; if(!set_bUserCmdTag) { PRINT_DISABLED(); return; } wscParam = Trim(wscParam); if(wscParam.length()) { wscParam = ToLower(wscParam); uint iGroup = 0; foreach(lstTagFactions, RepCB, rep) { uint iIDS = Reputation::get_short_name(rep->iGroup); wstring wscFaction = HkGetWStringFromIDS(iIDS); wscFaction = ToLower(wscFaction); if(wscFaction == wscParam) { iGroup = rep->iGroup; break; } else { iIDS = Reputation::get_name(rep->iGroup); wscFaction = HkGetWStringFromIDS(iIDS); wscFaction = ToLower(wscFaction); if(wscFaction == wscParam) { iGroup = rep->iGroup; break; } } } if(iGroup) { int iRep; pub::Player::GetRep(iClientID, iRep); uint iIDS = Reputation::get_name(iGroup); wstring wscFaction = HkGetWStringFromIDS(iIDS); float fRep; pub::Reputation::GetGroupFeelingsTowards(iRep, iGroup, fRep); if(fRep < set_fMinTagRep) { PrintUserCmdText(iClientID, L"Error: your reputation of %g to " + wscFaction + L" is less than the required %g.", fRep, set_fMinTagRep); } else { pub::Reputation::SetAffiliation(iRep, iGroup); PrintUserCmdText(iClientID, L"Affiliation changed to " + wscFaction); } } else { PrintUserCmdText(iClientID, L"Error: could not find faction"); } } else { PRINT_ERROR(); } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct CMDHELPINFO { bool bShowCmd; wchar_t *wscCommand; wchar_t *wscHelpTxt; }; CMDHELPINFO HelpInfo[] = { { true, L"set diemsg", L"Usage: /set diemsg xxx\n while xxx must be one of the following values:\n - all = all deaths will be displayed\n - system = only display deaths occurring in the system you are currently in\n - self = only display deaths the player is involved in(either as victim or killer)\n - none = don't show any death-messages"}, { true, L"set diemsgsize", L"Usage: /set diemsgsize <small/default>\n - change the size of the diemsgs"}, { true, L"set chatfont", L"Usage: /set chatfont <size> <style>\n <size>: small, default or big\n <style>: default, bold, italic or underline\n this lets every user adjust the appearance of the chat-messages"}, { false,L"set", L"See set diemsg, set diemsgsize, and set chatfont"}, { true, L"ignorelist", L"Usage: /ignorelist\n display ignore list"}, { true, L"delignore", L"Usage: /delignore <id> [<id2> <id3> ...]\n delete ignore entry"}, { true, L"ignore", L"Usage: /ignore <charname> [<flags>]\n /ignore$ <client-id> [<flags>]\n ignore chat from certain players"}, { true, L"ignoreuniverse", L"Usage: /ignoreuniverse <on|off>\n Ignores chat from the universe channel"}, { true, L"autobuy", L"Usage: /autobuy <on|off>\n - on: saves the current configuration of unmounted items and attempts to\n complete that configuration upon entering a base.\n - off: deletes the current configuration."}, { true, L"ids", L"Usage: /ids\n show client-ids of all players"}, { true, L"id", L"Usage: /id\n show own client-id"}, { false,L"i", L"Usage: /invite$ <client-id>\n /i$ <client-id>\n /i <charname>\n invite player to group"}, { true, L"invite", HelpInfo[10].wscHelpTxt}, { true, L"inviteall", L"Usage: /inviteall [name part]\n /ia [name part]\n Invites all players on server to join into a group with you.\n If [name part] is present, it only invites those who have [name part] in their name."}, { false,L"ia", HelpInfo[12].wscHelpTxt}, { true, L"cloak", L"Usage: /cloak\n /c\n Cloak the ship if a cloaking device is present on it.\n If used when cloaked, shows the time remaining for the cloak."}, { false,L"c", HelpInfo[14].wscHelpTxt}, { true, L"uncloak", L"Usage: /uncloak\n /uc\n Uncloak the ship if it is cloaked."}, { true, L"rename", L"Usage: /rename <new name>\n Renames the logged-in character to the new name. Enter the command to find out how much it costs."}, { true, L"sendcash", L"Usage: /sendcash <charname> <amount>\n /sendcash$ <client-id> <amount>\n Sends <amount> of credits to <charname>. Charges tax to the sender."}, { true, L"shieldsdown", L"Usage: /shieldsdown\n /sd\n Makes the shields on your ship fail."}, { false,L"sd", HelpInfo[19].wscHelpTxt}, { true, L"shieldsup", L"Usage: /shieldsup\n /su\n Makes the shields on your ship recharge to the levels they were at when the shields\n down command was used. Note that it will not make your shields go up instantly."}, { false,L"su", HelpInfo[21].wscHelpTxt}, { true, L"mark", L"Usage: /mark\n /m\n Makes the selected object appear in the important section of the contacts and\n have an arrow on the side of the screen, as well as have > and < on the sides\n of the selection box."}, { false,L"m", HelpInfo[23].wscHelpTxt}, { true, L"unmark", L"Usage: /unmark\n /um\n Unmarks the selected object marked with the /mark (/m) command."}, { false,L"um", HelpInfo[25].wscHelpTxt}, { true, L"groupmark", L"Usage: /groupmark\n /gm\n Marks selected object for the entire group."}, { false,L"gm", HelpInfo[27].wscHelpTxt}, { true, L"groupunmark", L"Usage: /groupunmark\n /gum\n Unmarks the selected object for the entire group."}, { false,L"gum", HelpInfo[29].wscHelpTxt}, { true, L"ignoregroupmarks",L"Usage: /ignoregroupmarks <on|off>\n Ignores marks from others in your group."}, { true, L"automark", L"Usage: /automark <on|off> [radius in KM]\n Automatically marks all ships in KM radius. Bots are marked automatically in the\n range specified whether on or off. If you want to completely disable automarking,\n set the radius to a number <= 0."}, { true, L"afk", L"Usage: /afk [Message]\n Sets away from keyboard message, which is automatically sent to people who message you.\n If no message is appended to the command and AFK is set, then AFK is unset; otherwise the message is updated."}, { true, L"botcombat", L"Usage: /botcombat <on|off>\n Turns your bots (AI Companion option) hostile to you for combat purposes."}, { true, L"dock", L"Usage: /dock\n /d\n Docks your ship at a valid player ship, allowing you to repair and buy equipment\n as with a normal base."}, { false,L"d", HelpInfo[35].wscHelpTxt}, { true, L"transfer", L"Usage: /transfer <charname> <item> \n/transfer$ <client-id> <item>\n Transfers <item> to <charname>. Valid items are those that are not grouped\n (like commodities and ammo). Enter the command to find how how much it costs."}, { true, L"enumcargo", L"Usage: /enumcargo\n Prints out a number for each cargo item that can be used with the /transfer command."}, { true, L"dp", L"Usage: /dp [on|off]\n Shows information about the death penalty. Also sets whether a notice about how\n much the death penalty costs is shown upon launch."}, { true, L"ping", L"Usage: /ping\nShows your current ping"}, { true, L"tag", L"/tag <faction>\n Changes your affiliation to <faction>, making it appear beside your name ingame."}, { true, L"mission", L"Usage: /mission\nCreates a mission instance"}, { true, L"help [command]", L"Usage: /help [command]\n /? [command]\n Gets help on available commands"}, { false,L"?", HelpInfo[40].wscHelpTxt}, }; void UserCmd_Help(uint iClientID, wstring wscParam) { if(!Trim(wscParam).length()) //No args, print out list of commands { for(uint i = 0; (i < sizeof(HelpInfo)/sizeof(CMDHELPINFO)); i++) { if(HelpInfo[i].bShowCmd) { wstring wscCommand = L"/"; wscCommand += HelpInfo[i].wscCommand; PrintUserCmdText(iClientID, wscCommand); } } } else { wscParam = ReplaceStr(wscParam, L"/", L""); wscParam = ReplaceStr(wscParam, L"$", L""); for(uint i = 0; (i < sizeof(HelpInfo)/sizeof(CMDHELPINFO)); i++) { if(HelpInfo[i].wscCommand == ToLower(wscParam)) { wstring wscHelpText = HelpInfo[i].wscHelpTxt; int iFind = wscHelpText.find(L"\n", 0); while(iFind!=-1) { PrintUserCmdText(iClientID, wscHelpText.substr(0, iFind)); wscHelpText = wscHelpText.substr(iFind+1); iFind = wscHelpText.find(L"\n", 0); } PrintUserCmdText(iClientID, wscHelpText); return; } } PrintUserCmdText(iClientID, L"Could not find help for the specified command"); } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// USERCMD UserCmds[] = { { L"/set diemsg", UserCmd_SetDieMsg}, { L"/set diemsgsize", UserCmd_SetDieMsgSize}, { L"/set chatfont", UserCmd_SetChatFont}, { L"/ignorelist", UserCmd_IgnoreList}, { L"/delignore", UserCmd_DelIgnore}, { L"/ignore", UserCmd_Ignore}, { L"/ignore$", UserCmd_IgnoreID}, { L"/autobuy", UserCmd_AutoBuy}, { L"/ids", UserCmd_IDs}, { L"/id", UserCmd_ID}, { L"/invite", UserCmd_Invite}, { L"/i", UserCmd_Invite}, { L"/i$", UserCmd_InviteID}, { L"/invite$", UserCmd_InviteID}, { L"/ia", UserCmd_InviteAll}, { L"/inviteall", UserCmd_InviteAll}, { L"/cloak", UserCmd_Cloak}, { L"/c", UserCmd_Cloak}, { L"/uncloak", UserCmd_UnCloak}, { L"/uc", UserCmd_UnCloak}, { L"/rename", UserCmd_Rename}, { L"/sendcash", UserCmd_SendCash}, { L"/sendcash$", UserCmd_SendCashID}, { L"/afk", UserCmd_Afk}, { L"/shieldsdown", UserCmd_ShieldsDown}, { L"/sd", UserCmd_ShieldsDown}, { L"/shieldsup", UserCmd_ShieldsUp}, { L"/su", UserCmd_ShieldsUp}, { L"/mark", UserCmd_MarkObj}, { L"/m", UserCmd_MarkObj}, { L"/unmark", UserCmd_UnMarkObj}, { L"/um", UserCmd_UnMarkObj}, { L"/unmarkall", UserCmd_UnMarkAllObj}, { L"/uma", UserCmd_UnMarkAllObj}, { L"/groupmark", UserCmd_MarkObjGroup}, { L"/gm", UserCmd_MarkObjGroup}, { L"/groupunmark", UserCmd_UnMarkObjGroup}, { L"/gum", UserCmd_UnMarkObjGroup}, { L"/ignoregroupmarks", UserCmd_SetIgnoreGroupMark}, { L"/automark", UserCmd_AutoMark}, { L"/botcombat", UserCmd_BotCombat}, { L"/dock", UserCmd_Dock}, { L"/d", UserCmd_Dock}, { L"/transfer", UserCmd_Transfer}, { L"/transfer$", UserCmd_TransferID}, { L"/enumcargo", UserCmd_EnumCargo}, { L"/dp", UserCmd_DeathPenalty}, { L"/ignoreuniverse", UserCmd_IgnoreUniverse}, { L"/ping", UserCmd_Ping}, { L"/tag", UserCmd_Tag}, { L"/mission", UserCmd_Mission}, { L"/help", UserCmd_Help}, { L"/?", UserCmd_Help}, }; bool UserCmd_Process(uint iClientID, wstring wscCmd) { wstring wscCmdLower = ToLower(wscCmd); for(uint i = 0; (i < sizeof(UserCmds)/sizeof(USERCMD)); i++) { if(wscCmdLower.find(ToLower(UserCmds[i].wszCmd)) == 0) { wstring wscParam = L""; if(wscCmd.length() > wcslen(UserCmds[i].wszCmd)) { if(wscCmd[wcslen(UserCmds[i].wszCmd)] != ' ') continue; wscParam = wscCmd.substr(wcslen(UserCmds[i].wszCmd) + 1); } UserCmds[i].proc(iClientID, wscParam); return true; } } return false; }
[ "M0tah@62241663-6891-49f9-b8c1-0f2e53ca0faf", "KillerJaguar@62241663-6891-49f9-b8c1-0f2e53ca0faf" ]
[ [ [ 1, 64 ], [ 66, 82 ], [ 84, 90 ], [ 92, 105 ], [ 108, 121 ], [ 123, 133 ], [ 135, 142 ], [ 144, 159 ], [ 161, 169 ], [ 171, 177 ], [ 179, 189 ], [ 191, 198 ], [ 201, 215 ], [ 217, 275 ], [ 277, 353 ], [ 355, 428 ], [ 430, 538 ], [ 540, 555 ], [ 557, 565 ], [ 567, 570 ], [ 572, 634 ], [ 636, 650 ], [ 652, 665 ], [ 667, 668 ], [ 670, 671 ], [ 673, 686 ], [ 689, 698 ], [ 700, 710 ], [ 712, 716 ], [ 718, 768 ], [ 770, 771 ], [ 773, 845 ], [ 847, 869 ], [ 871, 872 ], [ 874, 940 ], [ 942, 1034 ], [ 1036, 1058 ], [ 1060, 1130 ], [ 1132, 1176 ], [ 1178, 1271 ], [ 1273, 1310 ], [ 1312, 1344 ], [ 1346, 1350 ], [ 1352, 1487 ], [ 1489, 1493 ], [ 1495, 1647 ], [ 1649, 1745 ], [ 1747, 1779 ], [ 1806, 1807 ], [ 1809, 1885 ], [ 1887, 1928 ], [ 1930, 1930 ], [ 1932, 1953 ], [ 1955, 2026 ], [ 2028, 2028 ], [ 2030, 2055 ] ], [ [ 65, 65 ], [ 83, 83 ], [ 91, 91 ], [ 106, 107 ], [ 122, 122 ], [ 134, 134 ], [ 143, 143 ], [ 160, 160 ], [ 170, 170 ], [ 178, 178 ], [ 190, 190 ], [ 199, 200 ], [ 216, 216 ], [ 276, 276 ], [ 354, 354 ], [ 429, 429 ], [ 539, 539 ], [ 556, 556 ], [ 566, 566 ], [ 571, 571 ], [ 635, 635 ], [ 651, 651 ], [ 666, 666 ], [ 669, 669 ], [ 672, 672 ], [ 687, 688 ], [ 699, 699 ], [ 711, 711 ], [ 717, 717 ], [ 769, 769 ], [ 772, 772 ], [ 846, 846 ], [ 870, 870 ], [ 873, 873 ], [ 941, 941 ], [ 1035, 1035 ], [ 1059, 1059 ], [ 1131, 1131 ], [ 1177, 1177 ], [ 1272, 1272 ], [ 1311, 1311 ], [ 1345, 1345 ], [ 1351, 1351 ], [ 1488, 1488 ], [ 1494, 1494 ], [ 1648, 1648 ], [ 1746, 1746 ], [ 1780, 1805 ], [ 1808, 1808 ], [ 1886, 1886 ], [ 1929, 1929 ], [ 1931, 1931 ], [ 1954, 1954 ], [ 2027, 2027 ], [ 2029, 2029 ] ] ]
844ffa33982c26c518888551b1201ea5e7118042
ea12fed4c32e9c7992956419eb3e2bace91f063a
/zombie/code/zombie/zombieentity/src/zombieentity/ncdictionary_main.cc
34d44ff471cb31ed66fa0f0b0e20fee22524f4d4
[]
no_license
ugozapad/TheZombieEngine
832492930df28c28cd349673f79f3609b1fe7190
8e8c3e6225c2ed93e07287356def9fbdeacf3d6a
refs/heads/master
2020-04-30T11:35:36.258363
2011-02-24T14:18:43
2011-02-24T14:18:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
14,620
cc
#include "precompiled/pchncshared.h" //------------------------------------------------------------------------------ // ncdictionary_main.cc // (C) 2005 Conjurer Services, S.A. //------------------------------------------------------------------------------ #include "zombieentity/ncdictionary.h" #include "nscene/ncscene.h" #include "variable/nvariableserver.h" //------------------------------------------------------------------------------ nNebulaComponentObject(ncDictionary, nComponentObject); //----------------------------------------------------------------------------- NSCRIPT_INITCMDS_BEGIN(ncDictionary) NSCRIPT_ADDCMD_COMPOBJECT('SBOV', void, SetBoolVariable, 2, (const char *, bool), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('GBOV', bool, GetBoolVariable, 1, (const char *), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('SINV', void, SetIntVariable, 2, (const char *, int), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('GINV', int, GetIntVariable, 1, (const char *), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('SFLV', void, SetFloatVariable, 2, (const char *, float), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('GFLV', float, GetFloatVariable, 1, (const char *), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('SVCV', void, SetVectorVariable, 2, (const char *, const vector4&), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('GVCV', const vector4&, GetVectorVariable, 1, (const char *), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('SSTV', void, SetStringVariable, 2, (const char *, const char *), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('GSTV', const char *, GetStringVariable, 1, (const char *), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('SLIV', int, SetLocalIntVariable, 2, (const char *, int), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('GLIV', int, GetLocalIntVariable, 1, (const char *), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('SLFV', int, SetLocalFloatVariable, 2, (const char *, float), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('GLFV', float, GetLocalFloatVariable, 1, (const char *), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('SLVV', int, SetLocalVectorVariable, 2, (const char *, const vector4&), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('GLVV', const vector4&, GetLocalVectorVariable, 1, (const char *), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('SLSV', int, SetLocalStringVariable, 2, (const char *, const char *), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('GLSV', const char *, GetLocalStringVariable, 1, (const char *), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('SLOV', int, SetLocalObjectVariable, 2, (const char *, nObject*), 0, ()); NSCRIPT_ADDCMD_COMPOBJECT('GLOV', nObject*, GetLocalObjectVariable, 1, (const char *), 0, ()); NSCRIPT_INITCMDS_END() //------------------------------------------------------------------------------ /** constructor */ ncDictionary::ncDictionary() { // empty } //------------------------------------------------------------------------------ /** destructor */ ncDictionary::~ncDictionary() { // empty } //------------------------------------------------------------------------------ /** instance initialization (TEMPORARY) */ void ncDictionary::InitInstance(nObject::InitInstanceMsg initType) { if (initType == nObject::NewInstance) { // get the list of default variables from the class and create them ncDictionaryClass *compClass = this->GetEntityObject()->GetClassComponent<ncDictionaryClass>(); //n_assert(compClass);? if (compClass) { this->varContext.Clear(); nVariableContext& varContext = compClass->VariableContext(); for (int i = 0; i < varContext.GetNumVariables(); i++) { this->varContext.AddVariable(varContext.GetVariableAt(i)); } } } if (initType == nObject::ReloadedInstance) { this->ClearLocalVars(); } } //------------------------------------------------------------------------------ /** */ void ncDictionary::SetBoolVariable(const char *name, bool value) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->varContext.GetVariable(handle); if (var) { var->SetBool(value); } else { this->varContext.AddVariable(nVariable(handle, value)); } } //------------------------------------------------------------------------------ /** */ bool ncDictionary::GetBoolVariable(const char *name) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->varContext.GetVariable(handle); if (var) { return var->GetBool(); } else { return false; } } //------------------------------------------------------------------------------ /** */ void ncDictionary::SetIntVariable(const char *name, int value) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->varContext.GetVariable(handle); if (var) { var->SetInt(value); } else { this->varContext.AddVariable(nVariable(handle, value)); } } //------------------------------------------------------------------------------ /** */ int ncDictionary::GetIntVariable(const char *name) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->varContext.GetVariable(handle); if (var) { return var->GetInt(); } else { return 0; } } //------------------------------------------------------------------------------ /** */ void ncDictionary::SetFloatVariable(const char *name, float value) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->varContext.GetVariable(handle); if (var) { var->SetFloat(value); } else { this->varContext.AddVariable(nVariable(handle, value)); } } //------------------------------------------------------------------------------ /** */ float ncDictionary::GetFloatVariable(const char *name) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->varContext.GetVariable(handle); if (var) { return var->GetFloat(); } else { return 0.0f; } } //------------------------------------------------------------------------------ /** */ void ncDictionary::SetVectorVariable(const char *name, const vector4& value) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->varContext.GetVariable(handle); if (var) { var->SetVector4(value); } else { this->varContext.AddVariable(nVariable(handle, value)); } } //------------------------------------------------------------------------------ /** */ const vector4& ncDictionary::GetVectorVariable(const char *name) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->varContext.GetVariable(handle); if (var) { return var->GetVector4(); } static vector4 nullVec; return nullVec; } //------------------------------------------------------------------------------ /** */ void ncDictionary::SetStringVariable(const char *name, const char *value) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->varContext.GetVariable(handle); if (var) { var->SetString(value); } else { this->varContext.AddVariable(nVariable(handle, value)); } } //------------------------------------------------------------------------------ /** */ const char * ncDictionary::GetStringVariable(const char *name) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->varContext.GetVariable(handle); if (var) { return var->GetString(); } return ""; } // local variables //------------------------------------------------------------------------------ /** */ int ncDictionary::SetLocalIntVariable(const char *name, int value) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); return this->AddLocalVar(nVariable(handle, value)); } //------------------------------------------------------------------------------ /** */ int ncDictionary::GetLocalIntVariable(const char *name) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->FindLocalVar(handle); if (var) { return var->GetInt(); } return 0; } //------------------------------------------------------------------------------ /** */ int ncDictionary::SetLocalFloatVariable(const char *name, float value) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); return this->AddLocalVar(nVariable(handle, value)); } //------------------------------------------------------------------------------ /** */ float ncDictionary::GetLocalFloatVariable(const char *name) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->FindLocalVar(handle); if (var) { return var->GetFloat(); } return 0; } //------------------------------------------------------------------------------ /** */ int ncDictionary::SetLocalVectorVariable(const char *name, const vector4& value) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); return this->AddLocalVar(nVariable(handle, value)); } //------------------------------------------------------------------------------ /** */ const vector4& ncDictionary::GetLocalVectorVariable(const char *name) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->FindLocalVar(handle); if (var) { return var->GetVector4(); } static vector4 nullVec; return nullVec; } //------------------------------------------------------------------------------ /** */ int ncDictionary::SetLocalStringVariable(const char *name, const char* value) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); return this->AddLocalVar(nVariable(handle, value)); } //------------------------------------------------------------------------------ /** */ const char * ncDictionary::GetLocalStringVariable(const char *name) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->FindLocalVar(handle); if (var) { return var->GetString(); } return ""; } //------------------------------------------------------------------------------ /** */ int ncDictionary::SetLocalObjectVariable(const char *name, nObject *object) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); return this->AddLocalVar(nVariable(handle, object)); } //------------------------------------------------------------------------------ /** */ nObject* ncDictionary::GetLocalObjectVariable(const char *name) { nVariable::Handle handle = nVariableServer::Instance()->GetVariableHandleByName(name); nVariable *var = this->FindLocalVar(handle); if (var) { return (nObject*) var->GetObj(); } return 0; } // commands //------------------------------------------------------------------------------ /** */ bool ncDictionary::SaveCmds(nPersistServer * ps) { // --- setxxxvariable --- int varIndex; int numVars = this->varContext.GetNumVariables(); for (varIndex = 0; varIndex < numVars; varIndex++) { nVariable::Handle timeHandle = nVariableServer::Instance()->GetVariableHandleByName("time"); nVariable& var = this->varContext.GetVariableAt(varIndex); if (var.GetHandle() != timeHandle) { // // TODO: convert to new persistence format // nCmd* cmd; switch (var.GetType()) { case nVariable::Bool: // --- setboolvariable --- cmd = ps->GetCmd(this->GetEntityObject(), 'SBOV'); cmd->In()->SetS(nVariableServer::Instance()->GetVariableName(var.GetHandle())); cmd->In()->SetB(var.GetBool()); ps->PutCmd(cmd); break; case nVariable::Int: // --- setintvariable --- cmd = ps->GetCmd(this->GetEntityObject(), 'SINV'); cmd->In()->SetS(nVariableServer::Instance()->GetVariableName(var.GetHandle())); cmd->In()->SetI(var.GetInt()); ps->PutCmd(cmd); break; case nVariable::Float: // --- setfloatvariable --- cmd = ps->GetCmd(this->GetEntityObject(), 'SFLV'); cmd->In()->SetS(nVariableServer::Instance()->GetVariableName(var.GetHandle())); cmd->In()->SetF(var.GetFloat()); ps->PutCmd(cmd); break; case nVariable::Vector4: // --- setvectorvariable --- cmd = ps->GetCmd(this->GetEntityObject(), 'SVCV'); cmd->In()->SetS(nVariableServer::Instance()->GetVariableName(var.GetHandle())); cmd->In()->SetF(var.GetVector4().x); cmd->In()->SetF(var.GetVector4().y); cmd->In()->SetF(var.GetVector4().z); cmd->In()->SetF(var.GetVector4().w); ps->PutCmd(cmd); break; case nVariable::String: // --- setstringvariable --- cmd = ps->GetCmd(this->GetEntityObject(), 'SSTV'); cmd->In()->SetS(nVariableServer::Instance()->GetVariableName(var.GetHandle())); cmd->In()->SetS(var.GetString()); ps->PutCmd(cmd); break; } } } return true; }
[ "magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91" ]
[ [ [ 1, 463 ] ] ]
80b6193191b04cde406614663246f896b61b0bb7
eeec346974237733fa818302439cf1efacbed18b
/warfareA2RU.takistan/Rsc/Parameters.hpp
0446edde15218a2bfa69fc562926fbbe3beec80f
[]
no_license
looterz/arma2warfare
a2e286443d234d0aaf79609c06dbaf09f4ad0684
b5f153a346364db8bb277d341b7ea6d6d74637ee
refs/heads/master
2021-01-10T08:16:56.746002
2011-12-10T17:18:22
2011-12-10T17:18:22
51,976,448
0
0
null
null
null
null
UTF-8
C++
false
false
24,987
hpp
/* Parameters arma2.ru v3 */ class Params { class aiGroupSizeAI { title = "$STR_WF_PARAMETER_GroupSizeAI"; values[] = {1,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,35,40,45,50,60,70,80,90,100}; texts[] = {"1","2","4","6","8","10","12","14","16","18","20","22","24","26","28","30","35","40","45","50","60","70","80","90","100"}; default = 4; }; class aiGroupSizePlayer { title = "$STR_WF_PARAMETER_GroupSizePlayer"; values[] = {2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,35,40,45,50,60,70,80,90,100}; texts[] = {"2","4","6","8","10","12","14","16","18","20","22","24","26","28","30","35","40","45","50","60","70","80","90","100"}; default = 12; }; class aiKeepUnits { title = "$STR_WF_PARAMETER_KeepAI"; values[] = {0,1}; texts[] = {"$STR_WF_PARAMETER_No","$STR_WF_PARAMETER_Yes"};//{"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class aiTeams { title = "$STR_WF_PARAMETER_AI"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class artilleryCalls { title = "$STR_WF_PARAMETER_Arty"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; #ifndef VANILLA class artilleryComputer { title = "$STR_WF_PARAMETER_ArtilleryComputer"; values[] = {0,1,2}; texts[] = {"$STR_WF_Disabled","$STR_WF_PARAMETER_Enabled_Upgrade","$STR_WF_Enabled"}; default = 1; }; #endif class artilleryUI { title = "$STR_WF_PARAMETER_ArtilleryUI"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class artilleryRange { title = "$STR_WF_PARAMETER_Artillery"; values[] = {1,2,3}; texts[] = {"$STR_WF_PARAMETER_Short","$STR_WF_PARAMETER_Medium","$STR_WF_PARAMETER_Long"}; default = 3; }; class baseAICommander { title = "$STR_WF_PARAMETER_AICommander"; values[] = {0,1}; texts[] = {"$STR_WF_PARAMETER_No","$STR_WF_PARAMETER_Yes"};//{"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; //--- OA has no suitable allies for both side (yet). #ifndef ARROWHEAD class baseAllies { title = "$STR_WF_PARAMETER_Allies"; values[] = {0,1,2,3}; texts[] = {"$STR_WF_Disabled","$STR_WF_PARAMETER_Side_West","$STR_WF_PARAMETER_Side_East","$STR_WF_PARAMETER_Both"}; default = 0; }; #endif class baseAAR { title = "$STR_WF_PARAMETER_AntiAirRadar"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class baseArea { title = "$STR_WF_PARAMETER_BaseArea"; values[] = {0,1}; texts[] = {"$STR_WF_PARAMETER_No","$STR_WF_PARAMETER_Yes"};//{"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class baseAreaLimit { title = "$STR_WF_PARAMETER_BaseArea_Limit"; values[] = {1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,22,24}; texts[] = {"1","2","3","4","5","6","7","8","9","10","12","14","16","18","20","22","24"}; default = 3; }; class baseAutoDefenses { title = "$STR_WF_PARAMETER_AutoMannedDefense"; values[] = {0,10,20,30,40,50,60,70,80,90,100}; texts[] = {"$STR_WF_Disabled","10","20","30","40","50","60","70","80","90","100"}; default = 60; }; class baseAutoDefensesRange { title = "$STR_WF_PARAMETER_AutoDefense_Range"; values[] = {50,100,150,200,250,300,350,400,450,500,600,700,800,900,1000}; texts[] = {"50m","100m","150m","200m","250m","300m","350m","400m","450m","500m","600m","700m","800m","900m","1000m"}; default = 1000; }; class baseBuildingsLimit { title = "$STR_WF_PARAMETER_BuildingsLimit"; values[] = {1,2,3,4,5,6,7,8,9,10}; texts[] = {"1","2","3","4","5","6","7","8","9","10"}; default = 2; }; class baseConstructionMode { title = "$STR_WF_PARAMETER_ConstructionMode"; values[] = {0,1}; texts[] = {"$STR_WF_PARAMETER_Time","$STR_WF_PARAMETER_HQWorkers"}; default = 0; }; class baseDefensePlacement { title = "$STR_WF_PARAMETER_DefensePlacement"; values[] = {0,1}; texts[] = {"$STR_WF_PARAMETER_Collide_No","$STR_WF_PARAMETER_Collide"}; default = 1; }; class baseHQDeploycost { title = "$STR_WF_PARAMETER_HQDeployCost"; values[] = {100,200,300,400,500,600,700,800,900,1000,1500,2000,2500,3000,3500,4000,5000,6000,7000,8000,9000,10000}; texts[] = {"S 100","S 200","S 300","S 400","S 500","S 600","S 700","S 800","S 900","S 1000","S 1500","S 2000","S 2500","S 3000","S 3500","S 4000","S 5000","S 6000","S 7000","S 8000","S 9000","S 10000"}; default = 500; }; class baseHQDeployRange { title = "$STR_WF_PARAMETER_HQDeployRange"; values[] = {50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,220,240,260,280,300,320,340,360,380,400}; texts[] = {"50m","60m","70m","80m","90m","100m","110m","120m","130m","140m","150m","160m","170m","180m","190m","200m","220m","240m","260m","280m","300m","320m","340m","360m","380m","400m"}; default = 400; }; class basePatrols { title = "$STR_WF_PARAMETER_BasePatrols"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class baseSpawnSystemRestrict { title = "$STR_WF_PARAMETER_SpawnSystemRestrict"; values[] = {0,1}; texts[] = {"$STR_WF_PARAMETER_No","$STR_WF_PARAMETER_Yes"};//{"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class baseStartingDistance { title = "$STR_WF_PARAMETER_StartingDistance"; values[] = {-1,1000,1500,2000,2500,3000,3500,4000,4500,5000,5500,6000,6500,7000,7500,8000,8500,9000}; texts[] = {"$STR_WF_PARAMETER_StartingLocations_Random","1000m","1500m","2000m","2500m","3000m","3500m","4000m","4500m","5000m","5500m","6000m","6500m","7000m","7500m","8000m","8500m","9000m"}; default = 8500; }; class baseStartingLocations { title = "$STR_WF_PARAMETER_StartingLocations"; values[] = {0,1,2}; texts[] = {"$STR_WF_PARAMETER_StartingLocations_WestNorth","$STR_WF_PARAMETER_StartingLocations_WestSouth","$STR_WF_PARAMETER_StartingLocations_Random"}; default = 2; }; class economyCurrency { title = "$STR_WF_PARAMETER_Currency"; values[] = {0,1}; texts[] = {"$STR_WF_PARAMETER_Money_Supply","$STR_WF_PARAMETER_Money"}; default = 0; }; class economyIncomeInterval { title = "$STR_WF_PARAMETER_IncomeInterval"; values[] = {60,120,180,240,300,360,420,480,540,600}; texts[] = {"1 Minute","2 Minutes","3 Minutes","4 Minutes","5 Minutes","6 Minutes","7 Minutes","8 Minutes","9 Minutes","10 Minutes"}; default = 60; }; class economyIncomeSystem { title = "$STR_WF_PARAMETER_IncomeSystem"; values[] = {1,2,3,4}; texts[] = {"$STR_WF_PARAMETER_IncomeSystem_Full","$STR_WF_PARAMETER_IncomeSystem_Half","$STR_WF_PARAMETER_Income_Sys_Param","$STR_WF_PARAMETER_Income_Sys_Param_Full"}; default = 3; }; class economyStartingFundsEast { title = "$STR_WF_PARAMETER_Funds_East"; values[] = {800,1600,2400,3200,4000,4800,6400,8000,12800,25600,51200,102400,204800,409600,819200}; texts[] = {"$ 800","$ 1600","$ 2400","$ 3200","$ 4000","$ 4800","$ 6400","$ 8000","$ 12800","$ 25600","$ 51200","$ 102400","$ 204800","$ 409600","$ 819200"}; default = 3200; }; class economyStartingFundsWest { title = "$STR_WF_PARAMETER_Funds_West"; values[] = {800,1600,2400,3200,4000,4800,6400,8000,12800,25600,51200,102400,204800,409600,819200}; texts[] = {"$ 800","$ 1600","$ 2400","$ 3200","$ 4000","$ 4800","$ 6400","$ 8000","$ 12800","$ 25600","$ 51200","$ 102400","$ 204800","$ 409600","$ 819200"}; default = 3200; }; class economyStartingSupplyEast { title = "$STR_WF_PARAMETER_Supply_East"; values[] = {1200,2400,3600,4800,6000,7200,8400,9600,14400,38400,76800}; texts[] = {"S 1200","S 2400","S 3600","S 4800","S 6000","S 7200","S 8400","S 9600","S 14400","S 38400","S 76800"}; default = 14400; }; class economyStartingSupplyWest { title = "$STR_WF_PARAMETER_Supply_West"; values[] = {1200,2400,3600,4800,6000,7200,8400,9600,14400,38400,76800}; texts[] = {"S 1200","S 2400","S 3600","S 4800","S 6000","S 7200","S 8400","S 9600","S 14400","S 38400","S 76800"}; default = 14400; }; class economySupplySystem { title = "$STR_WF_PARAMETER_SupplySystem"; values[] = {0,1}; texts[] = {"$STR_WF_PARAMETER_SupplySystem_Truck","$STR_WF_PARAMETER_Time"}; default = 1; }; class environmentFastTime { title = "$STR_WF_PARAMETER_FastTime"; values[] = {0,1,2,3,4,5,6,7,8,9}; texts[] = {"$STR_WF_Disabled","1 Second = 2 Seconds","1 Second = 3 Seconds","1 Second = 4 Seconds","1 Second = 5 Seconds","1 Second = 10 Seconds","1 Second = 15 Seconds","1 Second = 20 Seconds","1 Second = 25 Seconds","1 Second = 30 Seconds"}; default = 0; }; class environmentTimeOfDay { title = "$STR_WF_PARAMETER_TimeOfDay"; values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}; texts[] = {"00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00", "12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"}; default = 9; }; class environmentWeather { title = "$STR_WF_PARAMETER_Weather"; values[] = {0,1,2,3}; texts[] = {"$STR_WF_PARAMETER_Weather_Clear","$STR_WF_PARAMETER_Weather_Cloudy","$STR_WF_PARAMETER_Weather_Rainy","$STR_WF_PARAMETER_Weather_Dynamic"}; default = 0; }; #ifndef VANILLA class extensionBAF { title = "$STR_WF_PARAMETER_BAF"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class extensionPMC { title = "$STR_WF_PARAMETER_PMC"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; #endif class gameplayAlice { title = "$STR_WF_PARAMETER_Alice"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class gameplayHangars { title = "$STR_WF_PARAMETER_Hangars"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class gameplayBodiesTimeout { title = "$STR_WF_PARAMETER_BodiesTimeout"; values[] = {60,120,180,240,300,600,1200,1800,2400,3000,3600}; texts[] = {"1 Minute","2 Minutes","3 Minutes","4 Minutes","5 Minutes","10 Minutes","20 Minutes","30 Minutes","40 Minutes","50 Minutes","1 Hour"}; default = 120; }; class gameplayVehiclesTimeout { title = "$STR_WF_PARAMETER_VehicleDelay"; values[] = {60,120,180,240,300,600,1200,1800,2400,3000,3600}; texts[] = {"1 Minute","2 Minutes","3 Minutes","4 Minutes","5 Minutes","10 Minutes","20 Minutes","30 Minutes","40 Minutes","50 Minutes","1 Hour"}; default = 1200; }; class gameplayExtendedInventory { title = "$STR_WF_PARAMETER_Extended_Inventory"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class gameplayFastTravel { title = "$STR_WF_PARAMETER_FastTravel"; values[] = {0,1,2}; texts[] = {"$STR_WF_Disabled","$STR_WF_PARAMETER_Free","$STR_WF_PARAMETER_Fee"}; default = 0; }; class gameplayFriendlyFire { title = "$STR_WF_PARAMETER_FriendlyFire"; values[] = {0}; texts[] = {"$STR_WF_Disabled"}; default = 0; }; class gameplayGrass { title = "$STR_WF_PARAMETER_Grass"; values[] = {10,20,30,50}; texts[] = {"Far","Medium","Short","Toggleable"}; default = 50; }; class gameplayKickTeamswap { title = "$STR_WF_PARAMETER_KickTeamswapper"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class gameplayLimitedBoundaries { title = "$STR_WF_PARAMETER_LimitedBoundaries"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class gameplayMapColoration { title = "$STR_WF_PARAMETER_Coloration"; values[] = {0,1}; texts[] = {"$STR_WF_PARAMETER_Default","$STR_WF_PARAMETER_NATO_Coloration"}; default = 0; }; class gameplayMissileRange { title = "$STR_WF_PARAMETER_MissileRange"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class gameplaySecondaryMissions { title = "$STR_WF_PARAMETER_SecondaryMissions"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class gameplayShowUID { title = "$STR_WF_PARAMETER_ShowUID"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class gameplaySpecialization { title = "$STR_WF_PARAMETER_Specialization"; values[] = {0,1,2,3}; texts[] = {"$STR_WF_PARAMETER_None","$STR_WF_PARAMETER_Infantry","$STR_WF_PARAMETER_LandVehicles","$STR_WF_PARAMETER_Aircraft"}; default = 0; }; class gameplayThermalImaging { title = "$STR_WF_PARAMETER_ThermalImaging"; values[] = {0,1,2,3}; texts[] = {"$STR_WF_Disabled","$STR_WF_PARAMETER_Weapons","$STR_WF_PARAMETER_Vehicles","$STR_WF_Enabled"}; default = 3; }; class gameplayTrackAI { title = "$STR_WF_PARAMETER_TrackAI"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class gameplayTrackPlayers { title = "$STR_WF_PARAMETER_TrackPlayers"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class gameplayUnitsBalancing { title = "$STR_WF_PARAMETER_Balance"; values[] = {1}; texts[] = {"$STR_WF_Enabled"}; default = 1; }; class gameplayUnitsBounty { title = "$STR_WF_PARAMETER_UnitsBounty"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class gameplayUpgradesEast { title = "$STR_WF_PARAMETER_Upgrades_East"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class gameplayUpgradesWest { title = "$STR_WF_PARAMETER_Upgrades_West"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class gameplayVictoryConditions { title = "$STR_WF_PARAMETER_VictoryCondition"; values[] = {0,1,2,3}; texts[] = {"$STR_WF_PARAMETER_Victory_Annihilation","$STR_WF_PARAMETER_Victory_Assassination","$STR_WF_PARAMETER_Victory_Supremacy","$STR_WF_PARAMETER_Victory_Towns"}; default = 0; }; class gameplayViewDistance { title = "$STR_WF_PARAMETER_ViewDistance"; values[] = {200,500,800,1000,1500,2000,2500,3000,3500,4000,4500,5000}; texts[] = {"200m","500m","800m","1000m","1500m","2000m","2500m","3000m","3500m","4000m","4500m","5000m"}; default = 4000; }; class moduleCM { title = "$STR_WF_PARAMETER_Countermeasures"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class moduleEASA { title = "$STR_WF_PARAMETER_EASA"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class moduleHC { title = "$STR_WF_PARAMETER_HighCommand"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class moduleICBM { title = "$STR_WF_PARAMETER_ICBM"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class moduleISIS { title = "$STR_WF_PARAMETER_ISIS"; values[] = {0,1,2}; texts[] = {"$STR_WF_Disabled","$STR_WF_Leader","$STR_WF_All"}; default = 0; }; class moduleUPSMON { title = "$STR_WF_PARAMETER_UPSMON"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class moduleVC { title = "$STR_WF_PARAMETER_Clouds"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class respawnCamps { title = "$STR_WF_PARAMETER_Camp"; values[] = {0,1,2,3}; texts[] = {"$STR_WF_Disabled","$STR_WF_PARAMETER_Classic","$STR_WF_PARAMETER_Respawn_CampsNearby","$STR_WF_PARAMETER_Respawn_Defender"}; default = 1; }; class respawnCampsRule { title = "$STR_WF_PARAMETER_CampRespawnRule"; values[] = {0,1,2}; texts[] = {"$STR_WF_Disabled","$STR_WF_PARAMETER_Respawn_CampsRule_WestEast","$STR_WF_PARAMETER_Respawn_CampsRule_WestEastRes"}; default = 1; }; class respawnDelay { title = "$STR_WF_PARAMETER_Respawn"; values[] = {10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90}; texts[] = {"10 Seconds","15 Seconds","20 Seconds","25 Seconds","30 Seconds","35 Seconds","40 Seconds","45 Seconds","50 Seconds", "55 Seconds","60 Seconds","65 Seconds","70 Seconds","75 Seconds","80 Seconds","85 Seconds","90 Seconds"}; default = 20; }; class respawnMASH { title = "$STR_WF_PARAMETER_Respawn_MASH"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class respawnMobile { title = "$STR_WF_PARAMETER_MobileRespawn"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class respawnPenalty { title = "$STR_WF_PARAMETER_Respawn_Penalty"; values[] = {0,1,2,3,4,5}; texts[] = {"$STR_WF_Disabled","$STR_WF_PARAMETER_Respawn_Penalty_Remove","$STR_WF_PARAMETER_Respawn_Penalty_Full","$STR_WF_PARAMETER_Respawn_Penalty_OneHalf","$STR_WF_PARAMETER_Respawn_Penalty_OneFourth","$STR_WF_PARAMETER_Respawn_Penalty_Mobile"}; default = 0; }; class respawnTownsRange { title = "$STR_WF_PARAMETER_TownRespawnRange"; values[] = {50,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,950,1000,1500,2000,2500,3000,3500,4000}; texts[] = {"50m","100m","150m","200m","250m","300m","350m","400m","450m","500m","550m","600m","650m","700m","750m","800m","850m","900m","950m","1000m","1500m","2000m","2500m","3000m","3500m","4000m"}; default = 400; }; class restrictionAdvancedAir { title = "$STR_WF_PARAMETER_AdvancedAir"; values[] = {0,1,2}; texts[] = {"$STR_WF_Disabled","$STR_WF_PARAMETER_Restriction_Air_H","$STR_WF_PARAMETER_Restriction_Air_HTransport"}; default = 0; }; class restrictionGear { title = "$STR_WF_PARAMETER_GearRestriction"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; #ifndef ARROWHEAD class restrictionKamov { title = "$STR_WF_PARAMETER_Kamov"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; #endif class townsAmount { title = "$STR_WF_PARAMETER_TownsAmount"; values[] = {0,1,2,3,4}; texts[] = {"$STR_WF_PARAMETER_Extra_Small","$STR_WF_PARAMETER_Small","$STR_WF_PARAMETER_Medium","$STR_WF_PARAMETER_Large","$STR_WF_PARAMETER_Full"}; default = 3; }; class townsStrikerMax { title = "$STR_WF_PARAMETER_MaxResStriker"; values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,24,26,28,30,32,34,36,38,40,50,60,70,80,90,100}; texts[] = {"$STR_WF_Disabled","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","22","24","26","28","30","32","34","36","38","40","50","60","70","80","90","100"}; default = 0; }; class townsCamps { title = "$STR_WF_PARAMETER_TownsCamps"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class townsCaptureMode { title = "$STR_WF_PARAMETER_TownsCaptureMode"; values[] = {0,1,2}; texts[] = {"$STR_WF_PARAMETER_Classic","$STR_WF_PARAMETER_TownsCaptureMode_Threshold","$STR_WF_PARAMETER_TownsCaptureMode_AllCamps"}; default = 2; }; #ifdef VANILLA class townsCivilians { title = "$STR_WF_PARAMETER_TownCivilians"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","Chernarus Civilians"}; default = 0; }; #endif #ifdef ARROWHEAD class townsCivilians { title = "$STR_WF_PARAMETER_TownCivilians"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","Takistan Civilians"}; default = 0; }; #endif #ifdef COMBINEDOPS class townsCivilians { title = "$STR_WF_PARAMETER_TownCivilians"; values[] = {0,1,2}; texts[] = {"$STR_WF_Disabled","Chernarus Civilians","Takistan Civilians"}; default = 0; }; #endif class townsConquestMode { title = "$STR_WF_PARAMETER_TownsConquestMode"; values[] = {0,1}; texts[] = {"$STR_WF_PARAMETER_Classic","$STR_WF_PARAMETER_Territorial"}; default = 0; }; class townsOccupation { title = "$STR_WF_PARAMETER_Occupation"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class townsOccupDifficulty { title = "$STR_WF_PARAMETER_Difficulty_Occupation"; values[] = {1,2,3,4,5}; texts[] = {"$STR_WF_PARAMETER_Light","$STR_WF_PARAMETER_Medium","$STR_WF_PARAMETER_Hard","$STR_WF_PARAMETER_Impossible","$STR_WF_PARAMETER_Automatic"}; default = 1; }; #ifdef VANILLA class townsOccupationFactionEast { title = "$STR_WF_Gameplay_Occupation_Type_East"; values[] = {0,1}; texts[] = {"Insurgents","Russians"}; default = 1; }; #endif #ifdef VANILLA class townsOccupationFactionWest { title = "$STR_WF_PARAMETER_Occupation_Type_West"; values[] = {0,1}; texts[] = {"Chernarussian Defence Force","United States Marine Corps"}; default = 1; }; #endif #ifdef ARROWHEAD class townsOccupationFactionEast { title = "$STR_WF_PARAMETER_Occupation_Type_East"; values[] = {0}; texts[] = {"Takistan Army"}; default = 0; }; #endif #ifdef ARROWHEAD class townsOccupationFactionWest { title = "$STR_WF_PARAMETER_Occupation_Type_West"; values[] = {0}; texts[] = {"United States"}; default = 0; }; #endif #ifdef COMBINEDOPS class townsOccupationFactionEast { title = "$STR_WF_PARAMETER_Occupation_Type_East"; values[] = {0,1,2}; texts[] = {"Insurgents","Russians","Takistan Army"}; default = 1; }; #endif #ifdef COMBINEDOPS class townsOccupationFactionWest { title = "$STR_WF_PARAMETER_Occupation_Type_West"; values[] = {0,1,2}; texts[] = {"Chernarussian Defence Force","United States","United States Marine Corps"}; default = 2; }; #endif class townsOccupReinforcement { title = "$STR_WF_PARAMETER_Reinforcement_Occupation"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class townsMaxPatrol { title = "$STR_WF_PARAMETER_MaxResPatrols"; values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,24,26,28,30,32,34,36,38,40,50,60,70,80,90,100}; texts[] = {"$STR_WF_Disabled","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","22","24","26","28","30","32","34","36","38","40","50","60","70","80","90","100"}; default = 0; }; class townsProtectionRange { title = "$STR_WF_PARAMETER_TownProtectionRange"; values[] = {0,50,100,150,200,250,300,350,400,450,500}; texts[] = {"0m","50m","100m","150m","200m","250m","300m","350m","400m","450m","500m"}; default = 0; }; class townsPurchaseInfantry { title = "$STR_WF_PARAMETER_TownsPurchaseMilita"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class townsResistance { title = "$STR_WF_PARAMETER_Resistance"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; class townsResistanceDifficulty { title = "$STR_WF_PARAMETER_Difficulty_Resistance"; values[] = {1,2,3,4}; texts[] = {"$STR_WF_PARAMETER_Light","$STR_WF_PARAMETER_Medium","$STR_WF_PARAMETER_Hard","$STR_WF_PARAMETER_Impossible"}; default = 2; }; #ifdef VANILLA class townsResistanceFaction { title = "$STR_WF_PARAMETER_Reinforcement_Type"; values[] = {0}; texts[] = {"Guerillas"}; default = 0; }; #endif #ifdef ARROWHEAD class townsResistanceFaction { title = "$STR_WF_PARAMETER_Reinforcement_Type"; values[] = {0,1}; texts[] = {"Private Military Company","Takistani Locals"}; default = 1; }; #endif #ifdef COMBINEDOPS class townsResistanceFaction { title = "$STR_WF_PARAMETER_Reinforcement_Type"; values[] = {0,1,2}; texts[] = {"Guerillas","Private Military Company","Takistani Locals"}; default = 2; }; #endif class townsResistanceReinforcement { title = "$STR_WF_PARAMETER_Reinforcement_Resistance"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class townsResistanceVehicleLock { title = "$STR_WF_PARAMETER_Resistance_VehLock"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 0; }; class townsStartingMode { title = "$STR_WF_PARAMETER_StartingMode"; values[] = {0,1,2,3}; texts[] = {"$STR_WF_PARAMETER_None","$STR_WF_PARAMETER_Divided_Towns","$STR_WF_PARAMETER_Nearby_Town","$STR_WF_PARAMETER_StartingLocations_Random"}; default = 0; }; class enableShellBallistics { title = "$STR_WF_PARAMETER_Ballistics"; values[] = {0,1}; texts[] = {"$STR_WF_PARAMETER_No","$STR_WF_PARAMETER_Yes"}; default = 1; }; class enableTownConstruction { title = "GAMEPLAY: Construction Static Defences at Towns"; values[] = {0,1}; texts[] = {"$STR_WF_Disabled","$STR_WF_Enabled"}; default = 1; }; };
[ [ [ 1, 688 ] ] ]
e53926598fc31d03f5e8db89051056d75f3d0ba9
5df145c06c45a6181d7402279aabf7ce9376e75e
/src/bookmarks.cpp
df7c9311582c6d3cded36c04f5f317d347271e3d
[]
no_license
plus7/openjohn
89318163f42347bbac24e8272081d794449ab861
1ffdcc1ea3f0af43b9033b68e8eca048a229305f
refs/heads/master
2021-03-12T22:55:57.315977
2009-05-15T11:30:00
2009-05-15T11:30:00
152,690
1
1
null
null
null
null
UTF-8
C++
false
false
33,549
cpp
/* * Copyright 2009 NOSE Takafumi <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information ([email protected]) ** ** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain ** additional rights. These rights are described in the Nokia Qt LGPL ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this ** package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at [email protected]. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "bookmarks.h" //#include "bookmarksmenu.h" //#include "autosaver.h" #include "johnapplication.h" #include "treeproxymodel.h" #include "xbel.h" #include <QtCore/QBuffer> #include <QtCore/QFile> #include <QtCore/QMimeData> #include <QtGui/QDesktopServices> #include <QtGui/QDragEnterEvent> #include <QtGui/QFileDialog> #include <QtGui/QHeaderView> #include <QtGui/QIcon> #include <QtGui/QMessageBox> #include <QtGui/QToolButton> #include <QtWebKit/QWebSettings> #include <QtCore/QDebug> #define BOOKMARKBAR "Bookmarks Bar" #define BOOKMARKMENU "Bookmarks Menu" BookmarksManager::BookmarksManager(QObject *parent) : QObject(parent) , m_loaded(false) //, m_saveTimer(new AutoSaver(this)) , m_bookmarkRootNode(0) , m_bookmarkModel(0) { // connect(this, SIGNAL(entryAdded(BookmarkNode *)), // m_saveTimer, SLOT(changeOccurred())); // connect(this, SIGNAL(entryRemoved(BookmarkNode *, int, BookmarkNode *)), // m_saveTimer, SLOT(changeOccurred())); // connect(this, SIGNAL(entryChanged(BookmarkNode *)), // m_saveTimer, SLOT(changeOccurred())); } BookmarksManager::~BookmarksManager() { //m_saveTimer->saveIfNeccessary(); } void BookmarksManager::changeExpanded() { //m_saveTimer->changeOccurred(); } void BookmarksManager::load() { if (m_loaded) return; m_loaded = true; QString dir = QDesktopServices::storageLocation(QDesktopServices::DataLocation); QString bookmarkFile = dir + QLatin1String("/bookmarks.xbel"); if (!QFile::exists(bookmarkFile)) bookmarkFile = QLatin1String(":defaultbookmarks.xbel"); XbelReader reader; m_bookmarkRootNode = reader.read(bookmarkFile); if (reader.error() != QXmlStreamReader::NoError) { QMessageBox::warning(0, QLatin1String("Loading Bookmark"), tr("Error when loading bookmarks on line %1, column %2:\n" "%3").arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString())); } BookmarkNode *toolbar = 0; BookmarkNode *menu = 0; QList<BookmarkNode*> others; for (int i = m_bookmarkRootNode->children().count() - 1; i >= 0; --i) { BookmarkNode *node = m_bookmarkRootNode->children().at(i); if (node->type() == BookmarkNode::Folder) { // Automatically convert if (node->title == tr("Toolbar Bookmarks") && !toolbar) { node->title = tr(BOOKMARKBAR); } if (node->title == tr(BOOKMARKBAR) && !toolbar) { toolbar = node; } // Automatically convert if (node->title == tr("Menu") && !menu) { node->title = tr(BOOKMARKMENU); } if (node->title == tr(BOOKMARKMENU) && !menu) { menu = node; } } else { others.append(node); } m_bookmarkRootNode->remove(node); } Q_ASSERT(m_bookmarkRootNode->children().count() == 0); if (!toolbar) { toolbar = new BookmarkNode(BookmarkNode::Folder, m_bookmarkRootNode); toolbar->title = tr(BOOKMARKBAR); } else { m_bookmarkRootNode->add(toolbar); } if (!menu) { menu = new BookmarkNode(BookmarkNode::Folder, m_bookmarkRootNode); menu->title = tr(BOOKMARKMENU); } else { m_bookmarkRootNode->add(menu); } for (int i = 0; i < others.count(); ++i) menu->add(others.at(i)); } void BookmarksManager::save() const { if (!m_loaded) return; XbelWriter writer; QString dir = QDesktopServices::storageLocation(QDesktopServices::DataLocation); QString bookmarkFile = dir + QLatin1String("/bookmarks.xbel"); if (!writer.write(bookmarkFile, m_bookmarkRootNode)) qWarning() << "BookmarkManager: error saving to" << bookmarkFile; } void BookmarksManager::addBookmark(BookmarkNode *parent, BookmarkNode *node, int row) { if (!m_loaded) return; Q_ASSERT(parent); InsertBookmarksCommand *command = new InsertBookmarksCommand(this, parent, node, row); m_commands.push(command); } void BookmarksManager::removeBookmark(BookmarkNode *node) { if (!m_loaded) return; Q_ASSERT(node); BookmarkNode *parent = node->parent(); int row = parent->children().indexOf(node); RemoveBookmarksCommand *command = new RemoveBookmarksCommand(this, parent, row); m_commands.push(command); } void BookmarksManager::setTitle(BookmarkNode *node, const QString &newTitle) { if (!m_loaded) return; Q_ASSERT(node); ChangeBookmarkCommand *command = new ChangeBookmarkCommand(this, node, newTitle, true); m_commands.push(command); } void BookmarksManager::setUrl(BookmarkNode *node, const QString &newUrl) { if (!m_loaded) return; Q_ASSERT(node); ChangeBookmarkCommand *command = new ChangeBookmarkCommand(this, node, newUrl, false); m_commands.push(command); } BookmarkNode *BookmarksManager::bookmarks() { if (!m_loaded) load(); return m_bookmarkRootNode; } BookmarkNode *BookmarksManager::menu() { if (!m_loaded) load(); for (int i = m_bookmarkRootNode->children().count() - 1; i >= 0; --i) { BookmarkNode *node = m_bookmarkRootNode->children().at(i); if (node->title == tr(BOOKMARKMENU)) return node; } Q_ASSERT(false); return 0; } BookmarkNode *BookmarksManager::toolbar() { if (!m_loaded) load(); for (int i = m_bookmarkRootNode->children().count() - 1; i >= 0; --i) { BookmarkNode *node = m_bookmarkRootNode->children().at(i); if (node->title == tr(BOOKMARKBAR)) return node; } Q_ASSERT(false); return 0; } BookmarksModel *BookmarksManager::bookmarksModel() { if (!m_bookmarkModel) m_bookmarkModel = new BookmarksModel(this, this); return m_bookmarkModel; } void BookmarksManager::importBookmarks() { QString fileName = QFileDialog::getOpenFileName(0, tr("Open File"), QString(), tr("XBEL (*.xbel *.xml)")); if (fileName.isEmpty()) return; XbelReader reader; BookmarkNode *importRootNode = reader.read(fileName); if (reader.error() != QXmlStreamReader::NoError) { QMessageBox::warning(0, QLatin1String("Loading Bookmark"), tr("Error when loading bookmarks on line %1, column %2:\n" "%3").arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString())); } importRootNode->setType(BookmarkNode::Folder); importRootNode->title = (tr("Imported %1").arg(QDate::currentDate().toString(Qt::SystemLocaleShortDate))); addBookmark(menu(), importRootNode); } void BookmarksManager::exportBookmarks() { QString fileName = QFileDialog::getSaveFileName(0, tr("Save File"), tr("%1 Bookmarks.xbel").arg(QCoreApplication::applicationName()), tr("XBEL (*.xbel *.xml)")); if (fileName.isEmpty()) return; XbelWriter writer; if (!writer.write(fileName, m_bookmarkRootNode)) QMessageBox::critical(0, tr("Export error"), tr("error saving bookmarks")); } RemoveBookmarksCommand::RemoveBookmarksCommand(BookmarksManager *m_bookmarkManagaer, BookmarkNode *parent, int row) : QUndoCommand(BookmarksManager::tr("Remove Bookmark")) , m_row(row) , m_bookmarkManagaer(m_bookmarkManagaer) , m_node(parent->children().value(row)) , m_parent(parent) , m_done(false) { } RemoveBookmarksCommand::~RemoveBookmarksCommand() { if (m_done && !m_node->parent()) { delete m_node; } } void RemoveBookmarksCommand::undo() { m_parent->add(m_node, m_row); emit m_bookmarkManagaer->entryAdded(m_node); m_done = false; } void RemoveBookmarksCommand::redo() { m_parent->remove(m_node); emit m_bookmarkManagaer->entryRemoved(m_parent, m_row, m_node); m_done = true; } InsertBookmarksCommand::InsertBookmarksCommand(BookmarksManager *m_bookmarkManagaer, BookmarkNode *parent, BookmarkNode *node, int row) : RemoveBookmarksCommand(m_bookmarkManagaer, parent, row) { setText(BookmarksManager::tr("Insert Bookmark")); m_node = node; } ChangeBookmarkCommand::ChangeBookmarkCommand(BookmarksManager *m_bookmarkManagaer, BookmarkNode *node, const QString &newValue, bool title) : QUndoCommand() , m_bookmarkManagaer(m_bookmarkManagaer) , m_title(title) , m_newValue(newValue) , m_node(node) { if (m_title) { m_oldValue = m_node->title; setText(BookmarksManager::tr("Name Change")); } else { m_oldValue = m_node->url; setText(BookmarksManager::tr("Address Change")); } } void ChangeBookmarkCommand::undo() { if (m_title) m_node->title = m_oldValue; else m_node->url = m_oldValue; emit m_bookmarkManagaer->entryChanged(m_node); } void ChangeBookmarkCommand::redo() { if (m_title) m_node->title = m_newValue; else m_node->url = m_newValue; emit m_bookmarkManagaer->entryChanged(m_node); } BookmarksModel::BookmarksModel(BookmarksManager *bookmarkManager, QObject *parent) : QAbstractItemModel(parent) , m_endMacro(false) , m_bookmarksManager(bookmarkManager) { connect(bookmarkManager, SIGNAL(entryAdded(BookmarkNode *)), this, SLOT(entryAdded(BookmarkNode *))); connect(bookmarkManager, SIGNAL(entryRemoved(BookmarkNode *, int, BookmarkNode *)), this, SLOT(entryRemoved(BookmarkNode *, int, BookmarkNode *))); connect(bookmarkManager, SIGNAL(entryChanged(BookmarkNode *)), this, SLOT(entryChanged(BookmarkNode *))); } QModelIndex BookmarksModel::index(BookmarkNode *node) const { BookmarkNode *parent = node->parent(); if (!parent) return QModelIndex(); return createIndex(parent->children().indexOf(node), 0, node); } void BookmarksModel::entryAdded(BookmarkNode *item) { Q_ASSERT(item && item->parent()); int row = item->parent()->children().indexOf(item); BookmarkNode *parent = item->parent(); // item was already added so remove beore beginInsertRows is called parent->remove(item); beginInsertRows(index(parent), row, row); parent->add(item, row); endInsertRows(); } void BookmarksModel::entryRemoved(BookmarkNode *parent, int row, BookmarkNode *item) { // item was already removed, re-add so beginRemoveRows works parent->add(item, row); beginRemoveRows(index(parent), row, row); parent->remove(item); endRemoveRows(); } void BookmarksModel::entryChanged(BookmarkNode *item) { QModelIndex idx = index(item); emit dataChanged(idx, idx); } bool BookmarksModel::removeRows(int row, int count, const QModelIndex &parent) { if (row < 0 || count <= 0 || row + count > rowCount(parent)) return false; BookmarkNode *bookmarkNode = node(parent); for (int i = row + count - 1; i >= row; --i) { BookmarkNode *node = bookmarkNode->children().at(i); if (node == m_bookmarksManager->menu() || node == m_bookmarksManager->toolbar()) continue; m_bookmarksManager->removeBookmark(node); } if (m_endMacro) { m_bookmarksManager->undoRedoStack()->endMacro(); m_endMacro = false; } return true; } QVariant BookmarksModel::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { switch (section) { case 0: return tr("Title"); case 1: return tr("Address"); } } return QAbstractItemModel::headerData(section, orientation, role); } QVariant BookmarksModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || index.model() != this) return QVariant(); const BookmarkNode *bookmarkNode = node(index); switch (role) { case Qt::EditRole: case Qt::DisplayRole: if (bookmarkNode->type() == BookmarkNode::Separator) { switch (index.column()) { case 0: return QString(50, 0xB7); case 1: return QString(); } } switch (index.column()) { case 0: return bookmarkNode->title; case 1: return bookmarkNode->url; } break; case BookmarksModel::UrlRole: return QUrl(bookmarkNode->url); break; case BookmarksModel::UrlStringRole: return bookmarkNode->url; break; case BookmarksModel::TypeRole: return bookmarkNode->type(); break; case BookmarksModel::SeparatorRole: return (bookmarkNode->type() == BookmarkNode::Separator); break; // case Qt::DecorationRole: // if (index.column() == 0) { // if (bookmarkNode->type() == BookmarkNode::Folder) // return QApplication::style()->standardIcon(QStyle::SP_DirIcon); // return BrowserApplication::instance()->icon(bookmarkNode->url); // } } return QVariant(); } int BookmarksModel::columnCount(const QModelIndex &parent) const { return (parent.column() > 0) ? 0 : 2; } int BookmarksModel::rowCount(const QModelIndex &parent) const { if (parent.column() > 0) return 0; if (!parent.isValid()) return m_bookmarksManager->bookmarks()->children().count(); const BookmarkNode *item = static_cast<BookmarkNode*>(parent.internalPointer()); return item->children().count(); } QModelIndex BookmarksModel::index(int row, int column, const QModelIndex &parent) const { if (row < 0 || column < 0 || row >= rowCount(parent) || column >= columnCount(parent)) return QModelIndex(); // get the parent node BookmarkNode *parentNode = node(parent); return createIndex(row, column, parentNode->children().at(row)); } QModelIndex BookmarksModel::parent(const QModelIndex &index) const { if (!index.isValid()) return QModelIndex(); BookmarkNode *itemNode = node(index); BookmarkNode *parentNode = (itemNode ? itemNode->parent() : 0); if (!parentNode || parentNode == m_bookmarksManager->bookmarks()) return QModelIndex(); // get the parent's row BookmarkNode *grandParentNode = parentNode->parent(); int parentRow = grandParentNode->children().indexOf(parentNode); Q_ASSERT(parentRow >= 0); return createIndex(parentRow, 0, parentNode); } bool BookmarksModel::hasChildren(const QModelIndex &parent) const { if (!parent.isValid()) return true; const BookmarkNode *parentNode = node(parent); return (parentNode->type() == BookmarkNode::Folder); } Qt::ItemFlags BookmarksModel::flags(const QModelIndex &index) const { if (!index.isValid()) return Qt::NoItemFlags; Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled; BookmarkNode *bookmarkNode = node(index); if (bookmarkNode != m_bookmarksManager->menu() && bookmarkNode != m_bookmarksManager->toolbar()) { flags |= Qt::ItemIsDragEnabled; if (bookmarkNode->type() != BookmarkNode::Separator) flags |= Qt::ItemIsEditable; } if (hasChildren(index)) flags |= Qt::ItemIsDropEnabled; return flags; } Qt::DropActions BookmarksModel::supportedDropActions () const { return Qt::CopyAction | Qt::MoveAction; } #define MIMETYPE QLatin1String("application/bookmarks.xbel") QStringList BookmarksModel::mimeTypes() const { QStringList types; types << MIMETYPE; return types; } QMimeData *BookmarksModel::mimeData(const QModelIndexList &indexes) const { QMimeData *mimeData = new QMimeData(); QByteArray data; QDataStream stream(&data, QIODevice::WriteOnly); foreach (QModelIndex index, indexes) { if (index.column() != 0 || !index.isValid()) continue; QByteArray encodedData; QBuffer buffer(&encodedData); buffer.open(QBuffer::ReadWrite); XbelWriter writer; const BookmarkNode *parentNode = node(index); writer.write(&buffer, parentNode); stream << encodedData; } mimeData->setData(MIMETYPE, data); return mimeData; } bool BookmarksModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) { if (action == Qt::IgnoreAction) return true; if (!data->hasFormat(MIMETYPE) || column > 0) return false; QByteArray ba = data->data(MIMETYPE); QDataStream stream(&ba, QIODevice::ReadOnly); if (stream.atEnd()) return false; QUndoStack *undoStack = m_bookmarksManager->undoRedoStack(); undoStack->beginMacro(QLatin1String("Move Bookmarks")); while (!stream.atEnd()) { QByteArray encodedData; stream >> encodedData; QBuffer buffer(&encodedData); buffer.open(QBuffer::ReadOnly); XbelReader reader; BookmarkNode *rootNode = reader.read(&buffer); QList<BookmarkNode*> children = rootNode->children(); for (int i = 0; i < children.count(); ++i) { BookmarkNode *bookmarkNode = children.at(i); rootNode->remove(bookmarkNode); row = qMax(0, row); BookmarkNode *parentNode = node(parent); m_bookmarksManager->addBookmark(parentNode, bookmarkNode, row); m_endMacro = true; } delete rootNode; } return true; } bool BookmarksModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (!index.isValid() || (flags(index) & Qt::ItemIsEditable) == 0) return false; BookmarkNode *item = node(index); switch (role) { case Qt::EditRole: case Qt::DisplayRole: if (index.column() == 0) { m_bookmarksManager->setTitle(item, value.toString()); break; } if (index.column() == 1) { m_bookmarksManager->setUrl(item, value.toString()); break; } return false; case BookmarksModel::UrlRole: m_bookmarksManager->setUrl(item, value.toUrl().toString()); break; case BookmarksModel::UrlStringRole: m_bookmarksManager->setUrl(item, value.toString()); break; default: break; return false; } return true; } BookmarkNode *BookmarksModel::node(const QModelIndex &index) const { BookmarkNode *itemNode = static_cast<BookmarkNode*>(index.internalPointer()); if (!itemNode) return m_bookmarksManager->bookmarks(); return itemNode; } AddBookmarkProxyModel::AddBookmarkProxyModel(QObject *parent) : QSortFilterProxyModel(parent) { } int AddBookmarkProxyModel::columnCount(const QModelIndex &parent) const { return qMin(1, QSortFilterProxyModel::columnCount(parent)); } bool AddBookmarkProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { QModelIndex idx = sourceModel()->index(source_row, 0, source_parent); return sourceModel()->hasChildren(idx); } AddBookmarkDialog::AddBookmarkDialog(const QString &url, const QString &title, QWidget *parent, BookmarksManager *bookmarkManager) : QDialog(parent) , m_url(url) , m_bookmarksManager(bookmarkManager) { setWindowFlags(Qt::Sheet); if (!m_bookmarksManager) m_bookmarksManager = JohnApplication::bookmarksManager(); setupUi(this); QTreeView *view = new QTreeView(this); m_proxyModel = new AddBookmarkProxyModel(this); BookmarksModel *model = m_bookmarksManager->bookmarksModel(); m_proxyModel->setSourceModel(model); view->setModel(m_proxyModel); view->expandAll(); view->header()->setStretchLastSection(true); view->header()->hide(); view->setItemsExpandable(false); view->setRootIsDecorated(false); view->setIndentation(10); location->setModel(m_proxyModel); view->show(); location->setView(view); BookmarkNode *menu = m_bookmarksManager->menu(); QModelIndex idx = m_proxyModel->mapFromSource(model->index(menu)); view->setCurrentIndex(idx); location->setCurrentIndex(idx.row()); name->setText(title); } void AddBookmarkDialog::accept() { QModelIndex index = location->view()->currentIndex(); index = m_proxyModel->mapToSource(index); if (!index.isValid()) index = m_bookmarksManager->bookmarksModel()->index(0, 0); BookmarkNode *parent = m_bookmarksManager->bookmarksModel()->node(index); BookmarkNode *bookmark = new BookmarkNode(BookmarkNode::Bookmark); bookmark->url = m_url; bookmark->title = name->text(); m_bookmarksManager->addBookmark(parent, bookmark); QDialog::accept(); } BookmarksMenu::BookmarksMenu(QWidget *parent) : ModelMenu(parent) , m_bookmarksManager(0) { connect(this, SIGNAL(activated(const QModelIndex &)), this, SLOT(activated(const QModelIndex &))); setMaxRows(-1); setHoverRole(BookmarksModel::UrlStringRole); setSeparatorRole(BookmarksModel::SeparatorRole); } void BookmarksMenu::activated(const QModelIndex &index) { emit openUrl(index.data(BookmarksModel::UrlRole).toUrl()); } bool BookmarksMenu::prePopulated() { m_bookmarksManager = JohnApplication::bookmarksManager(); setModel(m_bookmarksManager->bookmarksModel()); setRootIndex(m_bookmarksManager->bookmarksModel()->index(1, 0)); // initial actions for (int i = 0; i < m_initialActions.count(); ++i) addAction(m_initialActions.at(i)); if (!m_initialActions.isEmpty()) addSeparator(); createMenu(model()->index(0, 0), 1, this); return true; } void BookmarksMenu::setInitialActions(QList<QAction*> actions) { m_initialActions = actions; for (int i = 0; i < m_initialActions.count(); ++i) addAction(m_initialActions.at(i)); } BookmarksDialog::BookmarksDialog(QWidget *parent, BookmarksManager *manager) : QDialog(parent) { m_bookmarksManager = manager; if (!m_bookmarksManager) m_bookmarksManager = JohnApplication::bookmarksManager(); setupUi(this); tree->setUniformRowHeights(true); tree->setSelectionBehavior(QAbstractItemView::SelectRows); tree->setSelectionMode(QAbstractItemView::ContiguousSelection); tree->setTextElideMode(Qt::ElideMiddle); m_bookmarksModel = m_bookmarksManager->bookmarksModel(); m_proxyModel = new TreeProxyModel(this); connect(search, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString))); connect(removeButton, SIGNAL(clicked()), tree, SLOT(removeOne())); m_proxyModel->setSourceModel(m_bookmarksModel); tree->setModel(m_proxyModel); tree->setDragDropMode(QAbstractItemView::InternalMove); tree->setExpanded(m_proxyModel->index(0, 0), true); tree->setAlternatingRowColors(true); QFontMetrics fm(font()); int header = fm.width(QLatin1Char('m')) * 40; tree->header()->resizeSection(0, header); tree->header()->setStretchLastSection(true); connect(tree, SIGNAL(activated(const QModelIndex&)), this, SLOT(open())); tree->setContextMenuPolicy(Qt::CustomContextMenu); connect(tree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequested(const QPoint &))); connect(addFolderButton, SIGNAL(clicked()), this, SLOT(newFolder())); expandNodes(m_bookmarksManager->bookmarks()); setAttribute(Qt::WA_DeleteOnClose); } BookmarksDialog::~BookmarksDialog() { if (saveExpandedNodes(tree->rootIndex())) m_bookmarksManager->changeExpanded(); } bool BookmarksDialog::saveExpandedNodes(const QModelIndex &parent) { bool changed = false; for (int i = 0; i < m_proxyModel->rowCount(parent); ++i) { QModelIndex child = m_proxyModel->index(i, 0, parent); QModelIndex sourceIndex = m_proxyModel->mapToSource(child); BookmarkNode *childNode = m_bookmarksModel->node(sourceIndex); bool wasExpanded = childNode->expanded; if (tree->isExpanded(child)) { childNode->expanded = true; changed |= saveExpandedNodes(child); } else { childNode->expanded = false; } changed |= (wasExpanded != childNode->expanded); } return changed; } void BookmarksDialog::expandNodes(BookmarkNode *node) { for (int i = 0; i < node->children().count(); ++i) { BookmarkNode *childNode = node->children()[i]; if (childNode->expanded) { QModelIndex idx = m_bookmarksModel->index(childNode); idx = m_proxyModel->mapFromSource(idx); tree->setExpanded(idx, true); expandNodes(childNode); } } } void BookmarksDialog::customContextMenuRequested(const QPoint &pos) { QMenu menu; QModelIndex index = tree->indexAt(pos); index = index.sibling(index.row(), 0); if (index.isValid() && !tree->model()->hasChildren(index)) { menu.addAction(tr("Open"), this, SLOT(open())); menu.addSeparator(); } menu.addAction(tr("Delete"), tree, SLOT(removeOne())); menu.exec(QCursor::pos()); } void BookmarksDialog::open() { QModelIndex index = tree->currentIndex(); if (!index.parent().isValid()) return; emit openUrl(index.sibling(index.row(), 1).data(BookmarksModel::UrlRole).toUrl()); } void BookmarksDialog::newFolder() { QModelIndex currentIndex = tree->currentIndex(); QModelIndex idx = currentIndex; if (idx.isValid() && !idx.model()->hasChildren(idx)) idx = idx.parent(); if (!idx.isValid()) idx = tree->rootIndex(); idx = m_proxyModel->mapToSource(idx); BookmarkNode *parent = m_bookmarksManager->bookmarksModel()->node(idx); BookmarkNode *node = new BookmarkNode(BookmarkNode::Folder); node->title = tr("New Folder"); m_bookmarksManager->addBookmark(parent, node, currentIndex.row() + 1); } BookmarksToolBar::BookmarksToolBar(BookmarksModel *model, QWidget *parent) : QToolBar(tr("Bookmark"), parent) , m_bookmarksModel(model) { connect(this, SIGNAL(actionTriggered(QAction*)), this, SLOT(triggered(QAction*))); setRootIndex(model->index(0, 0)); connect(m_bookmarksModel, SIGNAL(modelReset()), this, SLOT(build())); connect(m_bookmarksModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(build())); connect(m_bookmarksModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(build())); connect(m_bookmarksModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(build())); setAcceptDrops(true); } void BookmarksToolBar::dragEnterEvent(QDragEnterEvent *event) { const QMimeData *mimeData = event->mimeData(); if (mimeData->hasUrls()) event->acceptProposedAction(); QToolBar::dragEnterEvent(event); } void BookmarksToolBar::dropEvent(QDropEvent *event) { const QMimeData *mimeData = event->mimeData(); if (mimeData->hasUrls() && mimeData->hasText()) { QList<QUrl> urls = mimeData->urls(); QAction *action = actionAt(event->pos()); QString dropText; if (action) dropText = action->text(); int row = -1; QModelIndex parentIndex = m_root; for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) { QModelIndex idx = m_bookmarksModel->index(i, 0, m_root); QString title = idx.data().toString(); if (title == dropText) { row = i; if (m_bookmarksModel->hasChildren(idx)) { parentIndex = idx; row = -1; } break; } } BookmarkNode *bookmark = new BookmarkNode(BookmarkNode::Bookmark); bookmark->url = urls.at(0).toString(); bookmark->title = mimeData->text(); BookmarkNode *parent = m_bookmarksModel->node(parentIndex); BookmarksManager *bookmarksManager = m_bookmarksModel->bookmarksManager(); bookmarksManager->addBookmark(parent, bookmark, row); event->acceptProposedAction(); } QToolBar::dropEvent(event); } void BookmarksToolBar::setRootIndex(const QModelIndex &index) { m_root = index; build(); } QModelIndex BookmarksToolBar::rootIndex() const { return m_root; } void BookmarksToolBar::build() { clear(); for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) { QModelIndex idx = m_bookmarksModel->index(i, 0, m_root); if (m_bookmarksModel->hasChildren(idx)) { QToolButton *button = new QToolButton(this); button->setPopupMode(QToolButton::InstantPopup); button->setArrowType(Qt::DownArrow); button->setText(idx.data().toString()); ModelMenu *menu = new ModelMenu(this); connect(menu, SIGNAL(activated(const QModelIndex &)), this, SLOT(activated(const QModelIndex &))); menu->setModel(m_bookmarksModel); menu->setRootIndex(idx); menu->addAction(new QAction(menu)); button->setMenu(menu); button->setToolButtonStyle(Qt::ToolButtonTextOnly); QAction *a = addWidget(button); a->setText(idx.data().toString()); } else { QAction *action = addAction(idx.data().toString()); action->setData(idx.data(BookmarksModel::UrlRole)); } } } void BookmarksToolBar::triggered(QAction *action) { QVariant v = action->data(); if (v.canConvert<QUrl>()) { emit openUrl(v.toUrl()); } } void BookmarksToolBar::activated(const QModelIndex &index) { emit openUrl(index.data(BookmarksModel::UrlRole).toUrl()); }
[ [ [ 1, 1007 ] ] ]
0ff084c5e9dc688c1c198217c803e5eaadf992df
b6bad03a59ec436b60c30fc793bdcf687a21cf31
/som2416/wince5/post.cpp
0a81e8a82149fd9e1afe227af9c90ad64aac88e4
[]
no_license
blackfa1con/openembed
9697f99b12df16b1c5135e962890e8a3935be877
3029d7d8c181449723bb16d0a73ee87f63860864
refs/heads/master
2021-01-10T14:14:39.694809
2010-12-16T03:20:27
2010-12-16T03:20:27
52,422,065
0
0
null
null
null
null
UTF-8
C++
false
false
29,186
cpp
// Ported for 2450 Win CE 5.0 // #include <windows.h> #include <nkintr.h> //#include <oalintr.h> #include <pm.h> #include "pmplatform.h" #include <ceddk.h> #include <S3c2450.h> #include <bsp.h> #include "post.h" #define PM_MSG 0 #define POST_MSG 0 #define POST_DEBUG 0 #define RETAIL_ON 0 #define DOTNET_DRIVER 1 // 0:PPC, 1:CE.NET #define POST_CLOCK_OFF_ON_IDLE 0 #if (POST_CLOCK_OFF_ON_IDLE == 1) #define POST_THREAD_TIMEOUT 3000 #else #define POST_THREAD_TIMEOUT INFINITE #endif #define USE_RESERVED_BUFFER 0 #if (USE_RESERVED_BUFFER == 1) volatile unsigned char* pVirtSrcAddr;// = (volatile unsigned char*)((DWORD)POST_INPUT_BUFFER + VIRTUAL_ADDR_OFFSET); volatile unsigned char* pVirtDstAddr;// = (volatile unsigned char*)((DWORD)POST_OUTPUT_BUFFER + VIRTUAL_ADDR_OFFSET); #else PHYSICAL_ADDRESS g_PhysSrcAddr; PHYSICAL_ADDRESS g_PhysDstAddr; PBYTE pVirtSrcAddr = NULL; PBYTE pVirtDstAddr = NULL; #endif volatile S3C2450_IOPORT_REG *s2450IOP = (S3C2450_IOPORT_REG *)S3C2450_BASE_REG_PA_IOPORT; volatile S3C2450_CAM_REG *s2450CAM = (S3C2450_CAM_REG *)S3C2450_BASE_REG_PA_CAM; volatile S3C2450_INTR_REG *s2450INT = (S3C2450_INTR_REG *)S3C2450_BASE_REG_PA_INTR; volatile S3C2450_CLKPWR_REG *s2450PWR = (S3C2450_CLKPWR_REG *)S3C2450_BASE_REG_PA_CLOCK_POWER; volatile U8 *PostInputBuffer = NULL; volatile U8 *PostOutputBuffer = NULL; unsigned char *Post_input_yuv; unsigned char *Post_output_rgb; unsigned int dwPostProcessTimeout = POST_THREAD_TIMEOUT; BOOL bIdlePwrDown = FALSE; BOOL bAppOpenFlag = FALSE; HANDLE PostThread; HANDLE PostEvent; HANDLE PostDoneEvent; // Added yash // DWORD gIntrPost = SYSINTR_NOP; static U32 ADDRStartRGB, ADDREndRGB ,ADDRStartY, ADDREndY; static U32 ADDRStartCb, ADDREndCb, ADDRStartCr, ADDREndCr; void Virtual_Alloc(); // Virtual allocation void Display_POST_Image(U32 pos_x, U32 pos_y, U32 size_x, U32 size_y); BOOL POSTClockOn(BOOL bOnOff); void PostInit(POSTINFO *pBufIn); void PostProcessOn(U8 *pBufIn, U8 *pBufOut); void PostProcessDone(U8 *pBufIn, U8 *pBufOut); void Post_CalculatePrescaler(U32 SrcSize, U32 DstSize, U32 *ratio,U32 *shift); DWORD PostProcessThread(void); BOOL InitInterruptThread(); CEDEVICE_POWER_STATE m_Dx; #ifdef DEBUG #define DBG_INIT 0x0001 #define DBG_OPEN 0x0002 #define DBG_READ 0x0004 #define DBG_WRITE 0x0008 #define DBG_CLOSE 0x0010 #define DBG_IOCTL 0x0020 #define DBG_THREAD 0x0040 #define DBG_EVENTS 0x0080 #define DBG_CRITSEC 0x0100 #define DBG_FLOW 0x0200 #define DBG_IR 0x0400 #define DBG_NOTHING 0x0800 #define DBG_ALLOC 0x1000 #define DBG_FUNCTION 0x2000 #define DBG_WARNING 0x4000 #define DBG_ERROR 0x8000 DBGPARAM dpCurSettings = { TEXT("postdriver"), { TEXT("Init"),TEXT("Open"),TEXT("Read"),TEXT("Write"), TEXT("Close"),TEXT("Ioctl"),TEXT("Thread"),TEXT("Events"), TEXT("CritSec"),TEXT("FlowCtrl"),TEXT("Infrared"),TEXT("User Read"), TEXT("Alloc"),TEXT("Function"),TEXT("Warning"),TEXT("Error")}, 0 }; #define ZONE_INIT DEBUGZONE(0) #define ZONE_OPEN DEBUGZONE(1) #define ZONE_READ DEBUGZONE(2) #define ZONE_WRITE DEBUGZONE(3) #define ZONE_CLOSE DEBUGZONE(4) #define ZONE_IOCTL DEBUGZONE(5) #define ZONE_THREAD DEBUGZONE(6) #define ZONE_EVENTS DEBUGZONE(7) #define ZONE_CRITSEC DEBUGZONE(8) #define ZONE_FLOW DEBUGZONE(9) #define ZONE_IR DEBUGZONE(10) #define ZONE_USR_READ DEBUGZONE(11) #define ZONE_ALLOC DEBUGZONE(12) #define ZONE_FUNCTION DEBUGZONE(13) #define ZONE_WARN DEBUGZONE(14) #define ZONE_ERROR DEBUGZONE(15) #endif //DEBUG POSTINFO sPOSTINFO; CRITICAL_SECTION m_Lock; void Lock() {EnterCriticalSection(&m_Lock);} void Unlock() {LeaveCriticalSection(&m_Lock);} static void Delay(USHORT count) { volatile int i, j = 0; volatile static int loop = S3C2450_FCLK/100000; for(;count > 0;count--) for(i=0;i < loop; i++) { j++; } } void PostProcessor_PowerDown(void) { RETAILMSG(PM_MSG, (_T("PostProcessor_PowerDown()\r\n"))); // Post Processor clock off PostClockOn(FALSE); RETAILMSG(POST_MSG, (_T("POST CLK_DOWN\r\n"))); } void PostProcessor_PowerUp(void) { RETAILMSG(PM_MSG, (_T("PostProcessor_PowerUp()\r\n"))); // Post Processor clock on PostClockOn(TRUE); RETAILMSG(POST_MSG,(_T("POST CLK_UP\r\n"))); } DWORD PostProcessThread(void) { DWORD dwCause; SetProcPermissions((DWORD)-1); while(TRUE) { RETAILMSG(PM_MSG, (TEXT("Before WaitForSingleObject(PostEvent,\r\n"))); dwCause = WaitForSingleObject(PostEvent, dwPostProcessTimeout); RETAILMSG(PM_MSG, (TEXT("After WaitForSingleObject(PostEvent,\r\n"))); if (dwCause == WAIT_OBJECT_0) { Lock(); __try { RETAILMSG(PM_MSG, (TEXT("Before SetEvent(PostDoneEvent)\r\n"))); SetEvent(PostDoneEvent); RETAILMSG(PM_MSG, (TEXT("After SetEvent(PostDoneEvent)\r\n"))); InterruptDone(gIntrPost); RETAILMSG(PM_MSG, (TEXT("After InterruptDone(gIntrPost)\r\n"))); } __except(EXCEPTION_EXECUTE_HANDLER) { RETAILMSG(PM_MSG, (TEXT("[POST] InterruptThread() - EXCEPTION: %d"), GetExceptionCode())); } Unlock(); } else if (dwCause == WAIT_TIMEOUT) { RETAILMSG(PM_MSG, (TEXT("WAIT_TIMEOUT\n"))); //RETAILMSG(1, (TEXT("IOCTL_POST_RUN: %d"), IOCTL_POST_RUN)); //RETAILMSG(1, (TEXT("IOCTL_POST_STOP: %d"), IOCTL_POST_STOP)); Lock(); //RETAILMSG(PM_MSG,(_T("[POST] InterruptThread Timeout : %d msec\r\n"), dwPostProcessTimeout)); dwPostProcessTimeout = INFINITE; // reset timeout until Post Interrupt occurs bIdlePwrDown = TRUE; // Post is off PostProcessor_PowerDown(); RETAILMSG(PM_MSG, (TEXT("[POST]Post Processor PowerDown Mode\r\n"))); Unlock(); } else { RETAILMSG(PM_MSG, (TEXT("[POST] InterruptThread : Exit %d, Cause %d\r\n"), GetLastError(), dwCause)); } } return 0; } void Virtual_Alloc() { DMA_ADAPTER_OBJECT Adapter1, Adapter2; memset(&Adapter1, 0, sizeof(DMA_ADAPTER_OBJECT)); Adapter1.InterfaceType = Internal; Adapter1.ObjectSize = sizeof(DMA_ADAPTER_OBJECT); memset(&Adapter2, 0, sizeof(DMA_ADAPTER_OBJECT)); Adapter2.InterfaceType = Internal; Adapter2.ObjectSize = sizeof(DMA_ADAPTER_OBJECT); // Allocate a block of virtual memory (physically contiguous) for the DMA buffers. // #if USE_RESERVED_BUFFER==1 // GPIO Virtual alloc pVirtSrcAddr = (volatile unsigned char*) VirtualAlloc(0,0x100000,MEM_RESERVE, PAGE_NOACCESS); if(pVirtSrcAddr == NULL) { RETAILMSG(1,(TEXT("For pVirtSrcAddr: VirtualAlloc failed!\r\n"))); } else { if(!VirtualCopy((PVOID)pVirtSrcAddr,(PVOID)(POST_INPUT_BUFFER>>8),0x100000,PAGE_READWRITE | PAGE_NOCACHE | PAGE_PHYSICAL)) { RETAILMSG(1,(TEXT("For pVirtSrcAddr: VirtualCopy failed!\r\n"))); } } pVirtDstAddr = (volatile unsigned char*) VirtualAlloc(0,0x100000,MEM_RESERVE, PAGE_NOACCESS); if(pVirtDstAddr == NULL) { RETAILMSG(1,(TEXT("For pVirtSrcAddr: pVirtDstAddr failed!\r\n"))); } else { if(!VirtualCopy((PVOID)pVirtDstAddr,(PVOID)(POST_OUTPUT_BUFFER>>8),0x100000,PAGE_READWRITE | PAGE_NOCACHE | PAGE_PHYSICAL)) { RETAILMSG(1,(TEXT("For pVirtDstAddr: VirtualCopy failed!\r\n"))); } } #else pVirtSrcAddr = (PBYTE)HalAllocateCommonBuffer(&Adapter1, 0x71000, &g_PhysSrcAddr, FALSE); if (pVirtSrcAddr == NULL) { RETAILMSG(TRUE, (TEXT("Camera:Virtual_Alloc() - Failed to allocate DMA buffer for Source.\r\n"))); } pVirtDstAddr = (PBYTE)HalAllocateCommonBuffer(&Adapter2, 0x96000, &g_PhysDstAddr, FALSE); if (pVirtDstAddr == NULL) { RETAILMSG(TRUE, (TEXT("Camera:Virtual_Alloc() - Failed to allocate DMA buffer for Destination.\r\n"))); } #endif // GPIO Virtual alloc s2450IOP = (volatile S3C2450_IOPORT_REG*) VirtualAlloc(0,sizeof(S3C2450_IOPORT_REG),MEM_RESERVE, PAGE_NOACCESS); if(s2450IOP == NULL) { RETAILMSG(1,(TEXT("For s2450IOP: VirtualAlloc failed!\r\n"))); } else { if(!VirtualCopy((PVOID)s2450IOP,(PVOID)(S3C2450_BASE_REG_PA_IOPORT>>8),sizeof(S3C2450_IOPORT_REG),PAGE_READWRITE | PAGE_NOCACHE | PAGE_PHYSICAL)) { RETAILMSG(1,(TEXT("For s2450IOP: VirtualCopy failed!\r\n"))); } } // Interrupt Virtual alloc s2450CAM = (volatile S3C2450_CAM_REG *) VirtualAlloc(0,sizeof(S3C2450_CAM_REG),MEM_RESERVE, PAGE_NOACCESS); if(s2450INT == NULL) { RETAILMSG(1,(TEXT("For s2450CAM: VirtualAlloc failed!\r\n"))); } else { if(!VirtualCopy((PVOID)s2450CAM,(PVOID)(S3C2450_BASE_REG_PA_CAM>>8),sizeof(S3C2450_CAM_REG),PAGE_READWRITE | PAGE_NOCACHE | PAGE_PHYSICAL)) { RETAILMSG(1,(TEXT("For s2450CAM: VirtualCopy failed!\r\n"))); } } // Interrupt Virtual alloc s2450INT = (volatile S3C2450_INTR_REG *) VirtualAlloc(0,sizeof(S3C2450_INTR_REG),MEM_RESERVE, PAGE_NOACCESS); if(s2450INT == NULL) { RETAILMSG(1,(TEXT("For s2450INT: VirtualAlloc failed!\r\n"))); } else { if(!VirtualCopy((PVOID)s2450INT,(PVOID)(S3C2450_BASE_REG_PA_INTR>>8),sizeof(S3C2450_INTR_REG),PAGE_READWRITE | PAGE_NOCACHE | PAGE_PHYSICAL)) { RETAILMSG(1,(TEXT("For s2450INT: VirtualCopy failed!\r\n"))); } } // PWM clock Virtual alloc s2450PWR = (volatile S3C2450_CLKPWR_REG*) VirtualAlloc(0,sizeof(S3C2450_CLKPWR_REG),MEM_RESERVE, PAGE_NOACCESS); if(s2450PWR == NULL) { RETAILMSG(1,(TEXT("For s2450PWR: VirtualAlloc failed!\r\n"))); } else { if(!VirtualCopy((PVOID)s2450PWR,(PVOID)(S3C2450_BASE_REG_PA_CLOCK_POWER>>8),sizeof(S3C2450_CLKPWR_REG),PAGE_READWRITE | PAGE_NOCACHE | PAGE_PHYSICAL)) { RETAILMSG(1,(TEXT("For s2450PWR: VirtualCopy failed!\r\n"))); } } } void Display_POST_Image(U32 pos_x, U32 pos_y, U32 size_x, U32 size_y) { U8 *buffer_rgb; U32 y; RETAILMSG(POST_MSG,(_T("Display_POST_Image()\r\n"))); buffer_rgb = (U8 *)PostOutputBuffer; #if (DOTNET_DRIVER) SetKMode(TRUE); #endif RETAILMSG(POST_MSG,(_T("buffer_rgb = 0x%x\r\n"), buffer_rgb)); for (y=0; y<size_y; y++) // YCbCr 4:2:0 format { //memcpy((void *)(FRAMEBUF_BASE+0x5e00+y*240*2),(void *)buffer_rgb,(QCIF_XSIZE)*2); memcpy((void *)(IMAGE_FRAMEBUFFER_UA_BASE+ (240*pos_y + pos_x) + y*240*2),(void *)buffer_rgb,size_x*2); buffer_rgb += (size_x*2); } #if (DOTNET_DRIVER) SetKMode(FALSE); #endif } BOOL WINAPI DllEntry(HANDLE hinstDLL, DWORD dwReason, LPVOID /* lpvReserved */) { switch(dwReason) { case DLL_PROCESS_ATTACH: DEBUGREGISTER((HINSTANCE)hinstDLL); DEBUGMSG(ZONE_INIT,(TEXT("POST: DLL_PROCESS_ATTACH\r\n"))); return TRUE; case DLL_THREAD_ATTACH: DEBUGMSG(ZONE_THREAD,(TEXT("POST: DLL_THREAD_ATTACH\r\n"))); break; case DLL_THREAD_DETACH: DEBUGMSG(ZONE_THREAD,(TEXT("POST: DLL_THREAD_DETACH\r\n"))); break; case DLL_PROCESS_DETACH: DEBUGMSG(ZONE_INIT,(TEXT("POST: DLL_PROCESS_DETACH\r\n"))); break; #ifdef UNDER_CE case DLL_PROCESS_EXITING: DEBUGMSG(ZONE_INIT,(TEXT("POST: DLL_PROCESS_EXITING\r\n"))); break; case DLL_SYSTEM_STARTED: DEBUGMSG(ZONE_INIT,(TEXT("POST: DLL_SYSTEM_STARTED\r\n"))); break; #endif } return TRUE; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- BOOL PST_Deinit(DWORD hDeviceContext) { DMA_ADAPTER_OBJECT Adapter1, Adapter2; memset(&Adapter1, 0, sizeof(DMA_ADAPTER_OBJECT)); Adapter1.InterfaceType = Internal; Adapter1.ObjectSize = sizeof(DMA_ADAPTER_OBJECT); memset(&Adapter2, 0, sizeof(DMA_ADAPTER_OBJECT)); Adapter2.InterfaceType = Internal; Adapter2.ObjectSize = sizeof(DMA_ADAPTER_OBJECT); BOOL bRet = TRUE; RETAILMSG(PM_MSG,(TEXT("POST: PST_Deinit\r\n"))); CloseHandle(PostThread); VirtualFree((void*)s2450IOP, 0, MEM_RELEASE); VirtualFree((void*)s2450CAM, 0, MEM_RELEASE); VirtualFree((void*)s2450INT, 0, MEM_RELEASE); VirtualFree((void*)s2450PWR, 0, MEM_RELEASE); #if USE_RESERVED_BUFFER == 1 VirtualFree((void*)pVirtSrcAddr, 0, MEM_RELEASE); VirtualFree((void*)pVirtDstAddr, 0, MEM_RELEASE); #else VirtualFree((void*)PostInputBuffer, 0,MEM_RELEASE); VirtualFree((void*)PostOutputBuffer,0,MEM_RELEASE); HalFreeCommonBuffer(&Adapter1, 0x71000, g_PhysSrcAddr, (PVOID)pVirtSrcAddr, FALSE); HalFreeCommonBuffer(&Adapter2, 0x96000, g_PhysDstAddr, (PVOID)pVirtDstAddr, FALSE); #endif return TRUE; } BOOL InitInterruptThread() { DWORD threadID; // thread ID BOOL bSuccess; UINT32 Irq; PostEvent = CreateEvent(NULL, FALSE, FALSE, NULL); // PostDoneEvent = CreateEvent(NULL,FALSE,FALSE,NULL); if (!PostEvent||!PostDoneEvent) { return FALSE; } // Obtain sysintr values from the OAL for the CAMIF interrupt. // Irq = IRQ_CAM_P; if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &Irq, sizeof(UINT32), &gIntrPost, sizeof(UINT32), NULL)) { RETAILMSG(RETAIL_ON, (TEXT("ERROR: Failed to request the post sysintr.\r\n"))); gIntrPost = SYSINTR_UNDEFINED; return(FALSE); } RETAILMSG(RETAIL_ON, (TEXT("POST Interrupt is ....... %d \r\n"), gIntrPost)); bSuccess = InterruptInitialize(gIntrPost, PostEvent, NULL, 0); RETAILMSG(RETAIL_ON, (TEXT("After InterruptInitialize\r\n"))); if (!bSuccess) { RETAILMSG(1,(TEXT("Fail to initialize Post interrupt event\r\n"))); return FALSE; } RETAILMSG(RETAIL_ON, (TEXT("PostThread = CreateThread\r\n"))); PostThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)PostProcessThread, 0, 0, &threadID); if (NULL == PostThread ) { RETAILMSG(1,(TEXT("Create Post Thread Fail\r\n"))); } RETAILMSG(PM_MSG,(_T("POST.DLL::InterruptThread Initialized.\r\n"))); return TRUE; } BOOL PostClockOn(BOOL bOnOff) { // Post Processor clock if (!bOnOff) s2450PWR->HCLKCON &= ~(1<<8); // Post clock disable else s2450PWR->HCLKCON |= (1<<8); // Post clock enable RETAILMSG(POST_MSG,(_T("PostClockOn = %d\r\n"), bOnOff)); Delay(500); return TRUE; } DWORD PST_Init(DWORD dwContext) { // 1. Virtual Alloc Virtual_Alloc(); RETAILMSG(POST_DEBUG, (TEXT("PST::Virtual_Alloc \r\n"))); PostClockOn(TRUE); if (!InitInterruptThread()) { RETAILMSG(POST_DEBUG,(TEXT("Fail to initialize Post interrupt event\r\n"))); return FALSE; } m_Dx = (_CEDEVICE_POWER_STATE)D0; DevicePowerNotify(_T("PST1:"),(_CEDEVICE_POWER_STATE)D0, POWER_NAME); RETAILMSG(POST_MSG, (TEXT("PST::POST_Init() \r\n"))); return TRUE; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- BOOL PST_IOControl(DWORD hOpenContext, DWORD dwCode, PBYTE pBufIn, DWORD dwLenIn, PBYTE pBufOut, DWORD dwLenOut, PDWORD pdwActualOut) { BOOL RetVal = TRUE; DWORD dwErr = ERROR_SUCCESS; PPVOID temp; static unsigned int time=0,old_time=0; switch (dwCode) { //----------------------------------------------------------------------------------------- case IOCTL_POWER_CAPABILITIES: { PPOWER_CAPABILITIES ppc; RETAILMSG(PM_MSG, (TEXT("PST: IOCTL_POWER_CAPABILITIES\r\n"))); if ( !pdwActualOut || !pBufOut || (dwLenOut < sizeof(POWER_CAPABILITIES)) ) { RetVal = FALSE; dwErr = ERROR_INVALID_PARAMETER; break; } ppc = (PPOWER_CAPABILITIES)pBufOut; memset(ppc, 0, sizeof(POWER_CAPABILITIES)); // support D0, D4 ppc->DeviceDx = 0x11; // Report our power consumption in uAmps rather than mWatts. ppc->Flags = POWER_CAP_PREFIX_MICRO | POWER_CAP_UNIT_AMPS; // 25 m = 25000 uA // TODO: find out a more accurate value ppc->Power[D0] = 15000; *pdwActualOut = sizeof(POWER_CAPABILITIES); } break; case IOCTL_POWER_SET: { CEDEVICE_POWER_STATE NewDx; RETAILMSG(PM_MSG,(_T("==================IOCTL_POWER_SET======================\r\n"))); if ( !pdwActualOut || !pBufOut || (dwLenOut < sizeof(CEDEVICE_POWER_STATE)) ) { RetVal = FALSE; dwErr = ERROR_INVALID_PARAMETER; break; } NewDx = *(PCEDEVICE_POWER_STATE)pBufOut; if ( VALID_DX(NewDx) ) { switch ( NewDx ) { case D0: if (m_Dx != D0) { PST_PowerUp(hOpenContext); m_Dx = D0; } break; default: if (m_Dx != (_CEDEVICE_POWER_STATE)D4) { PST_PowerDown(hOpenContext); m_Dx = (_CEDEVICE_POWER_STATE)D4; } break; } // return our state *(PCEDEVICE_POWER_STATE)pBufOut = m_Dx; RETAILMSG(PM_MSG, (TEXT("POST: IOCTL_POWER_SET: D%u \r\n"), NewDx)); *pdwActualOut = sizeof(CEDEVICE_POWER_STATE); } else { RetVal = FALSE; dwErr = ERROR_INVALID_PARAMETER; } } break; case IOCTL_POWER_GET: if ( !pdwActualOut || !pBufOut || (dwLenOut < sizeof(CEDEVICE_POWER_STATE)) ) { RetVal = FALSE; dwErr = ERROR_INVALID_PARAMETER; break; } *(PCEDEVICE_POWER_STATE)pBufOut = m_Dx; RETAILMSG(PM_MSG, (TEXT("POST: IOCTL_POWER_GET: D%u \r\n"), m_Dx)); *pdwActualOut = sizeof(CEDEVICE_POWER_STATE); break; //----------------------------------------------------------------------------------------- case IOCTL_POST_INIT : if (bIdlePwrDown == TRUE) { RETAILMSG(POST_DEBUG, (_T("[POST] IOControl POST_INIT(%x)\r\n"),dwLenIn)); PostProcessor_PowerUp(); bIdlePwrDown = FALSE; } dwPostProcessTimeout = POST_THREAD_TIMEOUT; PostInit((POSTINFO*)pBufIn); break; case IOCTL_POST_RUN: s2450INT->INTMSK1 &= ~(1<<IRQ_CAM); s2450INT->INTSUBMSK &= ~(1<<IRQ_SUB_CAM_P); PostProcessOn(pBufIn, pBufOut); RETAILMSG(POST_DEBUG,(TEXT("POST:IOCTL_POST_RUN\r\n"))); break; case IOCTL_POST_STOP : RETAILMSG(POST_DEBUG,(TEXT("POST:IOCTL_POST_STOP\r\n"))); // Disable POST interrupt s2450INT->INTMSK1 |= (1<<IRQ_CAM); s2450INT->INTSUBMSK |= (1<<IRQ_SUB_CAM_P); if(s2450INT->SUBSRCPND & (1<<IRQ_SUB_CAM_P)) s2450INT->SUBSRCPND = (1<<IRQ_SUB_CAM_P); if(s2450INT->SRCPND1 & (1<<IRQ_CAM)) s2450INT->SRCPND1 = (1<<IRQ_CAM); if(s2450INT->INTPND1 & (1<<IRQ_CAM)) s2450INT->INTPND1 = (1<<IRQ_CAM); break; case IOCTL_POST_GETINPUTBUFFER: temp = (PPVOID)pBufOut; *temp = (PVOID)(pVirtSrcAddr); RETAILMSG(1,(TEXT("0x%08X\n"), (BYTE*)(pVirtSrcAddr))); break; case IOCTL_POST_GETOUTPUTBUFFER: temp = (PPVOID)pBufOut; *temp = (PVOID)(pVirtDstAddr); RETAILMSG(1,(TEXT("0x%08X\n"), (BYTE*)(pVirtDstAddr))); break; default : RETAILMSG(POST_MSG,(TEXT("POST:Ioctl code = 0x%x\r\n"), dwCode)); return FALSE; } return TRUE; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- DWORD PST_Open(DWORD hDeviceContext, DWORD AccessCode, DWORD ShareMode) { RETAILMSG(PM_MSG,(TEXT("POST: PST_Open\r\n"))); bAppOpenFlag = TRUE; return TRUE; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- BOOL PST_Close(DWORD hOpenContext) { RETAILMSG(POST_MSG,(TEXT("POST: PST_Close\r\n"))); bAppOpenFlag = FALSE; return TRUE; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void PST_PowerDown(DWORD hDeviceContext) { RETAILMSG(POST_MSG,(TEXT("POST: PST_PowerDown\r\n"))); m_Dx = (_CEDEVICE_POWER_STATE)D4; bIdlePwrDown = TRUE; PostProcessor_PowerDown(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void PST_PowerUp(DWORD hDeviceContext) { RETAILMSG(POST_MSG,(TEXT("POST: POST_PowerUp\r\n"))); m_Dx = (_CEDEVICE_POWER_STATE)D0; if(bAppOpenFlag == FALSE) PostClockOn(FALSE); else PostProcessor_PowerUp(); RETAILMSG(POST_MSG,(TEXT("POST: PST_PowerUp, m_Dx = D%u\r\n"), m_Dx)); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- DWORD PST_Read(DWORD hOpenContext, LPVOID pBuffer, DWORD Count) { RETAILMSG(POST_MSG,(TEXT("POST: PST_Read\r\n"))); return TRUE; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- DWORD PST_Seek(DWORD hOpenContext, long Amount, DWORD Type) { RETAILMSG(POST_MSG,(TEXT("POST: PST_Seek\r\n"))); return 0; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- DWORD PST_Write(DWORD hOpenContext, LPCVOID pSourceBytes, DWORD NumberOfBytes) { RETAILMSG(POST_MSG,(TEXT("POST: PST_Write\r\n"))); return 0; } void Post_CalculatePrescaler(U32 SrcSize, U32 DstSize, U32 *ratio,U32 *shift) { RETAILMSG(POST_MSG, (TEXT("[POST] Caculate Prescaler..\r\n"))); if (SrcSize>=64*DstSize) { RETAILMSG(POST_MSG,(TEXT("ERROR: out of the prescaler range: SrcSize/DstSize = %d(< 64)\n"),SrcSize/DstSize)); while(1); } else if (SrcSize>=32*DstSize) { *ratio = 32; *shift = 5; } else if (SrcSize>=16*DstSize) { *ratio = 16; *shift = 4; } else if (SrcSize>=8*DstSize) { *ratio = 8; *shift = 3; } else if (SrcSize>=4*DstSize) { *ratio = 4; *shift = 2; } else if (SrcSize>=2*DstSize) { *ratio = 2; *shift = 1; } else { *ratio = 1; *shift = 0; } } void CalculateBurstSize(unsigned int hSize,unsigned int *mainBurstSize,unsigned int *remainedBurstSize) { unsigned int tmp; tmp=(hSize/4)%16; switch(tmp) { case 0: *mainBurstSize=16; *remainedBurstSize=16; break; case 4: *mainBurstSize=16; *remainedBurstSize=4; break; case 8: *mainBurstSize=16; *remainedBurstSize=8; break; default: tmp=(hSize/4)%8; switch(tmp) { case 0: *mainBurstSize=8; *remainedBurstSize=8; break; case 4: *mainBurstSize=8; *remainedBurstSize=4; default: *mainBurstSize=4; tmp=(hSize/4)%4; *remainedBurstSize= (tmp) ? tmp: 4; break; } break; } } void PostInit(POSTINFO *pBufIn) { U32 ScaleUp_H_Pr, ScaleUp_V_Pr,MainHorRatio, MainVerRatio; U32 H_Shift, V_Shift, PreHorRatio, PreVerRatio; U32 MainBurstSizeRGB, RemainedBurstSizeRGB; // U32 WinOfsEn=0; // U32 WinHorOffset1=0,WinVerOffset1=0,WinHorOffset2=0,WinVerOffset2=0; U32 inmultiplier, outmultiplier; U32 OffsetY, OffsetC; U32 ADDRStartY, ADDREndY, ADDRStartCb, ADDREndCb, ADDRStartCr, ADDREndCr; memset(&sPOSTINFO, 0, sizeof(sPOSTINFO)); memcpy(&sPOSTINFO, pBufIn, sizeof(sPOSTINFO)); RETAILMSG(POST_DEBUG,(TEXT("[POST] Post Processor Init for Run!!\r\n"))); #if USE_RESERVED_BUFFER==1 Post_input_yuv = (unsigned char *)POST_INPUT_BUFFER; Post_output_rgb = (unsigned char *)POST_OUTPUT_BUFFER; #else Post_input_yuv = (unsigned char *)g_PhysSrcAddr.LowPart; Post_output_rgb = (unsigned char *)g_PhysDstAddr.LowPart; #endif /* if(sPOSTINFO.nSrcWidth != sPOSTINFO.nOrgSrcWidth || sPOSTINFO.nSrcHeight != sPOSTINFO.nOrgSrcHeight) { WinOfsEn=1; WinHorOffset1 = sPOSTINFO.nSrcStartX; WinVerOffset1 = sPOSTINFO.nSrcStartY; WinHorOffset2 = sPOSTINFO.nOrgSrcWidth - WinHorOffset1 - sPOSTINFO.nSrcWidth; WinVerOffset2 = sPOSTINFO.nOrgSrcHeight - WinVerOffset1 - sPOSTINFO.nSrcHeight; } s2450CAM->CIWDOFST = (1<<30)|(0xf<<12); // clear overflow s2450CAM->CIWDOFST = 0; s2450CAM->CIWDOFST=(WinOfsEn<<31)|(WinHorOffset1<<16)|(WinVerOffset1); s2450CAM->CIDOWSFT2=(WinHorOffset2<<16)|(WinVerOffset2);*/ if(sPOSTINFO.nSrcWidth >= sPOSTINFO.nDestWidth) ScaleUp_H_Pr=0; //down else ScaleUp_H_Pr=1; //up if(sPOSTINFO.nSrcHeight >= sPOSTINFO.nDestHeight ) ScaleUp_V_Pr=0; else ScaleUp_V_Pr=1; Post_CalculatePrescaler(sPOSTINFO.nSrcWidth, sPOSTINFO.nDestWidth, &PreHorRatio, &H_Shift); Post_CalculatePrescaler(sPOSTINFO.nSrcHeight, sPOSTINFO.nDestHeight, &PreVerRatio, &V_Shift); MainHorRatio=(sPOSTINFO.nSrcWidth<<8)/(sPOSTINFO.nDestWidth<<H_Shift); MainVerRatio=(sPOSTINFO.nSrcHeight<<8)/(sPOSTINFO.nDestHeight<<V_Shift); CalculateBurstSize(sPOSTINFO.nDestWidth*2, &MainBurstSizeRGB, &RemainedBurstSizeRGB); s2450CAM->CIPRTRGFMT=(2<<30)|(sPOSTINFO.nDestWidth<<16)|(sPOSTINFO.nDestHeight); s2450CAM->CIPRCTRL=(MainBurstSizeRGB<<19)|(RemainedBurstSizeRGB<<14); s2450CAM->CIPRSCPRERATIO=((10-H_Shift-V_Shift)<<28)|(PreHorRatio<<16)|(PreVerRatio); s2450CAM->CIPRSCPREDST=((sPOSTINFO.nSrcWidth/PreHorRatio)<<16)|(sPOSTINFO.nSrcHeight/PreVerRatio); s2450CAM->CIPRSCCTRL=(1<<31)|(0/*16bit RGB*/<<30)|(ScaleUp_H_Pr<<29)|(ScaleUp_V_Pr<<28)|(MainHorRatio<<16)|(1<<15)|(MainVerRatio); s2450CAM->CIPRCLRSA1=(U32)(Post_output_rgb/*g_PhysDstAddr.LowPart*/); s2450CAM->CIPRCLRSA2=(U32)(Post_output_rgb/*g_PhysDstAddr.LowPart*/); s2450CAM->CIPRCLRSA3=(U32)(Post_output_rgb/*g_PhysDstAddr.LowPart*/); s2450CAM->CIPRCLRSA4=(U32)(Post_output_rgb/*g_PhysDstAddr.LowPart*/); s2450CAM->CIPRTAREA = sPOSTINFO.nDestWidth*sPOSTINFO.nDestHeight; inmultiplier=1; outmultiplier=2; OffsetY = (sPOSTINFO.nOrgSrcWidth-sPOSTINFO.nSrcWidth)*inmultiplier; OffsetC = (sPOSTINFO.nOrgSrcWidth-sPOSTINFO.nSrcWidth)*inmultiplier/2; ADDRStartY = (U32)(Post_input_yuv)+(sPOSTINFO.nOrgSrcWidth*sPOSTINFO.nSrcStartY+sPOSTINFO.nSrcStartX)*inmultiplier; ADDREndY = ADDRStartY+sPOSTINFO.nSrcWidth*sPOSTINFO.nSrcHeight*inmultiplier + OffsetY*(sPOSTINFO.nSrcHeight-1); ADDRStartCb = (U32)(Post_input_yuv)+(sPOSTINFO.nOrgSrcWidth*sPOSTINFO.nOrgSrcHeight)*inmultiplier+(sPOSTINFO.nOrgSrcWidth/2*sPOSTINFO.nSrcStartY/2+sPOSTINFO.nSrcStartX/2)*inmultiplier; ADDREndCb = ADDRStartCb+(sPOSTINFO.nSrcWidth/2*sPOSTINFO.nSrcHeight/2)*inmultiplier+OffsetC*(sPOSTINFO.nSrcHeight/2-1); ADDRStartCr = (U32)(Post_input_yuv)+(sPOSTINFO.nOrgSrcWidth*sPOSTINFO.nOrgSrcHeight+(sPOSTINFO.nOrgSrcWidth/2*sPOSTINFO.nOrgSrcHeight/2))*inmultiplier+(sPOSTINFO.nOrgSrcWidth/2*sPOSTINFO.nSrcStartY/2+sPOSTINFO.nSrcStartX/2)*inmultiplier; ADDREndCr = ADDRStartCr+(sPOSTINFO.nSrcWidth/2*sPOSTINFO.nSrcHeight/2)*inmultiplier+OffsetC*(sPOSTINFO.nSrcHeight/2-1); s2450CAM->CIMSYSA = ADDRStartY; s2450CAM->CIMSCBSA = ADDRStartCb; s2450CAM->CIMSCRSA = ADDRStartCr; s2450CAM->CIMSYEND = ADDREndY; s2450CAM->CIMSCBEND= ADDREndCb; s2450CAM->CIMSCREND= ADDREndCr; s2450CAM->CIMSYOFF = OffsetY; s2450CAM->CIMSCBOFF = OffsetC; s2450CAM->CIMSCROFF = OffsetC; s2450CAM->CIMSWIDTH = sPOSTINFO.nSrcWidth; } #if USE_RESERVED_BUFFER == 1 void PostProcessOn(U8 *pBufIn, U8 *pBufOut) { s2450CAM->CIMSCTRL &= ~(0x3f); s2450CAM->CIMSCTRL |= (0<<5|1<<2|1<<1); s2450CAM->CIPRSCCTRL |=(1<<15); s2450CAM->CIIMGCPT |=(1<<31)|(1<<29); s2450CAM->CIMSCTRL |= (1<<0); WaitForSingleObject(PostDoneEvent, INFINITE); } #else void PostProcessOn(U8 *pBufIn, U8 *pBufOut) { memcpy((BYTE*)(g_PhysSrcAddr.LowPart + VIRTUAL_ADDR_OFFSET), pBufIn, sPOSTINFO.nOrgSrcWidth*sPOSTINFO.nOrgSrcHeight*3/2); s2450CAM->CIMSCTRL &= ~(0x3f); s2450CAM->CIMSCTRL |= (0<<5|1<<2|1<<1); s2450CAM->CIPRSCCTRL |=(1<<15); s2450CAM->CIIMGCPT |=(1<<31)|(1<<29); s2450CAM->CIMSCTRL |= (1<<0); WaitForSingleObject(PostDoneEvent, INFINITE); memcpy(pBufOut, (BYTE*)(g_PhysDstAddr.LowPart + VIRTUAL_ADDR_OFFSET), sPOSTINFO.nDestWidth*sPOSTINFO.nDestHeight*2); } #endif
[ [ [ 1, 966 ] ] ]
0051c0529f88627279ae4defee1d3997857f32e9
2112057af069a78e75adfd244a3f5b224fbab321
/branches/ref1/src-root/src/ireon_ws/world/world.cpp
c9334937d57a06f5beb4397a3e832ecc5fdedecb
[]
no_license
blockspacer/ireon
120bde79e39fb107c961697985a1fe4cb309bd81
a89fa30b369a0b21661c992da2c4ec1087aac312
refs/heads/master
2023-04-15T00:22:02.905112
2010-01-07T20:31:07
2010-01-07T20:31:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
17,644
cpp
/* Copyright (C) 2005-2006 ireon.org developers council * $Id: world.cpp 635 2006-06-02 15:55:11Z zak $ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * 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 General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ /** * @file world.cpp * World manager */ #include "stdafx.h" #include "config.h" #include "world_app.h" #include "world/world.h" #include "world/world_char_player.h" #include "world/world_char_mob.h" #include "db/world_mob_prototype.h" #include "resource/resource_manager.h" #include "resource/image.h" CWorld* CWorld::m_singleton = 0; int64 CWorld::m_pulse = 0; bool CWorld::m_mobMovePulse; bool CWorld::m_playerMovePulse; bool CWorld::m_regenPulse; bool CWorld::m_processOutputPulse; bool CWorld::m_repopPulse; uint WorldPage::m_size = 1; float WorldPage::m_scale = 1; WorldPage::WorldPage(uint x, uint z): m_x(x), m_z(z), m_heightData(NULL), m_normalData(NULL) { } WorldPage::WorldPage(const WorldPage &p): m_heightData(NULL), m_normalData(NULL) { *this = p; }; WorldPage::~WorldPage() { if( m_heightData ) delete[] m_heightData; if( m_normalData ) delete[] m_normalData; }; WorldPage& WorldPage::operator=(const WorldPage& p) { if( m_heightData ) delete[] m_heightData; if( m_normalData ) delete[] m_normalData; m_x = p.m_x; m_z = p.m_z; if( p.m_heightData ) { m_heightData = new float[m_size*m_size]; memcpy(m_heightData,p.m_heightData,m_size*m_size*sizeof(float)); }; if( p.m_normalData ) { m_normalData = new Vector3[m_size*m_size*2]; memcpy(m_normalData,p.m_normalData,m_size*m_size*sizeof(Vector3)); }; return *this; }; float WorldPage::heightAt(const float& x, const float& z) const { const float localXf = x / m_scale; const float localZf = z / m_scale; const int localX = static_cast<int>(localXf); const int localZ = static_cast<int>(localZf); assert( !(localX < 0 || localX >= m_size-1 || localZ < 0 || localZ >= m_size-1)); // find the 4 heights around the point const float bottom_right_y = m_heightData[localX + localZ * m_size]; const float bottom_left_y = m_heightData[localX + 1 + localZ * m_size]; const float top_right_y = m_heightData[localX + (localZ + 1) * m_size]; const float top_left_y = m_heightData[localX + 1 + (localZ + 1) * m_size]; const float z_pct = (localZf - localZ); float x_pct = (localXf - localX); // TL-----TR 1.0 // | / | // | / | . // | / | . // | / | . ^ // | / | | // BL-----BR 0.0 z // 1.0 ... 0.0 // // < - x if (x_pct > 1 - z_pct) { // This point is on the upper-left tri const float y1 = bottom_left_y * (1-z_pct) + top_left_y * z_pct; const float y2 = bottom_left_y * (1-z_pct) + top_right_y * z_pct; if (z_pct > 0) x_pct = (x_pct - (1-z_pct)) / z_pct; return y1 * x_pct + y2 * (1-x_pct); } // if (x_pct > 1 - z_pct) else { // This point is on the lower-right tri const float y1 = bottom_left_y * (1-z_pct) + top_right_y * z_pct; const float y2 = bottom_right_y * (1-z_pct) + top_right_y * z_pct; if (z_pct < 1) x_pct = x_pct / (1-z_pct); return y1 * x_pct + y2 * (1-x_pct); } }; const Vector3& WorldPage::normalAt(const uint& x, const uint& z, bool upperTriangle) const { assert( !(x >= m_size || z >= m_size) ); return m_normalData[(x + z * m_size) * 2 + (upperTriangle ? 1 : 0)]; }; float WorldPage::vertexHeightAt(const uint& x, const uint& z) const { assert( !(x > m_size || x > m_size)); assert(m_heightData); return m_heightData[x + z * m_size]; }; void WorldPage::computeNormals() { /// Computing of normals taken from PagingLandScapeSceneManager if( !m_normalData ) m_normalData = new Vector3[m_size*m_size*2]; const float divider = static_cast <float> (m_size - 1) / CWorld::instance()->getMaxHeight(); uint x,z; /// Upper triangle for( x = 0; x < m_size; ++x ) for( z = 0; z < m_size; ++z ) { float h1,h2,h3; WorldPage* page; bool addX = false, addZ = false; if( x == m_size - 1 ) addX = true; if( z == m_size - 1 ) addZ = true; page = CWorld::instance()->getPage(m_x + (addX ? 1 : 0), m_z + (addZ ? 1 : 0) ); if( addZ ) { h1 = page ? page->vertexHeightAt(x,0) : 0; if( addX ) h3 = page ? page->vertexHeightAt(0,0) : 0; else h3 = page ? page->vertexHeightAt(x+1,0) : 0; } else { h1 = vertexHeightAt(x,z + 1); if( addX ) h3 = page ? page->vertexHeightAt(0,z+1) : 0; else h3 = page ? page->vertexHeightAt(x+1,z+1) : 0; } if( addX ) h2 = page ? page->vertexHeightAt(0,z) : 0; else h2 = vertexHeightAt(x+1,z); Vector3 result((h1 - h3) * divider, 1.0f, (h2 - h3) * divider); result.normalise (); m_normalData[(x + z * m_size) * 2 + 1] = result; } /// Bottom triangle for( x = 0; x < m_size; ++x ) for( z = 0; z < m_size; ++z ) { float h1,h2,h3; WorldPage* page; bool addX = false, addZ = false; if( x == m_size - 1 ) addX = true; if( z == m_size - 1 ) addZ = true; page = CWorld::instance()->getPage(m_x + (addX ? 1 : 0), m_z + (addZ ? 1 : 0) ); if( addZ ) h2 = page ? page->vertexHeightAt(x,0) : 0; else h2 = vertexHeightAt(x,z + 1); if( addX ) h1 = page ? page->vertexHeightAt(0,z) : 0; else h1 = vertexHeightAt(x+1,z); h3 = vertexHeightAt(x,z); Vector3 result((h3 - h1) * divider, 1.0f, (h3 - h2) * divider); result.normalise (); m_normalData[(x + z * m_size) * 2] = result; } }; void WorldPage::insertCharacter(const CharacterPtr& ch) { removeCharacter(ch); m_players.push_back(ch); }; void WorldPage::removeCharacter(const CharacterPtr& ch) { std::list<CharacterPtr>::iterator it; for( it = m_players.begin(); it != m_players.end(); ++it) if( *it == ch ) { m_players.erase(it); break; }; }; CWorld::CWorld() { }; CWorld::~CWorld() { }; bool CWorld::init() { if( !loadTerrain( CWorldApp::instance()->getSetting("/config/WorldCfg")) ) return false; /* if( !loadMobPrototypes() ) return false; CharMobPtr mob(new CWorldCharMob); mob->m_id = 1 | MOB_ID_FLAG; mob->m_startPos = Vector2(-20,-60); mob->m_prototype = getMobPrototype(1); insertCharMob(mob); mob.reset(new CWorldCharMob); mob->m_id = 2 | MOB_ID_FLAG; mob->m_startPos = Vector2(-20,-120); mob->m_prototype = getMobPrototype(2); insertCharMob(mob); mob.reset(new CWorldCharMob); mob->m_id = 3 | MOB_ID_FLAG; mob->m_startPos = Vector2(-50,-50); mob->m_prototype = getMobPrototype(3); insertCharMob(mob); mob.reset(new CWorldCharMob); mob->m_id = 4 | MOB_ID_FLAG; mob->m_startPos = Vector2(-20,-70); mob->m_prototype = getMobPrototype(4); insertCharMob(mob); mob.reset(new CWorldCharMob); mob->m_id = 5 | MOB_ID_FLAG; mob->m_startPos = Vector2(30,-80); mob->m_prototype = getMobPrototype(5); insertCharMob(mob); */ return true; }; bool CWorld::loadMobPrototypes() { CConfig cf; cf.load("mobs.ini"); StringVector vec = cf.getMultiSetting("Prototype"); for( StringVector::iterator it = vec.begin(); it != vec.end(); ++it ) { WorldMobProtPtr prot(new CWorldMobPrototype); if( prot->load(*it) ) { if( m_mobPrototypes.find(prot->getId()) != m_mobPrototypes.end() ) { CLog::instance()->log(CLog::msgFlagResources,CLog::msgLvlError,"Double mob prototype identifier %d!\n",prot->getId()); continue; } m_mobPrototypes.insert(std::pair<uint,WorldMobProtPtr>(prot->getId(),prot)); CLog::instance()->log(CLog::msgFlagResources,CLog::msgLvlInfo,"Added mob prototype with id %d.\n",prot->getId()); } } return true; }; bool CWorld::loadTerrain(const String& file) { CConfig cf; cf.load(file); m_width = StringConverter::parseInt(cf.getSetting("Width")); m_height = StringConverter::parseInt(cf.getSetting("Height")); m_pageSize = StringConverter::parseInt(cf.getSetting("PageSize")); WorldPage::m_size = m_pageSize; m_pageSize--; /// pages overlap String name = cf.getSetting("LandScapeFileName"); String ext = cf.getSetting("LandScapeExtension"); float scaleX = StringConverter::parseReal(cf.getSetting("ScaleX")); m_maxHeight = StringConverter::parseReal(cf.getSetting("ScaleY")); float scaleZ = StringConverter::parseReal(cf.getSetting("ScaleZ")); if( scaleX != scaleZ ) { CLog::instance()->log(CLog::msgLvlError,_("Landcape page isn't square.\n")); return false; }; if( !m_width || !m_height || !scaleX || !m_maxHeight || name == "" || ext == "" || !m_pageSize ) { CLog::instance()->log(CLog::msgLvlError,_("Not enough options in terrain config. Must be:\n Width, Height, PageSize, ScaleX, ScaleY, ScaleZ, LandScapeFileName, LandScapeExtension.\n")); return false; }; m_scale = (float)scaleZ / m_pageSize; WorldPage::m_scale = m_scale; m_invScale = (float)1/m_scale; m_scaledPage = m_scale * m_pageSize; m_maxUnscaledX = m_width * m_pageSize * 0.5f; m_maxScaledX = m_maxUnscaledX * m_scale; m_maxUnscaledZ = m_height * m_pageSize * 0.5f; m_maxScaledZ = m_maxUnscaledZ * m_scale; float scale = m_maxHeight / 256; /// It must be 255, but in plsm it's 256 CImage img; for( uint x = 0; x < m_width; ++x ) for( uint z = 0; z < m_height; ++z ) { WorldPage page(x,z); String filename = name + "." + StringConverter::toString(x) + "." + StringConverter::toString(z) + "." + ext; img.load(filename); if( !img.getData() ) return false; if( !img.getPixelSize() == 1 ) { CLog::instance()->log(CLog::msgLvlError,_("Image format isn't 8 bit grayscale. File: '%s'.\n"),filename.c_str()); return false; }; if( (img.getWidth() != (m_pageSize + 1)) || (img.getHeight() != (m_pageSize + 1)) ) { CLog::instance()->log(CLog::msgLvlError,_("Terrain page must be %dx%d pixels. File: '%s'.\n"),m_pageSize + 1, m_pageSize + 1,filename.c_str()); return false; }; page.m_heightData = new float[WorldPage::m_size * WorldPage::m_size]; for( uint i = 0; i < WorldPage::m_size; i++ ) for( uint j = 0; j < WorldPage::m_size; j++ ) page.m_heightData[i + j * WorldPage::m_size] = (float)img.getData()[i + j * WorldPage::m_size] * scale; m_pages.insert(page); }; computeNormals(); return true; }; void CWorld::computeNormals() { std::set<WorldPage>::iterator it; for( it = m_pages.begin(); it != m_pages.end(); ++it ) (const_cast<WorldPage&>(*it)).computeNormals(); }; WorldPage* CWorld::getPageByCoords(const float& x, const float& z) { return getPage((uint)(x + m_maxScaledX) / m_scaledPage,(uint)(z + m_maxScaledZ) / m_scaledPage); } WorldPage* CWorld::getPage(const uint x, const uint z) { WorldPage finder(0,0); finder.m_x = x; finder.m_z = z; std::set<WorldPage>::iterator it = m_pages.find(finder); if( it != m_pages.end() ) return const_cast<WorldPage*>(&(*it)); return NULL; }; float CWorld::heightAt(const float& x, const float& z) const { WorldPage finder(0,0); if( x + m_maxScaledX < 0 || z + m_maxScaledZ < 0 ) return 0.0; finder.m_x = (uint)((x + m_maxScaledX) / m_scaledPage); finder.m_z = (uint)((z + m_maxScaledZ) / m_scaledPage); std::set<WorldPage>::const_iterator it = m_pages.find(finder); if( it != m_pages.end() ) return (*it).heightAt(x + m_maxScaledX - (*it).m_x * m_scaledPage,z + m_maxScaledZ - (*it).m_z * m_scaledPage ); return 0.0; }; const Vector3& CWorld::normalAt(const float& x, const float& z) const { WorldPage finder(0,0); if( x + m_maxScaledX < 0 || z + m_maxScaledZ < 0 ) return Vector3::UNIT_Y; finder.m_x = (uint)((x + m_maxScaledX) / m_scaledPage); finder.m_z = (uint)((z + m_maxScaledZ) / m_scaledPage); std::set<WorldPage>::const_iterator it = m_pages.find(finder); if( it == m_pages.end() ) return Vector3::UNIT_Y; float localX = x / m_scale; float localZ = z / m_scale; // adjust x and z to be local to page localX -= (float)finder.m_x*m_pageSize - m_maxUnscaledX; localZ -= (float)finder.m_z*m_pageSize - m_maxUnscaledZ; // make sure x and z do not go outside the world boundaries if (localX < 0) localX = 0; else if (localX >= m_pageSize) localX = m_pageSize - 1; if (localZ < 0) localZ = 0; else if (localZ >= m_pageSize) localZ = m_pageSize - 1; uint iX = static_cast<uint>(localX); uint iZ = static_cast<uint>(localZ); if( localX - iX > 1 - (localZ - iZ) ) return (*it).normalAt(iX, iZ, true); /// Upper triangle else return (*it).normalAt(iX, iZ, false);/// Bottom triangle }; void CWorld::getPageIndices(const float& x, const float& z, uint& ix, uint& iz) const { ix = (x + m_maxScaledX) / m_scaledPage; iz = (z + m_maxScaledZ) / m_scaledPage; }; void CWorld::insertCharacter(const CharacterPtr &ch) { ch->m_ptr = ch; ch->m_inWorld = true; ch->onEnterWorld(); }; void CWorld::insertCharPlayer(const CharPlayerPtr& ch) { CLog::instance()->log(CLog::msgLvlInfo,"Insert player with id %d to world.\n",ch->getId()); m_players.insert(std::pair<uint,CharPlayerPtr>(ch->getId(),ch)); insertCharacter(ch); }; void CWorld::insertCharMob(const CharMobPtr& mob) { CLog::instance()->log(CLog::msgLvlInfo,"Insert mob with id %d to world.\n",mob->getId()); m_mobs.insert(std::pair<uint,CharMobPtr>(mob->getId(),mob)); insertCharacter(mob); }; void CWorld::removeCharPlayer(const CharPlayerPtr& ch) { removeCharPlayer(ch->getId()); }; void CWorld::removeCharPlayer(uint id) { CLog::instance()->log(CLog::msgLvlInfo,"Removing character with id %d from world.\n",id); std::map<uint,CharPlayerPtr>::iterator it = m_players.find(id); if( it != m_players.end() ) { (*it).second->onLeaveWorld(); (*it).second->m_inWorld = false; (*it).second->m_ptr.reset(); if( !m_walkingPlayers ) m_players.erase(it); else m_removePlayers.insert(id); } }; void CWorld::removeCharMob(const CharMobPtr& mob) { removeCharMob(mob->getId()); }; void CWorld::removeCharMob(uint id) { CLog::instance()->log(CLog::msgLvlInfo,"Removing mob with id %d from world.\n",id); std::map<uint,CharMobPtr>::iterator it = m_mobs.find(id); if( it != m_mobs.end() ) { (*it).second->onLeaveWorld(); (*it).second->m_inWorld = false; (*it).second->m_ptr.reset(); if( !m_walkingMobs ) m_mobs.erase(it); else m_removeMobs.insert(id); } }; CharacterPtr CWorld::findCharacter(uint id) { if (id & MOB_ID_FLAG) return findCharMob(id); else return findCharPlayer(id); } CharPlayerPtr CWorld::findCharPlayer(uint id) { std::map<uint,CharPlayerPtr>::iterator it = m_players.find(id); if( it != m_players.end() ) return (*it).second; return CharPlayerPtr(); }; CharMobPtr CWorld::findCharMob(uint id) { std::map<uint,CharMobPtr>::iterator it = m_mobs.find(id); if( it != m_mobs.end() ) return (*it).second; return CharMobPtr(); }; void CWorld::update(int64 pulse) { if( m_pulse % 5 == 0 ) { m_mobMovePulse = true; m_repopPulse = true; } else { m_repopPulse = false; m_mobMovePulse = false; } if( m_pulse % 5 == 1 ) m_playerMovePulse = true; else m_playerMovePulse = false; if( m_pulse % 5 == 2 ) m_processOutputPulse = true; else m_processOutputPulse = false; if( m_pulse % 50 == 0 ) m_regenPulse = true; else m_regenPulse = false; m_walkingPlayers = true; std::map<uint,CharPlayerPtr>::iterator it; for( it = m_players.begin(); it != m_players.end(); ++it) (*it).second->update(PULSE_TIME); m_walkingPlayers = false; std::set<uint>::iterator setIt; for( setIt = m_removePlayers.begin(); setIt != m_removePlayers.end(); ++setIt ) m_players.erase(*setIt); m_removePlayers.clear(); m_walkingMobs = true; std::map<uint,CharMobPtr>::iterator mobIt; for( mobIt = m_mobs.begin(); mobIt != m_mobs.end(); ++mobIt ) (*mobIt).second->update(PULSE_TIME); m_walkingMobs = false; for( setIt = m_removeMobs.begin(); setIt != m_removeMobs.end(); ++setIt ) m_mobs.erase(*setIt); m_removeMobs.clear(); if( m_repopPulse ) { std::multimap<int64,CharMobPtr>::iterator repop, next; for( repop = m_repop.begin(); repop != m_repop.end(); repop = next ) { next = repop; ++next; if( (*repop).first <= m_pulse ) { (*repop).second->repop(); insertCharMob((*repop).second); m_repop.erase(repop); } } } }; void CWorld::addMobRepop(int64 pulse, const CharMobPtr &mob) { m_repop.insert(std::pair<int64,CharMobPtr>(pulse,mob)); }; WorldMobProtPtr CWorld::getMobPrototype(uint id) { std::map<uint,WorldMobProtPtr>::iterator it = m_mobPrototypes.find(id); if( it != m_mobPrototypes.end() ) return (*it).second; return WorldMobProtPtr(); };
[ [ [ 1, 643 ] ] ]
aec2c73bdc0b9921f94e6ca9533e0cceec413b11
30a1e1c0c95239e5fa248fbb1b4ed41c6fe825ff
/jmail/color.cpp
2c030a2be13bd9895bc728332f0eed0acb08abb8
[]
no_license
inspirer/history
ed158ef5c04cdf95270821663820cf613b5c8de0
6df0145cd28477b23748b1b50e4264a67441daae
refs/heads/master
2021-01-01T17:22:46.101365
2011-06-12T00:58:37
2011-06-12T00:58:37
1,882,931
1
0
null
null
null
null
UTF-8
C++
false
false
3,922
cpp
// color.cpp #include "stdafx.h" #define var(c) ((c>='a'&&c<='z')||(c>='0'&&c<='9')||c=='_') #define num(c) (c>='0'&&c<='9') const static char* keywords[] = { "cl_standart","cl_edit","cl_currentedit","cl_cureditsel","cl_editsel", "cl_listinactive","cl_listactive","" }; class errorsCfg { public: char err[80]; errorsCfg(const char *l){ strcpy(err,l); } }; static int getfromint(char *val) { int i = 0; while(num(*val)){ i*=10;i+=*val-'0';val++;} if (*val) throw errorsCfg("invalid number"); return i; } static CString getfromCString(char *val) { if(*val!='"'||val[1]==0||val[strlen(val)-1]!='"') throw errorsCfg("wrong string"); val[strlen(val)-1]=0;return CString(val+1); } void cl_config::defvar(int varn,char *value) { switch(varn){ case 0: cl_standart=getfromint(value);break; case 1: cl_edit=getfromint(value);break; case 2: cl_currentedit=getfromint(value);break; case 3: cl_cureditsel=getfromint(value);break; case 4: cl_editsel=getfromint(value);break; case 5: cl_listinactive=getfromint(value);break; case 6: cl_listactive=getfromint(value);break; } } void cl_config::readconfig(const char *n,const char *section) { FILE *f; char s[128],*h,*l; DWORD lines = 0,i,e,q=0; defaults(); if ((f=fopen(n,"r"))==NULL){ sprintf(s,"`%s' not found",n); throw errors(s); } while (fgets(s,128,f)!=NULL){ lines++;h=s; while(*h) if (*h=='#'||*h=='\n') *h=0;else h++; h=s;while(*h==' ') h++; if (!*h) continue; if (*h=='['){ l=h;while(*l) if (*l==']') *l=0;else l++; q=!strcmp(h+1,section);continue; } if(!q) continue; l=h;while(*l) l++;l--; while(l>h&&*l==' ') *l--=0; if (!var(*h)){ sprintf(s,"%s(%i): wrong line",n,lines); throw errors(s); } l=h;while(var(*l)) l++; if (*l=='=') *l++=0; else { *l++=0; while(*l&&*l!='=') l++; if (!*l){ sprintf(s,"%s(%i): wrong line",n,lines); throw errors(s); } *l++=0; } while(*l==' ') l++; for(i=e=0;*keywords[i];i++) if(!strcmp(h,keywords[i])){ try { e=1;defvar(i,l); } catch(errorsCfg& e){ sprintf(s,"%s(%i): %s",n,lines,e.err); throw errors(s); } } if (!e){ sprintf(s,"%s(%i): unknown parameter `%s'",n,lines,h); throw errors(s); } } fclose(f); } void cl_config::writeconfig(const char *n,const char *section) { FILE *f,*old=NULL; char w[128],*h; if(!rename(n,"jMail.tmp")) old=fopen("jMail.tmp","r"); if ((f=fopen(n,"w"))==NULL){ sprintf(w,"`%s' not created",n); throw errors(w); } if (old){ while(fgets(w,128,old)!=NULL){ h=w;while(*h) if (*h=='\n') *h=0;else h++; if (*w=='['){ h=w;while(*h) if (*h==']') *h=0;else h++; } if (*w=='['&&(!strcmp(w+1,section))){ while(fgets(w,128,old)!=NULL){ if (*w=='[') break;*w=0; } break; } else { fprintf(f,"%s\n",w);} } fprintf(f,"[%s]\n",section); } else { fprintf(f,"# %s\n\n[%s]\n",n,section); } fprintf(f,"\n"); fprintf(f,"cl_standart=%i\n",cl_standart); fprintf(f,"cl_edit=%i\n",cl_edit); fprintf(f,"cl_currentedit=%i\n",cl_currentedit); fprintf(f,"cl_cureditsel=%i\n",cl_cureditsel); fprintf(f,"cl_editsel=%i\n",cl_editsel); fprintf(f,"cl_listinactive=%i\n",cl_listinactive); fprintf(f,"cl_listactive=%i\n",cl_listactive); if(old){ fprintf(f,"\n"); if (*w) fprintf(f,"%s",w); while (fgets(w,128,old)!=NULL) fprintf(f,"%s",w); fclose(old); unlink("jMail.tmp"); } fclose(f); } void cl_config::defaults() { cl_standart=7; cl_edit=23; cl_currentedit=31; cl_cureditsel=58; cl_editsel=18; cl_listinactive=23; cl_listactive=55; }
[ [ [ 1, 159 ] ] ]
1dd3fd90865648fd491061cc21f955bb97feb2b8
8be41f8425a39f7edc92efb3b73b6a8ca91150f3
/Qt/project/mainwindow.cpp
9dbbda9eb6a63e61932411c2c4710a016de054b2
[]
no_license
SysMa/msq-summer-project
b497a061feef25cac1c892fe4dd19ebb30ae9a56
0ef171aa62ad584259913377eabded14f9f09e4b
refs/heads/master
2021-01-23T09:28:34.696908
2011-09-16T06:39:52
2011-09-16T06:39:52
34,208,886
0
1
null
null
null
null
UTF-8
C++
false
false
40,222
cpp
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QUrl> #include <QDesktopServices> /* for dubug */ #include <QDebug> /**/ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); connect(ui->comboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(showPlanet(int))); connect(ui->comboBox_2,SIGNAL(currentIndexChanged(int)),this,SLOT(cameraPosition(int))); connect(ui->comboBox_3,SIGNAL(currentIndexChanged(int)),this,SLOT(viewPositon(int))); connect(ui->widget_2,SIGNAL(date_updated(int)),this,SLOT(refreshTime(int))); connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(showAbout())); connect(ui->pushButton_2,SIGNAL(clicked()),this,SLOT(showAdvice())); connect(ui->pushButton_3,SIGNAL(clicked()),this,SLOT(keepTime())); connect(ui->pushButton_4,SIGNAL(clicked()),this,SLOT(showHotkey())); connect(ui->pushButton_5,SIGNAL(clicked()),this,SLOT(showHelp())); connect(ui->pushButton_6,SIGNAL(clicked()),this,SLOT(anglePlus())); connect(ui->pushButton_7,SIGNAL(clicked()),this,SLOT(angleMinus())); connect(ui->pushButton_8,SIGNAL(clicked()),this,SLOT(showAngle())); showMessage = new QMessageBox(); } MainWindow::~MainWindow() { delete ui; } /** * show the selected one */ void MainWindow::showPlanet(int index) { switch(index) { case 0: ui->widget_2->solar->moon_line_color[0] = 0; ui->widget_2->solar->moon_line_color[1] = 1; ui->widget_2->solar->moon_line_color[2] = 0; ui->widget_2->solar->mercury_line_color[0] = 0; ui->widget_2->solar->mercury_line_color[1] = 1; ui->widget_2->solar->mercury_line_color[2] = 0; ui->widget_2->solar->venus_line_color[0] = 0; ui->widget_2->solar->venus_line_color[1] = 1; ui->widget_2->solar->venus_line_color[2] = 0; ui->widget_2->solar->earth_line_color[0] = 0; ui->widget_2->solar->earth_line_color[1] = 1; ui->widget_2->solar->earth_line_color[2] = 0; ui->widget_2->solar->mars_line_color[0] = 0; ui->widget_2->solar->mars_line_color[1] = 1; ui->widget_2->solar->mars_line_color[2] = 0; ui->widget_2->solar->jupiter_line_color[0] = 0; ui->widget_2->solar->jupiter_line_color[1] = 1; ui->widget_2->solar->jupiter_line_color[2] = 0; ui->widget_2->solar->saturn_line_color[0] = 0; ui->widget_2->solar->saturn_line_color[1] = 1; ui->widget_2->solar->saturn_line_color[2] = 0; ui->widget_2->solar->uranus_line_color[0] = 0; ui->widget_2->solar->uranus_line_color[1] = 1; ui->widget_2->solar->uranus_line_color[2] = 0; ui->widget_2->solar->neptune_line_color[0] = 0; ui->widget_2->solar->neptune_line_color[1] = 1; ui->widget_2->solar->neptune_line_color[2] = 0; ui->widget_2->updateGL(); break; case 1: ui->widget_2->solar->moon_line_color[0] = 0; ui->widget_2->solar->moon_line_color[1] = 1; ui->widget_2->solar->moon_line_color[2] = 0; ui->widget_2->solar->mercury_line_color[0] = 1; ui->widget_2->solar->mercury_line_color[1] = 0; ui->widget_2->solar->mercury_line_color[2] = 0; ui->widget_2->solar->venus_line_color[0] = 0; ui->widget_2->solar->venus_line_color[1] = 1; ui->widget_2->solar->venus_line_color[2] = 0; ui->widget_2->solar->earth_line_color[0] = 0; ui->widget_2->solar->earth_line_color[1] = 1; ui->widget_2->solar->earth_line_color[2] = 0; ui->widget_2->solar->mars_line_color[0] = 0; ui->widget_2->solar->mars_line_color[1] = 1; ui->widget_2->solar->mars_line_color[2] = 0; ui->widget_2->solar->jupiter_line_color[0] = 0; ui->widget_2->solar->jupiter_line_color[1] = 1; ui->widget_2->solar->jupiter_line_color[2] = 0; ui->widget_2->solar->saturn_line_color[0] = 0; ui->widget_2->solar->saturn_line_color[1] = 1; ui->widget_2->solar->saturn_line_color[2] = 0; ui->widget_2->solar->uranus_line_color[0] = 0; ui->widget_2->solar->uranus_line_color[1] = 1; ui->widget_2->solar->uranus_line_color[2] = 0; ui->widget_2->solar->neptune_line_color[0] = 0; ui->widget_2->solar->neptune_line_color[1] = 1; ui->widget_2->solar->neptune_line_color[2] = 0; ui->widget_2->updateGL(); break; case 2: ui->widget_2->solar->moon_line_color[0] = 0; ui->widget_2->solar->moon_line_color[1] = 1; ui->widget_2->solar->moon_line_color[2] = 0; ui->widget_2->solar->mercury_line_color[0] = 0; ui->widget_2->solar->mercury_line_color[1] = 1; ui->widget_2->solar->mercury_line_color[2] = 0; ui->widget_2->solar->venus_line_color[0] = 1; ui->widget_2->solar->venus_line_color[1] = 0; ui->widget_2->solar->venus_line_color[2] = 0; ui->widget_2->solar->earth_line_color[0] = 0; ui->widget_2->solar->earth_line_color[1] = 1; ui->widget_2->solar->earth_line_color[2] = 0; ui->widget_2->solar->mars_line_color[0] = 0; ui->widget_2->solar->mars_line_color[1] = 1; ui->widget_2->solar->mars_line_color[2] = 0; ui->widget_2->solar->jupiter_line_color[0] = 0; ui->widget_2->solar->jupiter_line_color[1] = 1; ui->widget_2->solar->jupiter_line_color[2] = 0; ui->widget_2->solar->saturn_line_color[0] = 0; ui->widget_2->solar->saturn_line_color[1] = 1; ui->widget_2->solar->saturn_line_color[2] = 0; ui->widget_2->solar->uranus_line_color[0] = 0; ui->widget_2->solar->uranus_line_color[1] = 1; ui->widget_2->solar->uranus_line_color[2] = 0; ui->widget_2->solar->neptune_line_color[0] = 0; ui->widget_2->solar->neptune_line_color[1] = 1; ui->widget_2->solar->neptune_line_color[2] = 0; ui->widget_2->updateGL(); break; case 3: ui->widget_2->solar->moon_line_color[0] = 0; ui->widget_2->solar->moon_line_color[1] = 1; ui->widget_2->solar->moon_line_color[2] = 0; ui->widget_2->solar->mercury_line_color[0] = 0; ui->widget_2->solar->mercury_line_color[1] = 1; ui->widget_2->solar->mercury_line_color[2] = 0; ui->widget_2->solar->venus_line_color[0] = 0; ui->widget_2->solar->venus_line_color[1] = 1; ui->widget_2->solar->venus_line_color[2] = 0; ui->widget_2->solar->earth_line_color[0] = 1; ui->widget_2->solar->earth_line_color[1] = 0; ui->widget_2->solar->earth_line_color[2] = 0; ui->widget_2->solar->mars_line_color[0] = 0; ui->widget_2->solar->mars_line_color[1] = 1; ui->widget_2->solar->mars_line_color[2] = 0; ui->widget_2->solar->jupiter_line_color[0] = 0; ui->widget_2->solar->jupiter_line_color[1] = 1; ui->widget_2->solar->jupiter_line_color[2] = 0; ui->widget_2->solar->saturn_line_color[0] = 0; ui->widget_2->solar->saturn_line_color[1] = 1; ui->widget_2->solar->saturn_line_color[2] = 0; ui->widget_2->solar->uranus_line_color[0] = 0; ui->widget_2->solar->uranus_line_color[1] = 1; ui->widget_2->solar->uranus_line_color[2] = 0; ui->widget_2->solar->neptune_line_color[0] = 0; ui->widget_2->solar->neptune_line_color[1] = 1; ui->widget_2->solar->neptune_line_color[2] = 0; ui->widget_2->updateGL(); break; case 4: ui->widget_2->solar->moon_line_color[0] = 0; ui->widget_2->solar->moon_line_color[1] = 1; ui->widget_2->solar->moon_line_color[2] = 0; ui->widget_2->solar->mercury_line_color[0] = 0; ui->widget_2->solar->mercury_line_color[1] = 1; ui->widget_2->solar->mercury_line_color[2] = 0; ui->widget_2->solar->venus_line_color[0] = 0; ui->widget_2->solar->venus_line_color[1] = 1; ui->widget_2->solar->venus_line_color[2] = 0; ui->widget_2->solar->earth_line_color[0] = 0; ui->widget_2->solar->earth_line_color[1] = 1; ui->widget_2->solar->earth_line_color[2] = 0; ui->widget_2->solar->mars_line_color[0] = 1; ui->widget_2->solar->mars_line_color[1] = 0; ui->widget_2->solar->mars_line_color[2] = 0; ui->widget_2->solar->jupiter_line_color[0] = 0; ui->widget_2->solar->jupiter_line_color[1] = 1; ui->widget_2->solar->jupiter_line_color[2] = 0; ui->widget_2->solar->saturn_line_color[0] = 0; ui->widget_2->solar->saturn_line_color[1] = 1; ui->widget_2->solar->saturn_line_color[2] = 0; ui->widget_2->solar->uranus_line_color[0] = 0; ui->widget_2->solar->uranus_line_color[1] = 1; ui->widget_2->solar->uranus_line_color[2] = 0; ui->widget_2->solar->neptune_line_color[0] = 0; ui->widget_2->solar->neptune_line_color[1] = 1; ui->widget_2->solar->neptune_line_color[2] = 0; ui->widget_2->updateGL(); break; case 5: ui->widget_2->solar->moon_line_color[0] = 0; ui->widget_2->solar->moon_line_color[1] = 1; ui->widget_2->solar->moon_line_color[2] = 0; ui->widget_2->solar->mercury_line_color[0] = 0; ui->widget_2->solar->mercury_line_color[1] = 1; ui->widget_2->solar->mercury_line_color[2] = 0; ui->widget_2->solar->venus_line_color[0] = 0; ui->widget_2->solar->venus_line_color[1] = 1; ui->widget_2->solar->venus_line_color[2] = 0; ui->widget_2->solar->earth_line_color[0] = 0; ui->widget_2->solar->earth_line_color[1] = 1; ui->widget_2->solar->earth_line_color[2] = 0; ui->widget_2->solar->mars_line_color[0] = 0; ui->widget_2->solar->mars_line_color[1] = 1; ui->widget_2->solar->mars_line_color[2] = 0; ui->widget_2->solar->jupiter_line_color[0] = 1; ui->widget_2->solar->jupiter_line_color[1] = 0; ui->widget_2->solar->jupiter_line_color[2] = 0; ui->widget_2->solar->saturn_line_color[0] = 0; ui->widget_2->solar->saturn_line_color[1] = 1; ui->widget_2->solar->saturn_line_color[2] = 0; ui->widget_2->solar->uranus_line_color[0] = 0; ui->widget_2->solar->uranus_line_color[1] = 1; ui->widget_2->solar->uranus_line_color[2] = 0; ui->widget_2->solar->neptune_line_color[0] = 0; ui->widget_2->solar->neptune_line_color[1] = 1; ui->widget_2->solar->neptune_line_color[2] = 0; ui->widget_2->updateGL(); break; case 6: ui->widget_2->solar->moon_line_color[0] = 0; ui->widget_2->solar->moon_line_color[1] = 1; ui->widget_2->solar->moon_line_color[2] = 0; ui->widget_2->solar->mercury_line_color[0] = 0; ui->widget_2->solar->mercury_line_color[1] = 1; ui->widget_2->solar->mercury_line_color[2] = 0; ui->widget_2->solar->venus_line_color[0] = 0; ui->widget_2->solar->venus_line_color[1] = 1; ui->widget_2->solar->venus_line_color[2] = 0; ui->widget_2->solar->earth_line_color[0] = 0; ui->widget_2->solar->earth_line_color[1] = 1; ui->widget_2->solar->earth_line_color[2] = 0; ui->widget_2->solar->mars_line_color[0] = 0; ui->widget_2->solar->mars_line_color[1] = 1; ui->widget_2->solar->mars_line_color[2] = 0; ui->widget_2->solar->jupiter_line_color[0] = 0; ui->widget_2->solar->jupiter_line_color[1] = 1; ui->widget_2->solar->jupiter_line_color[2] = 0; ui->widget_2->solar->saturn_line_color[0] = 1; ui->widget_2->solar->saturn_line_color[1] = 0; ui->widget_2->solar->saturn_line_color[2] = 0; ui->widget_2->solar->uranus_line_color[0] = 0; ui->widget_2->solar->uranus_line_color[1] = 1; ui->widget_2->solar->uranus_line_color[2] = 0; ui->widget_2->solar->neptune_line_color[0] = 0; ui->widget_2->solar->neptune_line_color[1] = 1; ui->widget_2->solar->neptune_line_color[2] = 0; ui->widget_2->updateGL(); break; case 7: ui->widget_2->solar->moon_line_color[0] = 0; ui->widget_2->solar->moon_line_color[1] = 1; ui->widget_2->solar->moon_line_color[2] = 0; ui->widget_2->solar->mercury_line_color[0] = 0; ui->widget_2->solar->mercury_line_color[1] = 1; ui->widget_2->solar->mercury_line_color[2] = 0; ui->widget_2->solar->venus_line_color[0] = 0; ui->widget_2->solar->venus_line_color[1] = 1; ui->widget_2->solar->venus_line_color[2] = 0; ui->widget_2->solar->earth_line_color[0] = 0; ui->widget_2->solar->earth_line_color[1] = 1; ui->widget_2->solar->earth_line_color[2] = 0; ui->widget_2->solar->mars_line_color[0] = 0; ui->widget_2->solar->mars_line_color[1] = 1; ui->widget_2->solar->mars_line_color[2] = 0; ui->widget_2->solar->jupiter_line_color[0] = 0; ui->widget_2->solar->jupiter_line_color[1] = 1; ui->widget_2->solar->jupiter_line_color[2] = 0; ui->widget_2->solar->saturn_line_color[0] = 0; ui->widget_2->solar->saturn_line_color[1] = 1; ui->widget_2->solar->saturn_line_color[2] = 0; ui->widget_2->solar->uranus_line_color[0] = 1; ui->widget_2->solar->uranus_line_color[1] = 0; ui->widget_2->solar->uranus_line_color[2] = 0; ui->widget_2->solar->neptune_line_color[0] = 0; ui->widget_2->solar->neptune_line_color[1] = 1; ui->widget_2->solar->neptune_line_color[2] = 0; ui->widget_2->updateGL(); break; case 8: ui->widget_2->solar->moon_line_color[0] = 0; ui->widget_2->solar->moon_line_color[1] = 1; ui->widget_2->solar->moon_line_color[2] = 0; ui->widget_2->solar->mercury_line_color[0] = 0; ui->widget_2->solar->mercury_line_color[1] = 1; ui->widget_2->solar->mercury_line_color[2] = 0; ui->widget_2->solar->venus_line_color[0] = 0; ui->widget_2->solar->venus_line_color[1] = 1; ui->widget_2->solar->venus_line_color[2] = 0; ui->widget_2->solar->earth_line_color[0] = 0; ui->widget_2->solar->earth_line_color[1] = 1; ui->widget_2->solar->earth_line_color[2] = 0; ui->widget_2->solar->mars_line_color[0] = 0; ui->widget_2->solar->mars_line_color[1] = 1; ui->widget_2->solar->mars_line_color[2] = 0; ui->widget_2->solar->jupiter_line_color[0] = 0; ui->widget_2->solar->jupiter_line_color[1] = 1; ui->widget_2->solar->jupiter_line_color[2] = 0; ui->widget_2->solar->saturn_line_color[0] = 0; ui->widget_2->solar->saturn_line_color[1] = 1; ui->widget_2->solar->saturn_line_color[2] = 0; ui->widget_2->solar->uranus_line_color[0] = 0; ui->widget_2->solar->uranus_line_color[1] = 1; ui->widget_2->solar->uranus_line_color[2] = 0; ui->widget_2->solar->neptune_line_color[0] = 1; ui->widget_2->solar->neptune_line_color[1] = 0; ui->widget_2->solar->neptune_line_color[2] = 0; ui->widget_2->updateGL(); break; default: break; } } /** * show the date with the same time in the widget */ void MainWindow::refreshTime(int add) { //qDebug()<<add; QDate begin(2000,1,1); QDate show; show = begin.addDays(add); //qDebug()<<begin<<" "<<show; ui->dateEdit->setDate(show); } /** * keep time with widget */ void MainWindow::keepTime() { if(ui->pushButton_3->text() == "Set") { ui->widget_2->solar->setSpeed(0); ui->pushButton_3->setText("OK"); } else if(ui->pushButton_3->text() == "OK") { //qDebug()<<ui->dateEdit->date(); QDate end = ui->dateEdit->date(); QDate begin(2000,1,1); int add = begin.daysTo(end); if( add < 0 || add > 109574) { QMessageBox* show = new QMessageBox; show->setText("Sorry, wrong date!"); return; } else { ui->pushButton_3->setText("Set"); ui->widget_2->solar->data_num = add; ui->widget_2->solar->setSpeed(1); } } } /** * determine the camera postion */ void MainWindow::cameraPosition(int index) { switch(index) { case 0: ui->widget_2->camera_changed = false; ui->widget_2->camera_from_default = true; ui->widget_2->camera_from_sun = false; ui->widget_2->camera_from_moon = false; ui->widget_2->camera_from_mercury = false; ui->widget_2->camera_from_venus = false; ui->widget_2->camera_from_earth = false; ui->widget_2->camera_from_mars = false; ui->widget_2->camera_from_jupiter = false; ui->widget_2->camera_from_saturn = false; ui->widget_2->camera_from_uranus = false; ui->widget_2->camera_from_neptune = false; // reset ui->widget_2->from_x = 0; ui->widget_2->from_y = ui->widget_2->solar->neptune_data_y[0]; ui->widget_2->from_z = 15; ui->widget_2->updateGL(); break; case 1: ui->widget_2->camera_changed = true; ui->widget_2->camera_from_default = false; ui->widget_2->camera_from_sun = true; ui->widget_2->camera_from_moon = false; ui->widget_2->camera_from_mercury = false; ui->widget_2->camera_from_venus = false; ui->widget_2->camera_from_earth = false; ui->widget_2->camera_from_mars = false; ui->widget_2->camera_from_jupiter = false; ui->widget_2->camera_from_saturn = false; ui->widget_2->camera_from_uranus = false; ui->widget_2->camera_from_neptune = false; ui->widget_2->updateGL(); break; case 2: ui->widget_2->camera_changed = true; ui->widget_2->camera_from_default = false; ui->widget_2->camera_from_sun = false; ui->widget_2->camera_from_moon = true; ui->widget_2->camera_from_mercury = false; ui->widget_2->camera_from_venus = false; ui->widget_2->camera_from_earth = false; ui->widget_2->camera_from_mars = false; ui->widget_2->camera_from_jupiter = false; ui->widget_2->camera_from_saturn = false; ui->widget_2->camera_from_uranus = false; ui->widget_2->camera_from_neptune = false; ui->widget_2->updateGL(); break; case 3: ui->widget_2->camera_changed = true; ui->widget_2->camera_from_default = false; ui->widget_2->camera_from_sun = false; ui->widget_2->camera_from_moon = false; ui->widget_2->camera_from_mercury = true; ui->widget_2->camera_from_venus = false; ui->widget_2->camera_from_earth = false; ui->widget_2->camera_from_mars = false; ui->widget_2->camera_from_jupiter = false; ui->widget_2->camera_from_saturn = false; ui->widget_2->camera_from_uranus = false; ui->widget_2->camera_from_neptune = false; ui->widget_2->updateGL(); break; case 4: ui->widget_2->camera_changed = true; ui->widget_2->camera_from_default = false; ui->widget_2->camera_from_sun = false; ui->widget_2->camera_from_moon = false; ui->widget_2->camera_from_mercury = false; ui->widget_2->camera_from_venus = true; ui->widget_2->camera_from_earth = false; ui->widget_2->camera_from_mars = false; ui->widget_2->camera_from_jupiter = false; ui->widget_2->camera_from_saturn = false; ui->widget_2->camera_from_uranus = false; ui->widget_2->camera_from_neptune = false; ui->widget_2->updateGL(); break; case 5: ui->widget_2->camera_changed = true; ui->widget_2->camera_from_default = false; ui->widget_2->camera_from_sun = false; ui->widget_2->camera_from_moon = false; ui->widget_2->camera_from_mercury = false; ui->widget_2->camera_from_venus = false; ui->widget_2->camera_from_earth = true; ui->widget_2->camera_from_mars = false; ui->widget_2->camera_from_jupiter = false; ui->widget_2->camera_from_saturn = false; ui->widget_2->camera_from_uranus = false; ui->widget_2->camera_from_neptune = false; ui->widget_2->updateGL(); break; case 6: ui->widget_2->camera_changed = true; ui->widget_2->camera_from_default = false; ui->widget_2->camera_from_sun = false; ui->widget_2->camera_from_moon = false; ui->widget_2->camera_from_mercury = false; ui->widget_2->camera_from_venus = false; ui->widget_2->camera_from_earth = false; ui->widget_2->camera_from_mars = true; ui->widget_2->camera_from_jupiter = false; ui->widget_2->camera_from_saturn = false; ui->widget_2->camera_from_uranus = false; ui->widget_2->camera_from_neptune = false; ui->widget_2->updateGL(); break; case 7: ui->widget_2->camera_changed = true; ui->widget_2->camera_from_default = false; ui->widget_2->camera_from_sun = false; ui->widget_2->camera_from_moon = false; ui->widget_2->camera_from_mercury = false; ui->widget_2->camera_from_venus = false; ui->widget_2->camera_from_earth = false; ui->widget_2->camera_from_mars = false; ui->widget_2->camera_from_jupiter = true; ui->widget_2->camera_from_saturn = false; ui->widget_2->camera_from_uranus = false; ui->widget_2->camera_from_neptune = false; ui->widget_2->updateGL(); break; case 8: ui->widget_2->camera_changed = true; ui->widget_2->camera_from_default = false; ui->widget_2->camera_from_sun = false; ui->widget_2->camera_from_moon = false; ui->widget_2->camera_from_mercury = false; ui->widget_2->camera_from_venus = false; ui->widget_2->camera_from_earth = false; ui->widget_2->camera_from_mars = false; ui->widget_2->camera_from_jupiter = false; ui->widget_2->camera_from_saturn = true; ui->widget_2->camera_from_uranus = false; ui->widget_2->camera_from_neptune = false; ui->widget_2->updateGL(); break; case 9: ui->widget_2->camera_changed = true; ui->widget_2->camera_from_default = false; ui->widget_2->camera_from_sun = false; ui->widget_2->camera_from_moon = false; ui->widget_2->camera_from_mercury = false; ui->widget_2->camera_from_venus = false; ui->widget_2->camera_from_earth = false; ui->widget_2->camera_from_mars = false; ui->widget_2->camera_from_jupiter = false; ui->widget_2->camera_from_saturn = false; ui->widget_2->camera_from_uranus = true; ui->widget_2->camera_from_neptune = false; ui->widget_2->updateGL(); break; case 10: ui->widget_2->camera_changed = true; ui->widget_2->camera_from_default = false; ui->widget_2->camera_from_sun = false; ui->widget_2->camera_from_moon = false; ui->widget_2->camera_from_mercury = false; ui->widget_2->camera_from_venus = false; ui->widget_2->camera_from_earth = false; ui->widget_2->camera_from_mars = false; ui->widget_2->camera_from_jupiter = false; ui->widget_2->camera_from_saturn = false; ui->widget_2->camera_from_uranus = false; ui->widget_2->camera_from_neptune = true; ui->widget_2->updateGL(); break; default: ui->widget_2->camera_changed = false; ui->widget_2->camera_from_default = true; ui->widget_2->camera_from_sun = false; ui->widget_2->camera_from_moon = false; ui->widget_2->camera_from_mercury = false; ui->widget_2->camera_from_venus = false; ui->widget_2->camera_from_earth = false; ui->widget_2->camera_from_mars = false; ui->widget_2->camera_from_jupiter = false; ui->widget_2->camera_from_saturn = false; ui->widget_2->camera_from_uranus = false; ui->widget_2->camera_from_neptune = false; // reset ui->widget_2->from_x = 0; ui->widget_2->from_y = ui->widget_2->solar->neptune_data_y[0]; ui->widget_2->from_z = 15; ui->widget_2->updateGL(); break; } } /** * determine the view position */ void MainWindow::viewPositon(int index) { switch(index) { case 0: ui->widget_2->view_changed = false; ui->widget_2->view_to_default = true; ui->widget_2->view_to_moon = false; ui->widget_2->view_to_mercury = false; ui->widget_2->view_to_venus = false; ui->widget_2->view_to_earth = false; ui->widget_2->view_to_mars = false; ui->widget_2->view_to_jupiter = false; ui->widget_2->view_to_saturn = false; ui->widget_2->view_to_uranus = false; ui->widget_2->view_to_neptune = false; // reset ui->widget_2->to_x = 0; ui->widget_2->to_y = 0; ui->widget_2->to_z = 0; ui->widget_2->updateGL(); break; case 1: ui->widget_2->view_changed = true; ui->widget_2->view_to_default = false; ui->widget_2->view_to_moon = true; ui->widget_2->view_to_mercury = false; ui->widget_2->view_to_venus = false; ui->widget_2->view_to_earth = false; ui->widget_2->view_to_mars = false; ui->widget_2->view_to_jupiter = false; ui->widget_2->view_to_saturn = false; ui->widget_2->view_to_uranus = false; ui->widget_2->view_to_neptune = false; ui->widget_2->updateGL(); break; case 2: ui->widget_2->view_changed = true; ui->widget_2->view_to_default = false; ui->widget_2->view_to_moon = false; ui->widget_2->view_to_mercury = true; ui->widget_2->view_to_venus = false; ui->widget_2->view_to_earth = false; ui->widget_2->view_to_mars = false; ui->widget_2->view_to_jupiter = false; ui->widget_2->view_to_saturn = false; ui->widget_2->view_to_uranus = false; ui->widget_2->view_to_neptune = false; ui->widget_2->updateGL(); break; case 3: ui->widget_2->view_changed = true; ui->widget_2->view_to_default = false; ui->widget_2->view_to_moon = false; ui->widget_2->view_to_mercury = false; ui->widget_2->view_to_venus = true; ui->widget_2->view_to_earth = false; ui->widget_2->view_to_mars = false; ui->widget_2->view_to_jupiter = false; ui->widget_2->view_to_saturn = false; ui->widget_2->view_to_uranus = false; ui->widget_2->view_to_neptune = false; ui->widget_2->updateGL(); break; case 4: ui->widget_2->view_changed = true; ui->widget_2->view_to_default = false; ui->widget_2->view_to_moon = false; ui->widget_2->view_to_mercury = false; ui->widget_2->view_to_venus = false; ui->widget_2->view_to_earth = true; ui->widget_2->view_to_mars = false; ui->widget_2->view_to_jupiter = false; ui->widget_2->view_to_saturn = false; ui->widget_2->view_to_uranus = false; ui->widget_2->view_to_neptune = false; ui->widget_2->updateGL(); break; case 5: ui->widget_2->view_changed = true; ui->widget_2->view_to_default = false; ui->widget_2->view_to_moon = false; ui->widget_2->view_to_mercury = false; ui->widget_2->view_to_venus = false; ui->widget_2->view_to_earth = false; ui->widget_2->view_to_mars = true; ui->widget_2->view_to_jupiter = false; ui->widget_2->view_to_saturn = false; ui->widget_2->view_to_uranus = false; ui->widget_2->view_to_neptune = false; ui->widget_2->updateGL(); break; case 6: ui->widget_2->view_changed = true; ui->widget_2->view_to_default = false; ui->widget_2->view_to_moon = false; ui->widget_2->view_to_mercury = false; ui->widget_2->view_to_venus = false; ui->widget_2->view_to_earth = false; ui->widget_2->view_to_mars = false; ui->widget_2->view_to_jupiter = true; ui->widget_2->view_to_saturn = false; ui->widget_2->view_to_uranus = false; ui->widget_2->view_to_neptune = false; ui->widget_2->updateGL(); break; case 7: ui->widget_2->view_changed = true; ui->widget_2->view_to_default = false; ui->widget_2->view_to_moon = false; ui->widget_2->view_to_mercury = false; ui->widget_2->view_to_venus = false; ui->widget_2->view_to_earth = false; ui->widget_2->view_to_mars = false; ui->widget_2->view_to_jupiter = false; ui->widget_2->view_to_saturn = true; ui->widget_2->view_to_uranus = false; ui->widget_2->view_to_neptune = false; ui->widget_2->updateGL(); break; case 8: ui->widget_2->view_changed = true; ui->widget_2->view_to_default = false; ui->widget_2->view_to_moon = false; ui->widget_2->view_to_mercury = false; ui->widget_2->view_to_venus = false; ui->widget_2->view_to_earth = false; ui->widget_2->view_to_mars = false; ui->widget_2->view_to_jupiter = false; ui->widget_2->view_to_saturn = false; ui->widget_2->view_to_uranus = true; ui->widget_2->view_to_neptune = false; ui->widget_2->updateGL(); break; case 9: ui->widget_2->view_changed = true; ui->widget_2->view_to_default = false; ui->widget_2->view_to_moon = false; ui->widget_2->view_to_mercury = false; ui->widget_2->view_to_venus = false; ui->widget_2->view_to_earth = false; ui->widget_2->view_to_mars = false; ui->widget_2->view_to_jupiter = false; ui->widget_2->view_to_saturn = false; ui->widget_2->view_to_uranus = false; ui->widget_2->view_to_neptune = true; ui->widget_2->updateGL(); break; default: ui->widget_2->view_changed = false; ui->widget_2->view_to_default = true; ui->widget_2->view_to_moon = false; ui->widget_2->view_to_mercury = false; ui->widget_2->view_to_venus = false; ui->widget_2->view_to_earth = false; ui->widget_2->view_to_mars = false; ui->widget_2->view_to_jupiter = false; ui->widget_2->view_to_saturn = false; ui->widget_2->view_to_uranus = false; ui->widget_2->view_to_neptune = false; // reset ui->widget_2->to_x = 0; ui->widget_2->to_y = 0; ui->widget_2->to_z = 0; ui->widget_2->updateGL(); break; } } /** * show about */ void MainWindow::showAbout() { aboutform = new About(); aboutform->show(); } /** * show hot key list */ void MainWindow::showHotkey() { hotkeyform = new Hotkey(); hotkeyform->show(); } /** * show advice */ void MainWindow::showAdvice() { adviceform = new Advice(); adviceform->show(); } /** * shwo help */ void MainWindow::showHelp() { QUrl url("help.chm"); QDesktopServices::openUrl(url); } /** * show the palnet or not */ void MainWindow::on_actionToogle_Mercury_triggered() { ui->widget_2->solar->mercury = !ui->widget_2->solar->mercury; } /** * show the palnet or not */ void MainWindow::on_actionVenus_triggered() { ui->widget_2->solar->venus = !ui->widget_2->solar->venus; } /** * show the palnet or not */ void MainWindow::on_actionEarth_triggered() { ui->widget_2->solar->earth = !ui->widget_2->solar->earth; } /** * show the palnet or not */ void MainWindow::on_actionMoon_triggered() { ui->widget_2->solar->moon = !ui->widget_2->solar->moon; } /** * show the palnet or not */ void MainWindow::on_actionMars_triggered() { ui->widget_2->solar->mars = !ui->widget_2->solar->mars; } /** * show the palnet or not */ void MainWindow::on_actionJupiter_triggered() { ui->widget_2->solar->jupiter = !ui->widget_2->solar->jupiter; } /** * show the palnet or not */ void MainWindow::on_actionNeptune_triggered() { ui->widget_2->solar->neptune = !ui->widget_2->solar->neptune; } /** * show the palnet or not */ void MainWindow::on_actionSaturn_triggered() { ui->widget_2->solar->saturn = !ui->widget_2->solar->saturn; } /** * show the palnet or not */ void MainWindow::on_actionUranus_triggered() { ui->widget_2->solar->uranus = !ui->widget_2->solar->uranus; } /** * show the palnet cirle or not */ void MainWindow::on_actionMercury_triggered() { ui->widget_2->solar->mercury_line = !ui->widget_2->solar->mercury_line; } /** * show the palnet cirle or not */ void MainWindow::on_actionVenus_2_triggered() { ui->widget_2->solar->venus_line = !ui->widget_2->solar->venus_line; } /** * show the palnet cirle or not */ void MainWindow::on_actionEarth_2_triggered() { ui->widget_2->solar->earth_line = !ui->widget_2->solar->earth_line; } /** * show the palnet cirle or not */ void MainWindow::on_actionMoon_2_triggered() { ui->widget_2->solar->moon_line = !ui->widget_2->solar->moon_line; } /** * show the palnet cirle or not */ void MainWindow::on_actionMars_2_triggered() { ui->widget_2->solar->mars_line = !ui->widget_2->solar->mars_line; } /** * show the palnet cirle or not */ void MainWindow::on_actionJupiter_2_triggered() { ui->widget_2->solar->jupiter_line = !ui->widget_2->solar->jupiter_line; } /** * show the palnet cirle or not */ void MainWindow::on_actionSaturn_2_triggered() { ui->widget_2->solar->saturn_line = !ui->widget_2->solar->saturn_line; } /** * show the palnet cirle or not */ void MainWindow::on_actionNeptune_2_triggered() { ui->widget_2->solar->neptune_line = !ui->widget_2->solar->neptune_line; } /** * show the palnet cirle or not */ void MainWindow::on_actionUranus_2_triggered() { ui->widget_2->solar->uranus_line = !ui->widget_2->solar->uranus_line; } /** * show the about form to introduce */ void MainWindow::on_actionAbout_triggered() { aboutform = new About(); aboutform->show(); } /** * show the acvice form to provide some infomation */ void MainWindow::on_actionHelp_triggered() { adviceform = new Advice(); adviceform->show(); } /** * show the hot key list to help the users */ void MainWindow::on_actionHot_Key_List_triggered() { hotkeyform = new Hotkey(); hotkeyform->show(); } /** * determine which system to show */ void MainWindow::on_actionSolar_triggered() { ui->widget_2->changeModel = true; } /** * determine which system to show */ void MainWindow::on_actionSun_Earth_Moon_triggered() { ui->widget_2->changeModel = false; } /** * determine if eclipse notice will be raised. */ void MainWindow::on_actionEclipse_triggered() { ui->widget_2->watchEclipse = !ui->widget_2->watchEclipse; if(ui->widget_2->watchEclipse) { showMessage->setText("We will stop when eclipse happen."); showMessage->show(); } else { showMessage->setText("Eclipse notice has been concelled."); showMessage->show(); } } /** * determine if planetary aligments notice will be raised. */ void MainWindow::on_actionPlanetary_Alignments_triggered() { ui->widget_2->watchStars = !ui->widget_2->watchStars; if(ui->widget_2->watchStars) { showMessage->setText("We will stop when planetary alignments happen."); showMessage->show(); } else { showMessage->setText("Planetary alignment notice has been concelled."); showMessage->show(); } } /** * determine if notice the next message. */ void MainWindow::on_actionNext_Notice_triggered() { ui->widget_2->flag = false; } /** * angle plus */ void MainWindow::anglePlus() { //qDebug()<<ui->widget_2->solar->required_angle; //qDebug()<<"add "<<ui->widget_2->solar->required_angle; ui->widget_2->solar->required_angle = ui->widget_2->solar->required_angle + 0.01; //qDebug()<<ui->widget_2->solar->required_angle<<"\n"; //qDebug()<<"After add "<<ui->widget_2->solar->required_angle; } /** * angle minus */ void MainWindow::angleMinus() { //ui->widget_2->solar->setSpeed(0); //qDebug()<<ui->widget_2->solar->required_angle; ui->widget_2->solar->required_angle = ui->widget_2->solar->required_angle - 0.01; //qDebug()<<ui->widget_2->solar->required_angle<<"\n"; } /** * show angle */ void MainWindow::showAngle() { //ui->widget_2->solar->setSpeed(0); double angle = ui->widget_2->solar->required_angle; //qDebug()<<angle<<endl; showMessage->setText("The angle now is :" + QString::number(angle,'g',3)); showMessage->show(); } /** * angle plus */ void MainWindow::on_actionAngle_triggered() { ui->widget_2->solar->required_angle = ui->widget_2->solar->required_angle + 0.01; } /** * angle minus */ void MainWindow::on_actionAngle_2_triggered() { ui->widget_2->solar->required_angle = ui->widget_2->solar->required_angle + 0.01; } /** * show angle */ void MainWindow::on_actionShow_Angle_triggered() { double angle = ui->widget_2->solar->required_angle; //qDebug()<<angle<<endl; showMessage->setText("The angle now is :" + QString::number(angle,'g',3)); showMessage->show(); } /** * chose light mode */ void MainWindow::on_actionLight0_triggered() { ui->widget_2->light0 = true; ui->widget_2->light1 = false; ui->widget_2->light2 = false; ui->widget_2->light_default = false; } /** * chose light mode */ void MainWindow::on_actionLight2_triggered() { ui->widget_2->light0 = false; ui->widget_2->light1 = true; ui->widget_2->light2 = false; ui->widget_2->light_default = false; } /** * chose light mode */ void MainWindow::on_actionLight2_2_triggered() { ui->widget_2->light0 = false; ui->widget_2->light1 = false; ui->widget_2->light2 = true; ui->widget_2->light_default = false; } /** * chose light mode */ void MainWindow::on_actionDeafult_triggered() { ui->widget_2->light0 = false; ui->widget_2->light1 = false; ui->widget_2->light2 = false; ui->widget_2->light_default = true; }
[ "[email protected]@551f4f89-5e81-c284-84fc-d916aa359411" ]
[ [ [ 1, 1212 ] ] ]
799a09b457bc82620b60e1bbd81150ee0ccca8de
7b379862f58f587d9327db829ae4c6493b745bb1
/JuceLibraryCode/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp
2f3ae0ae46a19b56c97ca3b194e45bddaf6ed22a
[]
no_license
owenvallis/Nomestate
75e844e8ab68933d481640c12019f0d734c62065
7fe7c06c2893421a3c77b5180e5f27ab61dd0ffd
refs/heads/master
2021-01-19T07:35:14.301832
2011-12-28T07:42:50
2011-12-28T07:42:50
2,950,072
2
0
null
null
null
null
UTF-8
C++
false
false
46,495
cpp
/* ============================================================================== This file is part of the JUCE library - "Jules' Utility Class Extensions" Copyright 2004-11 by Raw Material Software Ltd. ------------------------------------------------------------------------------ JUCE can be redistributed and/or modified under the terms of the GNU General Public License (Version 2), as published by the Free Software Foundation. A copy of the license is included in the JUCE distribution, or can be found online at www.gnu.org/licenses. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.rawmaterialsoftware.com/juce for more information. ============================================================================== */ END_JUCE_NAMESPACE extern "C" { // Declare just the minimum number of interfaces for the DSound objects that we need.. typedef struct typeDSBUFFERDESC { DWORD dwSize; DWORD dwFlags; DWORD dwBufferBytes; DWORD dwReserved; LPWAVEFORMATEX lpwfxFormat; GUID guid3DAlgorithm; } DSBUFFERDESC; struct IDirectSoundBuffer; #undef INTERFACE #define INTERFACE IDirectSound DECLARE_INTERFACE_(IDirectSound, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID*) PURE; STDMETHOD_(ULONG,AddRef) (THIS) PURE; STDMETHOD_(ULONG,Release) (THIS) PURE; STDMETHOD(CreateSoundBuffer) (THIS_ DSBUFFERDESC*, IDirectSoundBuffer**, LPUNKNOWN) PURE; STDMETHOD(GetCaps) (THIS_ void*) PURE; STDMETHOD(DuplicateSoundBuffer) (THIS_ IDirectSoundBuffer*, IDirectSoundBuffer**) PURE; STDMETHOD(SetCooperativeLevel) (THIS_ HWND, DWORD) PURE; STDMETHOD(Compact) (THIS) PURE; STDMETHOD(GetSpeakerConfig) (THIS_ LPDWORD) PURE; STDMETHOD(SetSpeakerConfig) (THIS_ DWORD) PURE; STDMETHOD(Initialize) (THIS_ const GUID*) PURE; }; #undef INTERFACE #define INTERFACE IDirectSoundBuffer DECLARE_INTERFACE_(IDirectSoundBuffer, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID*) PURE; STDMETHOD_(ULONG,AddRef) (THIS) PURE; STDMETHOD_(ULONG,Release) (THIS) PURE; STDMETHOD(GetCaps) (THIS_ void*) PURE; STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD, LPDWORD) PURE; STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX, DWORD, LPDWORD) PURE; STDMETHOD(GetVolume) (THIS_ LPLONG) PURE; STDMETHOD(GetPan) (THIS_ LPLONG) PURE; STDMETHOD(GetFrequency) (THIS_ LPDWORD) PURE; STDMETHOD(GetStatus) (THIS_ LPDWORD) PURE; STDMETHOD(Initialize) (THIS_ IDirectSound*, DSBUFFERDESC*) PURE; STDMETHOD(Lock) (THIS_ DWORD, DWORD, LPVOID*, LPDWORD, LPVOID*, LPDWORD, DWORD) PURE; STDMETHOD(Play) (THIS_ DWORD, DWORD, DWORD) PURE; STDMETHOD(SetCurrentPosition) (THIS_ DWORD) PURE; STDMETHOD(SetFormat) (THIS_ const WAVEFORMATEX*) PURE; STDMETHOD(SetVolume) (THIS_ LONG) PURE; STDMETHOD(SetPan) (THIS_ LONG) PURE; STDMETHOD(SetFrequency) (THIS_ DWORD) PURE; STDMETHOD(Stop) (THIS) PURE; STDMETHOD(Unlock) (THIS_ LPVOID, DWORD, LPVOID, DWORD) PURE; STDMETHOD(Restore) (THIS) PURE; }; //============================================================================== typedef struct typeDSCBUFFERDESC { DWORD dwSize; DWORD dwFlags; DWORD dwBufferBytes; DWORD dwReserved; LPWAVEFORMATEX lpwfxFormat; } DSCBUFFERDESC; struct IDirectSoundCaptureBuffer; #undef INTERFACE #define INTERFACE IDirectSoundCapture DECLARE_INTERFACE_(IDirectSoundCapture, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID*) PURE; STDMETHOD_(ULONG,AddRef) (THIS) PURE; STDMETHOD_(ULONG,Release) (THIS) PURE; STDMETHOD(CreateCaptureBuffer) (THIS_ DSCBUFFERDESC*, IDirectSoundCaptureBuffer**, LPUNKNOWN) PURE; STDMETHOD(GetCaps) (THIS_ void*) PURE; STDMETHOD(Initialize) (THIS_ const GUID*) PURE; }; #undef INTERFACE #define INTERFACE IDirectSoundCaptureBuffer DECLARE_INTERFACE_(IDirectSoundCaptureBuffer, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID*) PURE; STDMETHOD_(ULONG,AddRef) (THIS) PURE; STDMETHOD_(ULONG,Release) (THIS) PURE; STDMETHOD(GetCaps) (THIS_ void*) PURE; STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD, LPDWORD) PURE; STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX, DWORD, LPDWORD) PURE; STDMETHOD(GetStatus) (THIS_ LPDWORD) PURE; STDMETHOD(Initialize) (THIS_ IDirectSoundCapture*, DSCBUFFERDESC*) PURE; STDMETHOD(Lock) (THIS_ DWORD, DWORD, LPVOID*, LPDWORD, LPVOID*, LPDWORD, DWORD) PURE; STDMETHOD(Start) (THIS_ DWORD) PURE; STDMETHOD(Stop) (THIS) PURE; STDMETHOD(Unlock) (THIS_ LPVOID, DWORD, LPVOID, DWORD) PURE; }; } //============================================================================== BEGIN_JUCE_NAMESPACE namespace { String getDSErrorMessage (HRESULT hr) { const char* result = nullptr; switch (hr) { case MAKE_HRESULT(1, 0x878, 10): result = "Device already allocated"; break; case MAKE_HRESULT(1, 0x878, 30): result = "Control unavailable"; break; case E_INVALIDARG: result = "Invalid parameter"; break; case MAKE_HRESULT(1, 0x878, 50): result = "Invalid call"; break; case E_FAIL: result = "Generic error"; break; case MAKE_HRESULT(1, 0x878, 70): result = "Priority level error"; break; case E_OUTOFMEMORY: result = "Out of memory"; break; case MAKE_HRESULT(1, 0x878, 100): result = "Bad format"; break; case E_NOTIMPL: result = "Unsupported function"; break; case MAKE_HRESULT(1, 0x878, 120): result = "No driver"; break; case MAKE_HRESULT(1, 0x878, 130): result = "Already initialised"; break; case CLASS_E_NOAGGREGATION: result = "No aggregation"; break; case MAKE_HRESULT(1, 0x878, 150): result = "Buffer lost"; break; case MAKE_HRESULT(1, 0x878, 160): result = "Another app has priority"; break; case MAKE_HRESULT(1, 0x878, 170): result = "Uninitialised"; break; case E_NOINTERFACE: result = "No interface"; break; case S_OK: result = "No error"; break; default: return "Unknown error: " + String ((int) hr); } return result; } //============================================================================== #define DS_DEBUGGING 1 #ifdef DS_DEBUGGING #define CATCH JUCE_CATCH_EXCEPTION #undef log #define log(a) Logger::writeToLog(a); #undef logError #define logError(a) logDSError(a, __LINE__); static void logDSError (HRESULT hr, int lineNum) { if (hr != S_OK) { String error ("DS error at line "); error << lineNum << " - " << getDSErrorMessage (hr); log (error); } } #else #define CATCH JUCE_CATCH_ALL #define log(a) #define logError(a) #endif //============================================================================== #define DSOUND_FUNCTION(functionName, params) \ typedef HRESULT (WINAPI *type##functionName) params; \ static type##functionName ds##functionName = 0; #define DSOUND_FUNCTION_LOAD(functionName) \ ds##functionName = (type##functionName) GetProcAddress (h, #functionName); \ jassert (ds##functionName != 0); typedef BOOL (CALLBACK *LPDSENUMCALLBACKW) (LPGUID, LPCWSTR, LPCWSTR, LPVOID); typedef BOOL (CALLBACK *LPDSENUMCALLBACKA) (LPGUID, LPCSTR, LPCSTR, LPVOID); DSOUND_FUNCTION (DirectSoundCreate, (const GUID*, IDirectSound**, LPUNKNOWN)) DSOUND_FUNCTION (DirectSoundCaptureCreate, (const GUID*, IDirectSoundCapture**, LPUNKNOWN)) DSOUND_FUNCTION (DirectSoundEnumerateW, (LPDSENUMCALLBACKW, LPVOID)) DSOUND_FUNCTION (DirectSoundCaptureEnumerateW, (LPDSENUMCALLBACKW, LPVOID)) void initialiseDSoundFunctions() { if (dsDirectSoundCreate == 0) { HMODULE h = LoadLibraryA ("dsound.dll"); DSOUND_FUNCTION_LOAD (DirectSoundCreate) DSOUND_FUNCTION_LOAD (DirectSoundCaptureCreate) DSOUND_FUNCTION_LOAD (DirectSoundEnumerateW) DSOUND_FUNCTION_LOAD (DirectSoundCaptureEnumerateW) } } } //============================================================================== class DSoundInternalOutChannel { public: DSoundInternalOutChannel (const String& name_, const GUID& guid_, int rate, int bufferSize, float* left, float* right) : bitDepth (16), name (name_), guid (guid_), sampleRate (rate), bufferSizeSamples (bufferSize), leftBuffer (left), rightBuffer (right), pDirectSound (nullptr), pOutputBuffer (nullptr) { } ~DSoundInternalOutChannel() { close(); } void close() { HRESULT hr; if (pOutputBuffer != nullptr) { log ("closing dsound out: " + name); hr = pOutputBuffer->Stop(); logError (hr); pOutputBuffer->Release(); pOutputBuffer = nullptr; } if (pDirectSound != nullptr) { pDirectSound->Release(); pDirectSound = nullptr; } } String open() { log ("opening dsound out device: " + name + " rate=" + String (sampleRate) + " bits=" + String (bitDepth) + " buf=" + String (bufferSizeSamples)); pDirectSound = nullptr; pOutputBuffer = nullptr; writeOffset = 0; String error; HRESULT hr = E_NOINTERFACE; if (dsDirectSoundCreate != 0) hr = dsDirectSoundCreate (&guid, &pDirectSound, 0); if (hr == S_OK) { bytesPerBuffer = (bufferSizeSamples * (bitDepth >> 2)) & ~15; totalBytesPerBuffer = (3 * bytesPerBuffer) & ~15; const int numChannels = 2; hr = pDirectSound->SetCooperativeLevel (GetDesktopWindow(), 2 /* DSSCL_PRIORITY */); logError (hr); if (hr == S_OK) { IDirectSoundBuffer* pPrimaryBuffer; DSBUFFERDESC primaryDesc = { 0 }; primaryDesc.dwSize = sizeof (DSBUFFERDESC); primaryDesc.dwFlags = 1 /* DSBCAPS_PRIMARYBUFFER */; primaryDesc.dwBufferBytes = 0; primaryDesc.lpwfxFormat = 0; log ("opening dsound out step 2"); hr = pDirectSound->CreateSoundBuffer (&primaryDesc, &pPrimaryBuffer, 0); logError (hr); if (hr == S_OK) { WAVEFORMATEX wfFormat; wfFormat.wFormatTag = WAVE_FORMAT_PCM; wfFormat.nChannels = (unsigned short) numChannels; wfFormat.nSamplesPerSec = (DWORD) sampleRate; wfFormat.wBitsPerSample = (unsigned short) bitDepth; wfFormat.nBlockAlign = (unsigned short) (wfFormat.nChannels * wfFormat.wBitsPerSample / 8); wfFormat.nAvgBytesPerSec = wfFormat.nSamplesPerSec * wfFormat.nBlockAlign; wfFormat.cbSize = 0; hr = pPrimaryBuffer->SetFormat (&wfFormat); logError (hr); if (hr == S_OK) { DSBUFFERDESC secondaryDesc = { 0 }; secondaryDesc.dwSize = sizeof (DSBUFFERDESC); secondaryDesc.dwFlags = 0x8000 /* DSBCAPS_GLOBALFOCUS */ | 0x10000 /* DSBCAPS_GETCURRENTPOSITION2 */; secondaryDesc.dwBufferBytes = (DWORD) totalBytesPerBuffer; secondaryDesc.lpwfxFormat = &wfFormat; hr = pDirectSound->CreateSoundBuffer (&secondaryDesc, &pOutputBuffer, 0); logError (hr); if (hr == S_OK) { log ("opening dsound out step 3"); DWORD dwDataLen; unsigned char* pDSBuffData; hr = pOutputBuffer->Lock (0, (DWORD) totalBytesPerBuffer, (LPVOID*) &pDSBuffData, &dwDataLen, 0, 0, 0); logError (hr); if (hr == S_OK) { zeromem (pDSBuffData, dwDataLen); hr = pOutputBuffer->Unlock (pDSBuffData, dwDataLen, 0, 0); if (hr == S_OK) { hr = pOutputBuffer->SetCurrentPosition (0); if (hr == S_OK) { hr = pOutputBuffer->Play (0, 0, 1 /* DSBPLAY_LOOPING */); if (hr == S_OK) return String::empty; } } } } } } } } error = getDSErrorMessage (hr); close(); return error; } void synchronisePosition() { if (pOutputBuffer != nullptr) { DWORD playCursor; pOutputBuffer->GetCurrentPosition (&playCursor, &writeOffset); } } bool service() { if (pOutputBuffer == 0) return true; DWORD playCursor, writeCursor; for (;;) { HRESULT hr = pOutputBuffer->GetCurrentPosition (&playCursor, &writeCursor); if (hr == MAKE_HRESULT (1, 0x878, 150)) // DSERR_BUFFERLOST { pOutputBuffer->Restore(); continue; } if (hr == S_OK) break; logError (hr); jassertfalse; return true; } int playWriteGap = (int) (writeCursor - playCursor); if (playWriteGap < 0) playWriteGap += totalBytesPerBuffer; int bytesEmpty = (int) (playCursor - writeOffset); if (bytesEmpty < 0) bytesEmpty += totalBytesPerBuffer; if (bytesEmpty > (totalBytesPerBuffer - playWriteGap)) { writeOffset = writeCursor; bytesEmpty = totalBytesPerBuffer - playWriteGap; } if (bytesEmpty >= bytesPerBuffer) { void* lpbuf1 = nullptr; void* lpbuf2 = nullptr; DWORD dwSize1 = 0; DWORD dwSize2 = 0; HRESULT hr = pOutputBuffer->Lock ((DWORD) writeOffset, (DWORD) bytesPerBuffer, &lpbuf1, &dwSize1, &lpbuf2, &dwSize2, 0); if (hr == MAKE_HRESULT (1, 0x878, 150)) // DSERR_BUFFERLOST { pOutputBuffer->Restore(); hr = pOutputBuffer->Lock ((DWORD) writeOffset, (DWORD) bytesPerBuffer, &lpbuf1, &dwSize1, &lpbuf2, &dwSize2, 0); } if (hr == S_OK) { if (bitDepth == 16) { int* dest = static_cast<int*> (lpbuf1); const float* left = leftBuffer; const float* right = rightBuffer; int samples1 = (int) (dwSize1 >> 2); int samples2 = (int) (dwSize2 >> 2); if (left == 0) { while (--samples1 >= 0) *dest++ = (convertInputValue (*right++) << 16); dest = static_cast<int*> (lpbuf2); while (--samples2 >= 0) *dest++ = (convertInputValue (*right++) << 16); } else if (right == 0) { while (--samples1 >= 0) *dest++ = (0xffff & convertInputValue (*left++)); dest = static_cast<int*> (lpbuf2); while (--samples2 >= 0) *dest++ = (0xffff & convertInputValue (*left++)); } else { while (--samples1 >= 0) { const int l = convertInputValue (*left++); const int r = convertInputValue (*right++); *dest++ = (r << 16) | (0xffff & l); } dest = static_cast<int*> (lpbuf2); while (--samples2 >= 0) { const int l = convertInputValue (*left++); const int r = convertInputValue (*right++); *dest++ = (r << 16) | (0xffff & l); } } } else { jassertfalse; } writeOffset = (writeOffset + dwSize1 + dwSize2) % totalBytesPerBuffer; pOutputBuffer->Unlock (lpbuf1, dwSize1, lpbuf2, dwSize2); } else { jassertfalse; logError (hr); } bytesEmpty -= bytesPerBuffer; return true; } else { return false; } } int bitDepth; bool doneFlag; private: String name; GUID guid; int sampleRate, bufferSizeSamples; float* leftBuffer; float* rightBuffer; IDirectSound* pDirectSound; IDirectSoundBuffer* pOutputBuffer; DWORD writeOffset; int totalBytesPerBuffer, bytesPerBuffer; unsigned int lastPlayCursor; static inline int convertInputValue (const float v) noexcept { return jlimit (-32768, 32767, roundToInt (32767.0f * v)); } JUCE_DECLARE_NON_COPYABLE (DSoundInternalOutChannel); }; //============================================================================== struct DSoundInternalInChannel { public: DSoundInternalInChannel (const String& name_, const GUID& guid_, int rate, int bufferSize, float* left, float* right) : bitDepth (16), name (name_), guid (guid_), sampleRate (rate), bufferSizeSamples (bufferSize), leftBuffer (left), rightBuffer (right), pDirectSound (nullptr), pDirectSoundCapture (nullptr), pInputBuffer (nullptr) { } ~DSoundInternalInChannel() { close(); } void close() { HRESULT hr; if (pInputBuffer != nullptr) { log ("closing dsound in: " + name); hr = pInputBuffer->Stop(); logError (hr); pInputBuffer->Release(); pInputBuffer = nullptr; } if (pDirectSoundCapture != nullptr) { pDirectSoundCapture->Release(); pDirectSoundCapture = nullptr; } if (pDirectSound != nullptr) { pDirectSound->Release(); pDirectSound = nullptr; } } String open() { log ("opening dsound in device: " + name + " rate=" + String (sampleRate) + " bits=" + String (bitDepth) + " buf=" + String (bufferSizeSamples)); pDirectSound = nullptr; pDirectSoundCapture = nullptr; pInputBuffer = nullptr; readOffset = 0; totalBytesPerBuffer = 0; String error; HRESULT hr = E_NOINTERFACE; if (dsDirectSoundCaptureCreate != 0) hr = dsDirectSoundCaptureCreate (&guid, &pDirectSoundCapture, 0); logError (hr); if (hr == S_OK) { const int numChannels = 2; bytesPerBuffer = (bufferSizeSamples * (bitDepth >> 2)) & ~15; totalBytesPerBuffer = (3 * bytesPerBuffer) & ~15; WAVEFORMATEX wfFormat; wfFormat.wFormatTag = WAVE_FORMAT_PCM; wfFormat.nChannels = (unsigned short)numChannels; wfFormat.nSamplesPerSec = (DWORD) sampleRate; wfFormat.wBitsPerSample = (unsigned short)bitDepth; wfFormat.nBlockAlign = (unsigned short)(wfFormat.nChannels * (wfFormat.wBitsPerSample / 8)); wfFormat.nAvgBytesPerSec = wfFormat.nSamplesPerSec * wfFormat.nBlockAlign; wfFormat.cbSize = 0; DSCBUFFERDESC captureDesc = { 0 }; captureDesc.dwSize = sizeof (DSCBUFFERDESC); captureDesc.dwFlags = 0; captureDesc.dwBufferBytes = (DWORD) totalBytesPerBuffer; captureDesc.lpwfxFormat = &wfFormat; log ("opening dsound in step 2"); hr = pDirectSoundCapture->CreateCaptureBuffer (&captureDesc, &pInputBuffer, 0); logError (hr); if (hr == S_OK) { hr = pInputBuffer->Start (1 /* DSCBSTART_LOOPING */); logError (hr); if (hr == S_OK) return String::empty; } } error = getDSErrorMessage (hr); close(); return error; } void synchronisePosition() { if (pInputBuffer != nullptr) { DWORD capturePos; pInputBuffer->GetCurrentPosition (&capturePos, (DWORD*)&readOffset); } } bool service() { if (pInputBuffer == 0) return true; DWORD capturePos, readPos; HRESULT hr = pInputBuffer->GetCurrentPosition (&capturePos, &readPos); logError (hr); if (hr != S_OK) return true; int bytesFilled = (int) (readPos - readOffset); if (bytesFilled < 0) bytesFilled += totalBytesPerBuffer; if (bytesFilled >= bytesPerBuffer) { LPBYTE lpbuf1 = nullptr; LPBYTE lpbuf2 = nullptr; DWORD dwsize1 = 0; DWORD dwsize2 = 0; HRESULT hr = pInputBuffer->Lock ((DWORD) readOffset, (DWORD) bytesPerBuffer, (void**) &lpbuf1, &dwsize1, (void**) &lpbuf2, &dwsize2, 0); if (hr == S_OK) { if (bitDepth == 16) { const float g = 1.0f / 32768.0f; float* destL = leftBuffer; float* destR = rightBuffer; int samples1 = (int) (dwsize1 >> 2); int samples2 = (int) (dwsize2 >> 2); const short* src = (const short*)lpbuf1; if (destL == 0) { while (--samples1 >= 0) { ++src; *destR++ = *src++ * g; } src = (const short*)lpbuf2; while (--samples2 >= 0) { ++src; *destR++ = *src++ * g; } } else if (destR == 0) { while (--samples1 >= 0) { *destL++ = *src++ * g; ++src; } src = (const short*)lpbuf2; while (--samples2 >= 0) { *destL++ = *src++ * g; ++src; } } else { while (--samples1 >= 0) { *destL++ = *src++ * g; *destR++ = *src++ * g; } src = (const short*)lpbuf2; while (--samples2 >= 0) { *destL++ = *src++ * g; *destR++ = *src++ * g; } } } else { jassertfalse; } readOffset = (readOffset + dwsize1 + dwsize2) % totalBytesPerBuffer; pInputBuffer->Unlock (lpbuf1, dwsize1, lpbuf2, dwsize2); } else { logError (hr); jassertfalse; } bytesFilled -= bytesPerBuffer; return true; } else { return false; } } unsigned int readOffset; int bytesPerBuffer, totalBytesPerBuffer; int bitDepth; bool doneFlag; private: String name; GUID guid; int sampleRate, bufferSizeSamples; float* leftBuffer; float* rightBuffer; IDirectSound* pDirectSound; IDirectSoundCapture* pDirectSoundCapture; IDirectSoundCaptureBuffer* pInputBuffer; JUCE_DECLARE_NON_COPYABLE (DSoundInternalInChannel); }; //============================================================================== class DSoundAudioIODevice : public AudioIODevice, public Thread { public: DSoundAudioIODevice (const String& deviceName, const int outputDeviceIndex_, const int inputDeviceIndex_) : AudioIODevice (deviceName, "DirectSound"), Thread ("Juce DSound"), outputDeviceIndex (outputDeviceIndex_), inputDeviceIndex (inputDeviceIndex_), isOpen_ (false), isStarted (false), bufferSizeSamples (0), totalSamplesOut (0), sampleRate (0.0), inputBuffers (1, 1), outputBuffers (1, 1), callback (nullptr) { if (outputDeviceIndex_ >= 0) { outChannels.add (TRANS("Left")); outChannels.add (TRANS("Right")); } if (inputDeviceIndex_ >= 0) { inChannels.add (TRANS("Left")); inChannels.add (TRANS("Right")); } } ~DSoundAudioIODevice() { close(); } String open (const BigInteger& inputChannels, const BigInteger& outputChannels, double sampleRate, int bufferSizeSamples) { lastError = openDevice (inputChannels, outputChannels, sampleRate, bufferSizeSamples); isOpen_ = lastError.isEmpty(); return lastError; } void close() { stop(); if (isOpen_) { closeDevice(); isOpen_ = false; } } bool isOpen() { return isOpen_ && isThreadRunning(); } int getCurrentBufferSizeSamples() { return bufferSizeSamples; } double getCurrentSampleRate() { return sampleRate; } BigInteger getActiveOutputChannels() const { return enabledOutputs; } BigInteger getActiveInputChannels() const { return enabledInputs; } int getOutputLatencyInSamples() { return (int) (getCurrentBufferSizeSamples() * 1.5); } int getInputLatencyInSamples() { return getOutputLatencyInSamples(); } StringArray getOutputChannelNames() { return outChannels; } StringArray getInputChannelNames() { return inChannels; } int getNumSampleRates() { return 4; } int getDefaultBufferSize() { return 2560; } int getNumBufferSizesAvailable() { return 50; } double getSampleRate (int index) { const double samps[] = { 44100.0, 48000.0, 88200.0, 96000.0 }; return samps [jlimit (0, 3, index)]; } int getBufferSizeSamples (int index) { int n = 64; for (int i = 0; i < index; ++i) n += (n < 512) ? 32 : ((n < 1024) ? 64 : ((n < 2048) ? 128 : 256)); return n; } int getCurrentBitDepth() { int i, bits = 256; for (i = inChans.size(); --i >= 0;) bits = jmin (bits, inChans[i]->bitDepth); for (i = outChans.size(); --i >= 0;) bits = jmin (bits, outChans[i]->bitDepth); if (bits > 32) bits = 16; return bits; } void start (AudioIODeviceCallback* call) { if (isOpen_ && call != nullptr && ! isStarted) { if (! isThreadRunning()) { // something gone wrong and the thread's stopped.. isOpen_ = false; return; } call->audioDeviceAboutToStart (this); const ScopedLock sl (startStopLock); callback = call; isStarted = true; } } void stop() { if (isStarted) { AudioIODeviceCallback* const callbackLocal = callback; { const ScopedLock sl (startStopLock); isStarted = false; } if (callbackLocal != nullptr) callbackLocal->audioDeviceStopped(); } } bool isPlaying() { return isStarted && isOpen_ && isThreadRunning(); } String getLastError() { return lastError; } //============================================================================== StringArray inChannels, outChannels; int outputDeviceIndex, inputDeviceIndex; private: bool isOpen_; bool isStarted; String lastError; OwnedArray <DSoundInternalInChannel> inChans; OwnedArray <DSoundInternalOutChannel> outChans; WaitableEvent startEvent; int bufferSizeSamples; int volatile totalSamplesOut; int64 volatile lastBlockTime; double sampleRate; BigInteger enabledInputs, enabledOutputs; AudioSampleBuffer inputBuffers, outputBuffers; AudioIODeviceCallback* callback; CriticalSection startStopLock; String openDevice (const BigInteger& inputChannels, const BigInteger& outputChannels, double sampleRate_, int bufferSizeSamples_); void closeDevice() { isStarted = false; stopThread (5000); inChans.clear(); outChans.clear(); inputBuffers.setSize (1, 1); outputBuffers.setSize (1, 1); } void resync() { if (! threadShouldExit()) { sleep (5); int i; for (i = 0; i < outChans.size(); ++i) outChans.getUnchecked(i)->synchronisePosition(); for (i = 0; i < inChans.size(); ++i) inChans.getUnchecked(i)->synchronisePosition(); } } public: void run() { while (! threadShouldExit()) { if (wait (100)) break; } const int latencyMs = (int) (bufferSizeSamples * 1000.0 / sampleRate); const int maxTimeMS = jmax (5, 3 * latencyMs); while (! threadShouldExit()) { int numToDo = 0; uint32 startTime = Time::getMillisecondCounter(); int i; for (i = inChans.size(); --i >= 0;) { inChans.getUnchecked(i)->doneFlag = false; ++numToDo; } for (i = outChans.size(); --i >= 0;) { outChans.getUnchecked(i)->doneFlag = false; ++numToDo; } if (numToDo > 0) { const int maxCount = 3; int count = maxCount; for (;;) { for (i = inChans.size(); --i >= 0;) { DSoundInternalInChannel* const in = inChans.getUnchecked(i); if ((! in->doneFlag) && in->service()) { in->doneFlag = true; --numToDo; } } for (i = outChans.size(); --i >= 0;) { DSoundInternalOutChannel* const out = outChans.getUnchecked(i); if ((! out->doneFlag) && out->service()) { out->doneFlag = true; --numToDo; } } if (numToDo <= 0) break; if (Time::getMillisecondCounter() > startTime + maxTimeMS) { resync(); break; } if (--count <= 0) { Sleep (1); count = maxCount; } if (threadShouldExit()) return; } } else { sleep (1); } const ScopedLock sl (startStopLock); if (isStarted) { JUCE_TRY { callback->audioDeviceIOCallback (const_cast <const float**> (inputBuffers.getArrayOfChannels()), inputBuffers.getNumChannels(), outputBuffers.getArrayOfChannels(), outputBuffers.getNumChannels(), bufferSizeSamples); } JUCE_CATCH_EXCEPTION totalSamplesOut += bufferSizeSamples; } else { outputBuffers.clear(); totalSamplesOut = 0; sleep (1); } } } JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DSoundAudioIODevice); }; //============================================================================== struct DSoundDeviceList { StringArray outputDeviceNames, inputDeviceNames; Array<GUID> outputGuids, inputGuids; void scan() { outputDeviceNames.clear(); inputDeviceNames.clear(); outputGuids.clear(); inputGuids.clear(); if (dsDirectSoundEnumerateW != 0) { dsDirectSoundEnumerateW (outputEnumProcW, this); dsDirectSoundCaptureEnumerateW (inputEnumProcW, this); } } bool operator!= (const DSoundDeviceList& other) const noexcept { return outputDeviceNames != other.outputDeviceNames || inputDeviceNames != other.inputDeviceNames || outputGuids != other.outputGuids || inputGuids != other.inputGuids; } private: static BOOL enumProc (LPGUID lpGUID, String desc, StringArray& names, Array<GUID>& guids) { desc = desc.trim(); if (desc.isNotEmpty()) { const String origDesc (desc); int n = 2; while (names.contains (desc)) desc = origDesc + " (" + String (n++) + ")"; names.add (desc); guids.add (lpGUID != nullptr ? *lpGUID : GUID()); } return TRUE; } BOOL outputEnumProc (LPGUID guid, LPCWSTR desc) { return enumProc (guid, desc, outputDeviceNames, outputGuids); } BOOL inputEnumProc (LPGUID guid, LPCWSTR desc) { return enumProc (guid, desc, inputDeviceNames, inputGuids); } static BOOL CALLBACK outputEnumProcW (LPGUID lpGUID, LPCWSTR description, LPCWSTR, LPVOID object) { return static_cast<DSoundDeviceList*> (object)->outputEnumProc (lpGUID, description); } static BOOL CALLBACK inputEnumProcW (LPGUID lpGUID, LPCWSTR description, LPCWSTR, LPVOID object) { return static_cast<DSoundDeviceList*> (object)->inputEnumProc (lpGUID, description); } }; //============================================================================== String DSoundAudioIODevice::openDevice (const BigInteger& inputChannels, const BigInteger& outputChannels, double sampleRate_, int bufferSizeSamples_) { closeDevice(); totalSamplesOut = 0; sampleRate = sampleRate_; if (bufferSizeSamples_ <= 0) bufferSizeSamples_ = 960; // use as a default size if none is set. bufferSizeSamples = bufferSizeSamples_ & ~7; DSoundDeviceList dlh; dlh.scan(); enabledInputs = inputChannels; enabledInputs.setRange (inChannels.size(), enabledInputs.getHighestBit() + 1 - inChannels.size(), false); inputBuffers.setSize (jmax (1, enabledInputs.countNumberOfSetBits()), bufferSizeSamples); inputBuffers.clear(); int i, numIns = 0; for (i = 0; i <= enabledInputs.getHighestBit(); i += 2) { float* left = nullptr; if (enabledInputs[i]) left = inputBuffers.getSampleData (numIns++); float* right = nullptr; if (enabledInputs[i + 1]) right = inputBuffers.getSampleData (numIns++); if (left != nullptr || right != nullptr) inChans.add (new DSoundInternalInChannel (dlh.inputDeviceNames [inputDeviceIndex], dlh.inputGuids [inputDeviceIndex], (int) sampleRate, bufferSizeSamples, left, right)); } enabledOutputs = outputChannels; enabledOutputs.setRange (outChannels.size(), enabledOutputs.getHighestBit() + 1 - outChannels.size(), false); outputBuffers.setSize (jmax (1, enabledOutputs.countNumberOfSetBits()), bufferSizeSamples); outputBuffers.clear(); int numOuts = 0; for (i = 0; i <= enabledOutputs.getHighestBit(); i += 2) { float* left = nullptr; if (enabledOutputs[i]) left = outputBuffers.getSampleData (numOuts++); float* right = nullptr; if (enabledOutputs[i + 1]) right = outputBuffers.getSampleData (numOuts++); if (left != nullptr || right != nullptr) outChans.add (new DSoundInternalOutChannel (dlh.outputDeviceNames[outputDeviceIndex], dlh.outputGuids [outputDeviceIndex], (int) sampleRate, bufferSizeSamples, left, right)); } String error; // boost our priority while opening the devices to try to get better sync between them const int oldThreadPri = GetThreadPriority (GetCurrentThread()); const DWORD oldProcPri = GetPriorityClass (GetCurrentProcess()); SetThreadPriority (GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); SetPriorityClass (GetCurrentProcess(), REALTIME_PRIORITY_CLASS); for (i = 0; i < outChans.size(); ++i) { error = outChans[i]->open(); if (error.isNotEmpty()) { error = "Error opening " + dlh.outputDeviceNames[i] + ": \"" + error + "\""; break; } } if (error.isEmpty()) { for (i = 0; i < inChans.size(); ++i) { error = inChans[i]->open(); if (error.isNotEmpty()) { error = "Error opening " + dlh.inputDeviceNames[i] + ": \"" + error + "\""; break; } } } if (error.isEmpty()) { totalSamplesOut = 0; for (i = 0; i < outChans.size(); ++i) outChans.getUnchecked(i)->synchronisePosition(); for (i = 0; i < inChans.size(); ++i) inChans.getUnchecked(i)->synchronisePosition(); startThread (9); sleep (10); notify(); } else { log (error); } SetThreadPriority (GetCurrentThread(), oldThreadPri); SetPriorityClass (GetCurrentProcess(), oldProcPri); return error; } //============================================================================== class DSoundAudioIODeviceType : public AudioIODeviceType, private DeviceChangeDetector { public: DSoundAudioIODeviceType() : AudioIODeviceType ("DirectSound"), DeviceChangeDetector (L"DirectSound"), hasScanned (false) { initialiseDSoundFunctions(); } //============================================================================== void scanForDevices() { hasScanned = true; deviceList.scan(); } StringArray getDeviceNames (bool wantInputNames) const { jassert (hasScanned); // need to call scanForDevices() before doing this return wantInputNames ? deviceList.inputDeviceNames : deviceList.outputDeviceNames; } int getDefaultDeviceIndex (bool /*forInput*/) const { jassert (hasScanned); // need to call scanForDevices() before doing this return 0; } int getIndexOfDevice (AudioIODevice* device, bool asInput) const { jassert (hasScanned); // need to call scanForDevices() before doing this DSoundAudioIODevice* const d = dynamic_cast <DSoundAudioIODevice*> (device); if (d == 0) return -1; return asInput ? d->inputDeviceIndex : d->outputDeviceIndex; } bool hasSeparateInputsAndOutputs() const { return true; } AudioIODevice* createDevice (const String& outputDeviceName, const String& inputDeviceName) { jassert (hasScanned); // need to call scanForDevices() before doing this const int outputIndex = deviceList.outputDeviceNames.indexOf (outputDeviceName); const int inputIndex = deviceList.inputDeviceNames.indexOf (inputDeviceName); if (outputIndex >= 0 || inputIndex >= 0) return new DSoundAudioIODevice (outputDeviceName.isNotEmpty() ? outputDeviceName : inputDeviceName, outputIndex, inputIndex); return nullptr; } private: //============================================================================== DSoundDeviceList deviceList; bool hasScanned; void systemDeviceChanged() { DSoundDeviceList newList; newList.scan(); if (newList != deviceList) { deviceList = newList; callDeviceChangeListeners(); } } //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DSoundAudioIODeviceType); }; //============================================================================== AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_DirectSound() { return new DSoundAudioIODeviceType(); } #undef log #undef logError
[ "ow3nskip" ]
[ [ [ 1, 1368 ] ] ]
98546b16d3c6c330f82c619f963f1c79e5b3da12
0033659a033b4afac9b93c0ac80b8918a5ff9779
/game/shared/baseviewmodel_shared.cpp
219a0a79e228d43f1e5df215aab0287c8fc9550d
[]
no_license
jonnyboy0719/situation-outbreak-two
d03151dc7a12a97094fffadacf4a8f7ee6ec7729
50037e27e738ff78115faea84e235f865c61a68f
refs/heads/master
2021-01-10T09:59:39.214171
2011-01-11T01:15:33
2011-01-11T01:15:33
53,858,955
1
0
null
null
null
null
WINDOWS-1252
C++
false
false
23,525
cpp
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ //=============================================================================// #include "cbase.h" #include "baseviewmodel_shared.h" #include "datacache/imdlcache.h" #if defined( CLIENT_DLL ) #include "iprediction.h" #include "prediction.h" #else #include "vguiscreen.h" #endif ///// // SO2 - James // Weapon reorigin system // http://developer.valvesoftware.com/wiki/Adding_Ironsights // Modified a bit from the wiki version considering our system's purpose #include "weapon_sobase.h" ///// // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" #define VIEWMODEL_ANIMATION_PARITY_BITS 3 #define SCREEN_OVERLAY_MATERIAL "vgui/screens/vgui_overlay" //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- CBaseViewModel::CBaseViewModel() { #if defined( CLIENT_DLL ) // NOTE: We do this here because the color is never transmitted for the view model. m_nOldAnimationParity = 0; m_EntClientFlags |= ENTCLIENTFLAG_ALWAYS_INTERPOLATE; #endif SetRenderColor( 255, 255, 255, 255 ); // View model of this weapon m_sVMName = NULL_STRING; // Prefix of the animations that should be used by the player carrying this weapon m_sAnimationPrefix = NULL_STRING; m_nViewModelIndex = 0; m_nAnimationParity = 0; } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- CBaseViewModel::~CBaseViewModel() { } void CBaseViewModel::UpdateOnRemove( void ) { BaseClass::UpdateOnRemove(); DestroyControlPanels(); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBaseViewModel::Precache( void ) { } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBaseViewModel::Spawn( void ) { Precache( ); SetSize( Vector( -8, -4, -2), Vector(8, 4, 2) ); SetSolid( SOLID_NONE ); } #if defined ( CSTRIKE_DLL ) && !defined ( CLIENT_DLL ) #define VGUI_CONTROL_PANELS #endif #if defined ( TF_DLL ) #define VGUI_CONTROL_PANELS #endif #ifdef INVASION_DLL #define VGUI_CONTROL_PANELS #endif //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBaseViewModel::SetControlPanelsActive( bool bState ) { #if defined( VGUI_CONTROL_PANELS ) // Activate control panel screens for ( int i = m_hScreens.Count(); --i >= 0; ) { if (m_hScreens[i].Get()) { m_hScreens[i]->SetActive( bState ); } } #endif } //----------------------------------------------------------------------------- // This is called by the base object when it's time to spawn the control panels //----------------------------------------------------------------------------- void CBaseViewModel::SpawnControlPanels() { #if defined( VGUI_CONTROL_PANELS ) char buf[64]; // Destroy existing panels DestroyControlPanels(); CBaseCombatWeapon *weapon = m_hWeapon.Get(); if ( weapon == NULL ) { return; } MDLCACHE_CRITICAL_SECTION(); // FIXME: Deal with dynamically resizing control panels? // If we're attached to an entity, spawn control panels on it instead of use CBaseAnimating *pEntityToSpawnOn = this; char *pOrgLL = "controlpanel%d_ll"; char *pOrgUR = "controlpanel%d_ur"; char *pAttachmentNameLL = pOrgLL; char *pAttachmentNameUR = pOrgUR; /* if ( IsBuiltOnAttachment() ) { pEntityToSpawnOn = dynamic_cast<CBaseAnimating*>((CBaseEntity*)m_hBuiltOnEntity.Get()); if ( pEntityToSpawnOn ) { char sBuildPointLL[64]; char sBuildPointUR[64]; Q_snprintf( sBuildPointLL, sizeof( sBuildPointLL ), "bp%d_controlpanel%%d_ll", m_iBuiltOnPoint ); Q_snprintf( sBuildPointUR, sizeof( sBuildPointUR ), "bp%d_controlpanel%%d_ur", m_iBuiltOnPoint ); pAttachmentNameLL = sBuildPointLL; pAttachmentNameUR = sBuildPointUR; } else { pEntityToSpawnOn = this; } } */ Assert( pEntityToSpawnOn ); // Lookup the attachment point... int nPanel; for ( nPanel = 0; true; ++nPanel ) { Q_snprintf( buf, sizeof( buf ), pAttachmentNameLL, nPanel ); int nLLAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf); if (nLLAttachmentIndex <= 0) { // Try and use my panels then pEntityToSpawnOn = this; Q_snprintf( buf, sizeof( buf ), pOrgLL, nPanel ); nLLAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf); if (nLLAttachmentIndex <= 0) return; } Q_snprintf( buf, sizeof( buf ), pAttachmentNameUR, nPanel ); int nURAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf); if (nURAttachmentIndex <= 0) { // Try and use my panels then Q_snprintf( buf, sizeof( buf ), pOrgUR, nPanel ); nURAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf); if (nURAttachmentIndex <= 0) return; } const char *pScreenName; weapon->GetControlPanelInfo( nPanel, pScreenName ); if (!pScreenName) continue; const char *pScreenClassname; weapon->GetControlPanelClassName( nPanel, pScreenClassname ); if ( !pScreenClassname ) continue; // Compute the screen size from the attachment points... matrix3x4_t panelToWorld; pEntityToSpawnOn->GetAttachment( nLLAttachmentIndex, panelToWorld ); matrix3x4_t worldToPanel; MatrixInvert( panelToWorld, worldToPanel ); // Now get the lower right position + transform into panel space Vector lr, lrlocal; pEntityToSpawnOn->GetAttachment( nURAttachmentIndex, panelToWorld ); MatrixGetColumn( panelToWorld, 3, lr ); VectorTransform( lr, worldToPanel, lrlocal ); float flWidth = lrlocal.x; float flHeight = lrlocal.y; CVGuiScreen *pScreen = CreateVGuiScreen( pScreenClassname, pScreenName, pEntityToSpawnOn, this, nLLAttachmentIndex ); pScreen->ChangeTeam( GetTeamNumber() ); pScreen->SetActualSize( flWidth, flHeight ); pScreen->SetActive( false ); pScreen->MakeVisibleOnlyToTeammates( false ); #ifdef INVASION_DLL pScreen->SetOverlayMaterial( SCREEN_OVERLAY_MATERIAL ); #endif pScreen->SetAttachedToViewModel( true ); int nScreen = m_hScreens.AddToTail( ); m_hScreens[nScreen].Set( pScreen ); } #endif } void CBaseViewModel::DestroyControlPanels() { #if defined( VGUI_CONTROL_PANELS ) // Kill the control panels int i; for ( i = m_hScreens.Count(); --i >= 0; ) { DestroyVGuiScreen( m_hScreens[i].Get() ); } m_hScreens.RemoveAll(); #endif } //----------------------------------------------------------------------------- // Purpose: // Input : *pEntity - //----------------------------------------------------------------------------- void CBaseViewModel::SetOwner( CBaseEntity *pEntity ) { m_hOwner = pEntity; #if !defined( CLIENT_DLL ) // Make sure we're linked into hierarchy //SetParent( pEntity ); #endif } //----------------------------------------------------------------------------- // Purpose: // Input : nIndex - //----------------------------------------------------------------------------- void CBaseViewModel::SetIndex( int nIndex ) { m_nViewModelIndex = nIndex; Assert( m_nViewModelIndex < (1 << VIEWMODEL_INDEX_BITS) ); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- int CBaseViewModel::ViewModelIndex( ) const { return m_nViewModelIndex; } //----------------------------------------------------------------------------- // Purpose: Pass our visibility on to our child screens //----------------------------------------------------------------------------- void CBaseViewModel::AddEffects( int nEffects ) { if ( nEffects & EF_NODRAW ) { SetControlPanelsActive( false ); } BaseClass::AddEffects( nEffects ); } //----------------------------------------------------------------------------- // Purpose: Pass our visibility on to our child screens //----------------------------------------------------------------------------- void CBaseViewModel::RemoveEffects( int nEffects ) { if ( nEffects & EF_NODRAW ) { SetControlPanelsActive( true ); } BaseClass::RemoveEffects( nEffects ); } //----------------------------------------------------------------------------- // Purpose: // Input : *modelname - //----------------------------------------------------------------------------- void CBaseViewModel::SetWeaponModel( const char *modelname, CBaseCombatWeapon *weapon ) { m_hWeapon = weapon; #if defined( CLIENT_DLL ) SetModel( modelname ); #else string_t str; if ( modelname != NULL ) { str = MAKE_STRING( modelname ); } else { str = NULL_STRING; } if ( str != m_sVMName ) { // Msg( "SetWeaponModel %s at %f\n", modelname, gpGlobals->curtime ); m_sVMName = str; SetModel( STRING( m_sVMName ) ); // Create any vgui control panels associated with the weapon SpawnControlPanels(); bool showControlPanels = weapon && weapon->ShouldShowControlPanels(); SetControlPanelsActive( showControlPanels ); } #endif } //----------------------------------------------------------------------------- // Purpose: // Output : CBaseCombatWeapon //----------------------------------------------------------------------------- CBaseCombatWeapon *CBaseViewModel::GetOwningWeapon( void ) { return m_hWeapon.Get(); } //----------------------------------------------------------------------------- // Purpose: // Input : sequence - //----------------------------------------------------------------------------- void CBaseViewModel::SendViewModelMatchingSequence( int sequence ) { // since all we do is send a sequence number down to the client, // set this here so other weapons code knows which sequence is playing. SetSequence( sequence ); m_nAnimationParity = ( m_nAnimationParity + 1 ) & ( (1<<VIEWMODEL_ANIMATION_PARITY_BITS) - 1 ); #if defined( CLIENT_DLL ) m_nOldAnimationParity = m_nAnimationParity; // Force frame interpolation to start at exactly frame zero m_flAnimTime = gpGlobals->curtime; #else CBaseCombatWeapon *weapon = m_hWeapon.Get(); bool showControlPanels = weapon && weapon->ShouldShowControlPanels(); SetControlPanelsActive( showControlPanels ); #endif // Restart animation at frame 0 SetCycle( 0 ); ResetSequenceInfo(); } #if defined( CLIENT_DLL ) #include "ivieweffects.h" #endif ///// // SO2 - James // Weapon reorigin system // http://developer.valvesoftware.com/wiki/Adding_Ironsights // Modified a bit from the wiki version considering our system's purpose #ifdef CLIENT_DLL void CBaseViewModel::CalcReorigin( Vector &pos, QAngle &ang ) { CWeaponSOBase *pWeapon = dynamic_cast<CWeaponSOBase*>( GetOwningWeapon() ); if ( !pWeapon ) return; Vector newPos = pos; QAngle newAng = ang; Vector vForward, vRight, vUp, vOffset; AngleVectors( newAng, &vForward, &vRight, &vUp ); vOffset = pWeapon->GetIronsightPositionOffset(); newPos += vForward * vOffset.x; newPos += vRight * vOffset.y; newPos += vUp * vOffset.z; newAng += pWeapon->GetIronsightAngleOffset(); //fov is handled by CWeaponSOBase pos += ( newPos - pos ); ang += ( newAng - ang ); } #endif ///// ///// // SO2 - James // Weapon reorigin system // http://developer.valvesoftware.com/wiki/Adding_Ironsights // Modified a bit from the wiki version considering our system's purpose /*void CBaseViewModel::CalcViewModelView( CBasePlayer *owner, const Vector& eyePosition, const QAngle& eyeAngles ) { // UNDONE: Calc this on the server? Disabled for now as it seems unnecessary to have this info on the server #if defined( CLIENT_DLL ) QAngle vmangoriginal = eyeAngles; QAngle vmangles = eyeAngles; Vector vmorigin = eyePosition; CBaseCombatWeapon *pWeapon = m_hWeapon.Get(); //Allow weapon lagging if ( pWeapon != NULL ) { #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) #endif { // add weapon-specific bob pWeapon->AddViewmodelBob( this, vmorigin, vmangles ); } } // Add model-specific bob even if no weapon associated (for head bob for off hand models) AddViewModelBob( owner, vmorigin, vmangles ); // Add lag CalcViewModelLag( vmorigin, vmangles, vmangoriginal ); #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) { // Let the viewmodel shake at about 10% of the amplitude of the player's view vieweffects->ApplyShake( vmorigin, vmangles, 0.1 ); } #endif SetLocalOrigin( vmorigin ); SetLocalAngles( vmangles ); #endif }*/ // Cleaned up this function a bit from its original, too void CBaseViewModel::CalcViewModelView( CBasePlayer *owner, const Vector& eyePosition, const QAngle& eyeAngles ) { #ifdef CLIENT_DLL QAngle vmangoriginal = eyeAngles; QAngle vmangles = eyeAngles; Vector vmorigin = eyePosition; CWeaponSOBase *pWeapon = dynamic_cast<CWeaponSOBase*>( GetOwningWeapon() ); if ( pWeapon ) { CalcReorigin( vmorigin, vmangles ); if ( !prediction->InPrediction() ) { // add weapon-specific bob pWeapon->AddViewmodelBob( this, vmorigin, vmangles ); } } // Add model-specific bob even if no weapon associated (for head bob for off hand models) AddViewModelBob( owner, vmorigin, vmangles ); // Add lag CalcViewModelLag( vmorigin, vmangles, vmangoriginal ); if ( !prediction->InPrediction() ) { // Let the viewmodel shake at about 10% of the amplitude of the player's view vieweffects->ApplyShake( vmorigin, vmangles, 0.1 ); } SetLocalOrigin( vmorigin ); SetLocalAngles( vmangles ); #endif } ///// //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- float g_fMaxViewModelLag = 1.5f; void CBaseViewModel::CalcViewModelLag( Vector& origin, QAngle& angles, QAngle& original_angles ) { Vector vOriginalOrigin = origin; QAngle vOriginalAngles = angles; // Calculate our drift Vector forward; AngleVectors( angles, &forward, NULL, NULL ); if ( gpGlobals->frametime != 0.0f ) { Vector vDifference; VectorSubtract( forward, m_vecLastFacing, vDifference ); float flSpeed = 5.0f; // If we start to lag too far behind, we'll increase the "catch up" speed. Solves the problem with fast cl_yawspeed, m_yaw or joysticks // rotating quickly. The old code would slam lastfacing with origin causing the viewmodel to pop to a new position float flDiff = vDifference.Length(); if ( (flDiff > g_fMaxViewModelLag) && (g_fMaxViewModelLag > 0.0f) ) { float flScale = flDiff / g_fMaxViewModelLag; flSpeed *= flScale; } // FIXME: Needs to be predictable? VectorMA( m_vecLastFacing, flSpeed * gpGlobals->frametime, vDifference, m_vecLastFacing ); // Make sure it doesn't grow out of control!!! VectorNormalize( m_vecLastFacing ); VectorMA( origin, 5.0f, vDifference * -1.0f, origin ); Assert( m_vecLastFacing.IsValid() ); } Vector right, up; AngleVectors( original_angles, &forward, &right, &up ); float pitch = original_angles[ PITCH ]; if ( pitch > 180.0f ) pitch -= 360.0f; else if ( pitch < -180.0f ) pitch += 360.0f; if ( g_fMaxViewModelLag == 0.0f ) { origin = vOriginalOrigin; angles = vOriginalAngles; } //FIXME: These are the old settings that caused too many exposed polys on some models VectorMA( origin, -pitch * 0.035f, forward, origin ); VectorMA( origin, -pitch * 0.03f, right, origin ); VectorMA( origin, -pitch * 0.02f, up, origin); } //----------------------------------------------------------------------------- // Stub to keep networking consistent for DEM files //----------------------------------------------------------------------------- #if defined( CLIENT_DLL ) extern void RecvProxy_EffectFlags( const CRecvProxyData *pData, void *pStruct, void *pOut ); void RecvProxy_SequenceNum( const CRecvProxyData *pData, void *pStruct, void *pOut ); #endif //----------------------------------------------------------------------------- // Purpose: Resets anim cycle when the server changes the weapon on us //----------------------------------------------------------------------------- #if defined( CLIENT_DLL ) static void RecvProxy_Weapon( const CRecvProxyData *pData, void *pStruct, void *pOut ) { CBaseViewModel *pViewModel = ((CBaseViewModel*)pStruct); CBaseCombatWeapon *pOldWeapon = pViewModel->GetOwningWeapon(); // Chain through to the default recieve proxy ... RecvProxy_IntToEHandle( pData, pStruct, pOut ); // ... and reset our cycle index if the server is switching weapons on us CBaseCombatWeapon *pNewWeapon = pViewModel->GetOwningWeapon(); if ( pNewWeapon != pOldWeapon ) { // Restart animation at frame 0 pViewModel->SetCycle( 0 ); pViewModel->m_flAnimTime = gpGlobals->curtime; } } #endif LINK_ENTITY_TO_CLASS( viewmodel, CBaseViewModel ); IMPLEMENT_NETWORKCLASS_ALIASED( BaseViewModel, DT_BaseViewModel ) BEGIN_NETWORK_TABLE_NOBASE(CBaseViewModel, DT_BaseViewModel) #if !defined( CLIENT_DLL ) SendPropModelIndex(SENDINFO(m_nModelIndex)), SendPropInt (SENDINFO(m_nBody), 8), SendPropInt (SENDINFO(m_nSkin), 10), SendPropInt (SENDINFO(m_nSequence), 8, SPROP_UNSIGNED), SendPropInt (SENDINFO(m_nViewModelIndex), VIEWMODEL_INDEX_BITS, SPROP_UNSIGNED), SendPropFloat (SENDINFO(m_flPlaybackRate), 8, SPROP_ROUNDUP, -4.0, 12.0f), SendPropInt (SENDINFO(m_fEffects), 10, SPROP_UNSIGNED), SendPropInt (SENDINFO(m_nAnimationParity), 3, SPROP_UNSIGNED ), SendPropEHandle (SENDINFO(m_hWeapon)), SendPropEHandle (SENDINFO(m_hOwner)), SendPropInt( SENDINFO( m_nNewSequenceParity ), EF_PARITY_BITS, SPROP_UNSIGNED ), SendPropInt( SENDINFO( m_nResetEventsParity ), EF_PARITY_BITS, SPROP_UNSIGNED ), SendPropInt( SENDINFO( m_nMuzzleFlashParity ), EF_MUZZLEFLASH_BITS, SPROP_UNSIGNED ), #if !defined( INVASION_DLL ) && !defined( INVASION_CLIENT_DLL ) SendPropArray (SendPropFloat(SENDINFO_ARRAY(m_flPoseParameter), 8, 0, 0.0f, 1.0f), m_flPoseParameter), #endif #else RecvPropInt (RECVINFO(m_nModelIndex)), RecvPropInt (RECVINFO(m_nSkin)), RecvPropInt (RECVINFO(m_nBody)), RecvPropInt (RECVINFO(m_nSequence), 0, RecvProxy_SequenceNum ), RecvPropInt (RECVINFO(m_nViewModelIndex)), RecvPropFloat (RECVINFO(m_flPlaybackRate)), RecvPropInt (RECVINFO(m_fEffects), 0, RecvProxy_EffectFlags ), RecvPropInt (RECVINFO(m_nAnimationParity)), RecvPropEHandle (RECVINFO(m_hWeapon), RecvProxy_Weapon ), RecvPropEHandle (RECVINFO(m_hOwner)), RecvPropInt( RECVINFO( m_nNewSequenceParity )), RecvPropInt( RECVINFO( m_nResetEventsParity )), RecvPropInt( RECVINFO( m_nMuzzleFlashParity )), #if !defined( INVASION_DLL ) && !defined( INVASION_CLIENT_DLL ) RecvPropArray(RecvPropFloat(RECVINFO(m_flPoseParameter[0]) ), m_flPoseParameter ), #endif #endif END_NETWORK_TABLE() #ifdef CLIENT_DLL BEGIN_PREDICTION_DATA( CBaseViewModel ) // Networked DEFINE_PRED_FIELD( m_nModelIndex, FIELD_SHORT, FTYPEDESC_INSENDTABLE | FTYPEDESC_MODELINDEX ), DEFINE_PRED_FIELD( m_nSkin, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ), DEFINE_PRED_FIELD( m_nBody, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ), DEFINE_PRED_FIELD( m_nSequence, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ), DEFINE_PRED_FIELD( m_nViewModelIndex, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ), DEFINE_PRED_FIELD_TOL( m_flPlaybackRate, FIELD_FLOAT, FTYPEDESC_INSENDTABLE, 0.125f ), DEFINE_PRED_FIELD( m_fEffects, FIELD_INTEGER, FTYPEDESC_INSENDTABLE | FTYPEDESC_OVERRIDE ), DEFINE_PRED_FIELD( m_nAnimationParity, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ), DEFINE_PRED_FIELD( m_hWeapon, FIELD_EHANDLE, FTYPEDESC_INSENDTABLE ), DEFINE_PRED_FIELD( m_flAnimTime, FIELD_FLOAT, 0 ), DEFINE_FIELD( m_hOwner, FIELD_EHANDLE ), DEFINE_FIELD( m_flTimeWeaponIdle, FIELD_FLOAT ), DEFINE_FIELD( m_Activity, FIELD_INTEGER ), DEFINE_PRED_FIELD( m_flCycle, FIELD_FLOAT, FTYPEDESC_PRIVATE | FTYPEDESC_OVERRIDE | FTYPEDESC_NOERRORCHECK ), END_PREDICTION_DATA() void RecvProxy_SequenceNum( const CRecvProxyData *pData, void *pStruct, void *pOut ) { CBaseViewModel *model = (CBaseViewModel *)pStruct; if (pData->m_Value.m_Int != model->GetSequence()) { MDLCACHE_CRITICAL_SECTION(); model->SetSequence(pData->m_Value.m_Int); model->m_flAnimTime = gpGlobals->curtime; model->SetCycle(0); } } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- int CBaseViewModel::LookupAttachment( const char *pAttachmentName ) { if ( m_hWeapon.Get() && m_hWeapon.Get()->WantsToOverrideViewmodelAttachments() ) return m_hWeapon.Get()->LookupAttachment( pAttachmentName ); return BaseClass::LookupAttachment( pAttachmentName ); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool CBaseViewModel::GetAttachment( int number, matrix3x4_t &matrix ) { if ( m_hWeapon.Get() && m_hWeapon.Get()->WantsToOverrideViewmodelAttachments() ) return m_hWeapon.Get()->GetAttachment( number, matrix ); return BaseClass::GetAttachment( number, matrix ); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool CBaseViewModel::GetAttachment( int number, Vector &origin ) { if ( m_hWeapon.Get() && m_hWeapon.Get()->WantsToOverrideViewmodelAttachments() ) return m_hWeapon.Get()->GetAttachment( number, origin ); return BaseClass::GetAttachment( number, origin ); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool CBaseViewModel::GetAttachment( int number, Vector &origin, QAngle &angles ) { if ( m_hWeapon.Get() && m_hWeapon.Get()->WantsToOverrideViewmodelAttachments() ) return m_hWeapon.Get()->GetAttachment( number, origin, angles ); return BaseClass::GetAttachment( number, origin, angles ); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool CBaseViewModel::GetAttachmentVelocity( int number, Vector &originVel, Quaternion &angleVel ) { if ( m_hWeapon.Get() && m_hWeapon.Get()->WantsToOverrideViewmodelAttachments() ) return m_hWeapon.Get()->GetAttachmentVelocity( number, originVel, angleVel ); return BaseClass::GetAttachmentVelocity( number, originVel, angleVel ); } #endif
[ "MadKowa@ec9d42d2-91e1-33f0-ec5d-f2a905d45d61" ]
[ [ [ 1, 732 ] ] ]
f1bbd3f9ed01d82a0be813d6df6c643be85a1052
4de35be6f0b79bb7eeae32b540c6b1483b933219
/aura/gameprotocol.cpp
b1e4790c2cf3949eb1c85d666233d1c81122a34b
[]
no_license
NoodleBoy/aura-bot
67b2cfb44a0c8453f54cbde0526924e416a2a567
2a7d84dc56653c7a4a8edc1552a90bc848b5a5a9
refs/heads/master
2021-01-17T06:52:05.819609
2010-12-30T15:18:41
2010-12-30T15:18:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
34,513
cpp
/* Copyright [2010] [Josko Nikolic] 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. CODE PORTED FROM THE ORIGINAL GHOST PROJECT: http://ghost.pwner.org/ */ #include "aura.h" #include "util.h" #include "crc32.h" #include "gameplayer.h" #include "gameprotocol.h" #include "game.h" // // CGameProtocol // CGameProtocol :: CGameProtocol( CAura *nAura ) : m_Aura( nAura ) { } CGameProtocol :: ~CGameProtocol( ) { } /////////////////////// // RECEIVE FUNCTIONS // /////////////////////// CIncomingJoinPlayer *CGameProtocol :: RECEIVE_W3GS_REQJOIN( BYTEARRAY data ) { // DEBUG_Print( "RECEIVED W3GS_REQJOIN" ); // DEBUG_Print( data ); // 2 bytes -> Header // 2 bytes -> Length // 4 bytes -> Host Counter (Game ID) // 4 bytes -> Entry Key (used in LAN) // 1 byte -> ??? // 2 bytes -> Listen Port // 4 bytes -> Peer Key // null terminated string -> Name // 4 bytes -> ??? // 2 bytes -> InternalPort (???) // 4 bytes -> InternalIP if( ValidateLength( data ) && data.size( ) >= 20 ) { uint32_t HostCounter = UTIL_ByteArrayToUInt32( data, false, 4 ); uint32_t EntryKey = UTIL_ByteArrayToUInt32( data, false, 8 ); BYTEARRAY Name = UTIL_ExtractCString( data, 19 ); if( !Name.empty( ) && data.size( ) >= Name.size( ) + 30 ) { BYTEARRAY InternalIP = BYTEARRAY( data.begin( ) + Name.size( ) + 26, data.begin( ) + Name.size( ) + 30 ); return new CIncomingJoinPlayer( HostCounter, EntryKey, string( Name.begin( ), Name.end( ) ), InternalIP ); } } return NULL; } uint32_t CGameProtocol :: RECEIVE_W3GS_LEAVEGAME( BYTEARRAY data ) { // DEBUG_Print( "RECEIVED W3GS_LEAVEGAME" ); // DEBUG_Print( data ); // 2 bytes -> Header // 2 bytes -> Length // 4 bytes -> Reason if( ValidateLength( data ) && data.size( ) >= 8 ) return UTIL_ByteArrayToUInt32( data, false, 4 ); return 0; } bool CGameProtocol :: RECEIVE_W3GS_GAMELOADED_SELF( BYTEARRAY data ) { // DEBUG_Print( "RECEIVED W3GS_GAMELOADED_SELF" ); // DEBUG_Print( data ); // 2 bytes -> Header // 2 bytes -> Length if( ValidateLength( data ) ) return true; return false; } CIncomingAction *CGameProtocol :: RECEIVE_W3GS_OUTGOING_ACTION( BYTEARRAY data, unsigned char PID ) { // DEBUG_Print( "RECEIVED W3GS_OUTGOING_ACTION" ); // DEBUG_Print( data ); // 2 bytes -> Header // 2 bytes -> Length // 4 bytes -> CRC // remainder of packet -> Action if( PID != 255 && ValidateLength( data ) && data.size( ) >= 8 ) { BYTEARRAY CRC = BYTEARRAY( data.begin( ) + 4, data.begin( ) + 8 ); BYTEARRAY Action = BYTEARRAY( data.begin( ) + 8, data.end( ) ); return new CIncomingAction( PID, CRC, Action ); } return NULL; } uint32_t CGameProtocol :: RECEIVE_W3GS_OUTGOING_KEEPALIVE( BYTEARRAY data ) { // DEBUG_Print( "RECEIVED W3GS_OUTGOING_KEEPALIVE" ); // DEBUG_Print( data ); // 2 bytes -> Header // 2 bytes -> Length // 1 byte -> ??? // 4 bytes -> CheckSum??? (used in replays) if( ValidateLength( data ) && data.size( ) == 9 ) return UTIL_ByteArrayToUInt32( data, false, 5 ); return 0; } CIncomingChatPlayer *CGameProtocol :: RECEIVE_W3GS_CHAT_TO_HOST( BYTEARRAY data ) { // DEBUG_Print( "RECEIVED W3GS_CHAT_TO_HOST" ); // DEBUG_Print( data ); // 2 bytes -> Header // 2 bytes -> Length // 1 byte -> Total // for( 1 .. Total ) // 1 byte -> ToPID // 1 byte -> FromPID // 1 byte -> Flag // if( Flag == 16 ) // null term string -> Message // elseif( Flag == 17 ) // 1 byte -> Team // elseif( Flag == 18 ) // 1 byte -> Colour // elseif( Flag == 19 ) // 1 byte -> Race // elseif( Flag == 20 ) // 1 byte -> Handicap // elseif( Flag == 32 ) // 4 bytes -> ExtraFlags // null term string -> Message if( ValidateLength( data ) ) { unsigned int i = 5; unsigned char Total = data[4]; if( Total > 0 && data.size( ) >= i + Total ) { BYTEARRAY ToPIDs = BYTEARRAY( data.begin( ) + i, data.begin( ) + i + Total ); i += Total; unsigned char FromPID = data[i]; unsigned char Flag = data[i + 1]; i += 2; if( Flag == 16 && data.size( ) >= i + 1 ) { // chat message BYTEARRAY Message = UTIL_ExtractCString( data, i ); return new CIncomingChatPlayer( FromPID, ToPIDs, Flag, string( Message.begin( ), Message.end( ) ) ); } else if( ( Flag >= 17 && Flag <= 20 ) && data.size( ) >= i + 1 ) { // team/colour/race/handicap change request unsigned char Byte = data[i]; return new CIncomingChatPlayer( FromPID, ToPIDs, Flag, Byte ); } else if( Flag == 32 && data.size( ) >= i + 5 ) { // chat message with extra flags BYTEARRAY ExtraFlags = BYTEARRAY( data.begin( ) + i, data.begin( ) + i + 4 ); BYTEARRAY Message = UTIL_ExtractCString( data, i + 4 ); return new CIncomingChatPlayer( FromPID, ToPIDs, Flag, string( Message.begin( ), Message.end( ) ), ExtraFlags ); } } } return NULL; } bool CGameProtocol :: RECEIVE_W3GS_SEARCHGAME( BYTEARRAY data, unsigned char war3Version ) { uint32_t ProductID = 1462982736; // "W3XP" uint32_t Version = war3Version; // DEBUG_Print( "RECEIVED W3GS_SEARCHGAME" ); // DEBUG_Print( data ); // 2 bytes -> Header // 2 bytes -> Length // 4 bytes -> ProductID // 4 bytes -> Version // 4 bytes -> ??? (Zero) if( ValidateLength( data ) && data.size( ) >= 16 ) { if( UTIL_ByteArrayToUInt32( data, false, 4 ) == ProductID ) { if( UTIL_ByteArrayToUInt32( data, false, 8 ) == Version ) { if( UTIL_ByteArrayToUInt32( data, false, 12 ) == 0 ) return true; } } } return false; } CIncomingMapSize *CGameProtocol :: RECEIVE_W3GS_MAPSIZE( BYTEARRAY data, BYTEARRAY mapSize ) { // DEBUG_Print( "RECEIVED W3GS_MAPSIZE" ); // DEBUG_Print( data ); // 2 bytes -> Header // 2 bytes -> Length // 4 bytes -> ??? // 1 byte -> SizeFlag (1 = have map, 3 = continue download) // 4 bytes -> MapSize if( ValidateLength( data ) && data.size( ) >= 13 ) return new CIncomingMapSize( data[8], UTIL_ByteArrayToUInt32( data, false, 9 ) ); return NULL; } uint32_t CGameProtocol :: RECEIVE_W3GS_MAPPARTOK( BYTEARRAY data ) { // DEBUG_Print( "RECEIVED W3GS_MAPPARTOK" ); // DEBUG_Print( data ); // 2 bytes -> Header // 2 bytes -> Length // 1 byte -> SenderPID // 1 byte -> ReceiverPID // 4 bytes -> ??? // 4 bytes -> MapSize if( ValidateLength( data ) && data.size( ) >= 14 ) return UTIL_ByteArrayToUInt32( data, false, 10 ); return 0; } uint32_t CGameProtocol :: RECEIVE_W3GS_PONG_TO_HOST( BYTEARRAY data ) { // DEBUG_Print( "RECEIVED W3GS_PONG_TO_HOST" ); // DEBUG_Print( data ); // 2 bytes -> Header // 2 bytes -> Length // 4 bytes -> Pong // the pong value is just a copy of whatever was sent in SEND_W3GS_PING_FROM_HOST which was GetTicks( ) at the time of sending // so as long as we trust that the client isn't trying to fake us out and mess with the pong value we can find the round trip time by simple subtraction // (the subtraction is done elsewhere because the very first pong value seems to be 1 and we want to discard that one) if( ValidateLength( data ) && data.size( ) >= 8 ) return UTIL_ByteArrayToUInt32( data, false, 4 ); return 1; } //////////////////// // SEND FUNCTIONS // //////////////////// BYTEARRAY CGameProtocol :: SEND_W3GS_PING_FROM_HOST( ) { BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_PING_FROM_HOST ); // W3GS_PING_FROM_HOST packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, GetTicks( ), false ); // ping value AssignLength( packet ); // DEBUG_Print( "SENT W3GS_PING_FROM_HOST" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_SLOTINFOJOIN( unsigned char PID, BYTEARRAY port, BYTEARRAY externalIP, vector<CGameSlot> &slots, uint32_t randomSeed, unsigned char layoutStyle, unsigned char playerSlots ) { unsigned char Zeros[] = { 0, 0, 0, 0 }; BYTEARRAY SlotInfo = EncodeSlotInfo( slots, randomSeed, layoutStyle, playerSlots ); BYTEARRAY packet; if( port.size( ) == 2 && externalIP.size( ) == 4 ) { packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_SLOTINFOJOIN ); // W3GS_SLOTINFOJOIN packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, (uint16_t)SlotInfo.size( ), false ); // SlotInfo length UTIL_AppendByteArrayFast( packet, SlotInfo ); // SlotInfo packet.push_back( PID ); // PID packet.push_back( 2 ); // AF_INET packet.push_back( 0 ); // AF_INET continued... UTIL_AppendByteArray( packet, port ); // port UTIL_AppendByteArrayFast( packet, externalIP ); // external IP UTIL_AppendByteArray( packet, Zeros, 4 ); // ??? UTIL_AppendByteArray( packet, Zeros, 4 ); // ??? AssignLength( packet ); } else Print( "[GAMEPROTO] invalid parameters passed to SEND_W3GS_SLOTINFOJOIN" ); // DEBUG_Print( "SENT W3GS_SLOTINFOJOIN" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_REJECTJOIN( uint32_t reason ) { BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_REJECTJOIN ); // W3GS_REJECTJOIN packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, reason, false ); // reason AssignLength( packet ); // DEBUG_Print( "SENT W3GS_REJECTJOIN" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_PLAYERINFO( unsigned char PID, string name, BYTEARRAY externalIP, BYTEARRAY internalIP ) { unsigned char PlayerJoinCounter[] = { 2, 0, 0, 0 }; unsigned char Zeros[] = { 0, 0, 0, 0 }; BYTEARRAY packet; if( !name.empty( ) && name.size( ) <= 15 && externalIP.size( ) == 4 && internalIP.size( ) == 4 ) { packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_PLAYERINFO ); // W3GS_PLAYERINFO packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, PlayerJoinCounter, 4 ); // player join counter packet.push_back( PID ); // PID UTIL_AppendByteArrayFast( packet, name ); // player name packet.push_back( 1 ); // ??? packet.push_back( 0 ); // ??? packet.push_back( 2 ); // AF_INET packet.push_back( 0 ); // AF_INET continued... packet.push_back( 0 ); // port packet.push_back( 0 ); // port continued... UTIL_AppendByteArrayFast( packet, externalIP ); // external IP UTIL_AppendByteArray( packet, Zeros, 4 ); // ??? UTIL_AppendByteArray( packet, Zeros, 4 ); // ??? packet.push_back( 2 ); // AF_INET packet.push_back( 0 ); // AF_INET continued... packet.push_back( 0 ); // port packet.push_back( 0 ); // port continued... UTIL_AppendByteArrayFast( packet, internalIP ); // internal IP UTIL_AppendByteArray( packet, Zeros, 4 ); // ??? UTIL_AppendByteArray( packet, Zeros, 4 ); // ??? AssignLength( packet ); } else Print( "[GAMEPROTO] invalid parameters passed to SEND_W3GS_PLAYERINFO" ); // DEBUG_Print( "SENT W3GS_PLAYERINFO" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_PLAYERLEAVE_OTHERS( unsigned char PID, uint32_t leftCode ) { BYTEARRAY packet; if( PID != 255 ) { packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_PLAYERLEAVE_OTHERS ); // W3GS_PLAYERLEAVE_OTHERS packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later packet.push_back( PID ); // PID UTIL_AppendByteArray( packet, leftCode, false ); // left code (see PLAYERLEAVE_ constants in gameprotocol.h) AssignLength( packet ); } else Print( "[GAMEPROTO] invalid parameters passed to SEND_W3GS_PLAYERLEAVE_OTHERS" ); // DEBUG_Print( "SENT W3GS_PLAYERLEAVE_OTHERS" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_GAMELOADED_OTHERS( unsigned char PID ) { BYTEARRAY packet; if( PID != 255 ) { packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_GAMELOADED_OTHERS ); // W3GS_GAMELOADED_OTHERS packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later packet.push_back( PID ); // PID AssignLength( packet ); } else Print( "[GAMEPROTO] invalid parameters passed to SEND_W3GS_GAMELOADED_OTHERS" ); // DEBUG_Print( "SENT W3GS_GAMELOADED_OTHERS" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_SLOTINFO( vector<CGameSlot> &slots, uint32_t randomSeed, unsigned char layoutStyle, unsigned char playerSlots ) { BYTEARRAY SlotInfo = EncodeSlotInfo( slots, randomSeed, layoutStyle, playerSlots ); BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_SLOTINFO ); // W3GS_SLOTINFO packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, (uint16_t)SlotInfo.size( ), false ); // SlotInfo length UTIL_AppendByteArrayFast( packet, SlotInfo ); // SlotInfo AssignLength( packet ); // DEBUG_Print( "SENT W3GS_SLOTINFO" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_COUNTDOWN_START( ) { BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_COUNTDOWN_START ); // W3GS_COUNTDOWN_START packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later AssignLength( packet ); // DEBUG_Print( "SENT W3GS_COUNTDOWN_START" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_COUNTDOWN_END( ) { BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_COUNTDOWN_END ); // W3GS_COUNTDOWN_END packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later AssignLength( packet ); // DEBUG_Print( "SENT W3GS_COUNTDOWN_END" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_INCOMING_ACTION( queue<CIncomingAction *> actions, uint16_t sendInterval ) { BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_INCOMING_ACTION ); // W3GS_INCOMING_ACTION packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, sendInterval, false ); // send interval // create subpacket if( !actions.empty( ) ) { BYTEARRAY subpacket; while( !actions.empty( ) ) { CIncomingAction *Action = actions.front( ); actions.pop( ); subpacket.push_back( Action->GetPID( ) ); UTIL_AppendByteArray( subpacket, (uint16_t)Action->GetAction( )->size( ), false ); UTIL_AppendByteArrayFast( subpacket, *Action->GetAction( ) ); } // calculate crc (we only care about the first 2 bytes though) BYTEARRAY crc32 = UTIL_CreateByteArray( m_Aura->m_CRC->FullCRC( (unsigned char *)string( subpacket.begin( ), subpacket.end( ) ).c_str( ), subpacket.size( ) ), false ); crc32.resize( 2 ); // finish subpacket UTIL_AppendByteArrayFast( packet, crc32 ); // crc UTIL_AppendByteArrayFast( packet, subpacket ); // subpacket } AssignLength( packet ); // DEBUG_Print( "SENT W3GS_INCOMING_ACTION" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_CHAT_FROM_HOST( unsigned char fromPID, BYTEARRAY toPIDs, unsigned char flag, BYTEARRAY flagExtra, string message ) { BYTEARRAY packet; if( !toPIDs.empty( ) && !message.empty( ) && message.size( ) < 255 ) { packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_CHAT_FROM_HOST ); // W3GS_CHAT_FROM_HOST packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later packet.push_back( toPIDs.size( ) ); // number of receivers UTIL_AppendByteArrayFast( packet, toPIDs ); // receivers packet.push_back( fromPID ); // sender packet.push_back( flag ); // flag UTIL_AppendByteArrayFast( packet, flagExtra ); // extra flag UTIL_AppendByteArrayFast( packet, message ); // message AssignLength( packet ); } else Print( "[GAMEPROTO] invalid parameters passed to SEND_W3GS_CHAT_FROM_HOST" ); // DEBUG_Print( "SENT W3GS_CHAT_FROM_HOST" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_START_LAG( vector<CGamePlayer *> players ) { BYTEARRAY packet; unsigned char NumLaggers = 0; for( vector<CGamePlayer *> :: iterator i = players.begin( ); i != players.end( ); ++i ) { if( (*i)->GetLagging( ) ) ++NumLaggers; } if( NumLaggers > 0 ) { packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_START_LAG ); // W3GS_START_LAG packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later packet.push_back( NumLaggers ); for( vector<CGamePlayer *> :: iterator i = players.begin( ); i != players.end( ); ++i ) { if( (*i)->GetLagging( ) ) { packet.push_back( (*i)->GetPID( ) ); UTIL_AppendByteArray( packet, GetTicks( ) - (*i)->GetStartedLaggingTicks( ), false ); } } AssignLength( packet ); } else Print( "[GAMEPROTO] no laggers passed to SEND_W3GS_START_LAG" ); // DEBUG_Print( "SENT W3GS_START_LAG" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_STOP_LAG( CGamePlayer *player ) { BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_STOP_LAG ); // W3GS_STOP_LAG packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later packet.push_back( player->GetPID( ) ); UTIL_AppendByteArray( packet, GetTicks( ) - player->GetStartedLaggingTicks( ), false ); AssignLength( packet ); // DEBUG_Print( "SENT W3GS_STOP_LAG" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_SEARCHGAME( unsigned char war3Version ) { unsigned char ProductID_TFT[] = { 80, 88, 51, 87 }; // "W3XP" unsigned char Version[] = { war3Version, 0, 0, 0 }; unsigned char Unknown[] = { 0, 0, 0, 0 }; BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_SEARCHGAME ); // W3GS_SEARCHGAME packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, ProductID_TFT, 4 ); // Product ID (TFT) UTIL_AppendByteArray( packet, Version, 4 ); // Version UTIL_AppendByteArray( packet, Unknown, 4 ); // ??? AssignLength( packet ); // DEBUG_Print( "SENT W3GS_SEARCHGAME" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_GAMEINFO( unsigned char war3Version, BYTEARRAY mapGameType, BYTEARRAY mapFlags, BYTEARRAY mapWidth, BYTEARRAY mapHeight, string gameName, string hostName, uint32_t upTime, string mapPath, BYTEARRAY mapCRC, uint32_t slotsTotal, uint32_t slotsOpen, uint16_t port, uint32_t hostCounter ) { unsigned char ProductID_TFT[] = { 80, 88, 51, 87 }; // "W3XP" unsigned char Version[] = { war3Version, 0, 0, 0 }; unsigned char Unknown1[] = { 1, 2, 3, 4 }; unsigned char Unknown2[] = { 1, 0, 0, 0 }; BYTEARRAY packet; if( mapGameType.size( ) == 4 && mapFlags.size( ) == 4 && mapWidth.size( ) == 2 && mapHeight.size( ) == 2 && !gameName.empty( ) && !hostName.empty( ) && !mapPath.empty( ) && mapCRC.size( ) == 4 ) { // make the stat string BYTEARRAY StatString; UTIL_AppendByteArrayFast( StatString, mapFlags ); StatString.push_back( 0 ); UTIL_AppendByteArrayFast( StatString, mapWidth ); UTIL_AppendByteArrayFast( StatString, mapHeight ); UTIL_AppendByteArrayFast( StatString, mapCRC ); UTIL_AppendByteArrayFast( StatString, mapPath ); UTIL_AppendByteArrayFast( StatString, hostName ); StatString.push_back( 0 ); StatString = UTIL_EncodeStatString( StatString ); // make the rest of the packet packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_GAMEINFO ); // W3GS_GAMEINFO packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, ProductID_TFT, 4 ); // Product ID (TFT) UTIL_AppendByteArray( packet, Version, 4 ); // Version UTIL_AppendByteArray( packet, hostCounter, false ); // Host Counter UTIL_AppendByteArray( packet, Unknown1, 4 ); UTIL_AppendByteArrayFast( packet, gameName ); // Game Name packet.push_back( 0 ); // ??? (maybe game password) UTIL_AppendByteArrayFast( packet, StatString ); // Stat String packet.push_back( 0 ); // Stat String null terminator (the stat string is encoded to remove all even numbers i.e. zeros) UTIL_AppendByteArray( packet, slotsTotal, false ); // Slots Total UTIL_AppendByteArrayFast( packet, mapGameType ); // Game Type UTIL_AppendByteArray( packet, Unknown2, 4 ); // ??? UTIL_AppendByteArray( packet, slotsOpen, false ); // Slots Open UTIL_AppendByteArray( packet, upTime, false ); // time since creation UTIL_AppendByteArray( packet, port, false ); // port AssignLength( packet ); } else Print( "[GAMEPROTO] invalid parameters passed to SEND_W3GS_GAMEINFO" ); // DEBUG_Print( "SENT W3GS_GAMEINFO" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_CREATEGAME( unsigned char war3Version ) { unsigned char ProductID_TFT[] = { 80, 88, 51, 87 }; // "W3XP" unsigned char Version[] = { war3Version, 0, 0, 0 }; unsigned char HostCounter[] = { 1, 0, 0, 0 }; BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_CREATEGAME ); // W3GS_CREATEGAME packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, ProductID_TFT, 4 ); // Product ID (TFT) UTIL_AppendByteArray( packet, Version, 4 ); // Version UTIL_AppendByteArray( packet, HostCounter, 4 ); // Host Counter AssignLength( packet ); // DEBUG_Print( "SENT W3GS_CREATEGAME" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_REFRESHGAME( uint32_t players, uint32_t playerSlots ) { unsigned char HostCounter[] = { 1, 0, 0, 0 }; BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_REFRESHGAME ); // W3GS_REFRESHGAME packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, HostCounter, 4 ); // Host Counter UTIL_AppendByteArray( packet, players, false ); // Players UTIL_AppendByteArray( packet, playerSlots, false ); // Player Slots AssignLength( packet ); // DEBUG_Print( "SENT W3GS_REFRESHGAME" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_DECREATEGAME( ) { unsigned char HostCounter[] = { 1, 0, 0, 0 }; BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_DECREATEGAME ); // W3GS_DECREATEGAME packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, HostCounter, 4 ); // Host Counter AssignLength( packet ); // DEBUG_Print( "SENT W3GS_DECREATEGAME" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_MAPCHECK( string mapPath, BYTEARRAY mapSize, BYTEARRAY mapInfo, BYTEARRAY mapCRC, BYTEARRAY mapSHA1 ) { unsigned char Unknown[] = { 1, 0, 0, 0 }; BYTEARRAY packet; if( !mapPath.empty( ) && mapSize.size( ) == 4 && mapInfo.size( ) == 4 && mapCRC.size( ) == 4 && mapSHA1.size( ) == 20 ) { packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_MAPCHECK ); // W3GS_MAPCHECK packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, Unknown, 4 ); // ??? UTIL_AppendByteArrayFast( packet, mapPath ); // map path UTIL_AppendByteArrayFast( packet, mapSize ); // map size UTIL_AppendByteArrayFast( packet, mapInfo ); // map info UTIL_AppendByteArrayFast( packet, mapCRC ); // map crc UTIL_AppendByteArrayFast( packet, mapSHA1 ); // map sha1 AssignLength( packet ); } else Print( "[GAMEPROTO] invalid parameters passed to SEND_W3GS_MAPCHECK" ); // DEBUG_Print( "SENT W3GS_MAPCHECK" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_STARTDOWNLOAD( unsigned char fromPID ) { unsigned char Unknown[] = { 1, 0, 0, 0 }; BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_STARTDOWNLOAD ); // W3GS_STARTDOWNLOAD packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later UTIL_AppendByteArray( packet, Unknown, 4 ); // ??? packet.push_back( fromPID ); // from PID AssignLength( packet ); // DEBUG_Print( "SENT W3GS_STARTDOWNLOAD" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_MAPPART( unsigned char fromPID, unsigned char toPID, uint32_t start, string *mapData ) { unsigned char Unknown[] = { 1, 0, 0, 0 }; BYTEARRAY packet; if( start < mapData->size( ) ) { packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_MAPPART ); // W3GS_MAPPART packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later packet.push_back( toPID ); // to PID packet.push_back( fromPID ); // from PID UTIL_AppendByteArray( packet, Unknown, 4 ); // ??? UTIL_AppendByteArray( packet, start, false ); // start position // calculate end position (don't send more than 1442 map bytes in one packet) uint32_t End = start + 1442; if( End > mapData->size( ) ) End = mapData->size( ); // calculate crc BYTEARRAY crc32 = UTIL_CreateByteArray( m_Aura->m_CRC->FullCRC( (unsigned char *)mapData->c_str( ) + start, End - start ), false ); UTIL_AppendByteArrayFast( packet, crc32 ); // map data BYTEARRAY Data = UTIL_CreateByteArray( (unsigned char *)mapData->c_str( ) + start, End - start ); UTIL_AppendByteArrayFast( packet, Data ); AssignLength( packet ); } else Print( "[GAMEPROTO] invalid parameters passed to SEND_W3GS_MAPPART" ); // DEBUG_Print( "SENT W3GS_MAPPART" ); // DEBUG_Print( packet ); return packet; } BYTEARRAY CGameProtocol :: SEND_W3GS_INCOMING_ACTION2( queue<CIncomingAction *> actions ) { BYTEARRAY packet; packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant packet.push_back( W3GS_INCOMING_ACTION2 ); // W3GS_INCOMING_ACTION2 packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // packet length will be assigned later packet.push_back( 0 ); // ??? (send interval?) packet.push_back( 0 ); // ??? (send interval?) // create subpacket if( !actions.empty( ) ) { BYTEARRAY subpacket; while( !actions.empty( ) ) { CIncomingAction *Action = actions.front( ); actions.pop( ); subpacket.push_back( Action->GetPID( ) ); UTIL_AppendByteArray( subpacket, (uint16_t)Action->GetAction( )->size( ), false ); UTIL_AppendByteArrayFast( subpacket, *Action->GetAction( ) ); } // calculate crc (we only care about the first 2 bytes though) BYTEARRAY crc32 = UTIL_CreateByteArray( m_Aura->m_CRC->FullCRC( (unsigned char *)string( subpacket.begin( ), subpacket.end( ) ).c_str( ), subpacket.size( ) ), false ); crc32.resize( 2 ); // finish subpacket UTIL_AppendByteArrayFast( packet, crc32 ); // crc UTIL_AppendByteArrayFast( packet, subpacket ); // subpacket } AssignLength( packet ); // DEBUG_Print( "SENT W3GS_INCOMING_ACTION2" ); // DEBUG_Print( packet ); return packet; } ///////////////////// // OTHER FUNCTIONS // ///////////////////// inline bool CGameProtocol :: AssignLength( BYTEARRAY &content ) { // insert the actual length of the content array into bytes 3 and 4 (indices 2 and 3) BYTEARRAY LengthBytes; if( content.size( ) >= 4 && content.size( ) <= 65535 ) { LengthBytes = UTIL_CreateByteArray( (uint16_t)content.size( ), false ); content[2] = LengthBytes[0]; content[3] = LengthBytes[1]; return true; } return false; } inline bool CGameProtocol :: ValidateLength( BYTEARRAY &content ) { // verify that bytes 3 and 4 (indices 2 and 3) of the content array describe the length uint16_t Length; BYTEARRAY LengthBytes; if( content.size( ) >= 4 && content.size( ) <= 65535 ) { LengthBytes.push_back( content[2] ); LengthBytes.push_back( content[3] ); Length = UTIL_ByteArrayToUInt16( LengthBytes, false ); if( Length == content.size( ) ) return true; } return false; } inline BYTEARRAY CGameProtocol :: EncodeSlotInfo( vector<CGameSlot> &slots, uint32_t randomSeed, unsigned char layoutStyle, unsigned char playerSlots ) { BYTEARRAY SlotInfo; SlotInfo.push_back( (unsigned char)slots.size( ) ); // number of slots for( unsigned int i = 0; i < slots.size( ); ++i ) UTIL_AppendByteArray( SlotInfo, slots[i].GetByteArray( ) ); UTIL_AppendByteArray( SlotInfo, randomSeed, false ); // random seed SlotInfo.push_back( layoutStyle ); // LayoutStyle (0 = melee, 1 = custom forces, 3 = custom forces + fixed player settings) SlotInfo.push_back( playerSlots ); // number of player slots (non observer) return SlotInfo; } // // CIncomingJoinPlayer // CIncomingJoinPlayer :: CIncomingJoinPlayer( uint32_t nHostCounter, uint32_t nEntryKey, const string &nName, BYTEARRAY &nInternalIP ) : m_HostCounter( nHostCounter ), m_EntryKey( nEntryKey ), m_Name( nName ), m_InternalIP( nInternalIP ) { } CIncomingJoinPlayer :: ~CIncomingJoinPlayer( ) { } // // CIncomingAction // CIncomingAction :: CIncomingAction( unsigned char nPID, BYTEARRAY &nCRC, BYTEARRAY &nAction ) : m_PID( nPID ), m_CRC( nCRC ), m_Action( nAction ) { } CIncomingAction :: ~CIncomingAction( ) { } // // CIncomingChatPlayer // CIncomingChatPlayer :: CIncomingChatPlayer( unsigned char nFromPID, BYTEARRAY &nToPIDs, unsigned char nFlag, const string &nMessage ) : m_Type( CTH_MESSAGE ), m_FromPID( nFromPID ), m_ToPIDs( nToPIDs ), m_Flag( nFlag ), m_Message( nMessage ) { } CIncomingChatPlayer :: CIncomingChatPlayer( unsigned char nFromPID, BYTEARRAY &nToPIDs, unsigned char nFlag, const string &nMessage, BYTEARRAY &nExtraFlags ) : m_Type( CTH_MESSAGE ), m_FromPID( nFromPID ), m_ToPIDs( nToPIDs ), m_Flag( nFlag ), m_Message( nMessage ), m_ExtraFlags( nExtraFlags ) { } CIncomingChatPlayer :: CIncomingChatPlayer( unsigned char nFromPID, BYTEARRAY &nToPIDs, unsigned char nFlag, unsigned char nByte ) : m_FromPID( nFromPID ), m_ToPIDs( nToPIDs ), m_Flag( nFlag ), m_Byte( nByte ) { if( nFlag == 17 ) m_Type = CTH_TEAMCHANGE; else if( nFlag == 18 ) m_Type = CTH_COLOURCHANGE; else if( nFlag == 19 ) m_Type = CTH_RACECHANGE; else if( nFlag == 20 ) m_Type = CTH_HANDICAPCHANGE; } CIncomingChatPlayer :: ~CIncomingChatPlayer( ) { } // // CIncomingMapSize // CIncomingMapSize :: CIncomingMapSize( unsigned char nSizeFlag, uint32_t nMapSize ) : m_SizeFlag( nSizeFlag ), m_MapSize( nMapSize ) { } CIncomingMapSize :: ~CIncomingMapSize( ) { }
[ "[email protected]@268e31a9-a219-ec89-1cb4-ecc417c412f6", "[email protected]" ]
[ [ [ 1, 2 ], [ 4, 20 ], [ 22, 31 ], [ 33, 510 ], [ 512, 809 ], [ 811, 853 ], [ 855, 995 ] ], [ [ 3, 3 ], [ 21, 21 ], [ 32, 32 ], [ 511, 511 ], [ 810, 810 ], [ 854, 854 ] ] ]
43510bd0f1754fc04f043724efd0ef3bca06aa2d
a84b013cd995870071589cefe0ab060ff3105f35
/webdriver/branches/android/third_party/gecko-1.9.0.11/win32/include/nsIX509Cert.h
0fd0074fe3dc38e24c5bed46e7f6e3665c63b17f
[ "Apache-2.0" ]
permissive
vdt/selenium
137bcad58b7184690b8785859d77da0cd9f745a0
30e5e122b068aadf31bcd010d00a58afd8075217
refs/heads/master
2020-12-27T21:35:06.461381
2009-08-18T15:56:32
2009-08-18T15:56:32
13,650,409
1
0
null
null
null
null
UTF-8
C++
false
false
25,468
h
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM e:/xr19rel/WINNT_5.2_Depend/mozilla/security/manager/ssl/public/nsIX509Cert.idl */ #ifndef __gen_nsIX509Cert_h__ #define __gen_nsIX509Cert_h__ #ifndef __gen_nsISupports_h__ #include "nsISupports.h" #endif /* For IDL files that don't want to include root IDL files. */ #ifndef NS_NO_VTABLE #define NS_NO_VTABLE #endif class nsIArray; /* forward declaration */ class nsIX509CertValidity; /* forward declaration */ class nsIASN1Object; /* forward declaration */ /* starting interface: nsIX509Cert */ #define NS_IX509CERT_IID_STR "f0980f60-ee3d-11d4-998b-00b0d02354a0" #define NS_IX509CERT_IID \ {0xf0980f60, 0xee3d, 0x11d4, \ { 0x99, 0x8b, 0x00, 0xb0, 0xd0, 0x23, 0x54, 0xa0 }} /** * This represents a X.509 certificate. * * @status FROZEN */ class NS_NO_VTABLE NS_SCRIPTABLE nsIX509Cert : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IX509CERT_IID) /** * A nickname for the certificate. */ /* readonly attribute AString nickname; */ NS_SCRIPTABLE NS_IMETHOD GetNickname(nsAString & aNickname) = 0; /** * The primary email address of the certificate, if present. */ /* readonly attribute AString emailAddress; */ NS_SCRIPTABLE NS_IMETHOD GetEmailAddress(nsAString & aEmailAddress) = 0; /** * Obtain a list of all email addresses * contained in the certificate. * * @param length The number of strings in the returned array. * @return An array of email addresses. */ /* void getEmailAddresses (out unsigned long length, [array, size_is (length), retval] out wstring addresses); */ NS_SCRIPTABLE NS_IMETHOD GetEmailAddresses(PRUint32 *length, PRUnichar ***addresses) = 0; /** * Check whether a given address is contained in the certificate. * The comparison will convert the email address to lowercase. * The behaviour for non ASCII characters is undefined. * * @param aEmailAddress The address to search for. * * @return True if the address is contained in the certificate. */ /* boolean containsEmailAddress (in AString aEmailAddress); */ NS_SCRIPTABLE NS_IMETHOD ContainsEmailAddress(const nsAString & aEmailAddress, PRBool *_retval) = 0; /** * The subject owning the certificate. */ /* readonly attribute AString subjectName; */ NS_SCRIPTABLE NS_IMETHOD GetSubjectName(nsAString & aSubjectName) = 0; /** * The subject's common name. */ /* readonly attribute AString commonName; */ NS_SCRIPTABLE NS_IMETHOD GetCommonName(nsAString & aCommonName) = 0; /** * The subject's organization. */ /* readonly attribute AString organization; */ NS_SCRIPTABLE NS_IMETHOD GetOrganization(nsAString & aOrganization) = 0; /** * The subject's organizational unit. */ /* readonly attribute AString organizationalUnit; */ NS_SCRIPTABLE NS_IMETHOD GetOrganizationalUnit(nsAString & aOrganizationalUnit) = 0; /** * The fingerprint of the certificate's public key, * calculated using the SHA1 algorithm. */ /* readonly attribute AString sha1Fingerprint; */ NS_SCRIPTABLE NS_IMETHOD GetSha1Fingerprint(nsAString & aSha1Fingerprint) = 0; /** * The fingerprint of the certificate's public key, * calculated using the MD5 algorithm. */ /* readonly attribute AString md5Fingerprint; */ NS_SCRIPTABLE NS_IMETHOD GetMd5Fingerprint(nsAString & aMd5Fingerprint) = 0; /** * A human readable name identifying the hardware or * software token the certificate is stored on. */ /* readonly attribute AString tokenName; */ NS_SCRIPTABLE NS_IMETHOD GetTokenName(nsAString & aTokenName) = 0; /** * The subject identifying the issuer certificate. */ /* readonly attribute AString issuerName; */ NS_SCRIPTABLE NS_IMETHOD GetIssuerName(nsAString & aIssuerName) = 0; /** * The serial number the issuer assigned to this certificate. */ /* readonly attribute AString serialNumber; */ NS_SCRIPTABLE NS_IMETHOD GetSerialNumber(nsAString & aSerialNumber) = 0; /** * The issuer subject's common name. */ /* readonly attribute AString issuerCommonName; */ NS_SCRIPTABLE NS_IMETHOD GetIssuerCommonName(nsAString & aIssuerCommonName) = 0; /** * The issuer subject's organization. */ /* readonly attribute AString issuerOrganization; */ NS_SCRIPTABLE NS_IMETHOD GetIssuerOrganization(nsAString & aIssuerOrganization) = 0; /** * The issuer subject's organizational unit. */ /* readonly attribute AString issuerOrganizationUnit; */ NS_SCRIPTABLE NS_IMETHOD GetIssuerOrganizationUnit(nsAString & aIssuerOrganizationUnit) = 0; /** * The certificate used by the issuer to sign this certificate. */ /* readonly attribute nsIX509Cert issuer; */ NS_SCRIPTABLE NS_IMETHOD GetIssuer(nsIX509Cert * *aIssuer) = 0; /** * This certificate's validity period. */ /* readonly attribute nsIX509CertValidity validity; */ NS_SCRIPTABLE NS_IMETHOD GetValidity(nsIX509CertValidity * *aValidity) = 0; /** * A unique identifier of this certificate within the local storage. */ /* readonly attribute string dbKey; */ NS_SCRIPTABLE NS_IMETHOD GetDbKey(char * *aDbKey) = 0; /** * A human readable identifier to label this certificate. */ /* readonly attribute string windowTitle; */ NS_SCRIPTABLE NS_IMETHOD GetWindowTitle(char * *aWindowTitle) = 0; /** * Constants to classify the type of a certificate. */ enum { UNKNOWN_CERT = 0U }; enum { CA_CERT = 1U }; enum { USER_CERT = 2U }; enum { EMAIL_CERT = 4U }; enum { SERVER_CERT = 8U }; /** * Constants for certificate verification results. */ enum { VERIFIED_OK = 0U }; enum { NOT_VERIFIED_UNKNOWN = 1U }; enum { CERT_REVOKED = 2U }; enum { CERT_EXPIRED = 4U }; enum { CERT_NOT_TRUSTED = 8U }; enum { ISSUER_NOT_TRUSTED = 16U }; enum { ISSUER_UNKNOWN = 32U }; enum { INVALID_CA = 64U }; enum { USAGE_NOT_ALLOWED = 128U }; /** * Constants that describe the certified usages of a certificate. */ enum { CERT_USAGE_SSLClient = 0U }; enum { CERT_USAGE_SSLServer = 1U }; enum { CERT_USAGE_SSLServerWithStepUp = 2U }; enum { CERT_USAGE_SSLCA = 3U }; enum { CERT_USAGE_EmailSigner = 4U }; enum { CERT_USAGE_EmailRecipient = 5U }; enum { CERT_USAGE_ObjectSigner = 6U }; enum { CERT_USAGE_UserCertImport = 7U }; enum { CERT_USAGE_VerifyCA = 8U }; enum { CERT_USAGE_ProtectedObjectSigner = 9U }; enum { CERT_USAGE_StatusResponder = 10U }; enum { CERT_USAGE_AnyCA = 11U }; /** * Obtain a list of certificates that contains this certificate * and the issuing certificates of all involved issuers, * up to the root issuer. * * @return The chain of certifficates including the issuers. */ /* nsIArray getChain (); */ NS_SCRIPTABLE NS_IMETHOD GetChain(nsIArray **_retval) = 0; /** * Obtain an array of human readable strings describing * the certificate's certified usages. * * @param ignoreOcsp Do not use OCSP even if it is currently activated. * @param verified The certificate verification result, see constants. * @param count The number of human readable usages returned. * @param usages The array of human readable usages. */ /* void getUsagesArray (in boolean ignoreOcsp, out PRUint32 verified, out PRUint32 count, [array, size_is (count)] out wstring usages); */ NS_SCRIPTABLE NS_IMETHOD GetUsagesArray(PRBool ignoreOcsp, PRUint32 *verified, PRUint32 *count, PRUnichar ***usages) = 0; /** * Obtain a single comma separated human readable string describing * the certificate's certified usages. * * @param ignoreOcsp Do not use OCSP even if it is currently activated. * @param verified The certificate verification result, see constants. * @param purposes The string listing the usages. */ /* void getUsagesString (in boolean ignoreOcsp, out PRUint32 verified, out AString usages); */ NS_SCRIPTABLE NS_IMETHOD GetUsagesString(PRBool ignoreOcsp, PRUint32 *verified, nsAString & usages) = 0; /** * Verify the certificate for a particular usage. * * @return The certificate verification result, see constants. */ /* unsigned long verifyForUsage (in unsigned long usage); */ NS_SCRIPTABLE NS_IMETHOD VerifyForUsage(PRUint32 usage, PRUint32 *_retval) = 0; /** * This is the attribute which describes the ASN1 layout * of the certificate. This can be used when doing a * "pretty print" of the certificate's ASN1 structure. */ /* readonly attribute nsIASN1Object ASN1Structure; */ NS_SCRIPTABLE NS_IMETHOD GetASN1Structure(nsIASN1Object * *aASN1Structure) = 0; /** * Obtain a raw binary encoding of this certificate * in DER format. * * @param length The number of bytes in the binary encoding. * @param data The bytes representing the DER encoded certificate. */ /* void getRawDER (out unsigned long length, [array, size_is (length), retval] out octet data); */ NS_SCRIPTABLE NS_IMETHOD GetRawDER(PRUint32 *length, PRUint8 **data) = 0; /** * Test whether two certificate instances represent the * same certificate. * * @return Whether the certificates are equal */ /* boolean equals (in nsIX509Cert other); */ NS_SCRIPTABLE NS_IMETHOD Equals(nsIX509Cert *other, PRBool *_retval) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIX509Cert, NS_IX509CERT_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSIX509CERT \ NS_SCRIPTABLE NS_IMETHOD GetNickname(nsAString & aNickname); \ NS_SCRIPTABLE NS_IMETHOD GetEmailAddress(nsAString & aEmailAddress); \ NS_SCRIPTABLE NS_IMETHOD GetEmailAddresses(PRUint32 *length, PRUnichar ***addresses); \ NS_SCRIPTABLE NS_IMETHOD ContainsEmailAddress(const nsAString & aEmailAddress, PRBool *_retval); \ NS_SCRIPTABLE NS_IMETHOD GetSubjectName(nsAString & aSubjectName); \ NS_SCRIPTABLE NS_IMETHOD GetCommonName(nsAString & aCommonName); \ NS_SCRIPTABLE NS_IMETHOD GetOrganization(nsAString & aOrganization); \ NS_SCRIPTABLE NS_IMETHOD GetOrganizationalUnit(nsAString & aOrganizationalUnit); \ NS_SCRIPTABLE NS_IMETHOD GetSha1Fingerprint(nsAString & aSha1Fingerprint); \ NS_SCRIPTABLE NS_IMETHOD GetMd5Fingerprint(nsAString & aMd5Fingerprint); \ NS_SCRIPTABLE NS_IMETHOD GetTokenName(nsAString & aTokenName); \ NS_SCRIPTABLE NS_IMETHOD GetIssuerName(nsAString & aIssuerName); \ NS_SCRIPTABLE NS_IMETHOD GetSerialNumber(nsAString & aSerialNumber); \ NS_SCRIPTABLE NS_IMETHOD GetIssuerCommonName(nsAString & aIssuerCommonName); \ NS_SCRIPTABLE NS_IMETHOD GetIssuerOrganization(nsAString & aIssuerOrganization); \ NS_SCRIPTABLE NS_IMETHOD GetIssuerOrganizationUnit(nsAString & aIssuerOrganizationUnit); \ NS_SCRIPTABLE NS_IMETHOD GetIssuer(nsIX509Cert * *aIssuer); \ NS_SCRIPTABLE NS_IMETHOD GetValidity(nsIX509CertValidity * *aValidity); \ NS_SCRIPTABLE NS_IMETHOD GetDbKey(char * *aDbKey); \ NS_SCRIPTABLE NS_IMETHOD GetWindowTitle(char * *aWindowTitle); \ NS_SCRIPTABLE NS_IMETHOD GetChain(nsIArray **_retval); \ NS_SCRIPTABLE NS_IMETHOD GetUsagesArray(PRBool ignoreOcsp, PRUint32 *verified, PRUint32 *count, PRUnichar ***usages); \ NS_SCRIPTABLE NS_IMETHOD GetUsagesString(PRBool ignoreOcsp, PRUint32 *verified, nsAString & usages); \ NS_SCRIPTABLE NS_IMETHOD VerifyForUsage(PRUint32 usage, PRUint32 *_retval); \ NS_SCRIPTABLE NS_IMETHOD GetASN1Structure(nsIASN1Object * *aASN1Structure); \ NS_SCRIPTABLE NS_IMETHOD GetRawDER(PRUint32 *length, PRUint8 **data); \ NS_SCRIPTABLE NS_IMETHOD Equals(nsIX509Cert *other, PRBool *_retval); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSIX509CERT(_to) \ NS_SCRIPTABLE NS_IMETHOD GetNickname(nsAString & aNickname) { return _to GetNickname(aNickname); } \ NS_SCRIPTABLE NS_IMETHOD GetEmailAddress(nsAString & aEmailAddress) { return _to GetEmailAddress(aEmailAddress); } \ NS_SCRIPTABLE NS_IMETHOD GetEmailAddresses(PRUint32 *length, PRUnichar ***addresses) { return _to GetEmailAddresses(length, addresses); } \ NS_SCRIPTABLE NS_IMETHOD ContainsEmailAddress(const nsAString & aEmailAddress, PRBool *_retval) { return _to ContainsEmailAddress(aEmailAddress, _retval); } \ NS_SCRIPTABLE NS_IMETHOD GetSubjectName(nsAString & aSubjectName) { return _to GetSubjectName(aSubjectName); } \ NS_SCRIPTABLE NS_IMETHOD GetCommonName(nsAString & aCommonName) { return _to GetCommonName(aCommonName); } \ NS_SCRIPTABLE NS_IMETHOD GetOrganization(nsAString & aOrganization) { return _to GetOrganization(aOrganization); } \ NS_SCRIPTABLE NS_IMETHOD GetOrganizationalUnit(nsAString & aOrganizationalUnit) { return _to GetOrganizationalUnit(aOrganizationalUnit); } \ NS_SCRIPTABLE NS_IMETHOD GetSha1Fingerprint(nsAString & aSha1Fingerprint) { return _to GetSha1Fingerprint(aSha1Fingerprint); } \ NS_SCRIPTABLE NS_IMETHOD GetMd5Fingerprint(nsAString & aMd5Fingerprint) { return _to GetMd5Fingerprint(aMd5Fingerprint); } \ NS_SCRIPTABLE NS_IMETHOD GetTokenName(nsAString & aTokenName) { return _to GetTokenName(aTokenName); } \ NS_SCRIPTABLE NS_IMETHOD GetIssuerName(nsAString & aIssuerName) { return _to GetIssuerName(aIssuerName); } \ NS_SCRIPTABLE NS_IMETHOD GetSerialNumber(nsAString & aSerialNumber) { return _to GetSerialNumber(aSerialNumber); } \ NS_SCRIPTABLE NS_IMETHOD GetIssuerCommonName(nsAString & aIssuerCommonName) { return _to GetIssuerCommonName(aIssuerCommonName); } \ NS_SCRIPTABLE NS_IMETHOD GetIssuerOrganization(nsAString & aIssuerOrganization) { return _to GetIssuerOrganization(aIssuerOrganization); } \ NS_SCRIPTABLE NS_IMETHOD GetIssuerOrganizationUnit(nsAString & aIssuerOrganizationUnit) { return _to GetIssuerOrganizationUnit(aIssuerOrganizationUnit); } \ NS_SCRIPTABLE NS_IMETHOD GetIssuer(nsIX509Cert * *aIssuer) { return _to GetIssuer(aIssuer); } \ NS_SCRIPTABLE NS_IMETHOD GetValidity(nsIX509CertValidity * *aValidity) { return _to GetValidity(aValidity); } \ NS_SCRIPTABLE NS_IMETHOD GetDbKey(char * *aDbKey) { return _to GetDbKey(aDbKey); } \ NS_SCRIPTABLE NS_IMETHOD GetWindowTitle(char * *aWindowTitle) { return _to GetWindowTitle(aWindowTitle); } \ NS_SCRIPTABLE NS_IMETHOD GetChain(nsIArray **_retval) { return _to GetChain(_retval); } \ NS_SCRIPTABLE NS_IMETHOD GetUsagesArray(PRBool ignoreOcsp, PRUint32 *verified, PRUint32 *count, PRUnichar ***usages) { return _to GetUsagesArray(ignoreOcsp, verified, count, usages); } \ NS_SCRIPTABLE NS_IMETHOD GetUsagesString(PRBool ignoreOcsp, PRUint32 *verified, nsAString & usages) { return _to GetUsagesString(ignoreOcsp, verified, usages); } \ NS_SCRIPTABLE NS_IMETHOD VerifyForUsage(PRUint32 usage, PRUint32 *_retval) { return _to VerifyForUsage(usage, _retval); } \ NS_SCRIPTABLE NS_IMETHOD GetASN1Structure(nsIASN1Object * *aASN1Structure) { return _to GetASN1Structure(aASN1Structure); } \ NS_SCRIPTABLE NS_IMETHOD GetRawDER(PRUint32 *length, PRUint8 **data) { return _to GetRawDER(length, data); } \ NS_SCRIPTABLE NS_IMETHOD Equals(nsIX509Cert *other, PRBool *_retval) { return _to Equals(other, _retval); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSIX509CERT(_to) \ NS_SCRIPTABLE NS_IMETHOD GetNickname(nsAString & aNickname) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNickname(aNickname); } \ NS_SCRIPTABLE NS_IMETHOD GetEmailAddress(nsAString & aEmailAddress) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetEmailAddress(aEmailAddress); } \ NS_SCRIPTABLE NS_IMETHOD GetEmailAddresses(PRUint32 *length, PRUnichar ***addresses) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetEmailAddresses(length, addresses); } \ NS_SCRIPTABLE NS_IMETHOD ContainsEmailAddress(const nsAString & aEmailAddress, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ContainsEmailAddress(aEmailAddress, _retval); } \ NS_SCRIPTABLE NS_IMETHOD GetSubjectName(nsAString & aSubjectName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSubjectName(aSubjectName); } \ NS_SCRIPTABLE NS_IMETHOD GetCommonName(nsAString & aCommonName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCommonName(aCommonName); } \ NS_SCRIPTABLE NS_IMETHOD GetOrganization(nsAString & aOrganization) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOrganization(aOrganization); } \ NS_SCRIPTABLE NS_IMETHOD GetOrganizationalUnit(nsAString & aOrganizationalUnit) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOrganizationalUnit(aOrganizationalUnit); } \ NS_SCRIPTABLE NS_IMETHOD GetSha1Fingerprint(nsAString & aSha1Fingerprint) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSha1Fingerprint(aSha1Fingerprint); } \ NS_SCRIPTABLE NS_IMETHOD GetMd5Fingerprint(nsAString & aMd5Fingerprint) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetMd5Fingerprint(aMd5Fingerprint); } \ NS_SCRIPTABLE NS_IMETHOD GetTokenName(nsAString & aTokenName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetTokenName(aTokenName); } \ NS_SCRIPTABLE NS_IMETHOD GetIssuerName(nsAString & aIssuerName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIssuerName(aIssuerName); } \ NS_SCRIPTABLE NS_IMETHOD GetSerialNumber(nsAString & aSerialNumber) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSerialNumber(aSerialNumber); } \ NS_SCRIPTABLE NS_IMETHOD GetIssuerCommonName(nsAString & aIssuerCommonName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIssuerCommonName(aIssuerCommonName); } \ NS_SCRIPTABLE NS_IMETHOD GetIssuerOrganization(nsAString & aIssuerOrganization) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIssuerOrganization(aIssuerOrganization); } \ NS_SCRIPTABLE NS_IMETHOD GetIssuerOrganizationUnit(nsAString & aIssuerOrganizationUnit) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIssuerOrganizationUnit(aIssuerOrganizationUnit); } \ NS_SCRIPTABLE NS_IMETHOD GetIssuer(nsIX509Cert * *aIssuer) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIssuer(aIssuer); } \ NS_SCRIPTABLE NS_IMETHOD GetValidity(nsIX509CertValidity * *aValidity) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetValidity(aValidity); } \ NS_SCRIPTABLE NS_IMETHOD GetDbKey(char * *aDbKey) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDbKey(aDbKey); } \ NS_SCRIPTABLE NS_IMETHOD GetWindowTitle(char * *aWindowTitle) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWindowTitle(aWindowTitle); } \ NS_SCRIPTABLE NS_IMETHOD GetChain(nsIArray **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetChain(_retval); } \ NS_SCRIPTABLE NS_IMETHOD GetUsagesArray(PRBool ignoreOcsp, PRUint32 *verified, PRUint32 *count, PRUnichar ***usages) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUsagesArray(ignoreOcsp, verified, count, usages); } \ NS_SCRIPTABLE NS_IMETHOD GetUsagesString(PRBool ignoreOcsp, PRUint32 *verified, nsAString & usages) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUsagesString(ignoreOcsp, verified, usages); } \ NS_SCRIPTABLE NS_IMETHOD VerifyForUsage(PRUint32 usage, PRUint32 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->VerifyForUsage(usage, _retval); } \ NS_SCRIPTABLE NS_IMETHOD GetASN1Structure(nsIASN1Object * *aASN1Structure) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetASN1Structure(aASN1Structure); } \ NS_SCRIPTABLE NS_IMETHOD GetRawDER(PRUint32 *length, PRUint8 **data) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRawDER(length, data); } \ NS_SCRIPTABLE NS_IMETHOD Equals(nsIX509Cert *other, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Equals(other, _retval); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsX509Cert : public nsIX509Cert { public: NS_DECL_ISUPPORTS NS_DECL_NSIX509CERT nsX509Cert(); private: ~nsX509Cert(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsX509Cert, nsIX509Cert) nsX509Cert::nsX509Cert() { /* member initializers and constructor code */ } nsX509Cert::~nsX509Cert() { /* destructor code */ } /* readonly attribute AString nickname; */ NS_IMETHODIMP nsX509Cert::GetNickname(nsAString & aNickname) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString emailAddress; */ NS_IMETHODIMP nsX509Cert::GetEmailAddress(nsAString & aEmailAddress) { return NS_ERROR_NOT_IMPLEMENTED; } /* void getEmailAddresses (out unsigned long length, [array, size_is (length), retval] out wstring addresses); */ NS_IMETHODIMP nsX509Cert::GetEmailAddresses(PRUint32 *length, PRUnichar ***addresses) { return NS_ERROR_NOT_IMPLEMENTED; } /* boolean containsEmailAddress (in AString aEmailAddress); */ NS_IMETHODIMP nsX509Cert::ContainsEmailAddress(const nsAString & aEmailAddress, PRBool *_retval) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString subjectName; */ NS_IMETHODIMP nsX509Cert::GetSubjectName(nsAString & aSubjectName) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString commonName; */ NS_IMETHODIMP nsX509Cert::GetCommonName(nsAString & aCommonName) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString organization; */ NS_IMETHODIMP nsX509Cert::GetOrganization(nsAString & aOrganization) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString organizationalUnit; */ NS_IMETHODIMP nsX509Cert::GetOrganizationalUnit(nsAString & aOrganizationalUnit) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString sha1Fingerprint; */ NS_IMETHODIMP nsX509Cert::GetSha1Fingerprint(nsAString & aSha1Fingerprint) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString md5Fingerprint; */ NS_IMETHODIMP nsX509Cert::GetMd5Fingerprint(nsAString & aMd5Fingerprint) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString tokenName; */ NS_IMETHODIMP nsX509Cert::GetTokenName(nsAString & aTokenName) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString issuerName; */ NS_IMETHODIMP nsX509Cert::GetIssuerName(nsAString & aIssuerName) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString serialNumber; */ NS_IMETHODIMP nsX509Cert::GetSerialNumber(nsAString & aSerialNumber) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString issuerCommonName; */ NS_IMETHODIMP nsX509Cert::GetIssuerCommonName(nsAString & aIssuerCommonName) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString issuerOrganization; */ NS_IMETHODIMP nsX509Cert::GetIssuerOrganization(nsAString & aIssuerOrganization) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute AString issuerOrganizationUnit; */ NS_IMETHODIMP nsX509Cert::GetIssuerOrganizationUnit(nsAString & aIssuerOrganizationUnit) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute nsIX509Cert issuer; */ NS_IMETHODIMP nsX509Cert::GetIssuer(nsIX509Cert * *aIssuer) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute nsIX509CertValidity validity; */ NS_IMETHODIMP nsX509Cert::GetValidity(nsIX509CertValidity * *aValidity) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute string dbKey; */ NS_IMETHODIMP nsX509Cert::GetDbKey(char * *aDbKey) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute string windowTitle; */ NS_IMETHODIMP nsX509Cert::GetWindowTitle(char * *aWindowTitle) { return NS_ERROR_NOT_IMPLEMENTED; } /* nsIArray getChain (); */ NS_IMETHODIMP nsX509Cert::GetChain(nsIArray **_retval) { return NS_ERROR_NOT_IMPLEMENTED; } /* void getUsagesArray (in boolean ignoreOcsp, out PRUint32 verified, out PRUint32 count, [array, size_is (count)] out wstring usages); */ NS_IMETHODIMP nsX509Cert::GetUsagesArray(PRBool ignoreOcsp, PRUint32 *verified, PRUint32 *count, PRUnichar ***usages) { return NS_ERROR_NOT_IMPLEMENTED; } /* void getUsagesString (in boolean ignoreOcsp, out PRUint32 verified, out AString usages); */ NS_IMETHODIMP nsX509Cert::GetUsagesString(PRBool ignoreOcsp, PRUint32 *verified, nsAString & usages) { return NS_ERROR_NOT_IMPLEMENTED; } /* unsigned long verifyForUsage (in unsigned long usage); */ NS_IMETHODIMP nsX509Cert::VerifyForUsage(PRUint32 usage, PRUint32 *_retval) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute nsIASN1Object ASN1Structure; */ NS_IMETHODIMP nsX509Cert::GetASN1Structure(nsIASN1Object * *aASN1Structure) { return NS_ERROR_NOT_IMPLEMENTED; } /* void getRawDER (out unsigned long length, [array, size_is (length), retval] out octet data); */ NS_IMETHODIMP nsX509Cert::GetRawDER(PRUint32 *length, PRUint8 **data) { return NS_ERROR_NOT_IMPLEMENTED; } /* boolean equals (in nsIX509Cert other); */ NS_IMETHODIMP nsX509Cert::Equals(nsIX509Cert *other, PRBool *_retval) { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif #endif /* __gen_nsIX509Cert_h__ */
[ "alexber@07704840-8298-11de-bf8c-fd130f914ac9" ]
[ [ [ 1, 595 ] ] ]
c9206bbc7815cb9caa4ce6ddef7ee4c0cfc8f9b6
fca970494c70100402f2e2d405ce72745a7be4c9
/src/utils/Parser.cc
c171be857369fa782ffcd96f8532badb62a5fc70
[]
no_license
deepakantony/arrow
c0d555f681b4ed4688036ad2cd299e7a2e329dac
424ac43003e0ebd5ddb30c0093e5b244cfc713ed
refs/heads/master
2020-05-18T12:01:07.335442
2011-06-28T03:02:26
2011-06-28T03:02:26
1,868,162
1
0
null
null
null
null
UTF-8
C++
false
false
36,095
cc
#include "Parser.h" #include "PinholeCamera.h" #include "ConstantBackground.h" #include "PointLight.h" // Materials #include "LambertianMaterial.h" #include "PhongMaterial.h" #include "DielectricMaterial.h" #include "MetalMaterial.h" #include "TestFunctionMaterial.h" #include "PhongImageMaterial.h" #include "CheckerMaterial.h" #include "PhongMarble.h" #include "PhongDielectricImage.h" #include "TileMaterial.h" #include "InvisibleMaterial.h" // Objects #include "Group.h" #include "Instance.h" #include "Plane.h" #include "Sphere.h" #include "Box.h" #include "disk.h" #include "triangle.h" #include "ring.h" #include "Torus.h" #include "Rectangle.h" #include "Cylinder.h" #include "Heightfield.h" #include "SpherePolar.h" // Samplers #include "Sampler.h" #include "UniformSampler.h" #include "JitteredSampler.h" #include "MultiJitteredSampler.h" #include "NRooksSampler.h" #include "HammersleySampler.h" // filters #include "Filter.h" #include "BoxFilter.h" #include "TriangleFilter.h" #include "MitchellFilter.h" #include "GaussianFilter.h" #include "WindowedSincFilter.h" // mappings #include "Mapping.h" #include "SphericalMapping.h" #include "Scene.h" #include "Image.h" #include <cmath> #include <iostream> #include <istream> #include <sstream> #include <string> #include <cstdlib> using namespace std; void Parser::throwParseException( string const &message ) const { cerr << next_token.line_number << ":" << next_token.column_number << ": " << message << endl; exit( 1 ); } void Parser::readNextToken() { int state = 0; long long mantissa = 0; int exponent = 0; int exponent_adjustment = 0; bool negative_mantissa = false; bool negative_exponent = false; for ( ; ; ) { int character = input.get(); switch ( state ) { case 0: next_token.line_number = line_number; next_token.column_number = column_number; if ( input.eof() ) { next_token.token_type = Token::end_of_file; return; } else if ( character == ' ' || character == '\t' || character == '\r' || character == '\n' ) state = 0; else if ( character == '/' ) state = 1; else if ( character == '+' || character == '-' ) { negative_mantissa = character == '-'; state = 3; } else if ( character >= '0' && character <= '9' ) { mantissa = character - '0'; state = 4; } else if ( character == '.' ) state = 5; else if ( character == '"' ) { next_token.string_value.clear(); state = 10; } else if ( character >= 'A' && character <= 'Z' || character >= 'a' && character <= 'z' || character == '_' ) { next_token.string_value = static_cast< char >( character ); state = 12; } else if ( character == ',' ) { ++column_number; next_token.token_type = Token::comma; return; } else if ( character == '{' ) { ++column_number; next_token.token_type = Token::left_brace; return; } else if ( character == '}' ) { ++column_number; next_token.token_type = Token::right_brace; return; } else if ( character == '[' ) { ++column_number; next_token.token_type = Token::left_bracket; return; } else if ( character == ']' ) { ++column_number; next_token.token_type = Token::right_bracket; return; } else throwParseException( "Unexpected character" ); break; case 1: if ( character == '/' ) state = 2; else throwParseException( "Malformed comment" ); break; case 2: if ( character == '\n' || input.eof() ) state = 0; break; case 3: if ( character >= '0' && character <= '9' ) { mantissa = character - '0'; state = 4; } else if ( character == '.' ) state = 5; else throwParseException( "Invalid number" ); break; case 4: if ( character >= '0' && character <= '9' ) mantissa = mantissa * 10 + character - '0'; else if ( character == '.' ) state = 6; else if ( character == 'E' || character == 'e' ) state = 7; else { input.putback( static_cast< char >( character ) ); next_token.integer_value = ( static_cast< int >( mantissa ) * ( negative_mantissa ? -1 : 1 ) ); next_token.token_type = Token::integer; return; } break; case 5: if ( character >= '0' && character <= '9' ) { mantissa = character - '0'; exponent_adjustment = 1; state = 6; } else throwParseException( "Invalid number" ); break; case 6: if ( character >= '0' && character <= '9' ) { mantissa = mantissa * 10 + character - '0'; ++exponent_adjustment; } else if ( character == 'E' || character == 'e' ) state = 7; else { input.putback( static_cast< char >( character ) ); next_token.real_value = ( mantissa * ( negative_mantissa ? -1 : 1 ) * pow( 10.0, -exponent_adjustment ) ); next_token.token_type = Token::real; return; } break; case 7: if ( character == '+' || character == '-' ) { negative_exponent = character == '-'; state = 8; } else if ( character >= '0' && character <= '9' ) { exponent = character - '0'; state = 9; } else throwParseException( "Invalid number" ); break; case 8: if ( character >= '0' && character <= '9' ) { exponent = character - '0'; state = 9; } else throwParseException( "Invalid number" ); break; case 9: if ( character >= '0' && character <= '9' ) exponent = exponent * 10 + character - '0'; else { input.putback( static_cast< char >( character ) ); next_token.real_value = ( mantissa * ( negative_mantissa ? -1 : 1 ) * pow( 10.0, ( exponent * ( negative_exponent ? -1 : 1 ) - exponent_adjustment ) ) ); next_token.token_type = Token::real; return; } break; case 10: if ( input.eof() || character == '\n' ) throwParseException( "Unterminated string" ); else if ( character == '\\' ) state = 11; else if ( character == '"' ) { ++column_number; next_token.token_type = Token::string; return; } else next_token.string_value.push_back( static_cast< char >( character ) ); break; case 11: if ( input.eof() ) throwParseException( "Unterminated string" ); else if ( character == '\n' ) next_token.string_value.push_back( '\n' ); else if ( character == '\\' ) next_token.string_value.push_back( '\\' ); else if ( character == '"' ) next_token.string_value.push_back( '"' ); else next_token.string_value.push_back( static_cast< char >( character ) ); state = 10; break; case 12: if ( character >= '0' && character <= '9' || character >= 'A' && character <= 'Z' || character >= 'a' && character <= 'z' || character == '_' ) next_token.string_value.push_back( static_cast< char >( character ) ); else { input.putback( static_cast< char >( character ) ); next_token.token_type = Token::string; return; } break; } if ( character == '\n' ) { ++line_number; column_number = 0; } else if ( character == '\t' ) column_number = ( column_number + 8 ) / 8 * 8; else ++column_number; } } bool Parser::peek( Token::type const type ) { bool matched = next_token.token_type == type; if ( matched ) readNextToken(); return matched; } bool Parser::peek( string const &keyword ) { bool matched = ( next_token.token_type == Token::string && next_token.string_value == keyword ); if ( matched ) readNextToken(); return matched; } Parser::Token Parser::match( Token::type const type, string const &failure_message ) { if ( next_token.token_type != type ) throwParseException( failure_message ); Token current_token( next_token ); readNextToken(); return current_token; } Parser::Token Parser::match( string const &keyword, string const &failure_message ) { if ( next_token.token_type != Token::string || next_token.string_value != keyword ) throwParseException( failure_message ); Token current_token( next_token ); readNextToken(); return current_token; } string Parser::parseString() { Token next( match( Token::string, "Expected a string" ) ); return next.string_value; } bool Parser::parseBoolean() { if ( peek( "true" ) ) return true; else if ( peek( "false" ) ) return false; else throwParseException( "Expected `true' or `false'." ); return false; } int Parser::parseInteger() { Token next( match( Token::integer, "Expected an integer" ) ); return next.integer_value; } double Parser::parseReal() { if ( next_token.token_type == Token::integer ) { Token next( match( Token::integer, "Expected an integer or real" ) ); return static_cast< double >( next.integer_value ); } Token next( match( Token::real, "Expected an integer or real" ) ); return next.real_value; } Vector const Parser::parseVector() { match( Token::left_bracket, "Expected a left bracket" ); double x = parseReal(); match( Token::comma, "Expected a comma" ); double y = parseReal(); match( Token::comma, "Expected a comma" ); double z = parseReal(); match( Token::right_bracket, "Expected a right bracket" ); return Vector( x, y, z ); } Point const Parser::parsePoint() { match( Token::left_bracket, "Expected a left bracket" ); double x = parseReal(); match( Token::comma, "Expected a comma" ); double y = parseReal(); match( Token::comma, "Expected a comma" ); double z = parseReal(); match( Token::right_bracket, "Expected a right bracket" ); return Point( x, y, z ); } Color const Parser::parseColor() { if ( peek( Token::left_bracket ) ) { double r = parseReal(); match( Token::comma, "Expected a comma" ); double g = parseReal(); match( Token::comma, "Expected a comma" ); double b = parseReal(); match( Token::right_bracket, "Expected a right bracket" ); return Color( r, g, b ); } double v = parseReal(); return Color( v, v, v ); } Camera *Parser::parsePinholeCamera() { Point eye( 0.0, 0.0, 0.0 ); Point lookat( 0.0, 1.0, 0.0 ); Vector up( 0.0, 0.0, 1.0 ); double hfov = 90.0; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "eye" ) ) eye = parsePoint(); else if ( peek( "lookat" ) ) lookat = parsePoint(); else if ( peek( "up" ) ) up = parseVector(); else if ( peek( "hfov" ) ) hfov = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `eye', `lookat', `up', `hfov' or }." ); } return new PinholeCamera( eye, lookat, up, hfov ); } Camera *Parser::parseCamera() { if ( peek( "pinhole" ) ) return parsePinholeCamera(); throwParseException( "Expected a camera type." ); return 0; } Background *Parser::parseConstantBackground() { Color color( 0.0, 0.0, 0.0 ); if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "color" ) ) color = parseColor(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `color' or }." ); } return new ConstantBackground( color ); } Background *Parser::parseBackground() { if ( peek( "constant" ) ) return parseConstantBackground(); throwParseException( "Expected a background type." ); return 0; } Light *Parser::parsePointLight() { Point position( 0.0, 0.0, 10.0 ); Color color( 1.0, 1.0, 1.0 ); if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "position" ) ) position = parsePoint(); else if ( peek( "color" ) ) color = parseColor(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `position', `color' or }." ); } return new PointLight( position, color ); } Light *Parser::parseLight() { if ( peek( "point" ) ) return parsePointLight(); throwParseException( "Expected a light type." ); return 0; } Sampler *Parser::parseSampler() { int spp = parseInteger(); if( peek("uniform") ) return new UniformSampler(spp); else if( peek("jitter") ) return new JitteredSampler(spp); else if( peek("multijitter") ) return new MultiJitteredSampler(spp); else if( peek("nrooks") ) return new NRooksSampler(spp); else if( peek("hammersley") ) return new HammersleySampler(spp); else throwParseException( "Expected `uniform' `jitter' `multijitter' `nrooks' `hammersley'" ); } Filter *Parser::parseFilter() { if( peek("box") ) return new BoxFilter(); else if( peek("triangle") ) return new TriangleFilter(); else if( peek("gaussian") ) { double std = parseReal(); return new GaussianFilter(std); } else if( peek("mitchell") ) return new MitchellFilter(); else if( peek("sinc") || peek("lanczos") ) return new WindowedSincFilter(); else throwParseException( "Expected `box' `triangle' `gaussian' `mitchell' `sinc' `lanczos'" ); } /* Texture *Parser::parseImageTexture() { string file = parseString(); Mapping* map; if(peek("sphere")) map = new SphericalMapping(); else throwParseException("Expected Sphere"); return new ImageTexture(file, map); }*/ Material *Parser::parseLambertianMaterial() { Color color( 1.0, 1.0, 1.0 ); double Kd = 0.6; double Ka = 0.3; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "color" ) ) color = parseColor(); else if ( peek( "Kd" ) ) Kd = parseReal(); else if ( peek( "Ka" ) ) Ka = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `color', `Kd', `Ka' or }." ); } return new LambertianMaterial( color, Kd, Ka ); } Material *Parser::parsePhongMaterial() { Color color( 1.0, 1.0, 1.0 ), highlight(0.0,0.0,0.0); double Kd = 0.6; double Ka = 0.3; double exponent = 1.0; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "color" ) ) color = parseColor(); else if ( peek( "Kd" ) ) Kd = parseReal(); else if ( peek( "Ka" ) ) Ka = parseReal(); else if ( peek( "highlight" ) ) highlight = parseColor(); else if ( peek( "exponent" ) ) exponent = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `color', `Kd', `Ka', `highlight', `exponent' or }." ); } return new PhongMaterial( color, Kd, Ka, highlight, exponent ); } Material *Parser::parsePhongImageMaterial() { Color color( 1.0, 1.0, 1.0 ), highlight(0.0,0.0,0.0); Texture *tex; double Kd = 0.6; double Ka = 0.3; double exponent = 1.0; string file = ""; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "file" ) || peek( "texture") ) file = parseString(); else if ( peek( "Kd" ) ) Kd = parseReal(); else if ( peek( "Ka" ) ) Ka = parseReal(); else if ( peek( "highlight" ) ) highlight = parseColor(); else if ( peek( "exponent" ) ) exponent = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `file/texture', `Kd', `Ka', `highlight', `exponent' or }." ); } return new PhongImageMaterial( file, Kd, Ka, highlight, exponent ); } Material *Parser::parseInvisibleMaterial() { return new InvisibleMaterial(); } Material *Parser::parsePhongMarbleMaterial() { double scale, tscale, fscale, lacunarity, gain; int octaves; Color color1( 1.0, 1.0, 1.0 ), color2(1.0,1.0,1.0), highlight(0.0,0.0,0.0); Texture *tex; double Kd = 0.6; double Ka = 0.3; double exponent = 1.0; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "color1" ) ) color1 = parseColor(); else if( peek( "color2" ) ) color2 = parseColor(); else if( peek( "scale" ) ) scale = parseReal(); else if(peek("tscale")) tscale = parseReal(); else if(peek("fscale")) fscale = parseReal(); else if(peek("lacunarity")) lacunarity = parseReal(); else if(peek("gain")) gain = parseReal(); else if(peek("octaves")) octaves = parseInteger(); else if ( peek( "Kd" ) ) Kd = parseReal(); else if ( peek( "Ka" ) ) Ka = parseReal(); else if ( peek( "highlight" ) ) highlight = parseColor(); else if ( peek( "exponent" ) ) exponent = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `file/texture', `Kd', `Ka', `highlight', `exponent' or }." ); } return new PhongMarble(color1, color2, scale, octaves, tscale, fscale, lacunarity, gain, Kd, Ka, highlight, exponent); } Material *Parser::parseMetalMaterial() { Color color( 1.0, 1.0, 1.0 ); double exponent = 1.0; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "color" ) ) color = parseColor(); else if ( peek( "exponent" ) ) exponent = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `color', `exponent' or }." ); } return new MetalMaterial( color, exponent ); } Material *Parser::parseCheckerMaterial() { Vector vector1, vector2; Point origin; double scale; Material *matl1, *matl2; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "origin" ) ) origin = parsePoint(); else if ( peek( "vector1" ) ) vector1 = parseVector(); else if ( peek( "vector2" ) ) vector2 = parseVector(); else if ( peek( "scale" ) ) scale = parseReal(); else if ( peek( "material1" ) ) matl1 = parseMaterial(); else if ( peek( "material2" ) ) matl2 = parseMaterial(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `origin', `vector1', `vector2', `material1', `material2' or }." ); } return new CheckerMaterial( origin, vector1, vector2, scale, matl1, matl2); } Material *Parser::parseTestFunctionMaterial() { return new TestFunctionMaterial(); } Material *Parser::parseDielectricMaterial() { double eta = 1.0; double exponent = 1.0; Color atten(0.0,0.0,0.0); if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "eta" ) ) eta = parseReal(); else if ( peek( "exponent" ) ) exponent = parseReal(); else if ( peek( "attenuation" ) ) atten = parseColor(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `eta', `exponent' or }." ); } return new DielectricMaterial( eta, exponent, atten ); } Material *Parser::parsePhongDielectricImageMaterial() { Color colormask(0.0,0.0,0.0); string file; double maskrange; DielectricMaterial *dielectric; PhongMaterial *phong; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "file" ) ) file = parseString(); else if ( peek( "colormask" ) ) colormask = parseColor(); else if ( peek( "maskrange" ) ) maskrange = parseReal(); else if ( peek( "dielectric" ) ) { double eta = 1.0; double exponent = 1.0; Color atten(0.0,0.0,0.0); if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "eta" ) ) eta = parseReal(); else if ( peek( "exponent" ) ) exponent = parseReal(); else if ( peek( "attenuation" ) ) atten = parseColor(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `eta', `exponent' or }." ); } dielectric = new DielectricMaterial(eta, exponent, atten); } else if( peek( "phong" ) ) { Color color( 1.0, 1.0, 1.0 ), highlight(0.0,0.0,0.0); double Kd = 0.6; double Ka = 0.3; double exponent = 1.0; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "color" ) ) color = parseColor(); else if ( peek( "Kd" ) ) Kd = parseReal(); else if ( peek( "Ka" ) ) Ka = parseReal(); else if ( peek( "highlight" ) ) highlight = parseColor(); else if ( peek( "exponent" ) ) exponent = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `color', `Kd', `Ka', `highlight', `exponent' or }." ); } phong = new PhongMaterial( color, Kd, Ka, highlight, exponent ); } else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected file, colormask, dielectric, phong or }." ); } return new PhongDielectricImage(file, colormask, maskrange, phong, dielectric); } Material *Parser::parseTileMaterial() { Vector vector1, vector2; double groutWidth, scale; Material *matlTile, *matlGrout; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "vector1" ) ) vector1 = parseVector(); else if ( peek( "vector2" ) ) vector2 = parseVector(); else if ( peek( "groutwidth")) groutWidth = parseReal(); else if ( peek( "scale" ) ) scale = parseReal(); else if ( peek( "groutmaterial" ) ) matlGrout = parseMaterial(); else if ( peek( "tilematerial" ) ) matlTile = parseMaterial(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `vector1', `vector2', `scale', `groutwidth', `groutmaterial1', `tilematerial' or }." ); } return new TileMaterial( vector1, vector2, scale, groutWidth, matlTile, matlGrout); } Material *Parser::parseMaterial() { if ( peek( "lambertian" ) ) return parseLambertianMaterial(); else if( peek("phong")) return parsePhongMaterial(); else if( peek("phongimage")) return parsePhongImageMaterial(); else if( peek("phongmarble")) return parsePhongMarbleMaterial(); else if( peek("phongdielectricimage")) return parsePhongDielectricImageMaterial(); else if( peek("dielectric")) return parseDielectricMaterial(); else if( peek("metal")) return parseMetalMaterial(); else if( peek("testfunction")) return parseTestFunctionMaterial(); else if( peek("checker")) return parseCheckerMaterial(); else if( peek("tile")) return parseTileMaterial(); else if( peek("invisible") ) return parseInvisibleMaterial(); else if ( next_token.token_type == Token::string ) { map< string, Material * >::iterator found = defined_materials.find( parseString() ); if ( found != defined_materials.end() ) return ( *found ).second; } throwParseException( "Expected an material type." ); return 0; } Object *Parser::parseGroupObject() { Group *group = new Group(); match( Token::left_brace, "Expected a left brace" ); while ( !peek( Token::right_brace ) ) group->addObject( parseObject() ); return group; } Object *Parser::parsePlaneObject() { Material *material = default_material; Vector normal( 0.0, 0.0, 1.0 ); Point point( 0.0, 0.0, 0.0 ); if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "material" ) ) material = parseMaterial(); else if ( peek( "normal" ) ) normal = parseVector(); else if ( peek( "point" ) ) point = parsePoint(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `material', `point', `normal' or }." ); } return new Plane( material, normal, point ); } Object *Parser::parseSphereObject() { Material *material = default_material; Point center( 0.0, 0.0, 0.0 ); double radius = 0.5; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "material" ) ) material = parseMaterial(); else if ( peek( "center" ) ) center = parsePoint(); else if ( peek( "radius" ) ) radius = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `material', `center', `radius' or }." ); } return new Sphere( material, center, radius ); } Object *Parser::parseSpherePolarObject() { Material *material = default_material; Point center( 0.0, 0.0, 0.0 ); double radius = 0.5; Vector pole, meridian; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "material" ) ) material = parseMaterial(); else if ( peek( "center" ) ) center = parsePoint(); else if ( peek( "radius" ) ) radius = parseReal(); else if ( peek( "pole" ) ) pole = parseVector(); else if ( peek( "meridian" ) ) meridian = parseVector(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `material', `center', `radius' `pole' `meridian' or }." ); } return new SpherePolar( material, center, radius, pole, meridian ); } Object *Parser::parseBoxObject() { Material *material = default_material; Point corner1( 0.0, 0.0, 0.0 ), corner2(0.0,0.0,0.0); if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "material" ) ) material = parseMaterial(); else if ( peek( "corner1" ) ) corner1 = parsePoint(); else if ( peek( "corner2" ) ) corner2 = parsePoint(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `material', `corner1', `corner2' or }." ); } return new Box( material, corner1, corner2 ); } Object *Parser::parseTriangleObject() { Material *material = default_material; Point corner1( 0.0, 0.0, 0.0 ), corner2(0.0,0.0,0.0), corner3(0.0, 0.0, 0.0); if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "material" ) ) material = parseMaterial(); else if ( peek( "corner1" ) ) corner1 = parsePoint(); else if ( peek( "corner2" ) ) corner2 = parsePoint(); else if ( peek( "corner3" ) ) corner3 = parsePoint(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `material', `corner1', `corner2', 'corner3' or }." ); } return new Triangle( material, corner1, corner2, corner3 ); } Object *Parser::parseRingObject() { Material *material = default_material; Point center( 0.0, 0.0, 0.0 ); Vector normal(0.0,0.0,0.0); double outerRingRadius, innerRingRadius; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "material" ) ) material = parseMaterial(); else if ( peek( "center" ) ) center = parsePoint(); else if ( peek( "normal" ) ) normal = parseVector(); else if ( peek( "radius1" ) ) innerRingRadius = parseReal(); else if ( peek( "radius2" ) ) outerRingRadius = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `material', `Center', `Normal', 'Inner Radius', 'Outer Radius' or }." ); } return new Ring( material, center, normal, innerRingRadius, outerRingRadius ); } Object *Parser::parseDiskObject() { Material *material = default_material; Point center( 0.0, 0.0, 0.0 ); Vector normal(0.0,0.0,0.0); double radius; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "material" ) ) material = parseMaterial(); else if ( peek( "center" ) ) center = parsePoint(); else if ( peek( "normal" ) ) normal = parseVector(); else if ( peek( "radius" ) ) radius = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `material', `Center', `Normal', 'Radius', or }." ); } return new Disk( material, center, normal, radius ); } Object *Parser::parseTorusObject() { Material *material = default_material; Point center( 0.0, 0.0, 0.0 ); Vector normal(0.0,0.0,0.0); double radius, tubeRadius; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "material" ) ) material = parseMaterial(); else if ( peek( "center" ) ) center = parsePoint(); else if ( peek( "normal" ) ) normal = parseVector(); else if ( peek( "radius" ) ) radius = parseReal(); else if ( peek( "tubeRadius" ) ) tubeRadius = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `material', `Center', `Normal', 'Radius', 'Tube Radius' or }." ); } return new Torus( material, center, normal, radius, tubeRadius ); } Object *Parser::parseRectangleObject() { Material *material = default_material; Point p( 0.0, 0.0, 0.0 ), corner1(0.0, 0.0, 0.0), corner2(0.0,0.0,0.0); if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "material" ) ) material = parseMaterial(); else if ( peek( "pointp" ) ) p = parsePoint(); else if ( peek( "corner1" ) ) corner1 = parsePoint(); else if ( peek( "corner2" ) ) corner2 = parsePoint(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `material', `pointp', `corner1', 'corner2' or }." ); } return new Rectangle( material, p, corner1, corner2); } Object *Parser::parseCylinderObject() { Material *material = default_material; Point center( 0.0, 0.0, 0.0 ); double height, radius; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "material" ) ) material = parseMaterial(); else if ( peek( "center" ) ) center = parsePoint(); else if ( peek( "height" ) ) height = parseReal(); else if ( peek( "radius" ) ) radius = parseReal(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `material', `Center', `height', 'Radius' or }." ); } return new Cylinder( material, center, height, radius); } Object *Parser::parseHeightfieldObject() { Material *material = default_material; Point corner1( 0.0, 0.0, 0.0 ), corner2(0.0, 0.0, 0.0); string file; if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "material" ) ) material = parseMaterial(); else if ( peek( "file" ) ) file = parseString(); else if ( peek( "corner1" ) ) corner1 = parsePoint(); else if ( peek( "corner2" ) ) corner2 = parsePoint(); else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `material', `file', `corner1', 'corner2' or }." ); } return new Heightfield( material,file, corner1, corner2); } Object *Parser::parseInstance() { Object *obj = NULL; Instance *instance = new Instance(); if ( peek( Token::left_brace ) ) for ( ; ; ) { if ( peek( "object" ) ) obj = parseObject(); else if ( peek( "translate" ) ) { Vector vec = parseVector(); instance->translate(vec); } else if ( peek( "scale" ) ) { Vector vec = parseVector(); instance->scale(vec); } else if ( peek( "rotatex" )) { double r = parseReal(); instance->rotateX(r); } else if ( peek( "rotatey" )) { double r = parseReal(); instance->rotateY(r); } else if ( peek( "rotatez" )) { double r = parseReal(); instance->rotateZ(r); } else if ( peek( Token::right_brace ) ) break; else throwParseException( "Expected `object', `translate', `scale', 'rotateX/Y/Z' or }." ); } if(obj == NULL) throwParseException("No object in the instance!"); else instance->setObject(obj); return instance; } Object *Parser::parseObject() { if ( peek( "group" ) ) return parseGroupObject(); else if ( peek( "plane" ) ) return parsePlaneObject(); else if ( peek( "sphere" ) ) return parseSphereObject(); else if ( peek( "box" ) ) return parseBoxObject(); else if ( peek( "disk" ) ) return parseDiskObject(); else if ( peek( "ring" ) ) return parseRingObject(); else if ( peek( "triangle" ) ) return parseTriangleObject(); else if ( peek( "torus" ) ) return parseTorusObject(); else if ( peek( "rectangle" ) ) return parseRectangleObject(); else if ( peek( "cylinder" ) ) return parseCylinderObject(); else if ( peek( "heightfield" ) ) return parseHeightfieldObject(); else if ( peek( "spherepolar" ) ) return parseSpherePolarObject(); else if ( peek( "instance" ) ) return parseInstance(); else if ( next_token.token_type == Token::string ) { map< string, Object * >::iterator found = defined_objects.find( parseString() ); if ( found != defined_objects.end() ) return ( *found ).second; } throwParseException( "Expected an object type." ); return 0; } Parser::Parser( istream &input ) : input( input ), line_number( 1 ), column_number( 0 ), default_material( new LambertianMaterial( Color( 1.0, 1.0, 1.0 ), 0.6, 0.3 ) ) { readNextToken(); } Scene *Parser::parseScene( string &filename ) { // filename = "image.ppm"; int xres = 512; int yres = 512; Scene *scene = new Scene(); for ( ; ; ) { if ( peek( "filename" ) ) filename = parseString(); else if ( peek( "xres" ) ) xres = parseInteger(); else if ( peek( "yres" ) ) yres = parseInteger(); else if ( peek( "maxraydepth" ) ) scene->setMaxRayDepth( parseInteger() ); else if ( peek( "minattenuation" ) ) scene->setMinAttenuation( parseReal() ); else if ( peek( "camera" ) ) scene->setCamera( parseCamera() ); else if ( peek( "sampler" ) ) scene->setSampler( parseSampler() ); else if ( peek( "filter" ) ) scene->setFilter( parseFilter() ); else if ( peek( "background" ) ) scene->setBackground( parseBackground() ); else if ( peek( "ambient" ) ) scene->setAmbient( parseColor() ); else if ( peek( "light" ) ) scene->addLight( parseLight() ); else if ( peek( "scene" ) ) scene->setObject( parseObject() ); else if ( peek( "define" ) ) { if ( peek( "material" ) ) { string name( parseString() ); defined_materials.insert( pair< string, Material * >( name, parseMaterial() ) ); } else if ( peek( "object" ) ) { string name( parseString() ); defined_objects.insert( pair< string, Object * >( name, parseObject() ) ); } else throwParseException( "Expected `material', or `object'" ); } else if ( peek( Token::end_of_file ) ) break; else throwParseException( "Expected `filename', `xres', `yres', `maxraydepth', `minattenuation', " "`camera', `background', `ambient', `light', `scene', or `define'." ); } scene->setImage( new Image( xres, yres ) ); if(!scene->getSampler()) scene->setSampler(new UniformSampler(1)); if(!scene->getFilter()) scene->setFilter(new BoxFilter()); return scene; }
[ [ [ 1, 1264 ] ] ]
c71799fba82e70cb1b9824a1d02a2bb852f25f53
ccd91bc2a2a3923499f7ab55505efd6322fc9221
/include/opencv2/gpu/gpu.hpp
8c9614d6749346057d04a75667099a2b24f573da
[]
no_license
herbyme/pkmDetector
2de4972fd5125049fc28d3f190d2b49f7c66ab78
14c7670f5d33b969debcc56cee1309cb2c5451b4
refs/heads/master
2021-01-16T20:37:00.951404
2011-02-11T23:01:45
2011-02-11T23:01:45
null
0
0
null
null
null
null
WINDOWS-1250
C++
false
false
35,710
hpp
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other GpuMaterials provided with the distribution. // // * The name of the copyright holders may not 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 Intel Corporation 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. // //M*/ #ifndef __OPENCV_GPU_HPP__ #define __OPENCV_GPU_HPP__ #include <vector> #include "opencv2/core/core.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/gpu/devmem2d.hpp" namespace cv { namespace gpu { //////////////////////////////// Initialization //////////////////////// //! This is the only function that do not throw exceptions if the library is compiled without Cuda. CV_EXPORTS int getCudaEnabledDeviceCount(); //! Functions below throw cv::Expception if the library is compiled without Cuda. CV_EXPORTS string getDeviceName(int device); CV_EXPORTS void setDevice(int device); CV_EXPORTS int getDevice(); CV_EXPORTS void getComputeCapability(int device, int& major, int& minor); CV_EXPORTS int getNumberOfSMs(int device); CV_EXPORTS void getGpuMemInfo(size_t& free, size_t& total); //////////////////////////////// GpuMat //////////////////////////////// class Stream; class CudaMem; //! Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat. class CV_EXPORTS GpuMat { public: //! default constructor GpuMat(); //! constructs GpuMatrix of the specified size and type // (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.) GpuMat(int _rows, int _cols, int _type); GpuMat(Size _size, int _type); //! constucts GpuMatrix and fills it with the specified value _s. GpuMat(int _rows, int _cols, int _type, const Scalar& _s); GpuMat(Size _size, int _type, const Scalar& _s); //! copy constructor GpuMat(const GpuMat& m); //! constructor for GpuMatrix headers pointing to user-allocated data GpuMat(int _rows, int _cols, int _type, void* _data, size_t _step = Mat::AUTO_STEP); GpuMat(Size _size, int _type, void* _data, size_t _step = Mat::AUTO_STEP); //! creates a matrix header for a part of the bigger matrix GpuMat(const GpuMat& m, const Range& rowRange, const Range& colRange); GpuMat(const GpuMat& m, const Rect& roi); //! builds GpuMat from Mat. Perfom blocking upload to device. explicit GpuMat (const Mat& m); //! destructor - calls release() ~GpuMat(); //! assignment operators GpuMat& operator = (const GpuMat& m); //! assignment operator. Perfom blocking upload to device. GpuMat& operator = (const Mat& m); //! returns lightweight DevMem2D_ structure for passing to nvcc-compiled code. // Contains just image size, data ptr and step. template <class T> operator DevMem2D_<T>() const; //! pefroms blocking upload data to GpuMat. . void upload(const cv::Mat& m); //! upload async void upload(const CudaMem& m, Stream& stream); //! downloads data from device to host memory. Blocking calls. operator Mat() const; void download(cv::Mat& m) const; //! download async void download(CudaMem& m, Stream& stream) const; //! returns a new GpuMatrix header for the specified row GpuMat row(int y) const; //! returns a new GpuMatrix header for the specified column GpuMat col(int x) const; //! ... for the specified row span GpuMat rowRange(int startrow, int endrow) const; GpuMat rowRange(const Range& r) const; //! ... for the specified column span GpuMat colRange(int startcol, int endcol) const; GpuMat colRange(const Range& r) const; //! returns deep copy of the GpuMatrix, i.e. the data is copied GpuMat clone() const; //! copies the GpuMatrix content to "m". // It calls m.create(this->size(), this->type()). void copyTo( GpuMat& m ) const; //! copies those GpuMatrix elements to "m" that are marked with non-zero mask elements. void copyTo( GpuMat& m, const GpuMat& mask ) const; //! converts GpuMatrix to another datatype with optional scalng. See cvConvertScale. void convertTo( GpuMat& m, int rtype, double alpha=1, double beta=0 ) const; void assignTo( GpuMat& m, int type=-1 ) const; //! sets every GpuMatrix element to s GpuMat& operator = (const Scalar& s); //! sets some of the GpuMatrix elements to s, according to the mask GpuMat& setTo(const Scalar& s, const GpuMat& mask=GpuMat()); //! creates alternative GpuMatrix header for the same data, with different // number of channels and/or different number of rows. see cvReshape. GpuMat reshape(int _cn, int _rows=0) const; //! allocates new GpuMatrix data unless the GpuMatrix already has specified size and type. // previous data is unreferenced if needed. void create(int _rows, int _cols, int _type); void create(Size _size, int _type); //! decreases reference counter; // deallocate the data when reference counter reaches 0. void release(); //! swaps with other smart pointer void swap(GpuMat& mat); //! locates GpuMatrix header within a parent GpuMatrix. See below void locateROI( Size& wholeSize, Point& ofs ) const; //! moves/resizes the current GpuMatrix ROI inside the parent GpuMatrix. GpuMat& adjustROI( int dtop, int dbottom, int dleft, int dright ); //! extracts a rectangular sub-GpuMatrix // (this is a generalized form of row, rowRange etc.) GpuMat operator()( Range rowRange, Range colRange ) const; GpuMat operator()( const Rect& roi ) const; //! returns true iff the GpuMatrix data is continuous // (i.e. when there are no gaps between successive rows). // similar to CV_IS_GpuMat_CONT(cvGpuMat->type) bool isContinuous() const; //! returns element size in bytes, // similar to CV_ELEM_SIZE(cvMat->type) size_t elemSize() const; //! returns the size of element channel in bytes. size_t elemSize1() const; //! returns element type, similar to CV_MAT_TYPE(cvMat->type) int type() const; //! returns element type, similar to CV_MAT_DEPTH(cvMat->type) int depth() const; //! returns element type, similar to CV_MAT_CN(cvMat->type) int channels() const; //! returns step/elemSize1() size_t step1() const; //! returns GpuMatrix size: // width == number of columns, height == number of rows Size size() const; //! returns true if GpuMatrix data is NULL bool empty() const; //! returns pointer to y-th row uchar* ptr(int y=0); const uchar* ptr(int y=0) const; //! template version of the above method template<typename _Tp> _Tp* ptr(int y=0); template<typename _Tp> const _Tp* ptr(int y=0) const; //! matrix transposition GpuMat t() const; /*! includes several bit-fields: - the magic signature - continuity flag - depth - number of channels */ int flags; //! the number of rows and columns int rows, cols; //! a distance between successive rows in bytes; includes the gap if any size_t step; //! pointer to the data uchar* data; //! pointer to the reference counter; // when GpuMatrix points to user-allocated data, the pointer is NULL int* refcount; //! helper fields used in locateROI and adjustROI uchar* datastart; uchar* dataend; }; //////////////////////////////// CudaMem //////////////////////////////// // CudaMem is limited cv::Mat with page locked memory allocation. // Page locked memory is only needed for async and faster coping to GPU. // It is convertable to cv::Mat header without reference counting // so you can use it with other opencv functions. class CV_EXPORTS CudaMem { public: enum { ALLOC_PAGE_LOCKED = 1, ALLOC_ZEROCOPY = 2, ALLOC_WRITE_COMBINED = 4 }; CudaMem(); CudaMem(const CudaMem& m); CudaMem(int _rows, int _cols, int _type, int _alloc_type = ALLOC_PAGE_LOCKED); CudaMem(Size _size, int _type, int _alloc_type = ALLOC_PAGE_LOCKED); //! creates from cv::Mat with coping data explicit CudaMem(const Mat& m, int _alloc_type = ALLOC_PAGE_LOCKED); ~CudaMem(); CudaMem& operator = (const CudaMem& m); //! returns deep copy of the matrix, i.e. the data is copied CudaMem clone() const; //! allocates new matrix data unless the matrix already has specified size and type. void create(int _rows, int _cols, int _type, int _alloc_type = ALLOC_PAGE_LOCKED); void create(Size _size, int _type, int _alloc_type = ALLOC_PAGE_LOCKED); //! decrements reference counter and released memory if needed. void release(); //! returns matrix header with disabled reference counting for CudaMem data. Mat createMatHeader() const; operator Mat() const; //! maps host memory into device address space and returns GpuMat header for it. Throws exception if not supported by hardware. GpuMat createGpuMatHeader() const; operator GpuMat() const; //returns if host memory can be mapperd to gpu address space; static bool can_device_map_to_host(); // Please see cv::Mat for descriptions bool isContinuous() const; size_t elemSize() const; size_t elemSize1() const; int type() const; int depth() const; int channels() const; size_t step1() const; Size size() const; bool empty() const; // Please see cv::Mat for descriptions int flags; int rows, cols; size_t step; uchar* data; int* refcount; uchar* datastart; uchar* dataend; int alloc_type; }; //////////////////////////////// CudaStream //////////////////////////////// // Encapculates Cuda Stream. Provides interface for async coping. // Passed to each function that supports async kernel execution. // Reference counting is enabled class CV_EXPORTS Stream { public: Stream(); ~Stream(); Stream(const Stream&); Stream& operator=(const Stream&); bool queryIfComplete(); void waitForCompletion(); //! downloads asynchronously. // Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its subMat) void enqueueDownload(const GpuMat& src, CudaMem& dst); void enqueueDownload(const GpuMat& src, Mat& dst); //! uploads asynchronously. // Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its ROI) void enqueueUpload(const CudaMem& src, GpuMat& dst); void enqueueUpload(const Mat& src, GpuMat& dst); void enqueueCopy(const GpuMat& src, GpuMat& dst); void enqueueMemSet(const GpuMat& src, Scalar val); void enqueueMemSet(const GpuMat& src, Scalar val, const GpuMat& mask); // converts matrix type, ex from float to uchar depending on type void enqueueConvert(const GpuMat& src, GpuMat& dst, int type, double a = 1, double b = 0); private: void create(); void release(); struct Impl; Impl *impl; friend struct StreamAccessor; }; ////////////////////////////// Arithmetics /////////////////////////////////// //! adds one matrix to another (c = a + b) //! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types CV_EXPORTS void add(const GpuMat& a, const GpuMat& b, GpuMat& c); //! adds scalar to a matrix (c = a + s) //! supports only CV_32FC1 type CV_EXPORTS void add(const GpuMat& a, const Scalar& sc, GpuMat& c); //! subtracts one matrix from another (c = a - b) //! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types CV_EXPORTS void subtract(const GpuMat& a, const GpuMat& b, GpuMat& c); //! subtracts scalar from a matrix (c = a - s) //! supports only CV_32FC1 type CV_EXPORTS void subtract(const GpuMat& a, const Scalar& sc, GpuMat& c); //! computes element-wise product of the two arrays (c = a * b) //! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types CV_EXPORTS void multiply(const GpuMat& a, const GpuMat& b, GpuMat& c); //! multiplies matrix to a scalar (c = a * s) //! supports only CV_32FC1 type CV_EXPORTS void multiply(const GpuMat& a, const Scalar& sc, GpuMat& c); //! computes element-wise quotient of the two arrays (c = a / b) //! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types CV_EXPORTS void divide(const GpuMat& a, const GpuMat& b, GpuMat& c); //! computes element-wise quotient of matrix and scalar (c = a / s) //! supports only CV_32FC1 type CV_EXPORTS void divide(const GpuMat& a, const Scalar& sc, GpuMat& c); //! transposes the matrix //! supports only CV_8UC1 type CV_EXPORTS void transpose(const GpuMat& src1, GpuMat& dst); //! computes element-wise absolute difference of two arrays (c = abs(a - b)) //! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types CV_EXPORTS void absdiff(const GpuMat& a, const GpuMat& b, GpuMat& c); //! computes element-wise absolute difference of array and scalar (c = abs(a - s)) //! supports only CV_32FC1 type CV_EXPORTS void absdiff(const GpuMat& a, const Scalar& s, GpuMat& c); //! compares elements of two arrays (c = a <cmpop> b) //! supports CV_8UC4, CV_32FC1 types CV_EXPORTS void compare(const GpuMat& a, const GpuMat& b, GpuMat& c, int cmpop); //! computes mean value and standard deviation of all or selected array elements //! supports only CV_8UC1 type CV_EXPORTS void meanStdDev(const GpuMat& mtx, Scalar& mean, Scalar& stddev); //! computes norm of array //! supports NORM_INF, NORM_L1, NORM_L2 //! supports only CV_8UC1 type CV_EXPORTS double norm(const GpuMat& src1, int normType=NORM_L2); //! computes norm of the difference between two arrays //! supports NORM_INF, NORM_L1, NORM_L2 //! supports only CV_8UC1 type CV_EXPORTS double norm(const GpuMat& src1, const GpuMat& src2, int normType=NORM_L2); //! reverses the order of the rows, columns or both in a matrix //! supports CV_8UC1, CV_8UC4 types CV_EXPORTS void flip(const GpuMat& a, GpuMat& b, int flipCode); //! computes sum of array elements //! supports CV_8UC1, CV_8UC4 types CV_EXPORTS Scalar sum(const GpuMat& m); //! finds global minimum and maximum array elements and returns their values //! supports only CV_8UC1 type CV_EXPORTS void minMax(const GpuMat& src, double* minVal, double* maxVal = 0); //! transforms 8-bit unsigned integers using lookup table: dst(i)=lut(src(i)) //! destination array will have the depth type as lut and the same channels number as source //! supports CV_8UC1, CV_8UC3 types CV_EXPORTS void LUT(const GpuMat& src, const Mat& lut, GpuMat& dst); //! makes multi-channel array out of several single-channel arrays CV_EXPORTS void merge(const GpuMat* src, size_t n, GpuMat& dst); //! makes multi-channel array out of several single-channel arrays CV_EXPORTS void merge(const vector<GpuMat>& src, GpuMat& dst); //! makes multi-channel array out of several single-channel arrays (async version) CV_EXPORTS void merge(const GpuMat* src, size_t n, GpuMat& dst, const Stream& stream); //! makes multi-channel array out of several single-channel arrays (async version) CV_EXPORTS void merge(const vector<GpuMat>& src, GpuMat& dst, const Stream& stream); //! copies each plane of a multi-channel array to a dedicated array CV_EXPORTS void split(const GpuMat& src, GpuMat* dst); //! copies each plane of a multi-channel array to a dedicated array CV_EXPORTS void split(const GpuMat& src, vector<GpuMat>& dst); //! copies each plane of a multi-channel array to a dedicated array (async version) CV_EXPORTS void split(const GpuMat& src, GpuMat* dst, const Stream& stream); //! copies each plane of a multi-channel array to a dedicated array (async version) CV_EXPORTS void split(const GpuMat& src, vector<GpuMat>& dst, const Stream& stream); //! computes exponent of each matrix element (b = e**a) //! supports only CV_32FC1 type CV_EXPORTS void exp(const GpuMat& a, GpuMat& b); //! computes natural logarithm of absolute value of each matrix element: b = log(abs(a)) //! supports only CV_32FC1 type CV_EXPORTS void log(const GpuMat& a, GpuMat& b); //! computes magnitude (magnitude(i)) of each (x(i), y(i)) vector CV_EXPORTS void magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude); //! computes magnitude (magnitude(i)) of complex (x(i).re, x(i).im) vector CV_EXPORTS void magnitude(const GpuMat& x, GpuMat& magnitude); ////////////////////////////// Image processing ////////////////////////////// //! DST[x,y] = SRC[xmap[x,y],ymap[x,y]] with bilinear interpolation. //! supports CV_8UC1, CV_8UC3 source types and CV_32FC1 map type CV_EXPORTS void remap(const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap); //! Does mean shift filtering on GPU. CV_EXPORTS void meanShiftFiltering(const GpuMat& src, GpuMat& dst, int sp, int sr, TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1)); //! Does coloring of disparity image: [0..ndisp) -> [0..240, 1, 1] in HSV. //! Supported types of input disparity: CV_8U, CV_16S. //! Output disparity has CV_8UC4 type in BGRA format (alpha = 255). CV_EXPORTS void drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp); //! Acync version CV_EXPORTS void drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp, const Stream& stream); //! Reprojects disparity image to 3D space. //! Supports CV_8U and CV_16S types of input disparity. //! The output is a 4-channel floating-point (CV_32FC4) matrix. //! Each element of this matrix will contain the 3D coordinates of the point (x,y,z,1), computed from the disparity map. //! Q is the 4x4 perspective transformation matrix that can be obtained with cvStereoRectify. CV_EXPORTS void reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q); //! Acync version CV_EXPORTS void reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q, const Stream& stream); //! converts image from one color space to another CV_EXPORTS void cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn = 0); //! Acync version CV_EXPORTS void cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn, const Stream& stream); //! applies fixed threshold to the image. //! Now supports only THRESH_TRUNC threshold type and one channels float source. CV_EXPORTS double threshold(const GpuMat& src, GpuMat& dst, double thresh); //! resizes the image //! Supports INTER_NEAREST, INTER_LINEAR //! supports CV_8UC1, CV_8UC4 types CV_EXPORTS void resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR); //! warps the image using affine transformation //! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC CV_EXPORTS void warpAffine(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR); //! warps the image using perspective transformation //! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC CV_EXPORTS void warpPerspective(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR); //! rotate 8bit single or four channel image //! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC //! supports CV_8UC1, CV_8UC4 types CV_EXPORTS void rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, double xShift = 0, double yShift = 0, int interpolation = INTER_LINEAR); //! copies 2D array to a larger destination array and pads borders with user-specifiable constant //! supports CV_8UC1, CV_8UC4, CV_32SC1 types CV_EXPORTS void copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value = Scalar()); //! computes the integral image and integral for the squared image //! sum will have CV_32S type, sqsum - CV32F type //! supports only CV_32FC1 source type CV_EXPORTS void integral(GpuMat& src, GpuMat& sum, GpuMat& sqsum); //! smooths the image using the normalized box filter //! supports CV_8UC1, CV_8UC4 types and kernel size 3, 5, 7 CV_EXPORTS void boxFilter(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1)); //! a synonym for normalized box filter static inline void blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1)) { boxFilter(src, dst, ksize, anchor); } //! erodes the image (applies the local minimum operator) CV_EXPORTS void erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor, int iterations); //! dilates the image (applies the local maximum operator) CV_EXPORTS void dilate( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor, int iterations); //! applies an advanced morphological operation to the image CV_EXPORTS void morphologyEx( const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor, int iterations); //////////////////////////////// Image Labeling //////////////////////////////// //!performs labeling via graph cuts CV_EXPORTS void graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTransp, GpuMat& top, GpuMat& bottom, GpuMat& labels, GpuMat& buf); //////////////////////////////// StereoBM_GPU //////////////////////////////// class CV_EXPORTS StereoBM_GPU { public: enum { BASIC_PRESET = 0, PREFILTER_XSOBEL = 1 }; enum { DEFAULT_NDISP = 64, DEFAULT_WINSZ = 19 }; //! the default constructor StereoBM_GPU(); //! the full constructor taking the camera-specific preset, number of disparities and the SAD window size. ndisparities must be multiple of 8. StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP, int winSize = DEFAULT_WINSZ); //! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair //! Output disparity has CV_8U type. void operator() ( const GpuMat& left, const GpuMat& right, GpuMat& disparity); //! Acync version void operator() ( const GpuMat& left, const GpuMat& right, GpuMat& disparity, const Stream & stream); //! Some heuristics that tries to estmate // if current GPU will be faster then CPU in this algorithm. // It queries current active device. static bool checkIfGpuCallReasonable(); int ndisp; int winSize; int preset; // If avergeTexThreshold == 0 => post procesing is disabled // If avergeTexThreshold != 0 then disparity is set 0 in each point (x,y) where for left image // SumOfHorizontalGradiensInWindow(x, y, winSize) < (winSize * winSize) * avergeTexThreshold // i.e. input left image is low textured. float avergeTexThreshold; private: GpuMat minSSD, leBuf, riBuf; }; ////////////////////////// StereoBeliefPropagation /////////////////////////// // "Efficient Belief Propagation for Early Vision" // P.Felzenszwalb class CV_EXPORTS StereoBeliefPropagation { public: enum { DEFAULT_NDISP = 64 }; enum { DEFAULT_ITERS = 5 }; enum { DEFAULT_LEVELS = 5 }; static void estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels); //! the default constructor explicit StereoBeliefPropagation(int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int msg_type = CV_32F); //! the full constructor taking the number of disparities, number of BP iterations on each level, //! number of levels, truncation of data cost, data weight, //! truncation of discontinuity cost and discontinuity single jump //! DataTerm = data_weight * min(fabs(I2-I1), max_data_term) //! DiscTerm = min(disc_single_jump * fabs(f1-f2), max_disc_term) //! please see paper for more details StereoBeliefPropagation(int ndisp, int iters, int levels, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int msg_type = CV_32F); //! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair, //! if disparity is empty output type will be CV_16S else output type will be disparity.type(). void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity); //! Acync version void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream); //! version for user specified data term void operator()(const GpuMat& data, GpuMat& disparity); void operator()(const GpuMat& data, GpuMat& disparity, Stream& stream); int ndisp; int iters; int levels; float max_data_term; float data_weight; float max_disc_term; float disc_single_jump; int msg_type; private: GpuMat u, d, l, r, u2, d2, l2, r2; std::vector<GpuMat> datas; GpuMat out; }; /////////////////////////// StereoConstantSpaceBP /////////////////////////// // "A Constant-Space Belief Propagation Algorithm for Stereo Matching" // Qingxiong Yang, Liang Wang†, Narendra Ahuja // http://vision.ai.uiuc.edu/~qyang6/ class CV_EXPORTS StereoConstantSpaceBP { public: enum { DEFAULT_NDISP = 128 }; enum { DEFAULT_ITERS = 8 }; enum { DEFAULT_LEVELS = 4 }; enum { DEFAULT_NR_PLANE = 4 }; static void estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels, int& nr_plane); //! the default constructor explicit StereoConstantSpaceBP(int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int nr_plane = DEFAULT_NR_PLANE, int msg_type = CV_32F); //! the full constructor taking the number of disparities, number of BP iterations on each level, //! number of levels, number of active disparity on the first level, truncation of data cost, data weight, //! truncation of discontinuity cost, discontinuity single jump and minimum disparity threshold StereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int min_disp_th = 0, int msg_type = CV_32F); //! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair, //! if disparity is empty output type will be CV_16S else output type will be disparity.type(). void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity); //! Acync version void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream); int ndisp; int iters; int levels; int nr_plane; float max_data_term; float data_weight; float max_disc_term; float disc_single_jump; int min_disp_th; int msg_type; bool use_local_init_data_cost; private: GpuMat u[2], d[2], l[2], r[2]; GpuMat disp_selected_pyr[2]; GpuMat data_cost; GpuMat data_cost_selected; GpuMat temp; GpuMat out; }; /////////////////////////// DisparityBilateralFilter /////////////////////////// // Disparity map refinement using joint bilateral filtering given a single color image. // Qingxiong Yang, Liang Wang†, Narendra Ahuja // http://vision.ai.uiuc.edu/~qyang6/ class CV_EXPORTS DisparityBilateralFilter { public: enum { DEFAULT_NDISP = 64 }; enum { DEFAULT_RADIUS = 3 }; enum { DEFAULT_ITERS = 1 }; //! the default constructor explicit DisparityBilateralFilter(int ndisp = DEFAULT_NDISP, int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS); //! the full constructor taking the number of disparities, filter radius, //! number of iterations, truncation of data continuity, truncation of disparity continuity //! and filter range sigma DisparityBilateralFilter(int ndisp, int radius, int iters, float edge_threshold, float max_disc_threshold, float sigma_range); //! the disparity map refinement operator. Refine disparity map using joint bilateral filtering given a single color image. //! disparity must have CV_8U or CV_16S type, image must have CV_8UC1 or CV_8UC3 type. void operator()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst); //! Acync version void operator()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst, Stream& stream); private: int ndisp; int radius; int iters; float edge_threshold; float max_disc_threshold; float sigma_range; GpuMat table_color; GpuMat table_space; }; } //! Speckle filtering - filters small connected components on diparity image. //! It sets pixel (x,y) to newVal if it coresponds to small CC with size < maxSpeckleSize. //! Threshold for border between CC is diffThreshold; CV_EXPORTS void filterSpeckles( Mat& img, uchar newVal, int maxSpeckleSize, uchar diffThreshold, Mat& buf); } #include "opencv2/gpu/matrix_operations.hpp" #endif /* __OPENCV_GPU_HPP__ */
[ [ [ 1, 755 ] ] ]
085b54a687f299c0142b8d11f2e9774e806786eb
c95a83e1a741b8c0eb810dd018d91060e5872dd8
/Game/ObjectDLL/ObjectShared/Trigger.cpp
a3c94106c66fa43a78f387a717d50764ac9f162a
[]
no_license
rickyharis39/nolf2
ba0b56e2abb076e60d97fc7a2a8ee7be4394266c
0da0603dc961e73ac734ff365bfbfb8abb9b9b04
refs/heads/master
2021-01-01T17:21:00.678517
2011-07-23T12:11:19
2011-07-23T12:11:19
38,495,312
1
0
null
null
null
null
UTF-8
C++
false
false
29,821
cpp
// ----------------------------------------------------------------------- // // // MODULE : Trigger.cpp // // PURPOSE : Trigger - Implementation // // CREATED : 10/6/97 // // (c) 1997-2002 Monolith Productions, Inc. All Rights Reserved // // ----------------------------------------------------------------------- // #include "stdafx.h" #include "Trigger.h" #include "iltserver.h" #include "MsgIds.h" #include "PlayerObj.h" #include "gameservershell.h" #include "SoundMgr.h" #include "ObjectMsgs.h" #include "ParsedMsg.h" #include "ServerSoundMgr.h" #include <stdio.h> #include "AIUtils.h" LINKFROM_MODULE( Trigger ); #pragma force_active on BEGIN_CLASS(Trigger) ADD_VECTORPROP_VAL_FLAG(Dims, 16.0f, 16.0f, 16.0f, PF_DIMS) ADD_LONGINTPROP(NumberOfActivations, 1) ADD_REALPROP(SendDelay, 0.0f) ADD_REALPROP(TriggerDelay, 0.0) PROP_DEFINEGROUP(Commands, PF_GROUP(1)) ADD_STRINGPROP_FLAG(Command1, "", PF_GROUP(1) | PF_NOTIFYCHANGE) ADD_STRINGPROP_FLAG(Command2, "", PF_GROUP(1) | PF_NOTIFYCHANGE) ADD_STRINGPROP_FLAG(Command3, "", PF_GROUP(1) | PF_NOTIFYCHANGE) ADD_STRINGPROP_FLAG(Command4, "", PF_GROUP(1) | PF_NOTIFYCHANGE) ADD_STRINGPROP_FLAG(Command5, "", PF_GROUP(1) | PF_NOTIFYCHANGE) ADD_STRINGPROP_FLAG(Command6, "", PF_GROUP(1) | PF_NOTIFYCHANGE) ADD_STRINGPROP_FLAG(Command7, "", PF_GROUP(1) | PF_NOTIFYCHANGE) ADD_STRINGPROP_FLAG(Command8, "", PF_GROUP(1) | PF_NOTIFYCHANGE) ADD_STRINGPROP_FLAG(Command9, "", PF_GROUP(1) | PF_NOTIFYCHANGE) ADD_STRINGPROP_FLAG(Command10, "", PF_GROUP(1) | PF_NOTIFYCHANGE) ADD_BOOLPROP(TriggerTouch, 0) ADD_STRINGPROP_FLAG(CommandTouch, "", PF_NOTIFYCHANGE) ADD_BOOLPROP(PlayerTriggerable, 1) ADD_STRINGPROP_FLAG(PlayerKey, "<None>", PF_STATICLIST) ADD_BOOLPROP(AITriggerable, 0) ADD_STRINGPROP(AITriggerName, "") ADD_BOOLPROP(BodyTriggerable, 0) ADD_STRINGPROP(BodyTriggerName, "") ADD_BOOLPROP(WeightedTrigger, LTFALSE) ADD_REALPROP(Message1Weight, .5) ADD_BOOLPROP(TimedTrigger, LTFALSE) ADD_REALPROP(MinTriggerTime, 0.0f) ADD_REALPROP(MaxTriggerTime, 10.0f) ADD_LONGINTPROP(ActivationCount, 1) ADD_BOOLPROP(Locked, 0) ADD_STRINGPROP_FLAG(ActivationSound, "", PF_FILENAME) ADD_REALPROP_FLAG(SoundRadius, 200.0f, PF_RADIUS) ADD_STRINGPROP_FLAG(AttachToObject, "", PF_OBJECTLINK) ADD_REALPROP_FLAG(HUDLookAtDist, -1.0f, PF_RADIUS) ADD_REALPROP_FLAG(HUDAlwaysOnDist, -1.0f, PF_RADIUS) ADD_STRINGPROP_FLAG( TriggerType, "<none>", PF_STATICLIST ) END_CLASS_DEFAULT_FLAGS_PLUGIN(Trigger, GameBase, NULL, NULL, 0, CTriggerPlugin) #pragma force_active off // // Register the class with the command mgr plugin and add any messages to the class // CMDMGR_BEGIN_REGISTER_CLASS( Trigger ) CMDMGR_ADD_MSG( LOCK, 1, NULL, "LOCK" ) CMDMGR_ADD_MSG( UNLOCK, 1, NULL, "UNLOCK" ) CMDMGR_ADD_MSG( TRIGGER, 1, NULL, "TRIGGER" ) CMDMGR_END_REGISTER_CLASS( Trigger, GameBase ) // ----------------------------------------------------------------------- // // // ROUTINE: CTriggerPlugin::PreHook_EditStringList() // // PURPOSE: Fill out the list of key types // // ----------------------------------------------------------------------- // LTRESULT CTriggerPlugin::PreHook_EditStringList( const char* szRezPath, const char* szPropName, char** aszStrings, uint32* pcStrings, const uint32 cMaxStrings, const uint32 cMaxStringLength) { if( !cMaxStrings || !cMaxStringLength ) return LT_ERROR; if (stricmp(szPropName, "PlayerKey") == 0) { // Clear the first entry, so you can always clear out this field strcpy(aszStrings[0], "<None>"); // Hand off the rest to the keymgr LTBOOL bResult = m_KeyMgrPlugin.PopulateStringList(aszStrings + 1, pcStrings, cMaxStrings - 1, cMaxStringLength); ++(*pcStrings); return (bResult) ? LT_OK : LT_ERROR; } else if( stricmp( szPropName, "TriggerType" ) == 0 ) { if( m_TriggerTypeMgrPlugin.PreHook_EditStringList( szRezPath, szPropName, aszStrings, pcStrings, cMaxStrings, cMaxStringLength ) == LT_OK ) { return LT_OK; } } else return LT_OK; return LT_UNSUPPORTED; } // ----------------------------------------------------------------------- // // // ROUTINE: CTriggerPlugin::PreHook_PropChanged() // // PURPOSE: Check our commands // // ----------------------------------------------------------------------- // LTRESULT CTriggerPlugin::PreHook_PropChanged( const char *szObjName, const char *szPropName, const int nPropType, const GenericProp &gpPropValue, ILTPreInterface *pInterface, const char *szModifiers ) { // Just send down to the command mgr plugin... if( m_CommandMgrPlugin.PreHook_PropChanged( szObjName, szPropName, nPropType, gpPropValue, pInterface, szModifiers ) == LT_OK ) { return LT_OK; } return LT_UNSUPPORTED; } // Static global variables... static char *g_szLock = "LOCK"; static char *g_szUnLock = "UNLOCK"; static char *g_szTrigger = "TRIGGER"; #define UPDATE_DELTA 0.1f #define TRIGGER_DEACTIVATION_TIME 0.001f // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::Trigger() // // PURPOSE: Initialize object // // ----------------------------------------------------------------------- // Trigger::Trigger() : GameBase() { m_vDims.Init(5.0f, 5.0f, 5.0f); m_fTriggerDelay = 0.0f; for (int i=0; i < MAX_NUM_COMMANDS; i++) { m_hstrCommand[i] = LTNULL; } m_bTriggerTouch = LTFALSE; m_bTouchNotifyActivation= LTFALSE; m_hTouchObject = LTNULL; m_hstrCommandTouch = LTNULL; m_hstrActivationSound = LTNULL; m_hstrAttachToObject = LTNULL; m_bAttached = LTFALSE; m_fSoundRadius = 200.0f; m_bActive = LTTRUE; m_bPlayerTriggerable = LTTRUE; m_nPlayerKeyID = KEY_INVALID_ID; m_bAITriggerable = LTFALSE; m_bLocked = LTFALSE; m_hstrAIName = LTNULL; m_bBodyTriggerable = LTFALSE; m_hstrBodyName = LTNULL; m_bDelayingActivate = LTFALSE; m_fStartDelayTime = 0.0f; m_fSendDelay = 0.0f; m_fLastTouchTime = 0.0f; m_nCurrentActivation = 0; m_nActivationCount = 1; m_nNumActivations = 1; m_nNumTimesActivated = 0; m_bWeightedTrigger = LTFALSE; m_fMessage1Weight = .5f; m_bTimedTrigger = LTFALSE; m_fMinTriggerTime = 0.0f; m_fMaxTriggerTime = 1.0f; m_fNextTriggerTime = 0.0f; m_dwFlags = (FLAG_TOUCH_NOTIFY | FLAG_GOTHRUWORLD); m_bSendTriggerFXMsg = false; } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::~Trigger() // // PURPOSE: Deallocate object // // ----------------------------------------------------------------------- // Trigger::~Trigger() { for (int i=0; i < MAX_NUM_COMMANDS; i++) { if (m_hstrCommand[i]) { g_pLTServer->FreeString(m_hstrCommand[i]); } } if (m_hstrCommandTouch) { g_pLTServer->FreeString(m_hstrCommandTouch); } if (m_hstrActivationSound) { g_pLTServer->FreeString(m_hstrActivationSound); } if (m_hstrAttachToObject) { g_pLTServer->FreeString(m_hstrAttachToObject); } if (m_hstrAIName) { g_pLTServer->FreeString(m_hstrAIName); } if (m_hstrBodyName) { g_pLTServer->FreeString(m_hstrBodyName); } } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::EngineMessageFn // // PURPOSE: Handle engine messages // // ----------------------------------------------------------------------- // uint32 Trigger::EngineMessageFn(uint32 messageID, void *pData, LTFLOAT fData) { switch(messageID) { case MID_UPDATE: { if (!Update()) { g_pLTServer->RemoveObject(m_hObject); } } break; case MID_TOUCHNOTIFY: { ObjectTouch((HOBJECT)pData); } break; case MID_PRECREATE: { ObjectCreateStruct *pStruct = (ObjectCreateStruct *)pData; if (!pStruct) return 0; if (fData == PRECREATE_WORLDFILE) { ReadProp(pStruct); } pStruct->m_UserData = USRFLG_IGNORE_PROJECTILES; } break; case MID_INITIALUPDATE: { if (fData != INITIALUPDATE_SAVEGAME) { InitialUpdate(); } } break; case MID_SAVEOBJECT: { Save((ILTMessage_Write*)pData, (uint32)fData); } break; case MID_LOADOBJECT: { Load((ILTMessage_Read*)pData, (uint32)fData); } break; case MID_PARENTATTACHMENTREMOVED : { // Go away if our parent is removed... g_pLTServer->RemoveObject(m_hObject); } break; default : break; } return GameBase::EngineMessageFn(messageID, pData, fData); } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::OnTrigger // // PURPOSE: Handle trigger messages // // ----------------------------------------------------------------------- // bool Trigger::OnTrigger(HOBJECT hSender, const CParsedMsg &cMsg) { static CParsedMsg::CToken s_cTok_Trigger(g_szTrigger); static CParsedMsg::CToken s_cTok_Lock(g_szLock); static CParsedMsg::CToken s_cTok_Unlock(g_szUnLock); // See if we should trigger the trigger... if (cMsg.GetArg(0) == s_cTok_Trigger) { DoTrigger(hSender, LTFALSE); } else if (cMsg.GetArg(0) == s_cTok_Lock) // See if we should lock the trigger... { m_bLocked = LTTRUE; SendLockedMsg(); } else if (cMsg.GetArg(0) == s_cTok_Unlock) // See if we should unlock the trigger... { m_bLocked = LTFALSE; SendLockedMsg(); } else return GameBase::OnTrigger(hSender, cMsg); return true; } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::ReadProp // // PURPOSE: Set property value // // ----------------------------------------------------------------------- // LTBOOL Trigger::ReadProp(ObjectCreateStruct *pData) { if (!pData) return LTFALSE; const int nMaxFilesize = 500; char buf[nMaxFilesize + 1]; buf[0] = '\0'; char propName[50]; for (int i=0; i < MAX_NUM_COMMANDS; i++) { sprintf(propName, "Command%d", i+1); buf[0] = '\0'; if (g_pLTServer->GetPropString(propName, buf, nMaxFilesize) == LT_OK) { if (buf[0] && strlen(buf)) { m_hstrCommand[i] = g_pLTServer->CreateString(buf); } } } bool bFlag; g_pLTServer->GetPropBool("TriggerTouch", &bFlag); m_bTriggerTouch = (bFlag ? LTTRUE : LTFALSE); buf[0] = '\0'; g_pLTServer->GetPropString("CommandTouch", buf, nMaxFilesize); if (buf[0] && strlen(buf)) m_hstrCommandTouch = g_pLTServer->CreateString(buf); buf[0] = '\0'; g_pLTServer->GetPropString("ActivationSound", buf, nMaxFilesize); if (buf[0] && strlen(buf)) m_hstrActivationSound = g_pLTServer->CreateString(buf); buf[0] = '\0'; g_pLTServer->GetPropString("AttachToObject", buf, nMaxFilesize); if (buf[0] && strlen(buf)) m_hstrAttachToObject = g_pLTServer->CreateString(buf); g_pLTServer->GetPropVector("Dims", &m_vDims); g_pLTServer->GetPropReal("TriggerDelay", &m_fTriggerDelay); g_pLTServer->GetPropReal("SendDelay", &m_fSendDelay); g_pLTServer->GetPropReal("SoundRadius", &m_fSoundRadius); g_pLTServer->GetPropBool("PlayerTriggerable", &bFlag); m_bPlayerTriggerable = (bFlag ? LTTRUE : LTFALSE); g_pLTServer->GetPropBool("AITriggerable", &bFlag); m_bAITriggerable = (bFlag ? LTTRUE : LTFALSE); g_pLTServer->GetPropBool("Locked", &bFlag); m_bLocked = (bFlag ? LTTRUE : LTFALSE); g_pLTServer->GetPropReal("SoundRadius", &m_fSoundRadius); buf[0] = '\0'; g_pLTServer->GetPropString("AITriggerName", buf, nMaxFilesize); if (buf[0] && strlen(buf)) m_hstrAIName = g_pLTServer->CreateString(buf); g_pLTServer->GetPropBool("BodyTriggerable", &bFlag); m_bBodyTriggerable = (bFlag ? LTTRUE : LTFALSE); buf[0] = '\0'; g_pLTServer->GetPropString("BodyTriggerName", buf, nMaxFilesize); if (buf[0] && strlen(buf)) m_hstrBodyName = g_pLTServer->CreateString(buf); int32 nLongVal; if(g_pLTServer->GetPropLongInt("ActivationCount", &nLongVal) == LT_OK) { m_nActivationCount = nLongVal; } if(g_pLTServer->GetPropLongInt("NumberOfActivations", &nLongVal) == LT_OK) { m_nNumActivations = nLongVal; } g_pLTServer->GetPropBool("WeightedTrigger", &bFlag); m_bWeightedTrigger = (bFlag ? LTTRUE : LTFALSE); g_pLTServer->GetPropReal("Message1Weight", &m_fMessage1Weight); g_pLTServer->GetPropBool("TimedTrigger", &bFlag); m_bTimedTrigger = (bFlag ? LTTRUE : LTFALSE); g_pLTServer->GetPropReal("MinTriggerTime", &m_fMinTriggerTime); g_pLTServer->GetPropReal("MaxTriggerTime", &m_fMaxTriggerTime); m_fNextTriggerTime = g_pLTServer->GetTime() + m_fMinTriggerTime; m_nPlayerKeyID = KEY_INVALID_ID; buf[0] = '\0'; g_pLTServer->GetPropString("PlayerKey", buf, nMaxFilesize); if (buf[0]) { KEY *pKey = g_pKeyMgr->GetKey(buf); if (pKey) m_nPlayerKeyID = pKey->nId; } g_pLTServer->GetPropReal( "HUDLookAtDist", &m_TCS.fHUDLookAtDist ); g_pLTServer->GetPropReal( "HUDAlwaysOnDist", &m_TCS.fHUDAlwaysOnDist ); buf[0] = '\0'; g_pLTServer->GetPropString( "TriggerType", buf, nMaxFilesize ); if( buf[0] ) { TRIGGERTYPE *pType = g_pTriggerTypeMgr->GetTriggerType( buf ); if( pType ) { m_TCS.nTriggerTypeId = pType->nId; } } return LTTRUE; } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::ObjectTouch // // PURPOSE: Handle object touch // // ----------------------------------------------------------------------- // void Trigger::ObjectTouch(HOBJECT hObj) { // Only AI and players and bodies can trigger things... bool bIsPlayer = (IsPlayer(hObj) ? true : false); bool bIsAI = (IsAI(hObj) ? true : false); bool bIsBody = (IsBody(hObj) ? true : false); if (!bIsAI && !bIsPlayer && !bIsBody) { return; } // If we're AI, make sure we can activate this trigger... if (m_bAITriggerable) { if ( bIsAI ) { if (m_hstrAIName) // See if only a specific AI can trigger it... { const char* pAIName = g_pLTServer->GetStringData(m_hstrAIName); const char* pObjName = GetObjectName(hObj); if (pAIName && pObjName) { if ( stricmp(pAIName, pObjName) != 0 ) { return; } } } } // Check for knocked out AIs carried by players too... if (bIsPlayer && m_hstrAIName) { CPlayerObj* pPlayer = (CPlayerObj*)g_pLTServer->HandleToObject(hObj); if (pPlayer) { HOBJECT hBody = pPlayer->GetCarriedObject(); if (hBody) { const char* pBodyName = g_pLTServer->GetStringData(m_hstrAIName); const char* pObjName = GetObjectName(hBody); if (pBodyName && pObjName) { if ( stricmp(pBodyName, pObjName) == 0 ) { hObj = hBody; } } } } } } else // Not AI triggerable { if ( bIsAI ) { return; } } // If we're Body, make sure we can activate this trigger... if (m_bBodyTriggerable) { if ( bIsBody ) { if (m_hstrBodyName) // See if only a specific Body can trigger it... { const char* pBodyName = g_pLTServer->GetStringData(m_hstrBodyName); const char* pObjName = GetObjectName(hObj); if (pBodyName && pObjName) { if ( stricmp(pBodyName, pObjName) != 0 ) { return; } } } } //check for bodies carried by players too if (bIsPlayer && m_hstrBodyName) { CPlayerObj* pPlayer = (CPlayerObj*)g_pLTServer->HandleToObject(hObj); if (pPlayer) { HOBJECT hBody = pPlayer->GetCarriedObject(); if (hBody) { const char* pBodyName = g_pLTServer->GetStringData(m_hstrBodyName); const char* pObjName = GetObjectName(hBody); if (pBodyName && pObjName) { if ( stricmp(pBodyName, pObjName) == 0 ) { hObj = hBody; } } } } } } else // Not Body triggerable { if ( bIsBody ) { return; } } // If we're the player, make sure we can activate this trigger... if (m_bPlayerTriggerable) { if (bIsPlayer) { CPlayerObj* pPlayer = (CPlayerObj*)g_pLTServer->HandleToObject(hObj); if (!pPlayer) return; // Check to make sure the player has this key if (m_nPlayerKeyID != KEY_INVALID_ID) { uint8 nDummy; if (!pPlayer->GetKeyList()->Have(m_nPlayerKeyID, nDummy)) return; } } } else //not player triggerable { // Note we check IsPlayer() here instead of bIsPlayer because hObj may have // changed above... if ( IsPlayer(hObj) ) { return; } } DoTrigger(hObj, LTTRUE); } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::DoTrigger // // PURPOSE: Determine if we can be triggered, and if so do it... // // ----------------------------------------------------------------------- // void Trigger::DoTrigger(HOBJECT hObj, LTBOOL bTouchNotify) { // Okay ready to trigger. Make sure we've waited long enough before triggering... LTFLOAT fTime = g_pLTServer->GetTime(); if (fTime < m_fLastTouchTime + m_fTriggerDelay) { return; } m_fLastTouchTime = fTime; m_bTouchNotifyActivation = bTouchNotify; m_hTouchObject = hObj; if (m_bActive) { if (!m_bLocked) { RequestActivate(); } } } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::InitialUpdate // // PURPOSE: Initial update // // ----------------------------------------------------------------------- // LTBOOL Trigger::InitialUpdate() { g_pPhysicsLT->SetObjectDims(m_hObject, &m_vDims, 0); g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, m_dwFlags, FLAGMASK_ALL); g_pCommonLT->SetObjectFlags(m_hObject, OFT_User, USRFLG_IGNORE_PROJECTILES, FLAGMASK_ALL); // If I'm not a timed trigger, my object touch notification // will trigger new updates until then, I don't care... if (m_bTimedTrigger || m_hstrAttachToObject) { SetNextUpdate(UPDATE_DELTA); } else { SetNextUpdate(UPDATE_NEVER); } // Create the specialfx message... if( m_TCS.fHUDLookAtDist > 0.0f || m_TCS.fHUDAlwaysOnDist > 0.0f ) { // Only send the message if we need to... m_bSendTriggerFXMsg = true; } if( m_bSendTriggerFXMsg ) { g_pCommonLT->SetObjectFlags( m_hObject, OFT_Flags, FLAG_FORCECLIENTUPDATE , FLAG_FORCECLIENTUPDATE ); CreateSpecialFX(); } return LTTRUE; } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::Update // // PURPOSE: Handle Update // // ----------------------------------------------------------------------- // LTBOOL Trigger::Update() { // Handle timed trigger... if (m_bTimedTrigger) { LTFLOAT fTime = g_pLTServer->GetTime(); if (fTime > m_fNextTriggerTime) { m_fNextTriggerTime = fTime + GetRandom(m_fMinTriggerTime, m_fMaxTriggerTime); DoTrigger(LTNULL, LTFALSE); } } // Attach the trigger to the object... if (m_hstrAttachToObject && !m_bAttached) { AttachToObject(); m_bAttached = LTTRUE; } if (m_bDelayingActivate) { UpdateDelayingActivate(); } else { m_bActive = LTTRUE; // If not a timed trigger, my object touch notification will trigger // new updates until then, I don't care. if (m_bTimedTrigger) { SetNextUpdate(UPDATE_DELTA); } else { SetNextUpdate(UPDATE_NEVER); } } return LTTRUE; } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::Unlock // // PURPOSE: Unlock the trigger and trigger it // // ----------------------------------------------------------------------- // void Trigger::Unlock() { m_bLocked = LTFALSE; RequestActivate(); } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::RequestActivate // // PURPOSE: Request activation of the trigger // // ----------------------------------------------------------------------- // void Trigger::RequestActivate() { if (m_bActive) { m_fStartDelayTime = g_pLTServer->GetTime(); m_bDelayingActivate = LTTRUE; m_bActive = LTFALSE; if (m_fTriggerDelay > 0.0f) SetNextUpdate(UPDATE_NEXT_FRAME); else Update(); } } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::UpdateDelayingActivate // // PURPOSE: Update the delaying (and possibly activate) the trigger // // ----------------------------------------------------------------------- // void Trigger::UpdateDelayingActivate() { if (!m_bDelayingActivate) return; LTFLOAT fTime = g_pLTServer->GetTime(); if (fTime >= m_fStartDelayTime + m_fSendDelay) { Activate(); m_bDelayingActivate = LTFALSE; m_bActive = LTTRUE; } else { SetNextUpdate(UPDATE_NEXT_FRAME); } } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::Activate // // PURPOSE: Activate the trigger. // // ----------------------------------------------------------------------- // LTBOOL Trigger::Activate() { // Make us wait a bit before we can be triggered again... if (m_bTimedTrigger) { SetNextUpdate(UPDATE_DELTA); } else { SetNextUpdate(m_fTriggerDelay); } // If this is a counter trigger, determine if we can activate or not... if (++m_nCurrentActivation < m_nActivationCount) { return LTFALSE; } else { m_nCurrentActivation = 0; } // Only allow the object to be activated the number of specified times... if (m_nNumActivations > 0) { if (m_nNumTimesActivated >= m_nNumActivations) { return LTFALSE; } m_nNumTimesActivated++; } if (m_hstrActivationSound) { const char* pSound = g_pLTServer->GetStringData(m_hstrActivationSound); if (pSound && pSound[0] != '\0') { LTVector vPos; g_pLTServer->GetObjectPos(m_hObject, &vPos); g_pServerSoundMgr->PlaySoundFromPos(vPos, pSound, m_fSoundRadius, SOUNDPRIORITY_MISC_HIGH); } } LTBOOL bTriggerMsg1 = LTTRUE; LTBOOL bTriggerMsg2 = LTTRUE; if (m_bWeightedTrigger) { bTriggerMsg1 = (GetRandom(0.0f, 1.0f) < m_fMessage1Weight ? LTTRUE : LTFALSE); bTriggerMsg2 = !bTriggerMsg1; } // Loop through the commands and execute them... for (int i=0; i < MAX_NUM_COMMANDS; i++) { LTBOOL bOkayToSend = LTTRUE; if (i == 0 && !bTriggerMsg1) bOkayToSend = LTFALSE; else if (i == 1 && !bTriggerMsg2) bOkayToSend = LTFALSE; if (bOkayToSend && m_hstrCommand[i]) { const char *pCmd = g_pLTServer->GetStringData( m_hstrCommand[i] ); if( g_pCmdMgr->IsValidCmd( pCmd ) ) { g_pCmdMgr->Process( pCmd, m_hTouchObject, m_hObject ); } } } if (m_bTouchNotifyActivation && m_hTouchObject && m_bTriggerTouch && m_hstrCommandTouch) { const char *pCmd = g_pLTServer->GetStringData( m_hstrCommandTouch ); if( pCmd && g_pCmdMgr->IsValidCmd( pCmd )) { g_pCmdMgr->Process( pCmd, m_hTouchObject, m_hTouchObject ); } m_bTouchNotifyActivation = LTFALSE; m_hTouchObject = LTNULL; } // Clear the toucher. m_hTouchObject = LTNULL; return LTTRUE; } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::AttachToObject() // // PURPOSE: Attach the trigger to an object // // ----------------------------------------------------------------------- // void Trigger::AttachToObject() { if (!m_hstrAttachToObject) return; const char* pObjName = g_pLTServer->GetStringData(m_hstrAttachToObject); if (!pObjName) return; // Find object to attach to... ObjArray <HOBJECT, MAX_OBJECT_ARRAY_SIZE> objArray; g_pLTServer->FindNamedObjects(pObjName, objArray); if (!objArray.NumObjects()) return; HOBJECT hObj = objArray.GetObject(0); if (!hObj) return; LTVector vOffset(0, 0, 0); LTRotation rOffset; HATTACHMENT hAttachment; g_pLTServer->CreateAttachment(hObj, m_hObject, LTNULL, &vOffset, &rOffset, &hAttachment); } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::Save // // PURPOSE: Save the object // // ----------------------------------------------------------------------- // void Trigger::Save(ILTMessage_Write *pMsg, uint32 dwSaveFlags) { if (!pMsg) return; m_TCS.Write( pMsg ); SAVE_HOBJECT(m_hTouchObject); SAVE_BOOL(m_bAttached); SAVE_BOOL(m_bActive); SAVE_BOOL(m_bTriggerTouch); SAVE_BOOL(m_bTouchNotifyActivation); SAVE_BOOL(m_bPlayerTriggerable); SAVE_DWORD(m_nPlayerKeyID); SAVE_BOOL(m_bAITriggerable); SAVE_BOOL(m_bBodyTriggerable); SAVE_BOOL(m_bLocked); SAVE_BOOL(m_bDelayingActivate); SAVE_BOOL(m_bWeightedTrigger); SAVE_BOOL(m_bTimedTrigger); SAVE_TIME(m_fStartDelayTime); SAVE_FLOAT(m_fSendDelay); SAVE_TIME(m_fLastTouchTime); SAVE_FLOAT(m_fMessage1Weight); SAVE_FLOAT(m_fMinTriggerTime); SAVE_FLOAT(m_fMaxTriggerTime); SAVE_TIME(m_fNextTriggerTime); SAVE_FLOAT(m_fTriggerDelay); SAVE_FLOAT(m_fSoundRadius); SAVE_INT(m_nNumActivations); SAVE_DWORD(m_nNumTimesActivated); SAVE_DWORD(m_nActivationCount); SAVE_DWORD(m_nCurrentActivation); SAVE_HSTRING(m_hstrAIName); SAVE_HSTRING(m_hstrBodyName); SAVE_HSTRING(m_hstrCommandTouch); SAVE_HSTRING(m_hstrActivationSound); SAVE_bool(m_bSendTriggerFXMsg); for (int i=0; i < MAX_NUM_COMMANDS; i++) { SAVE_HSTRING(m_hstrCommand[i]); } } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::Load // // PURPOSE: Load the object // // ----------------------------------------------------------------------- // void Trigger::Load(ILTMessage_Read *pMsg, uint32 dwLoadFlags) { if (!pMsg) return; m_TCS.Read( pMsg ); LOAD_HOBJECT(m_hTouchObject); LOAD_BOOL(m_bAttached); LOAD_BOOL(m_bActive); LOAD_BOOL(m_bTriggerTouch); LOAD_BOOL(m_bTouchNotifyActivation); LOAD_BOOL(m_bPlayerTriggerable); LOAD_DWORD(m_nPlayerKeyID); LOAD_BOOL(m_bAITriggerable); LOAD_BOOL(m_bBodyTriggerable); LOAD_BOOL(m_bLocked); LOAD_BOOL(m_bDelayingActivate); LOAD_BOOL(m_bWeightedTrigger); LOAD_BOOL(m_bTimedTrigger); LOAD_TIME(m_fStartDelayTime); LOAD_FLOAT(m_fSendDelay); LOAD_TIME(m_fLastTouchTime); LOAD_FLOAT(m_fMessage1Weight); LOAD_FLOAT(m_fMinTriggerTime); LOAD_FLOAT(m_fMaxTriggerTime); LOAD_TIME(m_fNextTriggerTime); LOAD_FLOAT(m_fTriggerDelay); LOAD_FLOAT(m_fSoundRadius); LOAD_INT(m_nNumActivations); LOAD_DWORD(m_nNumTimesActivated); LOAD_DWORD(m_nActivationCount); LOAD_DWORD(m_nCurrentActivation); LOAD_HSTRING(m_hstrAIName); LOAD_HSTRING(m_hstrBodyName); LOAD_HSTRING(m_hstrCommandTouch); LOAD_HSTRING(m_hstrActivationSound); LOAD_bool(m_bSendTriggerFXMsg); for (int i=0; i < MAX_NUM_COMMANDS; i++) { LOAD_HSTRING(m_hstrCommand[i]); } } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::CreateSpecialFX() // // PURPOSE: Add client-side special fx // // ----------------------------------------------------------------------- // void Trigger::CreateSpecialFX( LTBOOL bUpdateClients /* =LTFALSE */ ) { m_TCS.bLocked = !!m_bLocked; m_TCS.vDims = m_vDims; if( !m_bSendTriggerFXMsg ) return; { CAutoMessage cMsg; cMsg.Writeuint8( SFX_TRIGGER_ID ); m_TCS.Write( cMsg ); g_pLTServer->SetObjectSFXMessage( m_hObject, cMsg.Read() ); } if( bUpdateClients ) { CAutoMessage cMsg; cMsg.Writeuint8( MID_SFX_MESSAGE ); cMsg.Writeuint8( SFX_TRIGGER_ID ); cMsg.WriteObject( m_hObject ); cMsg.Writeuint8( TRIGFX_ALLFX_MSG ); m_TCS.Write( cMsg ); g_pLTServer->SendToClient( cMsg.Read(), LTNULL, MESSAGE_GUARANTEED ); } } // ----------------------------------------------------------------------- // // // ROUTINE: Trigger::SendLockedMsg() // // PURPOSE: Add client-side special fx // // ----------------------------------------------------------------------- // void Trigger::SendLockedMsg() { if( !m_bSendTriggerFXMsg ) return; CAutoMessage cMsg; cMsg.Writeuint8( MID_SFX_MESSAGE ); cMsg.Writeuint8( SFX_TRIGGER_ID ); cMsg.WriteObject( m_hObject ); cMsg.Writeuint8( TRIGFX_LOCKED_MSG ); cMsg.Writeuint8( m_bLocked ); g_pLTServer->SendToClient( cMsg.Read(), LTNULL, MESSAGE_GUARANTEED ); CreateSpecialFX(); }
[ [ [ 1, 1186 ] ] ]
3c0b15070cb7665631c8972a1b1fce4bab6c16b1
f8bb83ac9abae656fc3347741c4c0b9752029c7a
/wrap/block49.cpp
caad564596d38ecc07718d1f5de87d65550c8f00
[ "Apache-2.0" ]
permissive
rowhit/pyoa
6d1c3f6bfba9daf2db4e1aacb2c15e8095bfae54
60b394ae20ccf2baf206b074f6ded21b04c2b0c9
refs/heads/master
2021-05-28T09:55:56.748751
2010-04-23T06:58:30
2010-04-23T06:58:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,372,380
cpp
/******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaElmore // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaElmore_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaElmore_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaElmoreObject* self = (PyoaStringAppDef_oaElmoreObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaElmore) { PyParamoaStringAppDef_oaElmore p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaElmore_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaElmore, Choices are:\n" " (oaStringAppDef_oaElmore)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaElmore_tp_dealloc(PyoaStringAppDef_oaElmoreObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaElmore_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaElmore value; int convert_status=PyoaStringAppDef_oaElmore_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[45]; sprintf(buffer,"<oaStringAppDef_oaElmore::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaElmore_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaElmore v1; PyParamoaStringAppDef_oaElmore v2; int convert_status1=PyoaStringAppDef_oaElmore_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaElmore_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaElmore_Convert(PyObject* ob,PyParamoaStringAppDef_oaElmore* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaElmore_Check(ob)) { result->SetData( (oaStringAppDef_oaElmore**) ((PyoaStringAppDef_oaElmoreObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaElmore Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaElmore_FromoaStringAppDef_oaElmore(oaStringAppDef_oaElmore** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaElmore* data=*value; PyObject* bself = PyoaStringAppDef_oaElmore_Type.tp_alloc(&PyoaStringAppDef_oaElmore_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaElmoreObject* self = (PyoaStringAppDef_oaElmoreObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaElmore_FromoaStringAppDef_oaElmore(oaStringAppDef_oaElmore* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaElmore_Type.tp_alloc(&PyoaStringAppDef_oaElmore_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaElmoreObject* self = (PyoaStringAppDef_oaElmoreObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaElmore_get_doc[] = "Class: oaStringAppDef_oaElmore, Function: get\n" " Paramegers: (oaElmore,oaString)\n" " Calls: void get(const oaElmore* object,oaString& value)\n" " Signature: get|void-void|cptr-oaElmore,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaElmore_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaElmore data; int convert_status=PyoaStringAppDef_oaElmore_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaElmoreObject* self=(PyoaStringAppDef_oaElmoreObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaElmore p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaElmore_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaElmore_getDefault_doc[] = "Class: oaStringAppDef_oaElmore, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaElmore_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaElmore data; int convert_status=PyoaStringAppDef_oaElmore_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaElmoreObject* self=(PyoaStringAppDef_oaElmoreObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaElmore_set_doc[] = "Class: oaStringAppDef_oaElmore, Function: set\n" " Paramegers: (oaElmore,oaString)\n" " Calls: void set(oaElmore* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaElmore,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaElmore_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaElmore data; int convert_status=PyoaStringAppDef_oaElmore_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaElmoreObject* self=(PyoaStringAppDef_oaElmoreObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaElmore p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaElmore_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaElmore_isNull_doc[] = "Class: oaStringAppDef_oaElmore, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaElmore_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaElmore data; int convert_status=PyoaStringAppDef_oaElmore_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaElmore_assign_doc[] = "Class: oaStringAppDef_oaElmore, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaElmore_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaElmore data; int convert_status=PyoaStringAppDef_oaElmore_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaElmore p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaElmore_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaElmore_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaElmore_get,METH_VARARGS,oaStringAppDef_oaElmore_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaElmore_getDefault,METH_VARARGS,oaStringAppDef_oaElmore_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaElmore_set,METH_VARARGS,oaStringAppDef_oaElmore_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaElmore_tp_isNull,METH_VARARGS,oaStringAppDef_oaElmore_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaElmore_tp_assign,METH_VARARGS,oaStringAppDef_oaElmore_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaElmore_doc[] = "Class: oaStringAppDef_oaElmore\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaElmore)\n" " Calls: (const oaStringAppDef_oaElmore&)\n" " Signature: oaStringAppDef_oaElmore||cref-oaStringAppDef_oaElmore,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaElmore_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaElmore", sizeof(PyoaStringAppDef_oaElmoreObject), 0, (destructor)oaStringAppDef_oaElmore_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaElmore_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaElmore_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaElmore_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaElmore_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaElmore_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaElmore_static_find_doc[] = "Class: oaStringAppDef_oaElmore, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaElmore* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaElmore|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaElmore* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaElmore|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaElmore_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaElmorep result= (oaStringAppDef_oaElmore::find(p1.Data())); return PyoaStringAppDef_oaElmore_FromoaStringAppDef_oaElmore(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaElmorep result= (oaStringAppDef_oaElmore::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaElmore_FromoaStringAppDef_oaElmore(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaElmore, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaElmore_static_get_doc[] = "Class: oaStringAppDef_oaElmore, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaElmore* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaElmore|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaElmore* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaElmore|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaElmore* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaElmore|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaElmore* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaElmore|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaElmore* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaElmore|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaElmore* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaElmore|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaElmore_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaElmorep result= (oaStringAppDef_oaElmore::get(p1.Data())); return PyoaStringAppDef_oaElmore_FromoaStringAppDef_oaElmore(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaElmorep result= (oaStringAppDef_oaElmore::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaElmore_FromoaStringAppDef_oaElmore(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaElmorep result= (oaStringAppDef_oaElmore::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaElmore_FromoaStringAppDef_oaElmore(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaElmorep result= (oaStringAppDef_oaElmore::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaElmore_FromoaStringAppDef_oaElmore(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaElmorep result= (oaStringAppDef_oaElmore::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaElmore_FromoaStringAppDef_oaElmore(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaElmorep result= (oaStringAppDef_oaElmore::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaElmore_FromoaStringAppDef_oaElmore(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaElmore, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaElmore_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaElmore_static_find,METH_VARARGS,oaStringAppDef_oaElmore_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaElmore_static_get,METH_VARARGS,oaStringAppDef_oaElmore_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaElmore_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaElmore_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaElmore\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaElmore", (PyObject*)(&PyoaStringAppDef_oaElmore_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaElmore\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaElmore_Type.tp_dict; for(method=oaStringAppDef_oaElmore_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaFigGroup // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaFigGroup_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaFigGroup_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFigGroupObject* self = (PyoaStringAppDef_oaFigGroupObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaFigGroup) { PyParamoaStringAppDef_oaFigGroup p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaFigGroup_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaFigGroup, Choices are:\n" " (oaStringAppDef_oaFigGroup)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaFigGroup_tp_dealloc(PyoaStringAppDef_oaFigGroupObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaFigGroup_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaFigGroup value; int convert_status=PyoaStringAppDef_oaFigGroup_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[47]; sprintf(buffer,"<oaStringAppDef_oaFigGroup::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaFigGroup_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaFigGroup v1; PyParamoaStringAppDef_oaFigGroup v2; int convert_status1=PyoaStringAppDef_oaFigGroup_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaFigGroup_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaFigGroup_Convert(PyObject* ob,PyParamoaStringAppDef_oaFigGroup* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaFigGroup_Check(ob)) { result->SetData( (oaStringAppDef_oaFigGroup**) ((PyoaStringAppDef_oaFigGroupObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaFigGroup Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaFigGroup_FromoaStringAppDef_oaFigGroup(oaStringAppDef_oaFigGroup** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaFigGroup* data=*value; PyObject* bself = PyoaStringAppDef_oaFigGroup_Type.tp_alloc(&PyoaStringAppDef_oaFigGroup_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFigGroupObject* self = (PyoaStringAppDef_oaFigGroupObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaFigGroup_FromoaStringAppDef_oaFigGroup(oaStringAppDef_oaFigGroup* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaFigGroup_Type.tp_alloc(&PyoaStringAppDef_oaFigGroup_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFigGroupObject* self = (PyoaStringAppDef_oaFigGroupObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroup_get_doc[] = "Class: oaStringAppDef_oaFigGroup, Function: get\n" " Paramegers: (oaFigGroup,oaString)\n" " Calls: void get(const oaFigGroup* object,oaString& value)\n" " Signature: get|void-void|cptr-oaFigGroup,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaFigGroup_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFigGroup data; int convert_status=PyoaStringAppDef_oaFigGroup_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFigGroupObject* self=(PyoaStringAppDef_oaFigGroupObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaFigGroup p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaFigGroup_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroup_getDefault_doc[] = "Class: oaStringAppDef_oaFigGroup, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaFigGroup_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFigGroup data; int convert_status=PyoaStringAppDef_oaFigGroup_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFigGroupObject* self=(PyoaStringAppDef_oaFigGroupObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroup_set_doc[] = "Class: oaStringAppDef_oaFigGroup, Function: set\n" " Paramegers: (oaFigGroup,oaString)\n" " Calls: void set(oaFigGroup* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaFigGroup,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaFigGroup_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFigGroup data; int convert_status=PyoaStringAppDef_oaFigGroup_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFigGroupObject* self=(PyoaStringAppDef_oaFigGroupObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaFigGroup p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaFigGroup_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroup_isNull_doc[] = "Class: oaStringAppDef_oaFigGroup, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaFigGroup_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaFigGroup data; int convert_status=PyoaStringAppDef_oaFigGroup_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaFigGroup_assign_doc[] = "Class: oaStringAppDef_oaFigGroup, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaFigGroup_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaFigGroup data; int convert_status=PyoaStringAppDef_oaFigGroup_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaFigGroup p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaFigGroup_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaFigGroup_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaFigGroup_get,METH_VARARGS,oaStringAppDef_oaFigGroup_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaFigGroup_getDefault,METH_VARARGS,oaStringAppDef_oaFigGroup_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaFigGroup_set,METH_VARARGS,oaStringAppDef_oaFigGroup_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaFigGroup_tp_isNull,METH_VARARGS,oaStringAppDef_oaFigGroup_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaFigGroup_tp_assign,METH_VARARGS,oaStringAppDef_oaFigGroup_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroup_doc[] = "Class: oaStringAppDef_oaFigGroup\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaFigGroup)\n" " Calls: (const oaStringAppDef_oaFigGroup&)\n" " Signature: oaStringAppDef_oaFigGroup||cref-oaStringAppDef_oaFigGroup,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaFigGroup_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaFigGroup", sizeof(PyoaStringAppDef_oaFigGroupObject), 0, (destructor)oaStringAppDef_oaFigGroup_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaFigGroup_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaFigGroup_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaFigGroup_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaFigGroup_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaFigGroup_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroup_static_find_doc[] = "Class: oaStringAppDef_oaFigGroup, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaFigGroup* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaFigGroup|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaFigGroup* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaFigGroup|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaFigGroup_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaFigGroupp result= (oaStringAppDef_oaFigGroup::find(p1.Data())); return PyoaStringAppDef_oaFigGroup_FromoaStringAppDef_oaFigGroup(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFigGroupp result= (oaStringAppDef_oaFigGroup::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFigGroup_FromoaStringAppDef_oaFigGroup(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaFigGroup, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroup_static_get_doc[] = "Class: oaStringAppDef_oaFigGroup, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaFigGroup* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroup|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaFigGroup* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroup|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaFigGroup* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroup|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaFigGroup* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroup|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaFigGroup* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroup|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaFigGroup* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroup|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaFigGroup_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaFigGroupp result= (oaStringAppDef_oaFigGroup::get(p1.Data())); return PyoaStringAppDef_oaFigGroup_FromoaStringAppDef_oaFigGroup(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaFigGroupp result= (oaStringAppDef_oaFigGroup::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFigGroup_FromoaStringAppDef_oaFigGroup(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaFigGroupp result= (oaStringAppDef_oaFigGroup::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaFigGroup_FromoaStringAppDef_oaFigGroup(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFigGroupp result= (oaStringAppDef_oaFigGroup::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFigGroup_FromoaStringAppDef_oaFigGroup(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFigGroupp result= (oaStringAppDef_oaFigGroup::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaFigGroup_FromoaStringAppDef_oaFigGroup(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFigGroupp result= (oaStringAppDef_oaFigGroup::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaFigGroup_FromoaStringAppDef_oaFigGroup(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaFigGroup, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaFigGroup_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaFigGroup_static_find,METH_VARARGS,oaStringAppDef_oaFigGroup_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaFigGroup_static_get,METH_VARARGS,oaStringAppDef_oaFigGroup_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaFigGroup_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaFigGroup_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaFigGroup\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaFigGroup", (PyObject*)(&PyoaStringAppDef_oaFigGroup_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaFigGroup\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaFigGroup_Type.tp_dict; for(method=oaStringAppDef_oaFigGroup_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaFigGroupMem // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaFigGroupMem_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaFigGroupMem_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFigGroupMemObject* self = (PyoaStringAppDef_oaFigGroupMemObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaFigGroupMem) { PyParamoaStringAppDef_oaFigGroupMem p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaFigGroupMem_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaFigGroupMem, Choices are:\n" " (oaStringAppDef_oaFigGroupMem)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaFigGroupMem_tp_dealloc(PyoaStringAppDef_oaFigGroupMemObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaFigGroupMem_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaFigGroupMem value; int convert_status=PyoaStringAppDef_oaFigGroupMem_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[50]; sprintf(buffer,"<oaStringAppDef_oaFigGroupMem::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaFigGroupMem_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaFigGroupMem v1; PyParamoaStringAppDef_oaFigGroupMem v2; int convert_status1=PyoaStringAppDef_oaFigGroupMem_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaFigGroupMem_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaFigGroupMem_Convert(PyObject* ob,PyParamoaStringAppDef_oaFigGroupMem* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaFigGroupMem_Check(ob)) { result->SetData( (oaStringAppDef_oaFigGroupMem**) ((PyoaStringAppDef_oaFigGroupMemObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaFigGroupMem Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaFigGroupMem_FromoaStringAppDef_oaFigGroupMem(oaStringAppDef_oaFigGroupMem** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaFigGroupMem* data=*value; PyObject* bself = PyoaStringAppDef_oaFigGroupMem_Type.tp_alloc(&PyoaStringAppDef_oaFigGroupMem_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFigGroupMemObject* self = (PyoaStringAppDef_oaFigGroupMemObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaFigGroupMem_FromoaStringAppDef_oaFigGroupMem(oaStringAppDef_oaFigGroupMem* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaFigGroupMem_Type.tp_alloc(&PyoaStringAppDef_oaFigGroupMem_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFigGroupMemObject* self = (PyoaStringAppDef_oaFigGroupMemObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroupMem_get_doc[] = "Class: oaStringAppDef_oaFigGroupMem, Function: get\n" " Paramegers: (oaFigGroupMem,oaString)\n" " Calls: void get(const oaFigGroupMem* object,oaString& value)\n" " Signature: get|void-void|cptr-oaFigGroupMem,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaFigGroupMem_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFigGroupMem data; int convert_status=PyoaStringAppDef_oaFigGroupMem_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFigGroupMemObject* self=(PyoaStringAppDef_oaFigGroupMemObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaFigGroupMem p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaFigGroupMem_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroupMem_getDefault_doc[] = "Class: oaStringAppDef_oaFigGroupMem, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaFigGroupMem_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFigGroupMem data; int convert_status=PyoaStringAppDef_oaFigGroupMem_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFigGroupMemObject* self=(PyoaStringAppDef_oaFigGroupMemObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroupMem_set_doc[] = "Class: oaStringAppDef_oaFigGroupMem, Function: set\n" " Paramegers: (oaFigGroupMem,oaString)\n" " Calls: void set(oaFigGroupMem* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaFigGroupMem,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaFigGroupMem_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFigGroupMem data; int convert_status=PyoaStringAppDef_oaFigGroupMem_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFigGroupMemObject* self=(PyoaStringAppDef_oaFigGroupMemObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaFigGroupMem p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaFigGroupMem_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroupMem_isNull_doc[] = "Class: oaStringAppDef_oaFigGroupMem, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaFigGroupMem_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaFigGroupMem data; int convert_status=PyoaStringAppDef_oaFigGroupMem_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaFigGroupMem_assign_doc[] = "Class: oaStringAppDef_oaFigGroupMem, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaFigGroupMem_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaFigGroupMem data; int convert_status=PyoaStringAppDef_oaFigGroupMem_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaFigGroupMem p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaFigGroupMem_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaFigGroupMem_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaFigGroupMem_get,METH_VARARGS,oaStringAppDef_oaFigGroupMem_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaFigGroupMem_getDefault,METH_VARARGS,oaStringAppDef_oaFigGroupMem_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaFigGroupMem_set,METH_VARARGS,oaStringAppDef_oaFigGroupMem_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaFigGroupMem_tp_isNull,METH_VARARGS,oaStringAppDef_oaFigGroupMem_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaFigGroupMem_tp_assign,METH_VARARGS,oaStringAppDef_oaFigGroupMem_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroupMem_doc[] = "Class: oaStringAppDef_oaFigGroupMem\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaFigGroupMem)\n" " Calls: (const oaStringAppDef_oaFigGroupMem&)\n" " Signature: oaStringAppDef_oaFigGroupMem||cref-oaStringAppDef_oaFigGroupMem,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaFigGroupMem_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaFigGroupMem", sizeof(PyoaStringAppDef_oaFigGroupMemObject), 0, (destructor)oaStringAppDef_oaFigGroupMem_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaFigGroupMem_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaFigGroupMem_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaFigGroupMem_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaFigGroupMem_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaFigGroupMem_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroupMem_static_find_doc[] = "Class: oaStringAppDef_oaFigGroupMem, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaFigGroupMem* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaFigGroupMem|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaFigGroupMem* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaFigGroupMem|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaFigGroupMem_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaFigGroupMemp result= (oaStringAppDef_oaFigGroupMem::find(p1.Data())); return PyoaStringAppDef_oaFigGroupMem_FromoaStringAppDef_oaFigGroupMem(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFigGroupMemp result= (oaStringAppDef_oaFigGroupMem::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFigGroupMem_FromoaStringAppDef_oaFigGroupMem(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaFigGroupMem, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFigGroupMem_static_get_doc[] = "Class: oaStringAppDef_oaFigGroupMem, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaFigGroupMem* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroupMem|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaFigGroupMem* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroupMem|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaFigGroupMem* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroupMem|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaFigGroupMem* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroupMem|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaFigGroupMem* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroupMem|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaFigGroupMem* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaFigGroupMem|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaFigGroupMem_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaFigGroupMemp result= (oaStringAppDef_oaFigGroupMem::get(p1.Data())); return PyoaStringAppDef_oaFigGroupMem_FromoaStringAppDef_oaFigGroupMem(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaFigGroupMemp result= (oaStringAppDef_oaFigGroupMem::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFigGroupMem_FromoaStringAppDef_oaFigGroupMem(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaFigGroupMemp result= (oaStringAppDef_oaFigGroupMem::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaFigGroupMem_FromoaStringAppDef_oaFigGroupMem(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFigGroupMemp result= (oaStringAppDef_oaFigGroupMem::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFigGroupMem_FromoaStringAppDef_oaFigGroupMem(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFigGroupMemp result= (oaStringAppDef_oaFigGroupMem::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaFigGroupMem_FromoaStringAppDef_oaFigGroupMem(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFigGroupMemp result= (oaStringAppDef_oaFigGroupMem::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaFigGroupMem_FromoaStringAppDef_oaFigGroupMem(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaFigGroupMem, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaFigGroupMem_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaFigGroupMem_static_find,METH_VARARGS,oaStringAppDef_oaFigGroupMem_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaFigGroupMem_static_get,METH_VARARGS,oaStringAppDef_oaFigGroupMem_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaFigGroupMem_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaFigGroupMem_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaFigGroupMem\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaFigGroupMem", (PyObject*)(&PyoaStringAppDef_oaFigGroupMem_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaFigGroupMem\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaFigGroupMem_Type.tp_dict; for(method=oaStringAppDef_oaFigGroupMem_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaFrame // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaFrame_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaFrame_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFrameObject* self = (PyoaStringAppDef_oaFrameObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaFrame) { PyParamoaStringAppDef_oaFrame p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaFrame_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaFrame, Choices are:\n" " (oaStringAppDef_oaFrame)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaFrame_tp_dealloc(PyoaStringAppDef_oaFrameObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaFrame_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaFrame value; int convert_status=PyoaStringAppDef_oaFrame_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[44]; sprintf(buffer,"<oaStringAppDef_oaFrame::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaFrame_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaFrame v1; PyParamoaStringAppDef_oaFrame v2; int convert_status1=PyoaStringAppDef_oaFrame_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaFrame_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaFrame_Convert(PyObject* ob,PyParamoaStringAppDef_oaFrame* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaFrame_Check(ob)) { result->SetData( (oaStringAppDef_oaFrame**) ((PyoaStringAppDef_oaFrameObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaFrame Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaFrame_FromoaStringAppDef_oaFrame(oaStringAppDef_oaFrame** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaFrame* data=*value; PyObject* bself = PyoaStringAppDef_oaFrame_Type.tp_alloc(&PyoaStringAppDef_oaFrame_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFrameObject* self = (PyoaStringAppDef_oaFrameObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaFrame_FromoaStringAppDef_oaFrame(oaStringAppDef_oaFrame* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaFrame_Type.tp_alloc(&PyoaStringAppDef_oaFrame_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFrameObject* self = (PyoaStringAppDef_oaFrameObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFrame_get_doc[] = "Class: oaStringAppDef_oaFrame, Function: get\n" " Paramegers: (oaFrame,oaString)\n" " Calls: void get(const oaFrame* object,oaString& value)\n" " Signature: get|void-void|cptr-oaFrame,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaFrame_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFrame data; int convert_status=PyoaStringAppDef_oaFrame_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFrameObject* self=(PyoaStringAppDef_oaFrameObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaFrame p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaFrame_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFrame_getDefault_doc[] = "Class: oaStringAppDef_oaFrame, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaFrame_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFrame data; int convert_status=PyoaStringAppDef_oaFrame_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFrameObject* self=(PyoaStringAppDef_oaFrameObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFrame_set_doc[] = "Class: oaStringAppDef_oaFrame, Function: set\n" " Paramegers: (oaFrame,oaString)\n" " Calls: void set(oaFrame* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaFrame,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaFrame_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFrame data; int convert_status=PyoaStringAppDef_oaFrame_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFrameObject* self=(PyoaStringAppDef_oaFrameObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaFrame p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaFrame_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFrame_isNull_doc[] = "Class: oaStringAppDef_oaFrame, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaFrame_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaFrame data; int convert_status=PyoaStringAppDef_oaFrame_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaFrame_assign_doc[] = "Class: oaStringAppDef_oaFrame, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaFrame_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaFrame data; int convert_status=PyoaStringAppDef_oaFrame_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaFrame p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaFrame_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaFrame_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaFrame_get,METH_VARARGS,oaStringAppDef_oaFrame_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaFrame_getDefault,METH_VARARGS,oaStringAppDef_oaFrame_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaFrame_set,METH_VARARGS,oaStringAppDef_oaFrame_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaFrame_tp_isNull,METH_VARARGS,oaStringAppDef_oaFrame_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaFrame_tp_assign,METH_VARARGS,oaStringAppDef_oaFrame_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFrame_doc[] = "Class: oaStringAppDef_oaFrame\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaFrame)\n" " Calls: (const oaStringAppDef_oaFrame&)\n" " Signature: oaStringAppDef_oaFrame||cref-oaStringAppDef_oaFrame,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaFrame_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaFrame", sizeof(PyoaStringAppDef_oaFrameObject), 0, (destructor)oaStringAppDef_oaFrame_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaFrame_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaFrame_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaFrame_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaFrame_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaFrame_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFrame_static_find_doc[] = "Class: oaStringAppDef_oaFrame, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaFrame* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaFrame|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaFrame* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaFrame|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaFrame_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaFramep result= (oaStringAppDef_oaFrame::find(p1.Data())); return PyoaStringAppDef_oaFrame_FromoaStringAppDef_oaFrame(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFramep result= (oaStringAppDef_oaFrame::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFrame_FromoaStringAppDef_oaFrame(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaFrame, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFrame_static_get_doc[] = "Class: oaStringAppDef_oaFrame, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaFrame* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaFrame|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaFrame* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaFrame|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaFrame* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaFrame|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaFrame* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaFrame|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaFrame* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaFrame|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaFrame* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaFrame|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaFrame_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaFramep result= (oaStringAppDef_oaFrame::get(p1.Data())); return PyoaStringAppDef_oaFrame_FromoaStringAppDef_oaFrame(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaFramep result= (oaStringAppDef_oaFrame::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFrame_FromoaStringAppDef_oaFrame(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaFramep result= (oaStringAppDef_oaFrame::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaFrame_FromoaStringAppDef_oaFrame(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFramep result= (oaStringAppDef_oaFrame::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFrame_FromoaStringAppDef_oaFrame(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFramep result= (oaStringAppDef_oaFrame::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaFrame_FromoaStringAppDef_oaFrame(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFramep result= (oaStringAppDef_oaFrame::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaFrame_FromoaStringAppDef_oaFrame(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaFrame, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaFrame_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaFrame_static_find,METH_VARARGS,oaStringAppDef_oaFrame_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaFrame_static_get,METH_VARARGS,oaStringAppDef_oaFrame_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaFrame_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaFrame_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaFrame\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaFrame", (PyObject*)(&PyoaStringAppDef_oaFrame_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaFrame\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaFrame_Type.tp_dict; for(method=oaStringAppDef_oaFrame_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaFrameInst // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaFrameInst_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaFrameInst_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFrameInstObject* self = (PyoaStringAppDef_oaFrameInstObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaFrameInst) { PyParamoaStringAppDef_oaFrameInst p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaFrameInst_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaFrameInst, Choices are:\n" " (oaStringAppDef_oaFrameInst)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaFrameInst_tp_dealloc(PyoaStringAppDef_oaFrameInstObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaFrameInst_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaFrameInst value; int convert_status=PyoaStringAppDef_oaFrameInst_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[48]; sprintf(buffer,"<oaStringAppDef_oaFrameInst::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaFrameInst_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaFrameInst v1; PyParamoaStringAppDef_oaFrameInst v2; int convert_status1=PyoaStringAppDef_oaFrameInst_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaFrameInst_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaFrameInst_Convert(PyObject* ob,PyParamoaStringAppDef_oaFrameInst* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaFrameInst_Check(ob)) { result->SetData( (oaStringAppDef_oaFrameInst**) ((PyoaStringAppDef_oaFrameInstObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaFrameInst Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaFrameInst_FromoaStringAppDef_oaFrameInst(oaStringAppDef_oaFrameInst** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaFrameInst* data=*value; PyObject* bself = PyoaStringAppDef_oaFrameInst_Type.tp_alloc(&PyoaStringAppDef_oaFrameInst_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFrameInstObject* self = (PyoaStringAppDef_oaFrameInstObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaFrameInst_FromoaStringAppDef_oaFrameInst(oaStringAppDef_oaFrameInst* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaFrameInst_Type.tp_alloc(&PyoaStringAppDef_oaFrameInst_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaFrameInstObject* self = (PyoaStringAppDef_oaFrameInstObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFrameInst_get_doc[] = "Class: oaStringAppDef_oaFrameInst, Function: get\n" " Paramegers: (oaFrameInst,oaString)\n" " Calls: void get(const oaFrameInst* object,oaString& value)\n" " Signature: get|void-void|cptr-oaFrameInst,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaFrameInst_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFrameInst data; int convert_status=PyoaStringAppDef_oaFrameInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFrameInstObject* self=(PyoaStringAppDef_oaFrameInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaFrameInst p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaFrameInst_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFrameInst_getDefault_doc[] = "Class: oaStringAppDef_oaFrameInst, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaFrameInst_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFrameInst data; int convert_status=PyoaStringAppDef_oaFrameInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFrameInstObject* self=(PyoaStringAppDef_oaFrameInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFrameInst_set_doc[] = "Class: oaStringAppDef_oaFrameInst, Function: set\n" " Paramegers: (oaFrameInst,oaString)\n" " Calls: void set(oaFrameInst* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaFrameInst,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaFrameInst_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaFrameInst data; int convert_status=PyoaStringAppDef_oaFrameInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaFrameInstObject* self=(PyoaStringAppDef_oaFrameInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaFrameInst p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaFrameInst_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFrameInst_isNull_doc[] = "Class: oaStringAppDef_oaFrameInst, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaFrameInst_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaFrameInst data; int convert_status=PyoaStringAppDef_oaFrameInst_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaFrameInst_assign_doc[] = "Class: oaStringAppDef_oaFrameInst, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaFrameInst_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaFrameInst data; int convert_status=PyoaStringAppDef_oaFrameInst_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaFrameInst p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaFrameInst_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaFrameInst_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaFrameInst_get,METH_VARARGS,oaStringAppDef_oaFrameInst_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaFrameInst_getDefault,METH_VARARGS,oaStringAppDef_oaFrameInst_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaFrameInst_set,METH_VARARGS,oaStringAppDef_oaFrameInst_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaFrameInst_tp_isNull,METH_VARARGS,oaStringAppDef_oaFrameInst_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaFrameInst_tp_assign,METH_VARARGS,oaStringAppDef_oaFrameInst_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFrameInst_doc[] = "Class: oaStringAppDef_oaFrameInst\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaFrameInst)\n" " Calls: (const oaStringAppDef_oaFrameInst&)\n" " Signature: oaStringAppDef_oaFrameInst||cref-oaStringAppDef_oaFrameInst,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaFrameInst_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaFrameInst", sizeof(PyoaStringAppDef_oaFrameInstObject), 0, (destructor)oaStringAppDef_oaFrameInst_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaFrameInst_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaFrameInst_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaFrameInst_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaFrameInst_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaFrameInst_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaFrameInst_static_find_doc[] = "Class: oaStringAppDef_oaFrameInst, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaFrameInst* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaFrameInst|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaFrameInst* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaFrameInst|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaFrameInst_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaFrameInstp result= (oaStringAppDef_oaFrameInst::find(p1.Data())); return PyoaStringAppDef_oaFrameInst_FromoaStringAppDef_oaFrameInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFrameInstp result= (oaStringAppDef_oaFrameInst::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFrameInst_FromoaStringAppDef_oaFrameInst(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaFrameInst, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaFrameInst_static_get_doc[] = "Class: oaStringAppDef_oaFrameInst, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaFrameInst* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaFrameInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaFrameInst* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaFrameInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaFrameInst* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaFrameInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaFrameInst* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaFrameInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaFrameInst* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaFrameInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaFrameInst* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaFrameInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaFrameInst_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaFrameInstp result= (oaStringAppDef_oaFrameInst::get(p1.Data())); return PyoaStringAppDef_oaFrameInst_FromoaStringAppDef_oaFrameInst(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaFrameInstp result= (oaStringAppDef_oaFrameInst::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFrameInst_FromoaStringAppDef_oaFrameInst(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaFrameInstp result= (oaStringAppDef_oaFrameInst::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaFrameInst_FromoaStringAppDef_oaFrameInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFrameInstp result= (oaStringAppDef_oaFrameInst::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaFrameInst_FromoaStringAppDef_oaFrameInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFrameInstp result= (oaStringAppDef_oaFrameInst::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaFrameInst_FromoaStringAppDef_oaFrameInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaFrameInstp result= (oaStringAppDef_oaFrameInst::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaFrameInst_FromoaStringAppDef_oaFrameInst(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaFrameInst, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaFrameInst_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaFrameInst_static_find,METH_VARARGS,oaStringAppDef_oaFrameInst_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaFrameInst_static_get,METH_VARARGS,oaStringAppDef_oaFrameInst_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaFrameInst_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaFrameInst_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaFrameInst\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaFrameInst", (PyObject*)(&PyoaStringAppDef_oaFrameInst_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaFrameInst\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaFrameInst_Type.tp_dict; for(method=oaStringAppDef_oaFrameInst_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaGCellPattern // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaGCellPattern_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaGCellPattern_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGCellPatternObject* self = (PyoaStringAppDef_oaGCellPatternObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaGCellPattern) { PyParamoaStringAppDef_oaGCellPattern p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaGCellPattern_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaGCellPattern, Choices are:\n" " (oaStringAppDef_oaGCellPattern)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaGCellPattern_tp_dealloc(PyoaStringAppDef_oaGCellPatternObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaGCellPattern_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaGCellPattern value; int convert_status=PyoaStringAppDef_oaGCellPattern_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[51]; sprintf(buffer,"<oaStringAppDef_oaGCellPattern::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaGCellPattern_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaGCellPattern v1; PyParamoaStringAppDef_oaGCellPattern v2; int convert_status1=PyoaStringAppDef_oaGCellPattern_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaGCellPattern_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaGCellPattern_Convert(PyObject* ob,PyParamoaStringAppDef_oaGCellPattern* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaGCellPattern_Check(ob)) { result->SetData( (oaStringAppDef_oaGCellPattern**) ((PyoaStringAppDef_oaGCellPatternObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaGCellPattern Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaGCellPattern_FromoaStringAppDef_oaGCellPattern(oaStringAppDef_oaGCellPattern** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaGCellPattern* data=*value; PyObject* bself = PyoaStringAppDef_oaGCellPattern_Type.tp_alloc(&PyoaStringAppDef_oaGCellPattern_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGCellPatternObject* self = (PyoaStringAppDef_oaGCellPatternObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaGCellPattern_FromoaStringAppDef_oaGCellPattern(oaStringAppDef_oaGCellPattern* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaGCellPattern_Type.tp_alloc(&PyoaStringAppDef_oaGCellPattern_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGCellPatternObject* self = (PyoaStringAppDef_oaGCellPatternObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGCellPattern_get_doc[] = "Class: oaStringAppDef_oaGCellPattern, Function: get\n" " Paramegers: (oaGCellPattern,oaString)\n" " Calls: void get(const oaGCellPattern* object,oaString& value)\n" " Signature: get|void-void|cptr-oaGCellPattern,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaGCellPattern_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGCellPattern data; int convert_status=PyoaStringAppDef_oaGCellPattern_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGCellPatternObject* self=(PyoaStringAppDef_oaGCellPatternObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaGCellPattern p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaGCellPattern_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGCellPattern_getDefault_doc[] = "Class: oaStringAppDef_oaGCellPattern, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaGCellPattern_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGCellPattern data; int convert_status=PyoaStringAppDef_oaGCellPattern_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGCellPatternObject* self=(PyoaStringAppDef_oaGCellPatternObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGCellPattern_set_doc[] = "Class: oaStringAppDef_oaGCellPattern, Function: set\n" " Paramegers: (oaGCellPattern,oaString)\n" " Calls: void set(oaGCellPattern* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaGCellPattern,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaGCellPattern_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGCellPattern data; int convert_status=PyoaStringAppDef_oaGCellPattern_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGCellPatternObject* self=(PyoaStringAppDef_oaGCellPatternObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaGCellPattern p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaGCellPattern_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGCellPattern_isNull_doc[] = "Class: oaStringAppDef_oaGCellPattern, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaGCellPattern_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaGCellPattern data; int convert_status=PyoaStringAppDef_oaGCellPattern_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaGCellPattern_assign_doc[] = "Class: oaStringAppDef_oaGCellPattern, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaGCellPattern_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaGCellPattern data; int convert_status=PyoaStringAppDef_oaGCellPattern_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaGCellPattern p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaGCellPattern_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaGCellPattern_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaGCellPattern_get,METH_VARARGS,oaStringAppDef_oaGCellPattern_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaGCellPattern_getDefault,METH_VARARGS,oaStringAppDef_oaGCellPattern_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaGCellPattern_set,METH_VARARGS,oaStringAppDef_oaGCellPattern_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaGCellPattern_tp_isNull,METH_VARARGS,oaStringAppDef_oaGCellPattern_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaGCellPattern_tp_assign,METH_VARARGS,oaStringAppDef_oaGCellPattern_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGCellPattern_doc[] = "Class: oaStringAppDef_oaGCellPattern\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaGCellPattern)\n" " Calls: (const oaStringAppDef_oaGCellPattern&)\n" " Signature: oaStringAppDef_oaGCellPattern||cref-oaStringAppDef_oaGCellPattern,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaGCellPattern_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaGCellPattern", sizeof(PyoaStringAppDef_oaGCellPatternObject), 0, (destructor)oaStringAppDef_oaGCellPattern_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaGCellPattern_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaGCellPattern_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaGCellPattern_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaGCellPattern_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaGCellPattern_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGCellPattern_static_find_doc[] = "Class: oaStringAppDef_oaGCellPattern, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaGCellPattern* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaGCellPattern|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaGCellPattern* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaGCellPattern|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaGCellPattern_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaGCellPatternp result= (oaStringAppDef_oaGCellPattern::find(p1.Data())); return PyoaStringAppDef_oaGCellPattern_FromoaStringAppDef_oaGCellPattern(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGCellPatternp result= (oaStringAppDef_oaGCellPattern::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGCellPattern_FromoaStringAppDef_oaGCellPattern(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaGCellPattern, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGCellPattern_static_get_doc[] = "Class: oaStringAppDef_oaGCellPattern, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaGCellPattern* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaGCellPattern|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaGCellPattern* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaGCellPattern|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaGCellPattern* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaGCellPattern|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaGCellPattern* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaGCellPattern|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaGCellPattern* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaGCellPattern|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaGCellPattern* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaGCellPattern|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaGCellPattern_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaGCellPatternp result= (oaStringAppDef_oaGCellPattern::get(p1.Data())); return PyoaStringAppDef_oaGCellPattern_FromoaStringAppDef_oaGCellPattern(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaGCellPatternp result= (oaStringAppDef_oaGCellPattern::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGCellPattern_FromoaStringAppDef_oaGCellPattern(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaGCellPatternp result= (oaStringAppDef_oaGCellPattern::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaGCellPattern_FromoaStringAppDef_oaGCellPattern(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGCellPatternp result= (oaStringAppDef_oaGCellPattern::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGCellPattern_FromoaStringAppDef_oaGCellPattern(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGCellPatternp result= (oaStringAppDef_oaGCellPattern::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaGCellPattern_FromoaStringAppDef_oaGCellPattern(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGCellPatternp result= (oaStringAppDef_oaGCellPattern::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaGCellPattern_FromoaStringAppDef_oaGCellPattern(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaGCellPattern, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaGCellPattern_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaGCellPattern_static_find,METH_VARARGS,oaStringAppDef_oaGCellPattern_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaGCellPattern_static_get,METH_VARARGS,oaStringAppDef_oaGCellPattern_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaGCellPattern_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaGCellPattern_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaGCellPattern\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaGCellPattern", (PyObject*)(&PyoaStringAppDef_oaGCellPattern_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaGCellPattern\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaGCellPattern_Type.tp_dict; for(method=oaStringAppDef_oaGCellPattern_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaGroup // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaGroup_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaGroup_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGroupObject* self = (PyoaStringAppDef_oaGroupObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaGroup) { PyParamoaStringAppDef_oaGroup p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaGroup_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaGroup, Choices are:\n" " (oaStringAppDef_oaGroup)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaGroup_tp_dealloc(PyoaStringAppDef_oaGroupObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaGroup_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaGroup value; int convert_status=PyoaStringAppDef_oaGroup_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[44]; sprintf(buffer,"<oaStringAppDef_oaGroup::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaGroup_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaGroup v1; PyParamoaStringAppDef_oaGroup v2; int convert_status1=PyoaStringAppDef_oaGroup_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaGroup_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaGroup_Convert(PyObject* ob,PyParamoaStringAppDef_oaGroup* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaGroup_Check(ob)) { result->SetData( (oaStringAppDef_oaGroup**) ((PyoaStringAppDef_oaGroupObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaGroup Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaGroup_FromoaStringAppDef_oaGroup(oaStringAppDef_oaGroup** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaGroup* data=*value; PyObject* bself = PyoaStringAppDef_oaGroup_Type.tp_alloc(&PyoaStringAppDef_oaGroup_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGroupObject* self = (PyoaStringAppDef_oaGroupObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaGroup_FromoaStringAppDef_oaGroup(oaStringAppDef_oaGroup* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaGroup_Type.tp_alloc(&PyoaStringAppDef_oaGroup_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGroupObject* self = (PyoaStringAppDef_oaGroupObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGroup_get_doc[] = "Class: oaStringAppDef_oaGroup, Function: get\n" " Paramegers: (oaGroup,oaString)\n" " Calls: void get(const oaGroup* object,oaString& value)\n" " Signature: get|void-void|cptr-oaGroup,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaGroup_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGroup data; int convert_status=PyoaStringAppDef_oaGroup_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGroupObject* self=(PyoaStringAppDef_oaGroupObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaGroup p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaGroup_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGroup_getDefault_doc[] = "Class: oaStringAppDef_oaGroup, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaGroup_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGroup data; int convert_status=PyoaStringAppDef_oaGroup_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGroupObject* self=(PyoaStringAppDef_oaGroupObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGroup_set_doc[] = "Class: oaStringAppDef_oaGroup, Function: set\n" " Paramegers: (oaGroup,oaString)\n" " Calls: void set(oaGroup* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaGroup,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaGroup_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGroup data; int convert_status=PyoaStringAppDef_oaGroup_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGroupObject* self=(PyoaStringAppDef_oaGroupObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaGroup p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaGroup_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGroup_isNull_doc[] = "Class: oaStringAppDef_oaGroup, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaGroup_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaGroup data; int convert_status=PyoaStringAppDef_oaGroup_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaGroup_assign_doc[] = "Class: oaStringAppDef_oaGroup, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaGroup_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaGroup data; int convert_status=PyoaStringAppDef_oaGroup_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaGroup p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaGroup_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaGroup_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaGroup_get,METH_VARARGS,oaStringAppDef_oaGroup_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaGroup_getDefault,METH_VARARGS,oaStringAppDef_oaGroup_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaGroup_set,METH_VARARGS,oaStringAppDef_oaGroup_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaGroup_tp_isNull,METH_VARARGS,oaStringAppDef_oaGroup_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaGroup_tp_assign,METH_VARARGS,oaStringAppDef_oaGroup_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGroup_doc[] = "Class: oaStringAppDef_oaGroup\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaGroup)\n" " Calls: (const oaStringAppDef_oaGroup&)\n" " Signature: oaStringAppDef_oaGroup||cref-oaStringAppDef_oaGroup,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaGroup_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaGroup", sizeof(PyoaStringAppDef_oaGroupObject), 0, (destructor)oaStringAppDef_oaGroup_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaGroup_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaGroup_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaGroup_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaGroup_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaGroup_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGroup_static_find_doc[] = "Class: oaStringAppDef_oaGroup, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaGroup* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaGroup|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaGroup* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaGroup|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaGroup_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaGroupp result= (oaStringAppDef_oaGroup::find(p1.Data())); return PyoaStringAppDef_oaGroup_FromoaStringAppDef_oaGroup(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGroupp result= (oaStringAppDef_oaGroup::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGroup_FromoaStringAppDef_oaGroup(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaGroup, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGroup_static_get_doc[] = "Class: oaStringAppDef_oaGroup, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaGroup* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaGroup|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaGroup* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaGroup|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaGroup* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaGroup|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaGroup* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaGroup|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaGroup* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaGroup|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaGroup* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaGroup|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaGroup_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaGroupp result= (oaStringAppDef_oaGroup::get(p1.Data())); return PyoaStringAppDef_oaGroup_FromoaStringAppDef_oaGroup(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaGroupp result= (oaStringAppDef_oaGroup::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGroup_FromoaStringAppDef_oaGroup(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaGroupp result= (oaStringAppDef_oaGroup::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaGroup_FromoaStringAppDef_oaGroup(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGroupp result= (oaStringAppDef_oaGroup::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGroup_FromoaStringAppDef_oaGroup(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGroupp result= (oaStringAppDef_oaGroup::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaGroup_FromoaStringAppDef_oaGroup(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGroupp result= (oaStringAppDef_oaGroup::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaGroup_FromoaStringAppDef_oaGroup(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaGroup, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaGroup_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaGroup_static_find,METH_VARARGS,oaStringAppDef_oaGroup_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaGroup_static_get,METH_VARARGS,oaStringAppDef_oaGroup_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaGroup_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaGroup_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaGroup\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaGroup", (PyObject*)(&PyoaStringAppDef_oaGroup_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaGroup\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaGroup_Type.tp_dict; for(method=oaStringAppDef_oaGroup_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaGroupMember // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaGroupMember_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaGroupMember_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGroupMemberObject* self = (PyoaStringAppDef_oaGroupMemberObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaGroupMember) { PyParamoaStringAppDef_oaGroupMember p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaGroupMember_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaGroupMember, Choices are:\n" " (oaStringAppDef_oaGroupMember)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaGroupMember_tp_dealloc(PyoaStringAppDef_oaGroupMemberObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaGroupMember_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaGroupMember value; int convert_status=PyoaStringAppDef_oaGroupMember_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[50]; sprintf(buffer,"<oaStringAppDef_oaGroupMember::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaGroupMember_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaGroupMember v1; PyParamoaStringAppDef_oaGroupMember v2; int convert_status1=PyoaStringAppDef_oaGroupMember_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaGroupMember_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaGroupMember_Convert(PyObject* ob,PyParamoaStringAppDef_oaGroupMember* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaGroupMember_Check(ob)) { result->SetData( (oaStringAppDef_oaGroupMember**) ((PyoaStringAppDef_oaGroupMemberObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaGroupMember Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaGroupMember_FromoaStringAppDef_oaGroupMember(oaStringAppDef_oaGroupMember** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaGroupMember* data=*value; PyObject* bself = PyoaStringAppDef_oaGroupMember_Type.tp_alloc(&PyoaStringAppDef_oaGroupMember_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGroupMemberObject* self = (PyoaStringAppDef_oaGroupMemberObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaGroupMember_FromoaStringAppDef_oaGroupMember(oaStringAppDef_oaGroupMember* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaGroupMember_Type.tp_alloc(&PyoaStringAppDef_oaGroupMember_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGroupMemberObject* self = (PyoaStringAppDef_oaGroupMemberObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGroupMember_get_doc[] = "Class: oaStringAppDef_oaGroupMember, Function: get\n" " Paramegers: (oaGroupMember,oaString)\n" " Calls: void get(const oaGroupMember* object,oaString& value)\n" " Signature: get|void-void|cptr-oaGroupMember,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaGroupMember_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGroupMember data; int convert_status=PyoaStringAppDef_oaGroupMember_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGroupMemberObject* self=(PyoaStringAppDef_oaGroupMemberObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaGroupMember p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaGroupMember_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGroupMember_getDefault_doc[] = "Class: oaStringAppDef_oaGroupMember, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaGroupMember_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGroupMember data; int convert_status=PyoaStringAppDef_oaGroupMember_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGroupMemberObject* self=(PyoaStringAppDef_oaGroupMemberObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGroupMember_set_doc[] = "Class: oaStringAppDef_oaGroupMember, Function: set\n" " Paramegers: (oaGroupMember,oaString)\n" " Calls: void set(oaGroupMember* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaGroupMember,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaGroupMember_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGroupMember data; int convert_status=PyoaStringAppDef_oaGroupMember_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGroupMemberObject* self=(PyoaStringAppDef_oaGroupMemberObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaGroupMember p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaGroupMember_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGroupMember_isNull_doc[] = "Class: oaStringAppDef_oaGroupMember, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaGroupMember_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaGroupMember data; int convert_status=PyoaStringAppDef_oaGroupMember_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaGroupMember_assign_doc[] = "Class: oaStringAppDef_oaGroupMember, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaGroupMember_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaGroupMember data; int convert_status=PyoaStringAppDef_oaGroupMember_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaGroupMember p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaGroupMember_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaGroupMember_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaGroupMember_get,METH_VARARGS,oaStringAppDef_oaGroupMember_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaGroupMember_getDefault,METH_VARARGS,oaStringAppDef_oaGroupMember_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaGroupMember_set,METH_VARARGS,oaStringAppDef_oaGroupMember_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaGroupMember_tp_isNull,METH_VARARGS,oaStringAppDef_oaGroupMember_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaGroupMember_tp_assign,METH_VARARGS,oaStringAppDef_oaGroupMember_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGroupMember_doc[] = "Class: oaStringAppDef_oaGroupMember\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaGroupMember)\n" " Calls: (const oaStringAppDef_oaGroupMember&)\n" " Signature: oaStringAppDef_oaGroupMember||cref-oaStringAppDef_oaGroupMember,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaGroupMember_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaGroupMember", sizeof(PyoaStringAppDef_oaGroupMemberObject), 0, (destructor)oaStringAppDef_oaGroupMember_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaGroupMember_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaGroupMember_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaGroupMember_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaGroupMember_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaGroupMember_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGroupMember_static_find_doc[] = "Class: oaStringAppDef_oaGroupMember, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaGroupMember* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaGroupMember|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaGroupMember* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaGroupMember|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaGroupMember_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaGroupMemberp result= (oaStringAppDef_oaGroupMember::find(p1.Data())); return PyoaStringAppDef_oaGroupMember_FromoaStringAppDef_oaGroupMember(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGroupMemberp result= (oaStringAppDef_oaGroupMember::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGroupMember_FromoaStringAppDef_oaGroupMember(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaGroupMember, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGroupMember_static_get_doc[] = "Class: oaStringAppDef_oaGroupMember, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaGroupMember* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaGroupMember|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaGroupMember* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaGroupMember|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaGroupMember* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaGroupMember|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaGroupMember* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaGroupMember|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaGroupMember* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaGroupMember|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaGroupMember* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaGroupMember|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaGroupMember_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaGroupMemberp result= (oaStringAppDef_oaGroupMember::get(p1.Data())); return PyoaStringAppDef_oaGroupMember_FromoaStringAppDef_oaGroupMember(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaGroupMemberp result= (oaStringAppDef_oaGroupMember::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGroupMember_FromoaStringAppDef_oaGroupMember(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaGroupMemberp result= (oaStringAppDef_oaGroupMember::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaGroupMember_FromoaStringAppDef_oaGroupMember(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGroupMemberp result= (oaStringAppDef_oaGroupMember::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGroupMember_FromoaStringAppDef_oaGroupMember(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGroupMemberp result= (oaStringAppDef_oaGroupMember::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaGroupMember_FromoaStringAppDef_oaGroupMember(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGroupMemberp result= (oaStringAppDef_oaGroupMember::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaGroupMember_FromoaStringAppDef_oaGroupMember(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaGroupMember, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaGroupMember_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaGroupMember_static_find,METH_VARARGS,oaStringAppDef_oaGroupMember_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaGroupMember_static_get,METH_VARARGS,oaStringAppDef_oaGroupMember_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaGroupMember_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaGroupMember_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaGroupMember\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaGroupMember", (PyObject*)(&PyoaStringAppDef_oaGroupMember_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaGroupMember\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaGroupMember_Type.tp_dict; for(method=oaStringAppDef_oaGroupMember_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaGuide // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaGuide_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaGuide_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGuideObject* self = (PyoaStringAppDef_oaGuideObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaGuide) { PyParamoaStringAppDef_oaGuide p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaGuide_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaGuide, Choices are:\n" " (oaStringAppDef_oaGuide)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaGuide_tp_dealloc(PyoaStringAppDef_oaGuideObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaGuide_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaGuide value; int convert_status=PyoaStringAppDef_oaGuide_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[44]; sprintf(buffer,"<oaStringAppDef_oaGuide::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaGuide_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaGuide v1; PyParamoaStringAppDef_oaGuide v2; int convert_status1=PyoaStringAppDef_oaGuide_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaGuide_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaGuide_Convert(PyObject* ob,PyParamoaStringAppDef_oaGuide* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaGuide_Check(ob)) { result->SetData( (oaStringAppDef_oaGuide**) ((PyoaStringAppDef_oaGuideObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaGuide Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaGuide_FromoaStringAppDef_oaGuide(oaStringAppDef_oaGuide** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaGuide* data=*value; PyObject* bself = PyoaStringAppDef_oaGuide_Type.tp_alloc(&PyoaStringAppDef_oaGuide_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGuideObject* self = (PyoaStringAppDef_oaGuideObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaGuide_FromoaStringAppDef_oaGuide(oaStringAppDef_oaGuide* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaGuide_Type.tp_alloc(&PyoaStringAppDef_oaGuide_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaGuideObject* self = (PyoaStringAppDef_oaGuideObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGuide_get_doc[] = "Class: oaStringAppDef_oaGuide, Function: get\n" " Paramegers: (oaGuide,oaString)\n" " Calls: void get(const oaGuide* object,oaString& value)\n" " Signature: get|void-void|cptr-oaGuide,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaGuide_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGuide data; int convert_status=PyoaStringAppDef_oaGuide_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGuideObject* self=(PyoaStringAppDef_oaGuideObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaGuide p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaGuide_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGuide_getDefault_doc[] = "Class: oaStringAppDef_oaGuide, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaGuide_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGuide data; int convert_status=PyoaStringAppDef_oaGuide_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGuideObject* self=(PyoaStringAppDef_oaGuideObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGuide_set_doc[] = "Class: oaStringAppDef_oaGuide, Function: set\n" " Paramegers: (oaGuide,oaString)\n" " Calls: void set(oaGuide* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaGuide,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaGuide_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaGuide data; int convert_status=PyoaStringAppDef_oaGuide_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaGuideObject* self=(PyoaStringAppDef_oaGuideObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaGuide p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaGuide_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGuide_isNull_doc[] = "Class: oaStringAppDef_oaGuide, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaGuide_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaGuide data; int convert_status=PyoaStringAppDef_oaGuide_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaGuide_assign_doc[] = "Class: oaStringAppDef_oaGuide, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaGuide_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaGuide data; int convert_status=PyoaStringAppDef_oaGuide_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaGuide p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaGuide_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaGuide_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaGuide_get,METH_VARARGS,oaStringAppDef_oaGuide_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaGuide_getDefault,METH_VARARGS,oaStringAppDef_oaGuide_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaGuide_set,METH_VARARGS,oaStringAppDef_oaGuide_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaGuide_tp_isNull,METH_VARARGS,oaStringAppDef_oaGuide_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaGuide_tp_assign,METH_VARARGS,oaStringAppDef_oaGuide_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGuide_doc[] = "Class: oaStringAppDef_oaGuide\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaGuide)\n" " Calls: (const oaStringAppDef_oaGuide&)\n" " Signature: oaStringAppDef_oaGuide||cref-oaStringAppDef_oaGuide,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaGuide_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaGuide", sizeof(PyoaStringAppDef_oaGuideObject), 0, (destructor)oaStringAppDef_oaGuide_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaGuide_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaGuide_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaGuide_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaGuide_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaGuide_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaGuide_static_find_doc[] = "Class: oaStringAppDef_oaGuide, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaGuide* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaGuide|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaGuide* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaGuide|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaGuide_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaGuidep result= (oaStringAppDef_oaGuide::find(p1.Data())); return PyoaStringAppDef_oaGuide_FromoaStringAppDef_oaGuide(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGuidep result= (oaStringAppDef_oaGuide::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGuide_FromoaStringAppDef_oaGuide(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaGuide, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaGuide_static_get_doc[] = "Class: oaStringAppDef_oaGuide, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaGuide* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaGuide|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaGuide* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaGuide|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaGuide* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaGuide|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaGuide* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaGuide|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaGuide* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaGuide|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaGuide* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaGuide|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaGuide_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaGuidep result= (oaStringAppDef_oaGuide::get(p1.Data())); return PyoaStringAppDef_oaGuide_FromoaStringAppDef_oaGuide(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaGuidep result= (oaStringAppDef_oaGuide::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGuide_FromoaStringAppDef_oaGuide(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaGuidep result= (oaStringAppDef_oaGuide::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaGuide_FromoaStringAppDef_oaGuide(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGuidep result= (oaStringAppDef_oaGuide::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaGuide_FromoaStringAppDef_oaGuide(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGuidep result= (oaStringAppDef_oaGuide::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaGuide_FromoaStringAppDef_oaGuide(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaGuidep result= (oaStringAppDef_oaGuide::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaGuide_FromoaStringAppDef_oaGuide(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaGuide, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaGuide_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaGuide_static_find,METH_VARARGS,oaStringAppDef_oaGuide_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaGuide_static_get,METH_VARARGS,oaStringAppDef_oaGuide_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaGuide_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaGuide_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaGuide\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaGuide", (PyObject*)(&PyoaStringAppDef_oaGuide_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaGuide\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaGuide_Type.tp_dict; for(method=oaStringAppDef_oaGuide_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaImage // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaImage_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaImage_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaImageObject* self = (PyoaStringAppDef_oaImageObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaImage) { PyParamoaStringAppDef_oaImage p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaImage_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaImage, Choices are:\n" " (oaStringAppDef_oaImage)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaImage_tp_dealloc(PyoaStringAppDef_oaImageObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaImage_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaImage value; int convert_status=PyoaStringAppDef_oaImage_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[44]; sprintf(buffer,"<oaStringAppDef_oaImage::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaImage_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaImage v1; PyParamoaStringAppDef_oaImage v2; int convert_status1=PyoaStringAppDef_oaImage_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaImage_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaImage_Convert(PyObject* ob,PyParamoaStringAppDef_oaImage* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaImage_Check(ob)) { result->SetData( (oaStringAppDef_oaImage**) ((PyoaStringAppDef_oaImageObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaImage Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaImage_FromoaStringAppDef_oaImage(oaStringAppDef_oaImage** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaImage* data=*value; PyObject* bself = PyoaStringAppDef_oaImage_Type.tp_alloc(&PyoaStringAppDef_oaImage_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaImageObject* self = (PyoaStringAppDef_oaImageObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaImage_FromoaStringAppDef_oaImage(oaStringAppDef_oaImage* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaImage_Type.tp_alloc(&PyoaStringAppDef_oaImage_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaImageObject* self = (PyoaStringAppDef_oaImageObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaImage_get_doc[] = "Class: oaStringAppDef_oaImage, Function: get\n" " Paramegers: (oaImage,oaString)\n" " Calls: void get(const oaImage* object,oaString& value)\n" " Signature: get|void-void|cptr-oaImage,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaImage_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaImage data; int convert_status=PyoaStringAppDef_oaImage_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaImageObject* self=(PyoaStringAppDef_oaImageObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaImage p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaImage_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaImage_getDefault_doc[] = "Class: oaStringAppDef_oaImage, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaImage_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaImage data; int convert_status=PyoaStringAppDef_oaImage_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaImageObject* self=(PyoaStringAppDef_oaImageObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaImage_set_doc[] = "Class: oaStringAppDef_oaImage, Function: set\n" " Paramegers: (oaImage,oaString)\n" " Calls: void set(oaImage* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaImage,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaImage_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaImage data; int convert_status=PyoaStringAppDef_oaImage_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaImageObject* self=(PyoaStringAppDef_oaImageObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaImage p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaImage_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaImage_isNull_doc[] = "Class: oaStringAppDef_oaImage, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaImage_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaImage data; int convert_status=PyoaStringAppDef_oaImage_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaImage_assign_doc[] = "Class: oaStringAppDef_oaImage, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaImage_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaImage data; int convert_status=PyoaStringAppDef_oaImage_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaImage p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaImage_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaImage_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaImage_get,METH_VARARGS,oaStringAppDef_oaImage_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaImage_getDefault,METH_VARARGS,oaStringAppDef_oaImage_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaImage_set,METH_VARARGS,oaStringAppDef_oaImage_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaImage_tp_isNull,METH_VARARGS,oaStringAppDef_oaImage_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaImage_tp_assign,METH_VARARGS,oaStringAppDef_oaImage_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaImage_doc[] = "Class: oaStringAppDef_oaImage\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaImage)\n" " Calls: (const oaStringAppDef_oaImage&)\n" " Signature: oaStringAppDef_oaImage||cref-oaStringAppDef_oaImage,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaImage_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaImage", sizeof(PyoaStringAppDef_oaImageObject), 0, (destructor)oaStringAppDef_oaImage_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaImage_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaImage_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaImage_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaImage_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaImage_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaImage_static_find_doc[] = "Class: oaStringAppDef_oaImage, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaImage* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaImage|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaImage* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaImage|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaImage_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaImagep result= (oaStringAppDef_oaImage::find(p1.Data())); return PyoaStringAppDef_oaImage_FromoaStringAppDef_oaImage(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaImagep result= (oaStringAppDef_oaImage::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaImage_FromoaStringAppDef_oaImage(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaImage, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaImage_static_get_doc[] = "Class: oaStringAppDef_oaImage, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaImage* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaImage|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaImage* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaImage|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaImage* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaImage|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaImage* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaImage|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaImage* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaImage|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaImage* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaImage|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaImage_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaImagep result= (oaStringAppDef_oaImage::get(p1.Data())); return PyoaStringAppDef_oaImage_FromoaStringAppDef_oaImage(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaImagep result= (oaStringAppDef_oaImage::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaImage_FromoaStringAppDef_oaImage(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaImagep result= (oaStringAppDef_oaImage::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaImage_FromoaStringAppDef_oaImage(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaImagep result= (oaStringAppDef_oaImage::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaImage_FromoaStringAppDef_oaImage(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaImagep result= (oaStringAppDef_oaImage::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaImage_FromoaStringAppDef_oaImage(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaImagep result= (oaStringAppDef_oaImage::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaImage_FromoaStringAppDef_oaImage(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaImage, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaImage_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaImage_static_find,METH_VARARGS,oaStringAppDef_oaImage_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaImage_static_get,METH_VARARGS,oaStringAppDef_oaImage_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaImage_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaImage_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaImage\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaImage", (PyObject*)(&PyoaStringAppDef_oaImage_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaImage\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaImage_Type.tp_dict; for(method=oaStringAppDef_oaImage_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaInst // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaInst_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaInst_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaInstObject* self = (PyoaStringAppDef_oaInstObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaInst) { PyParamoaStringAppDef_oaInst p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaInst_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaInst, Choices are:\n" " (oaStringAppDef_oaInst)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaInst_tp_dealloc(PyoaStringAppDef_oaInstObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaInst_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaInst value; int convert_status=PyoaStringAppDef_oaInst_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[43]; sprintf(buffer,"<oaStringAppDef_oaInst::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaInst_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaInst v1; PyParamoaStringAppDef_oaInst v2; int convert_status1=PyoaStringAppDef_oaInst_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaInst_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaInst_Convert(PyObject* ob,PyParamoaStringAppDef_oaInst* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaInst_Check(ob)) { result->SetData( (oaStringAppDef_oaInst**) ((PyoaStringAppDef_oaInstObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaInst Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaInst_FromoaStringAppDef_oaInst(oaStringAppDef_oaInst** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaInst* data=*value; PyObject* bself = PyoaStringAppDef_oaInst_Type.tp_alloc(&PyoaStringAppDef_oaInst_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaInstObject* self = (PyoaStringAppDef_oaInstObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaInst_FromoaStringAppDef_oaInst(oaStringAppDef_oaInst* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaInst_Type.tp_alloc(&PyoaStringAppDef_oaInst_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaInstObject* self = (PyoaStringAppDef_oaInstObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaInst_get_doc[] = "Class: oaStringAppDef_oaInst, Function: get\n" " Paramegers: (oaInst,oaString)\n" " Calls: void get(const oaInst* object,oaString& value)\n" " Signature: get|void-void|cptr-oaInst,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaInst_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaInst data; int convert_status=PyoaStringAppDef_oaInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaInstObject* self=(PyoaStringAppDef_oaInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaInst p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaInst_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInst_getDefault_doc[] = "Class: oaStringAppDef_oaInst, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaInst_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaInst data; int convert_status=PyoaStringAppDef_oaInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaInstObject* self=(PyoaStringAppDef_oaInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInst_set_doc[] = "Class: oaStringAppDef_oaInst, Function: set\n" " Paramegers: (oaInst,oaString)\n" " Calls: void set(oaInst* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaInst,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaInst_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaInst data; int convert_status=PyoaStringAppDef_oaInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaInstObject* self=(PyoaStringAppDef_oaInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaInst p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaInst_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInst_isNull_doc[] = "Class: oaStringAppDef_oaInst, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaInst_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaInst data; int convert_status=PyoaStringAppDef_oaInst_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaInst_assign_doc[] = "Class: oaStringAppDef_oaInst, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaInst_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaInst data; int convert_status=PyoaStringAppDef_oaInst_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaInst p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaInst_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaInst_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaInst_get,METH_VARARGS,oaStringAppDef_oaInst_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaInst_getDefault,METH_VARARGS,oaStringAppDef_oaInst_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaInst_set,METH_VARARGS,oaStringAppDef_oaInst_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaInst_tp_isNull,METH_VARARGS,oaStringAppDef_oaInst_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaInst_tp_assign,METH_VARARGS,oaStringAppDef_oaInst_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaInst_doc[] = "Class: oaStringAppDef_oaInst\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaInst)\n" " Calls: (const oaStringAppDef_oaInst&)\n" " Signature: oaStringAppDef_oaInst||cref-oaStringAppDef_oaInst,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaInst_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaInst", sizeof(PyoaStringAppDef_oaInstObject), 0, (destructor)oaStringAppDef_oaInst_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaInst_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaInst_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaInst_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaInst_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaInst_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaInst_static_find_doc[] = "Class: oaStringAppDef_oaInst, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaInst* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaInst|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaInst* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaInst|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaInst_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaInstp result= (oaStringAppDef_oaInst::find(p1.Data())); return PyoaStringAppDef_oaInst_FromoaStringAppDef_oaInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstp result= (oaStringAppDef_oaInst::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaInst_FromoaStringAppDef_oaInst(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaInst, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInst_static_get_doc[] = "Class: oaStringAppDef_oaInst, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaInst* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaInst* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaInst* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaInst* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaInst* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaInst* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaInst_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaInstp result= (oaStringAppDef_oaInst::get(p1.Data())); return PyoaStringAppDef_oaInst_FromoaStringAppDef_oaInst(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaInstp result= (oaStringAppDef_oaInst::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaInst_FromoaStringAppDef_oaInst(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaInstp result= (oaStringAppDef_oaInst::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaInst_FromoaStringAppDef_oaInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstp result= (oaStringAppDef_oaInst::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaInst_FromoaStringAppDef_oaInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstp result= (oaStringAppDef_oaInst::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaInst_FromoaStringAppDef_oaInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstp result= (oaStringAppDef_oaInst::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaInst_FromoaStringAppDef_oaInst(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaInst, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaInst_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaInst_static_find,METH_VARARGS,oaStringAppDef_oaInst_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaInst_static_get,METH_VARARGS,oaStringAppDef_oaInst_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaInst_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaInst_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaInst\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaInst", (PyObject*)(&PyoaStringAppDef_oaInst_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaInst\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaInst_Type.tp_dict; for(method=oaStringAppDef_oaInst_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaInstHeader // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaInstHeader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaInstHeader_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaInstHeaderObject* self = (PyoaStringAppDef_oaInstHeaderObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaInstHeader) { PyParamoaStringAppDef_oaInstHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaInstHeader_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaInstHeader, Choices are:\n" " (oaStringAppDef_oaInstHeader)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaInstHeader_tp_dealloc(PyoaStringAppDef_oaInstHeaderObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaInstHeader_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaInstHeader value; int convert_status=PyoaStringAppDef_oaInstHeader_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[49]; sprintf(buffer,"<oaStringAppDef_oaInstHeader::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaInstHeader_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaInstHeader v1; PyParamoaStringAppDef_oaInstHeader v2; int convert_status1=PyoaStringAppDef_oaInstHeader_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaInstHeader_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaInstHeader_Convert(PyObject* ob,PyParamoaStringAppDef_oaInstHeader* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaInstHeader_Check(ob)) { result->SetData( (oaStringAppDef_oaInstHeader**) ((PyoaStringAppDef_oaInstHeaderObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaInstHeader Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaInstHeader_FromoaStringAppDef_oaInstHeader(oaStringAppDef_oaInstHeader** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaInstHeader* data=*value; PyObject* bself = PyoaStringAppDef_oaInstHeader_Type.tp_alloc(&PyoaStringAppDef_oaInstHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaInstHeaderObject* self = (PyoaStringAppDef_oaInstHeaderObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaInstHeader_FromoaStringAppDef_oaInstHeader(oaStringAppDef_oaInstHeader* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaInstHeader_Type.tp_alloc(&PyoaStringAppDef_oaInstHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaInstHeaderObject* self = (PyoaStringAppDef_oaInstHeaderObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaInstHeader_get_doc[] = "Class: oaStringAppDef_oaInstHeader, Function: get\n" " Paramegers: (oaInstHeader,oaString)\n" " Calls: void get(const oaInstHeader* object,oaString& value)\n" " Signature: get|void-void|cptr-oaInstHeader,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaInstHeader_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaInstHeader data; int convert_status=PyoaStringAppDef_oaInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaInstHeaderObject* self=(PyoaStringAppDef_oaInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaInstHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaInstHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInstHeader_getDefault_doc[] = "Class: oaStringAppDef_oaInstHeader, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaInstHeader_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaInstHeader data; int convert_status=PyoaStringAppDef_oaInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaInstHeaderObject* self=(PyoaStringAppDef_oaInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInstHeader_set_doc[] = "Class: oaStringAppDef_oaInstHeader, Function: set\n" " Paramegers: (oaInstHeader,oaString)\n" " Calls: void set(oaInstHeader* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaInstHeader,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaInstHeader_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaInstHeader data; int convert_status=PyoaStringAppDef_oaInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaInstHeaderObject* self=(PyoaStringAppDef_oaInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaInstHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaInstHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInstHeader_isNull_doc[] = "Class: oaStringAppDef_oaInstHeader, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaInstHeader_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaInstHeader data; int convert_status=PyoaStringAppDef_oaInstHeader_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaInstHeader_assign_doc[] = "Class: oaStringAppDef_oaInstHeader, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaInstHeader_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaInstHeader data; int convert_status=PyoaStringAppDef_oaInstHeader_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaInstHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaInstHeader_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaInstHeader_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaInstHeader_get,METH_VARARGS,oaStringAppDef_oaInstHeader_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaInstHeader_getDefault,METH_VARARGS,oaStringAppDef_oaInstHeader_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaInstHeader_set,METH_VARARGS,oaStringAppDef_oaInstHeader_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaInstHeader_tp_isNull,METH_VARARGS,oaStringAppDef_oaInstHeader_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaInstHeader_tp_assign,METH_VARARGS,oaStringAppDef_oaInstHeader_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaInstHeader_doc[] = "Class: oaStringAppDef_oaInstHeader\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaInstHeader)\n" " Calls: (const oaStringAppDef_oaInstHeader&)\n" " Signature: oaStringAppDef_oaInstHeader||cref-oaStringAppDef_oaInstHeader,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaInstHeader_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaInstHeader", sizeof(PyoaStringAppDef_oaInstHeaderObject), 0, (destructor)oaStringAppDef_oaInstHeader_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaInstHeader_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaInstHeader_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaInstHeader_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaInstHeader_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaInstHeader_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaInstHeader_static_find_doc[] = "Class: oaStringAppDef_oaInstHeader, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaInstHeader* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaInstHeader|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaInstHeader* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaInstHeader|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaInstHeader_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaInstHeaderp result= (oaStringAppDef_oaInstHeader::find(p1.Data())); return PyoaStringAppDef_oaInstHeader_FromoaStringAppDef_oaInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstHeaderp result= (oaStringAppDef_oaInstHeader::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaInstHeader_FromoaStringAppDef_oaInstHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaInstHeader, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInstHeader_static_get_doc[] = "Class: oaStringAppDef_oaInstHeader, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaInstHeader* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaInstHeader* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaInstHeader* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaInstHeader* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaInstHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaInstHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaInstHeader_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaInstHeaderp result= (oaStringAppDef_oaInstHeader::get(p1.Data())); return PyoaStringAppDef_oaInstHeader_FromoaStringAppDef_oaInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaInstHeaderp result= (oaStringAppDef_oaInstHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaInstHeader_FromoaStringAppDef_oaInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaInstHeaderp result= (oaStringAppDef_oaInstHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaInstHeader_FromoaStringAppDef_oaInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstHeaderp result= (oaStringAppDef_oaInstHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaInstHeader_FromoaStringAppDef_oaInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstHeaderp result= (oaStringAppDef_oaInstHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaInstHeader_FromoaStringAppDef_oaInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstHeaderp result= (oaStringAppDef_oaInstHeader::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaInstHeader_FromoaStringAppDef_oaInstHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaInstHeader, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaInstHeader_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaInstHeader_static_find,METH_VARARGS,oaStringAppDef_oaInstHeader_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaInstHeader_static_get,METH_VARARGS,oaStringAppDef_oaInstHeader_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaInstHeader_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaInstHeader_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaInstHeader\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaInstHeader", (PyObject*)(&PyoaStringAppDef_oaInstHeader_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaInstHeader\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaInstHeader_Type.tp_dict; for(method=oaStringAppDef_oaInstHeader_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaInstTerm // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaInstTerm_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaInstTerm_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaInstTermObject* self = (PyoaStringAppDef_oaInstTermObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaInstTerm) { PyParamoaStringAppDef_oaInstTerm p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaInstTerm_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaInstTerm, Choices are:\n" " (oaStringAppDef_oaInstTerm)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaInstTerm_tp_dealloc(PyoaStringAppDef_oaInstTermObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaInstTerm_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaInstTerm value; int convert_status=PyoaStringAppDef_oaInstTerm_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[47]; sprintf(buffer,"<oaStringAppDef_oaInstTerm::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaInstTerm_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaInstTerm v1; PyParamoaStringAppDef_oaInstTerm v2; int convert_status1=PyoaStringAppDef_oaInstTerm_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaInstTerm_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaInstTerm_Convert(PyObject* ob,PyParamoaStringAppDef_oaInstTerm* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaInstTerm_Check(ob)) { result->SetData( (oaStringAppDef_oaInstTerm**) ((PyoaStringAppDef_oaInstTermObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaInstTerm Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaInstTerm_FromoaStringAppDef_oaInstTerm(oaStringAppDef_oaInstTerm** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaInstTerm* data=*value; PyObject* bself = PyoaStringAppDef_oaInstTerm_Type.tp_alloc(&PyoaStringAppDef_oaInstTerm_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaInstTermObject* self = (PyoaStringAppDef_oaInstTermObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaInstTerm_FromoaStringAppDef_oaInstTerm(oaStringAppDef_oaInstTerm* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaInstTerm_Type.tp_alloc(&PyoaStringAppDef_oaInstTerm_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaInstTermObject* self = (PyoaStringAppDef_oaInstTermObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaInstTerm_get_doc[] = "Class: oaStringAppDef_oaInstTerm, Function: get\n" " Paramegers: (oaInstTerm,oaString)\n" " Calls: void get(const oaInstTerm* object,oaString& value)\n" " Signature: get|void-void|cptr-oaInstTerm,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaInstTerm_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaInstTerm data; int convert_status=PyoaStringAppDef_oaInstTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaInstTermObject* self=(PyoaStringAppDef_oaInstTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaInstTerm p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaInstTerm_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInstTerm_getDefault_doc[] = "Class: oaStringAppDef_oaInstTerm, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaInstTerm_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaInstTerm data; int convert_status=PyoaStringAppDef_oaInstTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaInstTermObject* self=(PyoaStringAppDef_oaInstTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInstTerm_set_doc[] = "Class: oaStringAppDef_oaInstTerm, Function: set\n" " Paramegers: (oaInstTerm,oaString)\n" " Calls: void set(oaInstTerm* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaInstTerm,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaInstTerm_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaInstTerm data; int convert_status=PyoaStringAppDef_oaInstTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaInstTermObject* self=(PyoaStringAppDef_oaInstTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaInstTerm p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaInstTerm_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInstTerm_isNull_doc[] = "Class: oaStringAppDef_oaInstTerm, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaInstTerm_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaInstTerm data; int convert_status=PyoaStringAppDef_oaInstTerm_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaInstTerm_assign_doc[] = "Class: oaStringAppDef_oaInstTerm, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaInstTerm_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaInstTerm data; int convert_status=PyoaStringAppDef_oaInstTerm_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaInstTerm p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaInstTerm_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaInstTerm_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaInstTerm_get,METH_VARARGS,oaStringAppDef_oaInstTerm_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaInstTerm_getDefault,METH_VARARGS,oaStringAppDef_oaInstTerm_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaInstTerm_set,METH_VARARGS,oaStringAppDef_oaInstTerm_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaInstTerm_tp_isNull,METH_VARARGS,oaStringAppDef_oaInstTerm_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaInstTerm_tp_assign,METH_VARARGS,oaStringAppDef_oaInstTerm_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaInstTerm_doc[] = "Class: oaStringAppDef_oaInstTerm\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaInstTerm)\n" " Calls: (const oaStringAppDef_oaInstTerm&)\n" " Signature: oaStringAppDef_oaInstTerm||cref-oaStringAppDef_oaInstTerm,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaInstTerm_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaInstTerm", sizeof(PyoaStringAppDef_oaInstTermObject), 0, (destructor)oaStringAppDef_oaInstTerm_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaInstTerm_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaInstTerm_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaInstTerm_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaInstTerm_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaInstTerm_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaInstTerm_static_find_doc[] = "Class: oaStringAppDef_oaInstTerm, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaInstTerm* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaInstTerm|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaInstTerm* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaInstTerm|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaInstTerm_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaInstTermp result= (oaStringAppDef_oaInstTerm::find(p1.Data())); return PyoaStringAppDef_oaInstTerm_FromoaStringAppDef_oaInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstTermp result= (oaStringAppDef_oaInstTerm::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaInstTerm_FromoaStringAppDef_oaInstTerm(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaInstTerm, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaInstTerm_static_get_doc[] = "Class: oaStringAppDef_oaInstTerm, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaInstTerm* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaInstTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaInstTerm* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaInstTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaInstTerm* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaInstTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaInstTerm* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaInstTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaInstTerm* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaInstTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaInstTerm* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaInstTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaInstTerm_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaInstTermp result= (oaStringAppDef_oaInstTerm::get(p1.Data())); return PyoaStringAppDef_oaInstTerm_FromoaStringAppDef_oaInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaInstTermp result= (oaStringAppDef_oaInstTerm::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaInstTerm_FromoaStringAppDef_oaInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaInstTermp result= (oaStringAppDef_oaInstTerm::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaInstTerm_FromoaStringAppDef_oaInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstTermp result= (oaStringAppDef_oaInstTerm::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaInstTerm_FromoaStringAppDef_oaInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstTermp result= (oaStringAppDef_oaInstTerm::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaInstTerm_FromoaStringAppDef_oaInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaInstTermp result= (oaStringAppDef_oaInstTerm::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaInstTerm_FromoaStringAppDef_oaInstTerm(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaInstTerm, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaInstTerm_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaInstTerm_static_find,METH_VARARGS,oaStringAppDef_oaInstTerm_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaInstTerm_static_get,METH_VARARGS,oaStringAppDef_oaInstTerm_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaInstTerm_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaInstTerm_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaInstTerm\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaInstTerm", (PyObject*)(&PyoaStringAppDef_oaInstTerm_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaInstTerm\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaInstTerm_Type.tp_dict; for(method=oaStringAppDef_oaInstTerm_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaLPPHeader // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaLPPHeader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaLPPHeader_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLPPHeaderObject* self = (PyoaStringAppDef_oaLPPHeaderObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaLPPHeader) { PyParamoaStringAppDef_oaLPPHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaLPPHeader_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaLPPHeader, Choices are:\n" " (oaStringAppDef_oaLPPHeader)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaLPPHeader_tp_dealloc(PyoaStringAppDef_oaLPPHeaderObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaLPPHeader_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaLPPHeader value; int convert_status=PyoaStringAppDef_oaLPPHeader_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[48]; sprintf(buffer,"<oaStringAppDef_oaLPPHeader::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaLPPHeader_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaLPPHeader v1; PyParamoaStringAppDef_oaLPPHeader v2; int convert_status1=PyoaStringAppDef_oaLPPHeader_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaLPPHeader_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaLPPHeader_Convert(PyObject* ob,PyParamoaStringAppDef_oaLPPHeader* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaLPPHeader_Check(ob)) { result->SetData( (oaStringAppDef_oaLPPHeader**) ((PyoaStringAppDef_oaLPPHeaderObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaLPPHeader Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaLPPHeader_FromoaStringAppDef_oaLPPHeader(oaStringAppDef_oaLPPHeader** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaLPPHeader* data=*value; PyObject* bself = PyoaStringAppDef_oaLPPHeader_Type.tp_alloc(&PyoaStringAppDef_oaLPPHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLPPHeaderObject* self = (PyoaStringAppDef_oaLPPHeaderObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaLPPHeader_FromoaStringAppDef_oaLPPHeader(oaStringAppDef_oaLPPHeader* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaLPPHeader_Type.tp_alloc(&PyoaStringAppDef_oaLPPHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLPPHeaderObject* self = (PyoaStringAppDef_oaLPPHeaderObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLPPHeader_get_doc[] = "Class: oaStringAppDef_oaLPPHeader, Function: get\n" " Paramegers: (oaLPPHeader,oaString)\n" " Calls: void get(const oaLPPHeader* object,oaString& value)\n" " Signature: get|void-void|cptr-oaLPPHeader,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaLPPHeader_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLPPHeader data; int convert_status=PyoaStringAppDef_oaLPPHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLPPHeaderObject* self=(PyoaStringAppDef_oaLPPHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaLPPHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaLPPHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLPPHeader_getDefault_doc[] = "Class: oaStringAppDef_oaLPPHeader, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaLPPHeader_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLPPHeader data; int convert_status=PyoaStringAppDef_oaLPPHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLPPHeaderObject* self=(PyoaStringAppDef_oaLPPHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLPPHeader_set_doc[] = "Class: oaStringAppDef_oaLPPHeader, Function: set\n" " Paramegers: (oaLPPHeader,oaString)\n" " Calls: void set(oaLPPHeader* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaLPPHeader,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaLPPHeader_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLPPHeader data; int convert_status=PyoaStringAppDef_oaLPPHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLPPHeaderObject* self=(PyoaStringAppDef_oaLPPHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaLPPHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaLPPHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLPPHeader_isNull_doc[] = "Class: oaStringAppDef_oaLPPHeader, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaLPPHeader_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaLPPHeader data; int convert_status=PyoaStringAppDef_oaLPPHeader_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaLPPHeader_assign_doc[] = "Class: oaStringAppDef_oaLPPHeader, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaLPPHeader_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaLPPHeader data; int convert_status=PyoaStringAppDef_oaLPPHeader_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaLPPHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaLPPHeader_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaLPPHeader_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaLPPHeader_get,METH_VARARGS,oaStringAppDef_oaLPPHeader_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaLPPHeader_getDefault,METH_VARARGS,oaStringAppDef_oaLPPHeader_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaLPPHeader_set,METH_VARARGS,oaStringAppDef_oaLPPHeader_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaLPPHeader_tp_isNull,METH_VARARGS,oaStringAppDef_oaLPPHeader_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaLPPHeader_tp_assign,METH_VARARGS,oaStringAppDef_oaLPPHeader_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLPPHeader_doc[] = "Class: oaStringAppDef_oaLPPHeader\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaLPPHeader)\n" " Calls: (const oaStringAppDef_oaLPPHeader&)\n" " Signature: oaStringAppDef_oaLPPHeader||cref-oaStringAppDef_oaLPPHeader,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaLPPHeader_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaLPPHeader", sizeof(PyoaStringAppDef_oaLPPHeaderObject), 0, (destructor)oaStringAppDef_oaLPPHeader_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaLPPHeader_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaLPPHeader_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaLPPHeader_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaLPPHeader_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaLPPHeader_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLPPHeader_static_find_doc[] = "Class: oaStringAppDef_oaLPPHeader, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaLPPHeader* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaLPPHeader|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaLPPHeader* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaLPPHeader|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaLPPHeader_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaLPPHeaderp result= (oaStringAppDef_oaLPPHeader::find(p1.Data())); return PyoaStringAppDef_oaLPPHeader_FromoaStringAppDef_oaLPPHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLPPHeaderp result= (oaStringAppDef_oaLPPHeader::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLPPHeader_FromoaStringAppDef_oaLPPHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaLPPHeader, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLPPHeader_static_get_doc[] = "Class: oaStringAppDef_oaLPPHeader, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaLPPHeader* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaLPPHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaLPPHeader* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaLPPHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaLPPHeader* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaLPPHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaLPPHeader* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaLPPHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaLPPHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaLPPHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaLPPHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaLPPHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaLPPHeader_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaLPPHeaderp result= (oaStringAppDef_oaLPPHeader::get(p1.Data())); return PyoaStringAppDef_oaLPPHeader_FromoaStringAppDef_oaLPPHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaLPPHeaderp result= (oaStringAppDef_oaLPPHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLPPHeader_FromoaStringAppDef_oaLPPHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaLPPHeaderp result= (oaStringAppDef_oaLPPHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaLPPHeader_FromoaStringAppDef_oaLPPHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLPPHeaderp result= (oaStringAppDef_oaLPPHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLPPHeader_FromoaStringAppDef_oaLPPHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLPPHeaderp result= (oaStringAppDef_oaLPPHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaLPPHeader_FromoaStringAppDef_oaLPPHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLPPHeaderp result= (oaStringAppDef_oaLPPHeader::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaLPPHeader_FromoaStringAppDef_oaLPPHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaLPPHeader, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaLPPHeader_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaLPPHeader_static_find,METH_VARARGS,oaStringAppDef_oaLPPHeader_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaLPPHeader_static_get,METH_VARARGS,oaStringAppDef_oaLPPHeader_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaLPPHeader_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaLPPHeader_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaLPPHeader\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaLPPHeader", (PyObject*)(&PyoaStringAppDef_oaLPPHeader_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaLPPHeader\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaLPPHeader_Type.tp_dict; for(method=oaStringAppDef_oaLPPHeader_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaLayer // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaLayer_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaLayer_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLayerObject* self = (PyoaStringAppDef_oaLayerObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaLayer) { PyParamoaStringAppDef_oaLayer p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaLayer_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaLayer, Choices are:\n" " (oaStringAppDef_oaLayer)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaLayer_tp_dealloc(PyoaStringAppDef_oaLayerObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaLayer_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaLayer value; int convert_status=PyoaStringAppDef_oaLayer_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[44]; sprintf(buffer,"<oaStringAppDef_oaLayer::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaLayer_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaLayer v1; PyParamoaStringAppDef_oaLayer v2; int convert_status1=PyoaStringAppDef_oaLayer_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaLayer_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaLayer_Convert(PyObject* ob,PyParamoaStringAppDef_oaLayer* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaLayer_Check(ob)) { result->SetData( (oaStringAppDef_oaLayer**) ((PyoaStringAppDef_oaLayerObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaLayer Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaLayer_FromoaStringAppDef_oaLayer(oaStringAppDef_oaLayer** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaLayer* data=*value; PyObject* bself = PyoaStringAppDef_oaLayer_Type.tp_alloc(&PyoaStringAppDef_oaLayer_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLayerObject* self = (PyoaStringAppDef_oaLayerObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaLayer_FromoaStringAppDef_oaLayer(oaStringAppDef_oaLayer* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaLayer_Type.tp_alloc(&PyoaStringAppDef_oaLayer_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLayerObject* self = (PyoaStringAppDef_oaLayerObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLayer_get_doc[] = "Class: oaStringAppDef_oaLayer, Function: get\n" " Paramegers: (oaLayer,oaString)\n" " Calls: void get(const oaLayer* object,oaString& value)\n" " Signature: get|void-void|cptr-oaLayer,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaLayer_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLayer data; int convert_status=PyoaStringAppDef_oaLayer_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLayerObject* self=(PyoaStringAppDef_oaLayerObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaLayer p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaLayer_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLayer_getDefault_doc[] = "Class: oaStringAppDef_oaLayer, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaLayer_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLayer data; int convert_status=PyoaStringAppDef_oaLayer_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLayerObject* self=(PyoaStringAppDef_oaLayerObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLayer_set_doc[] = "Class: oaStringAppDef_oaLayer, Function: set\n" " Paramegers: (oaLayer,oaString)\n" " Calls: void set(oaLayer* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaLayer,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaLayer_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLayer data; int convert_status=PyoaStringAppDef_oaLayer_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLayerObject* self=(PyoaStringAppDef_oaLayerObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaLayer p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaLayer_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLayer_isNull_doc[] = "Class: oaStringAppDef_oaLayer, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaLayer_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaLayer data; int convert_status=PyoaStringAppDef_oaLayer_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaLayer_assign_doc[] = "Class: oaStringAppDef_oaLayer, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaLayer_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaLayer data; int convert_status=PyoaStringAppDef_oaLayer_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaLayer p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaLayer_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaLayer_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaLayer_get,METH_VARARGS,oaStringAppDef_oaLayer_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaLayer_getDefault,METH_VARARGS,oaStringAppDef_oaLayer_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaLayer_set,METH_VARARGS,oaStringAppDef_oaLayer_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaLayer_tp_isNull,METH_VARARGS,oaStringAppDef_oaLayer_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaLayer_tp_assign,METH_VARARGS,oaStringAppDef_oaLayer_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLayer_doc[] = "Class: oaStringAppDef_oaLayer\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaLayer)\n" " Calls: (const oaStringAppDef_oaLayer&)\n" " Signature: oaStringAppDef_oaLayer||cref-oaStringAppDef_oaLayer,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaLayer_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaLayer", sizeof(PyoaStringAppDef_oaLayerObject), 0, (destructor)oaStringAppDef_oaLayer_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaLayer_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaLayer_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaLayer_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaLayer_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaLayer_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLayer_static_find_doc[] = "Class: oaStringAppDef_oaLayer, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaLayer* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaLayer|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaLayer* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaLayer|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaLayer_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaLayerp result= (oaStringAppDef_oaLayer::find(p1.Data())); return PyoaStringAppDef_oaLayer_FromoaStringAppDef_oaLayer(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLayerp result= (oaStringAppDef_oaLayer::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLayer_FromoaStringAppDef_oaLayer(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaLayer, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLayer_static_get_doc[] = "Class: oaStringAppDef_oaLayer, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaLayer* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaLayer|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaLayer* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaLayer|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaLayer* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaLayer|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaLayer* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaLayer|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaLayer* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaLayer|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaLayer* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaLayer|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaLayer_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaLayerp result= (oaStringAppDef_oaLayer::get(p1.Data())); return PyoaStringAppDef_oaLayer_FromoaStringAppDef_oaLayer(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaLayerp result= (oaStringAppDef_oaLayer::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLayer_FromoaStringAppDef_oaLayer(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaLayerp result= (oaStringAppDef_oaLayer::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaLayer_FromoaStringAppDef_oaLayer(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLayerp result= (oaStringAppDef_oaLayer::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLayer_FromoaStringAppDef_oaLayer(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLayerp result= (oaStringAppDef_oaLayer::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaLayer_FromoaStringAppDef_oaLayer(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLayerp result= (oaStringAppDef_oaLayer::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaLayer_FromoaStringAppDef_oaLayer(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaLayer, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaLayer_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaLayer_static_find,METH_VARARGS,oaStringAppDef_oaLayer_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaLayer_static_get,METH_VARARGS,oaStringAppDef_oaLayer_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaLayer_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaLayer_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaLayer\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaLayer", (PyObject*)(&PyoaStringAppDef_oaLayer_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaLayer\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaLayer_Type.tp_dict; for(method=oaStringAppDef_oaLayer_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaLayerHeader // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaLayerHeader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaLayerHeader_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLayerHeaderObject* self = (PyoaStringAppDef_oaLayerHeaderObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaLayerHeader) { PyParamoaStringAppDef_oaLayerHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaLayerHeader_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaLayerHeader, Choices are:\n" " (oaStringAppDef_oaLayerHeader)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaLayerHeader_tp_dealloc(PyoaStringAppDef_oaLayerHeaderObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaLayerHeader_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaLayerHeader value; int convert_status=PyoaStringAppDef_oaLayerHeader_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[50]; sprintf(buffer,"<oaStringAppDef_oaLayerHeader::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaLayerHeader_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaLayerHeader v1; PyParamoaStringAppDef_oaLayerHeader v2; int convert_status1=PyoaStringAppDef_oaLayerHeader_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaLayerHeader_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaLayerHeader_Convert(PyObject* ob,PyParamoaStringAppDef_oaLayerHeader* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaLayerHeader_Check(ob)) { result->SetData( (oaStringAppDef_oaLayerHeader**) ((PyoaStringAppDef_oaLayerHeaderObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaLayerHeader Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaLayerHeader_FromoaStringAppDef_oaLayerHeader(oaStringAppDef_oaLayerHeader** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaLayerHeader* data=*value; PyObject* bself = PyoaStringAppDef_oaLayerHeader_Type.tp_alloc(&PyoaStringAppDef_oaLayerHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLayerHeaderObject* self = (PyoaStringAppDef_oaLayerHeaderObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaLayerHeader_FromoaStringAppDef_oaLayerHeader(oaStringAppDef_oaLayerHeader* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaLayerHeader_Type.tp_alloc(&PyoaStringAppDef_oaLayerHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLayerHeaderObject* self = (PyoaStringAppDef_oaLayerHeaderObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLayerHeader_get_doc[] = "Class: oaStringAppDef_oaLayerHeader, Function: get\n" " Paramegers: (oaLayerHeader,oaString)\n" " Calls: void get(const oaLayerHeader* object,oaString& value)\n" " Signature: get|void-void|cptr-oaLayerHeader,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaLayerHeader_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLayerHeader data; int convert_status=PyoaStringAppDef_oaLayerHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLayerHeaderObject* self=(PyoaStringAppDef_oaLayerHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaLayerHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaLayerHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLayerHeader_getDefault_doc[] = "Class: oaStringAppDef_oaLayerHeader, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaLayerHeader_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLayerHeader data; int convert_status=PyoaStringAppDef_oaLayerHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLayerHeaderObject* self=(PyoaStringAppDef_oaLayerHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLayerHeader_set_doc[] = "Class: oaStringAppDef_oaLayerHeader, Function: set\n" " Paramegers: (oaLayerHeader,oaString)\n" " Calls: void set(oaLayerHeader* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaLayerHeader,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaLayerHeader_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLayerHeader data; int convert_status=PyoaStringAppDef_oaLayerHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLayerHeaderObject* self=(PyoaStringAppDef_oaLayerHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaLayerHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaLayerHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLayerHeader_isNull_doc[] = "Class: oaStringAppDef_oaLayerHeader, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaLayerHeader_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaLayerHeader data; int convert_status=PyoaStringAppDef_oaLayerHeader_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaLayerHeader_assign_doc[] = "Class: oaStringAppDef_oaLayerHeader, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaLayerHeader_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaLayerHeader data; int convert_status=PyoaStringAppDef_oaLayerHeader_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaLayerHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaLayerHeader_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaLayerHeader_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaLayerHeader_get,METH_VARARGS,oaStringAppDef_oaLayerHeader_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaLayerHeader_getDefault,METH_VARARGS,oaStringAppDef_oaLayerHeader_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaLayerHeader_set,METH_VARARGS,oaStringAppDef_oaLayerHeader_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaLayerHeader_tp_isNull,METH_VARARGS,oaStringAppDef_oaLayerHeader_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaLayerHeader_tp_assign,METH_VARARGS,oaStringAppDef_oaLayerHeader_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLayerHeader_doc[] = "Class: oaStringAppDef_oaLayerHeader\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaLayerHeader)\n" " Calls: (const oaStringAppDef_oaLayerHeader&)\n" " Signature: oaStringAppDef_oaLayerHeader||cref-oaStringAppDef_oaLayerHeader,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaLayerHeader_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaLayerHeader", sizeof(PyoaStringAppDef_oaLayerHeaderObject), 0, (destructor)oaStringAppDef_oaLayerHeader_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaLayerHeader_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaLayerHeader_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaLayerHeader_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaLayerHeader_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaLayerHeader_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLayerHeader_static_find_doc[] = "Class: oaStringAppDef_oaLayerHeader, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaLayerHeader* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaLayerHeader|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaLayerHeader* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaLayerHeader|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaLayerHeader_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaLayerHeaderp result= (oaStringAppDef_oaLayerHeader::find(p1.Data())); return PyoaStringAppDef_oaLayerHeader_FromoaStringAppDef_oaLayerHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLayerHeaderp result= (oaStringAppDef_oaLayerHeader::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLayerHeader_FromoaStringAppDef_oaLayerHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaLayerHeader, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLayerHeader_static_get_doc[] = "Class: oaStringAppDef_oaLayerHeader, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaLayerHeader* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaLayerHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaLayerHeader* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaLayerHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaLayerHeader* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaLayerHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaLayerHeader* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaLayerHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaLayerHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaLayerHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaLayerHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaLayerHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaLayerHeader_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaLayerHeaderp result= (oaStringAppDef_oaLayerHeader::get(p1.Data())); return PyoaStringAppDef_oaLayerHeader_FromoaStringAppDef_oaLayerHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaLayerHeaderp result= (oaStringAppDef_oaLayerHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLayerHeader_FromoaStringAppDef_oaLayerHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaLayerHeaderp result= (oaStringAppDef_oaLayerHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaLayerHeader_FromoaStringAppDef_oaLayerHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLayerHeaderp result= (oaStringAppDef_oaLayerHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLayerHeader_FromoaStringAppDef_oaLayerHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLayerHeaderp result= (oaStringAppDef_oaLayerHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaLayerHeader_FromoaStringAppDef_oaLayerHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLayerHeaderp result= (oaStringAppDef_oaLayerHeader::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaLayerHeader_FromoaStringAppDef_oaLayerHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaLayerHeader, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaLayerHeader_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaLayerHeader_static_find,METH_VARARGS,oaStringAppDef_oaLayerHeader_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaLayerHeader_static_get,METH_VARARGS,oaStringAppDef_oaLayerHeader_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaLayerHeader_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaLayerHeader_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaLayerHeader\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaLayerHeader", (PyObject*)(&PyoaStringAppDef_oaLayerHeader_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaLayerHeader\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaLayerHeader_Type.tp_dict; for(method=oaStringAppDef_oaLayerHeader_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaLib // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaLib_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaLib_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLibObject* self = (PyoaStringAppDef_oaLibObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaLib) { PyParamoaStringAppDef_oaLib p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaLib_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaLib, Choices are:\n" " (oaStringAppDef_oaLib)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaLib_tp_dealloc(PyoaStringAppDef_oaLibObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaLib_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaLib value; int convert_status=PyoaStringAppDef_oaLib_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[42]; sprintf(buffer,"<oaStringAppDef_oaLib::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaLib_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaLib v1; PyParamoaStringAppDef_oaLib v2; int convert_status1=PyoaStringAppDef_oaLib_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaLib_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaLib_Convert(PyObject* ob,PyParamoaStringAppDef_oaLib* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaLib_Check(ob)) { result->SetData( (oaStringAppDef_oaLib**) ((PyoaStringAppDef_oaLibObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaLib Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaLib_FromoaStringAppDef_oaLib(oaStringAppDef_oaLib** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaLib* data=*value; PyObject* bself = PyoaStringAppDef_oaLib_Type.tp_alloc(&PyoaStringAppDef_oaLib_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLibObject* self = (PyoaStringAppDef_oaLibObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaLib_FromoaStringAppDef_oaLib(oaStringAppDef_oaLib* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaLib_Type.tp_alloc(&PyoaStringAppDef_oaLib_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaLibObject* self = (PyoaStringAppDef_oaLibObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLib_get_doc[] = "Class: oaStringAppDef_oaLib, Function: get\n" " Paramegers: (oaLib,oaString)\n" " Calls: void get(const oaLib* object,oaString& value)\n" " Signature: get|void-void|cptr-oaLib,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaLib_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLib data; int convert_status=PyoaStringAppDef_oaLib_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLibObject* self=(PyoaStringAppDef_oaLibObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaLib p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaLib_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLib_getDefault_doc[] = "Class: oaStringAppDef_oaLib, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaLib_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLib data; int convert_status=PyoaStringAppDef_oaLib_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLibObject* self=(PyoaStringAppDef_oaLibObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLib_set_doc[] = "Class: oaStringAppDef_oaLib, Function: set\n" " Paramegers: (oaLib,oaString)\n" " Calls: void set(oaLib* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaLib,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaLib_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaLib data; int convert_status=PyoaStringAppDef_oaLib_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaLibObject* self=(PyoaStringAppDef_oaLibObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaLib p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaLib_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLib_isNull_doc[] = "Class: oaStringAppDef_oaLib, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaLib_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaLib data; int convert_status=PyoaStringAppDef_oaLib_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaLib_assign_doc[] = "Class: oaStringAppDef_oaLib, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaLib_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaLib data; int convert_status=PyoaStringAppDef_oaLib_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaLib p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaLib_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaLib_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaLib_get,METH_VARARGS,oaStringAppDef_oaLib_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaLib_getDefault,METH_VARARGS,oaStringAppDef_oaLib_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaLib_set,METH_VARARGS,oaStringAppDef_oaLib_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaLib_tp_isNull,METH_VARARGS,oaStringAppDef_oaLib_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaLib_tp_assign,METH_VARARGS,oaStringAppDef_oaLib_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLib_doc[] = "Class: oaStringAppDef_oaLib\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaLib)\n" " Calls: (const oaStringAppDef_oaLib&)\n" " Signature: oaStringAppDef_oaLib||cref-oaStringAppDef_oaLib,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaLib_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaLib", sizeof(PyoaStringAppDef_oaLibObject), 0, (destructor)oaStringAppDef_oaLib_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaLib_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaLib_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaLib_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaLib_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaLib_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaLib_static_find_doc[] = "Class: oaStringAppDef_oaLib, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaLib* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaLib|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaLib* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaLib|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaLib_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaLibp result= (oaStringAppDef_oaLib::find(p1.Data())); return PyoaStringAppDef_oaLib_FromoaStringAppDef_oaLib(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLibp result= (oaStringAppDef_oaLib::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLib_FromoaStringAppDef_oaLib(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaLib, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaLib_static_get_doc[] = "Class: oaStringAppDef_oaLib, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaLib* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaLib|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaLib* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaLib|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaLib* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaLib|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaLib* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaLib|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaLib* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaLib|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaLib* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaLib|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaLib_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaLibp result= (oaStringAppDef_oaLib::get(p1.Data())); return PyoaStringAppDef_oaLib_FromoaStringAppDef_oaLib(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaLibp result= (oaStringAppDef_oaLib::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLib_FromoaStringAppDef_oaLib(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaLibp result= (oaStringAppDef_oaLib::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaLib_FromoaStringAppDef_oaLib(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLibp result= (oaStringAppDef_oaLib::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaLib_FromoaStringAppDef_oaLib(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLibp result= (oaStringAppDef_oaLib::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaLib_FromoaStringAppDef_oaLib(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaLibp result= (oaStringAppDef_oaLib::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaLib_FromoaStringAppDef_oaLib(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaLib, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaLib_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaLib_static_find,METH_VARARGS,oaStringAppDef_oaLib_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaLib_static_get,METH_VARARGS,oaStringAppDef_oaLib_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaLib_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaLib_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaLib\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaLib", (PyObject*)(&PyoaStringAppDef_oaLib_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaLib\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaLib_Type.tp_dict; for(method=oaStringAppDef_oaLib_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaMarker // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaMarker_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaMarker_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaMarkerObject* self = (PyoaStringAppDef_oaMarkerObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaMarker) { PyParamoaStringAppDef_oaMarker p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaMarker_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaMarker, Choices are:\n" " (oaStringAppDef_oaMarker)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaMarker_tp_dealloc(PyoaStringAppDef_oaMarkerObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaMarker_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaMarker value; int convert_status=PyoaStringAppDef_oaMarker_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[45]; sprintf(buffer,"<oaStringAppDef_oaMarker::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaMarker_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaMarker v1; PyParamoaStringAppDef_oaMarker v2; int convert_status1=PyoaStringAppDef_oaMarker_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaMarker_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaMarker_Convert(PyObject* ob,PyParamoaStringAppDef_oaMarker* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaMarker_Check(ob)) { result->SetData( (oaStringAppDef_oaMarker**) ((PyoaStringAppDef_oaMarkerObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaMarker Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaMarker_FromoaStringAppDef_oaMarker(oaStringAppDef_oaMarker** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaMarker* data=*value; PyObject* bself = PyoaStringAppDef_oaMarker_Type.tp_alloc(&PyoaStringAppDef_oaMarker_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaMarkerObject* self = (PyoaStringAppDef_oaMarkerObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaMarker_FromoaStringAppDef_oaMarker(oaStringAppDef_oaMarker* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaMarker_Type.tp_alloc(&PyoaStringAppDef_oaMarker_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaMarkerObject* self = (PyoaStringAppDef_oaMarkerObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaMarker_get_doc[] = "Class: oaStringAppDef_oaMarker, Function: get\n" " Paramegers: (oaMarker,oaString)\n" " Calls: void get(const oaMarker* object,oaString& value)\n" " Signature: get|void-void|cptr-oaMarker,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaMarker_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaMarker data; int convert_status=PyoaStringAppDef_oaMarker_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaMarkerObject* self=(PyoaStringAppDef_oaMarkerObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaMarker p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaMarker_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaMarker_getDefault_doc[] = "Class: oaStringAppDef_oaMarker, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaMarker_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaMarker data; int convert_status=PyoaStringAppDef_oaMarker_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaMarkerObject* self=(PyoaStringAppDef_oaMarkerObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaMarker_set_doc[] = "Class: oaStringAppDef_oaMarker, Function: set\n" " Paramegers: (oaMarker,oaString)\n" " Calls: void set(oaMarker* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaMarker,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaMarker_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaMarker data; int convert_status=PyoaStringAppDef_oaMarker_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaMarkerObject* self=(PyoaStringAppDef_oaMarkerObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaMarker p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaMarker_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaMarker_isNull_doc[] = "Class: oaStringAppDef_oaMarker, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaMarker_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaMarker data; int convert_status=PyoaStringAppDef_oaMarker_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaMarker_assign_doc[] = "Class: oaStringAppDef_oaMarker, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaMarker_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaMarker data; int convert_status=PyoaStringAppDef_oaMarker_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaMarker p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaMarker_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaMarker_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaMarker_get,METH_VARARGS,oaStringAppDef_oaMarker_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaMarker_getDefault,METH_VARARGS,oaStringAppDef_oaMarker_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaMarker_set,METH_VARARGS,oaStringAppDef_oaMarker_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaMarker_tp_isNull,METH_VARARGS,oaStringAppDef_oaMarker_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaMarker_tp_assign,METH_VARARGS,oaStringAppDef_oaMarker_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaMarker_doc[] = "Class: oaStringAppDef_oaMarker\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaMarker)\n" " Calls: (const oaStringAppDef_oaMarker&)\n" " Signature: oaStringAppDef_oaMarker||cref-oaStringAppDef_oaMarker,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaMarker_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaMarker", sizeof(PyoaStringAppDef_oaMarkerObject), 0, (destructor)oaStringAppDef_oaMarker_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaMarker_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaMarker_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaMarker_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaMarker_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaMarker_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaMarker_static_find_doc[] = "Class: oaStringAppDef_oaMarker, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaMarker* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaMarker|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaMarker* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaMarker|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaMarker_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaMarkerp result= (oaStringAppDef_oaMarker::find(p1.Data())); return PyoaStringAppDef_oaMarker_FromoaStringAppDef_oaMarker(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaMarkerp result= (oaStringAppDef_oaMarker::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaMarker_FromoaStringAppDef_oaMarker(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaMarker, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaMarker_static_get_doc[] = "Class: oaStringAppDef_oaMarker, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaMarker* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaMarker|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaMarker* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaMarker|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaMarker* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaMarker|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaMarker* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaMarker|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaMarker* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaMarker|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaMarker* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaMarker|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaMarker_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaMarkerp result= (oaStringAppDef_oaMarker::get(p1.Data())); return PyoaStringAppDef_oaMarker_FromoaStringAppDef_oaMarker(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaMarkerp result= (oaStringAppDef_oaMarker::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaMarker_FromoaStringAppDef_oaMarker(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaMarkerp result= (oaStringAppDef_oaMarker::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaMarker_FromoaStringAppDef_oaMarker(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaMarkerp result= (oaStringAppDef_oaMarker::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaMarker_FromoaStringAppDef_oaMarker(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaMarkerp result= (oaStringAppDef_oaMarker::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaMarker_FromoaStringAppDef_oaMarker(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaMarkerp result= (oaStringAppDef_oaMarker::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaMarker_FromoaStringAppDef_oaMarker(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaMarker, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaMarker_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaMarker_static_find,METH_VARARGS,oaStringAppDef_oaMarker_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaMarker_static_get,METH_VARARGS,oaStringAppDef_oaMarker_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaMarker_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaMarker_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaMarker\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaMarker", (PyObject*)(&PyoaStringAppDef_oaMarker_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaMarker\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaMarker_Type.tp_dict; for(method=oaStringAppDef_oaMarker_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModAssignment // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModAssignment_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModAssignment_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModAssignmentObject* self = (PyoaStringAppDef_oaModAssignmentObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModAssignment) { PyParamoaStringAppDef_oaModAssignment p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModAssignment_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModAssignment, Choices are:\n" " (oaStringAppDef_oaModAssignment)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModAssignment_tp_dealloc(PyoaStringAppDef_oaModAssignmentObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModAssignment_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModAssignment value; int convert_status=PyoaStringAppDef_oaModAssignment_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[52]; sprintf(buffer,"<oaStringAppDef_oaModAssignment::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModAssignment_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModAssignment v1; PyParamoaStringAppDef_oaModAssignment v2; int convert_status1=PyoaStringAppDef_oaModAssignment_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModAssignment_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModAssignment_Convert(PyObject* ob,PyParamoaStringAppDef_oaModAssignment* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModAssignment_Check(ob)) { result->SetData( (oaStringAppDef_oaModAssignment**) ((PyoaStringAppDef_oaModAssignmentObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModAssignment Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModAssignment_FromoaStringAppDef_oaModAssignment(oaStringAppDef_oaModAssignment** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModAssignment* data=*value; PyObject* bself = PyoaStringAppDef_oaModAssignment_Type.tp_alloc(&PyoaStringAppDef_oaModAssignment_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModAssignmentObject* self = (PyoaStringAppDef_oaModAssignmentObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModAssignment_FromoaStringAppDef_oaModAssignment(oaStringAppDef_oaModAssignment* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModAssignment_Type.tp_alloc(&PyoaStringAppDef_oaModAssignment_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModAssignmentObject* self = (PyoaStringAppDef_oaModAssignmentObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModAssignment_get_doc[] = "Class: oaStringAppDef_oaModAssignment, Function: get\n" " Paramegers: (oaModAssignment,oaString)\n" " Calls: void get(const oaModAssignment* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModAssignment,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModAssignment_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModAssignment data; int convert_status=PyoaStringAppDef_oaModAssignment_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModAssignmentObject* self=(PyoaStringAppDef_oaModAssignmentObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModAssignment p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModAssignment_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModAssignment_getDefault_doc[] = "Class: oaStringAppDef_oaModAssignment, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModAssignment_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModAssignment data; int convert_status=PyoaStringAppDef_oaModAssignment_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModAssignmentObject* self=(PyoaStringAppDef_oaModAssignmentObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModAssignment_set_doc[] = "Class: oaStringAppDef_oaModAssignment, Function: set\n" " Paramegers: (oaModAssignment,oaString)\n" " Calls: void set(oaModAssignment* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModAssignment,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModAssignment_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModAssignment data; int convert_status=PyoaStringAppDef_oaModAssignment_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModAssignmentObject* self=(PyoaStringAppDef_oaModAssignmentObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModAssignment p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModAssignment_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModAssignment_isNull_doc[] = "Class: oaStringAppDef_oaModAssignment, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModAssignment_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModAssignment data; int convert_status=PyoaStringAppDef_oaModAssignment_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModAssignment_assign_doc[] = "Class: oaStringAppDef_oaModAssignment, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModAssignment_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModAssignment data; int convert_status=PyoaStringAppDef_oaModAssignment_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModAssignment p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModAssignment_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModAssignment_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModAssignment_get,METH_VARARGS,oaStringAppDef_oaModAssignment_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModAssignment_getDefault,METH_VARARGS,oaStringAppDef_oaModAssignment_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModAssignment_set,METH_VARARGS,oaStringAppDef_oaModAssignment_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModAssignment_tp_isNull,METH_VARARGS,oaStringAppDef_oaModAssignment_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModAssignment_tp_assign,METH_VARARGS,oaStringAppDef_oaModAssignment_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModAssignment_doc[] = "Class: oaStringAppDef_oaModAssignment\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModAssignment)\n" " Calls: (const oaStringAppDef_oaModAssignment&)\n" " Signature: oaStringAppDef_oaModAssignment||cref-oaStringAppDef_oaModAssignment,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModAssignment_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModAssignment", sizeof(PyoaStringAppDef_oaModAssignmentObject), 0, (destructor)oaStringAppDef_oaModAssignment_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModAssignment_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModAssignment_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModAssignment_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModAssignment_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModAssignment_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModAssignment_static_find_doc[] = "Class: oaStringAppDef_oaModAssignment, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModAssignment* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModAssignment|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModAssignment* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModAssignment|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModAssignment_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModAssignmentp result= (oaStringAppDef_oaModAssignment::find(p1.Data())); return PyoaStringAppDef_oaModAssignment_FromoaStringAppDef_oaModAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModAssignmentp result= (oaStringAppDef_oaModAssignment::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModAssignment_FromoaStringAppDef_oaModAssignment(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModAssignment, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModAssignment_static_get_doc[] = "Class: oaStringAppDef_oaModAssignment, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModAssignment* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModAssignment|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModAssignment* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModAssignment|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModAssignment* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModAssignment|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModAssignment* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModAssignment|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModAssignment* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModAssignment|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModAssignment* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModAssignment|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModAssignment_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModAssignmentp result= (oaStringAppDef_oaModAssignment::get(p1.Data())); return PyoaStringAppDef_oaModAssignment_FromoaStringAppDef_oaModAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModAssignmentp result= (oaStringAppDef_oaModAssignment::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModAssignment_FromoaStringAppDef_oaModAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModAssignmentp result= (oaStringAppDef_oaModAssignment::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModAssignment_FromoaStringAppDef_oaModAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModAssignmentp result= (oaStringAppDef_oaModAssignment::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModAssignment_FromoaStringAppDef_oaModAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModAssignmentp result= (oaStringAppDef_oaModAssignment::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModAssignment_FromoaStringAppDef_oaModAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModAssignmentp result= (oaStringAppDef_oaModAssignment::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModAssignment_FromoaStringAppDef_oaModAssignment(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModAssignment, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModAssignment_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModAssignment_static_find,METH_VARARGS,oaStringAppDef_oaModAssignment_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModAssignment_static_get,METH_VARARGS,oaStringAppDef_oaModAssignment_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModAssignment_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModAssignment_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModAssignment\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModAssignment", (PyObject*)(&PyoaStringAppDef_oaModAssignment_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModAssignment\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModAssignment_Type.tp_dict; for(method=oaStringAppDef_oaModAssignment_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModBusNetDef // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModBusNetDef_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModBusNetDef_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModBusNetDefObject* self = (PyoaStringAppDef_oaModBusNetDefObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModBusNetDef) { PyParamoaStringAppDef_oaModBusNetDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModBusNetDef_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModBusNetDef, Choices are:\n" " (oaStringAppDef_oaModBusNetDef)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModBusNetDef_tp_dealloc(PyoaStringAppDef_oaModBusNetDefObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModBusNetDef_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModBusNetDef value; int convert_status=PyoaStringAppDef_oaModBusNetDef_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[51]; sprintf(buffer,"<oaStringAppDef_oaModBusNetDef::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModBusNetDef_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModBusNetDef v1; PyParamoaStringAppDef_oaModBusNetDef v2; int convert_status1=PyoaStringAppDef_oaModBusNetDef_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModBusNetDef_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModBusNetDef_Convert(PyObject* ob,PyParamoaStringAppDef_oaModBusNetDef* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModBusNetDef_Check(ob)) { result->SetData( (oaStringAppDef_oaModBusNetDef**) ((PyoaStringAppDef_oaModBusNetDefObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModBusNetDef Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModBusNetDef_FromoaStringAppDef_oaModBusNetDef(oaStringAppDef_oaModBusNetDef** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModBusNetDef* data=*value; PyObject* bself = PyoaStringAppDef_oaModBusNetDef_Type.tp_alloc(&PyoaStringAppDef_oaModBusNetDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModBusNetDefObject* self = (PyoaStringAppDef_oaModBusNetDefObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModBusNetDef_FromoaStringAppDef_oaModBusNetDef(oaStringAppDef_oaModBusNetDef* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModBusNetDef_Type.tp_alloc(&PyoaStringAppDef_oaModBusNetDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModBusNetDefObject* self = (PyoaStringAppDef_oaModBusNetDefObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusNetDef_get_doc[] = "Class: oaStringAppDef_oaModBusNetDef, Function: get\n" " Paramegers: (oaModBusNetDef,oaString)\n" " Calls: void get(const oaModBusNetDef* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModBusNetDef,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModBusNetDef_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModBusNetDef data; int convert_status=PyoaStringAppDef_oaModBusNetDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModBusNetDefObject* self=(PyoaStringAppDef_oaModBusNetDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModBusNetDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModBusNetDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusNetDef_getDefault_doc[] = "Class: oaStringAppDef_oaModBusNetDef, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModBusNetDef_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModBusNetDef data; int convert_status=PyoaStringAppDef_oaModBusNetDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModBusNetDefObject* self=(PyoaStringAppDef_oaModBusNetDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusNetDef_set_doc[] = "Class: oaStringAppDef_oaModBusNetDef, Function: set\n" " Paramegers: (oaModBusNetDef,oaString)\n" " Calls: void set(oaModBusNetDef* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModBusNetDef,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModBusNetDef_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModBusNetDef data; int convert_status=PyoaStringAppDef_oaModBusNetDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModBusNetDefObject* self=(PyoaStringAppDef_oaModBusNetDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModBusNetDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModBusNetDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusNetDef_isNull_doc[] = "Class: oaStringAppDef_oaModBusNetDef, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModBusNetDef_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModBusNetDef data; int convert_status=PyoaStringAppDef_oaModBusNetDef_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModBusNetDef_assign_doc[] = "Class: oaStringAppDef_oaModBusNetDef, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModBusNetDef_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModBusNetDef data; int convert_status=PyoaStringAppDef_oaModBusNetDef_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModBusNetDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModBusNetDef_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModBusNetDef_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModBusNetDef_get,METH_VARARGS,oaStringAppDef_oaModBusNetDef_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModBusNetDef_getDefault,METH_VARARGS,oaStringAppDef_oaModBusNetDef_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModBusNetDef_set,METH_VARARGS,oaStringAppDef_oaModBusNetDef_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModBusNetDef_tp_isNull,METH_VARARGS,oaStringAppDef_oaModBusNetDef_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModBusNetDef_tp_assign,METH_VARARGS,oaStringAppDef_oaModBusNetDef_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusNetDef_doc[] = "Class: oaStringAppDef_oaModBusNetDef\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModBusNetDef)\n" " Calls: (const oaStringAppDef_oaModBusNetDef&)\n" " Signature: oaStringAppDef_oaModBusNetDef||cref-oaStringAppDef_oaModBusNetDef,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModBusNetDef_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModBusNetDef", sizeof(PyoaStringAppDef_oaModBusNetDefObject), 0, (destructor)oaStringAppDef_oaModBusNetDef_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModBusNetDef_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModBusNetDef_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModBusNetDef_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModBusNetDef_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModBusNetDef_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusNetDef_static_find_doc[] = "Class: oaStringAppDef_oaModBusNetDef, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModBusNetDef* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModBusNetDef|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModBusNetDef* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModBusNetDef|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModBusNetDef_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModBusNetDefp result= (oaStringAppDef_oaModBusNetDef::find(p1.Data())); return PyoaStringAppDef_oaModBusNetDef_FromoaStringAppDef_oaModBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModBusNetDefp result= (oaStringAppDef_oaModBusNetDef::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModBusNetDef_FromoaStringAppDef_oaModBusNetDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModBusNetDef, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusNetDef_static_get_doc[] = "Class: oaStringAppDef_oaModBusNetDef, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModBusNetDef* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModBusNetDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModBusNetDef* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModBusNetDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModBusNetDef* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModBusNetDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModBusNetDef* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModBusNetDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModBusNetDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModBusNetDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModBusNetDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModBusNetDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModBusNetDef_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModBusNetDefp result= (oaStringAppDef_oaModBusNetDef::get(p1.Data())); return PyoaStringAppDef_oaModBusNetDef_FromoaStringAppDef_oaModBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModBusNetDefp result= (oaStringAppDef_oaModBusNetDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModBusNetDef_FromoaStringAppDef_oaModBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModBusNetDefp result= (oaStringAppDef_oaModBusNetDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModBusNetDef_FromoaStringAppDef_oaModBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModBusNetDefp result= (oaStringAppDef_oaModBusNetDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModBusNetDef_FromoaStringAppDef_oaModBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModBusNetDefp result= (oaStringAppDef_oaModBusNetDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModBusNetDef_FromoaStringAppDef_oaModBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModBusNetDefp result= (oaStringAppDef_oaModBusNetDef::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModBusNetDef_FromoaStringAppDef_oaModBusNetDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModBusNetDef, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModBusNetDef_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModBusNetDef_static_find,METH_VARARGS,oaStringAppDef_oaModBusNetDef_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModBusNetDef_static_get,METH_VARARGS,oaStringAppDef_oaModBusNetDef_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModBusNetDef_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModBusNetDef_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModBusNetDef\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModBusNetDef", (PyObject*)(&PyoaStringAppDef_oaModBusNetDef_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModBusNetDef\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModBusNetDef_Type.tp_dict; for(method=oaStringAppDef_oaModBusNetDef_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModBusTermDef // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModBusTermDef_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModBusTermDef_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModBusTermDefObject* self = (PyoaStringAppDef_oaModBusTermDefObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModBusTermDef) { PyParamoaStringAppDef_oaModBusTermDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModBusTermDef_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModBusTermDef, Choices are:\n" " (oaStringAppDef_oaModBusTermDef)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModBusTermDef_tp_dealloc(PyoaStringAppDef_oaModBusTermDefObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModBusTermDef_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModBusTermDef value; int convert_status=PyoaStringAppDef_oaModBusTermDef_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[52]; sprintf(buffer,"<oaStringAppDef_oaModBusTermDef::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModBusTermDef_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModBusTermDef v1; PyParamoaStringAppDef_oaModBusTermDef v2; int convert_status1=PyoaStringAppDef_oaModBusTermDef_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModBusTermDef_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModBusTermDef_Convert(PyObject* ob,PyParamoaStringAppDef_oaModBusTermDef* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModBusTermDef_Check(ob)) { result->SetData( (oaStringAppDef_oaModBusTermDef**) ((PyoaStringAppDef_oaModBusTermDefObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModBusTermDef Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModBusTermDef_FromoaStringAppDef_oaModBusTermDef(oaStringAppDef_oaModBusTermDef** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModBusTermDef* data=*value; PyObject* bself = PyoaStringAppDef_oaModBusTermDef_Type.tp_alloc(&PyoaStringAppDef_oaModBusTermDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModBusTermDefObject* self = (PyoaStringAppDef_oaModBusTermDefObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModBusTermDef_FromoaStringAppDef_oaModBusTermDef(oaStringAppDef_oaModBusTermDef* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModBusTermDef_Type.tp_alloc(&PyoaStringAppDef_oaModBusTermDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModBusTermDefObject* self = (PyoaStringAppDef_oaModBusTermDefObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusTermDef_get_doc[] = "Class: oaStringAppDef_oaModBusTermDef, Function: get\n" " Paramegers: (oaModBusTermDef,oaString)\n" " Calls: void get(const oaModBusTermDef* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModBusTermDef,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModBusTermDef_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModBusTermDef data; int convert_status=PyoaStringAppDef_oaModBusTermDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModBusTermDefObject* self=(PyoaStringAppDef_oaModBusTermDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModBusTermDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModBusTermDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusTermDef_getDefault_doc[] = "Class: oaStringAppDef_oaModBusTermDef, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModBusTermDef_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModBusTermDef data; int convert_status=PyoaStringAppDef_oaModBusTermDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModBusTermDefObject* self=(PyoaStringAppDef_oaModBusTermDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusTermDef_set_doc[] = "Class: oaStringAppDef_oaModBusTermDef, Function: set\n" " Paramegers: (oaModBusTermDef,oaString)\n" " Calls: void set(oaModBusTermDef* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModBusTermDef,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModBusTermDef_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModBusTermDef data; int convert_status=PyoaStringAppDef_oaModBusTermDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModBusTermDefObject* self=(PyoaStringAppDef_oaModBusTermDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModBusTermDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModBusTermDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusTermDef_isNull_doc[] = "Class: oaStringAppDef_oaModBusTermDef, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModBusTermDef_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModBusTermDef data; int convert_status=PyoaStringAppDef_oaModBusTermDef_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModBusTermDef_assign_doc[] = "Class: oaStringAppDef_oaModBusTermDef, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModBusTermDef_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModBusTermDef data; int convert_status=PyoaStringAppDef_oaModBusTermDef_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModBusTermDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModBusTermDef_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModBusTermDef_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModBusTermDef_get,METH_VARARGS,oaStringAppDef_oaModBusTermDef_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModBusTermDef_getDefault,METH_VARARGS,oaStringAppDef_oaModBusTermDef_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModBusTermDef_set,METH_VARARGS,oaStringAppDef_oaModBusTermDef_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModBusTermDef_tp_isNull,METH_VARARGS,oaStringAppDef_oaModBusTermDef_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModBusTermDef_tp_assign,METH_VARARGS,oaStringAppDef_oaModBusTermDef_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusTermDef_doc[] = "Class: oaStringAppDef_oaModBusTermDef\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModBusTermDef)\n" " Calls: (const oaStringAppDef_oaModBusTermDef&)\n" " Signature: oaStringAppDef_oaModBusTermDef||cref-oaStringAppDef_oaModBusTermDef,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModBusTermDef_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModBusTermDef", sizeof(PyoaStringAppDef_oaModBusTermDefObject), 0, (destructor)oaStringAppDef_oaModBusTermDef_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModBusTermDef_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModBusTermDef_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModBusTermDef_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModBusTermDef_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModBusTermDef_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusTermDef_static_find_doc[] = "Class: oaStringAppDef_oaModBusTermDef, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModBusTermDef* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModBusTermDef|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModBusTermDef* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModBusTermDef|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModBusTermDef_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModBusTermDefp result= (oaStringAppDef_oaModBusTermDef::find(p1.Data())); return PyoaStringAppDef_oaModBusTermDef_FromoaStringAppDef_oaModBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModBusTermDefp result= (oaStringAppDef_oaModBusTermDef::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModBusTermDef_FromoaStringAppDef_oaModBusTermDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModBusTermDef, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModBusTermDef_static_get_doc[] = "Class: oaStringAppDef_oaModBusTermDef, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModBusTermDef* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModBusTermDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModBusTermDef* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModBusTermDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModBusTermDef* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModBusTermDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModBusTermDef* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModBusTermDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModBusTermDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModBusTermDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModBusTermDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModBusTermDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModBusTermDef_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModBusTermDefp result= (oaStringAppDef_oaModBusTermDef::get(p1.Data())); return PyoaStringAppDef_oaModBusTermDef_FromoaStringAppDef_oaModBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModBusTermDefp result= (oaStringAppDef_oaModBusTermDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModBusTermDef_FromoaStringAppDef_oaModBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModBusTermDefp result= (oaStringAppDef_oaModBusTermDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModBusTermDef_FromoaStringAppDef_oaModBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModBusTermDefp result= (oaStringAppDef_oaModBusTermDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModBusTermDef_FromoaStringAppDef_oaModBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModBusTermDefp result= (oaStringAppDef_oaModBusTermDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModBusTermDef_FromoaStringAppDef_oaModBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModBusTermDefp result= (oaStringAppDef_oaModBusTermDef::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModBusTermDef_FromoaStringAppDef_oaModBusTermDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModBusTermDef, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModBusTermDef_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModBusTermDef_static_find,METH_VARARGS,oaStringAppDef_oaModBusTermDef_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModBusTermDef_static_get,METH_VARARGS,oaStringAppDef_oaModBusTermDef_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModBusTermDef_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModBusTermDef_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModBusTermDef\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModBusTermDef", (PyObject*)(&PyoaStringAppDef_oaModBusTermDef_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModBusTermDef\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModBusTermDef_Type.tp_dict; for(method=oaStringAppDef_oaModBusTermDef_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModConnectDef // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModConnectDef_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModConnectDef_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModConnectDefObject* self = (PyoaStringAppDef_oaModConnectDefObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModConnectDef) { PyParamoaStringAppDef_oaModConnectDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModConnectDef_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModConnectDef, Choices are:\n" " (oaStringAppDef_oaModConnectDef)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModConnectDef_tp_dealloc(PyoaStringAppDef_oaModConnectDefObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModConnectDef_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModConnectDef value; int convert_status=PyoaStringAppDef_oaModConnectDef_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[52]; sprintf(buffer,"<oaStringAppDef_oaModConnectDef::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModConnectDef_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModConnectDef v1; PyParamoaStringAppDef_oaModConnectDef v2; int convert_status1=PyoaStringAppDef_oaModConnectDef_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModConnectDef_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModConnectDef_Convert(PyObject* ob,PyParamoaStringAppDef_oaModConnectDef* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModConnectDef_Check(ob)) { result->SetData( (oaStringAppDef_oaModConnectDef**) ((PyoaStringAppDef_oaModConnectDefObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModConnectDef Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModConnectDef_FromoaStringAppDef_oaModConnectDef(oaStringAppDef_oaModConnectDef** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModConnectDef* data=*value; PyObject* bself = PyoaStringAppDef_oaModConnectDef_Type.tp_alloc(&PyoaStringAppDef_oaModConnectDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModConnectDefObject* self = (PyoaStringAppDef_oaModConnectDefObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModConnectDef_FromoaStringAppDef_oaModConnectDef(oaStringAppDef_oaModConnectDef* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModConnectDef_Type.tp_alloc(&PyoaStringAppDef_oaModConnectDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModConnectDefObject* self = (PyoaStringAppDef_oaModConnectDefObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModConnectDef_get_doc[] = "Class: oaStringAppDef_oaModConnectDef, Function: get\n" " Paramegers: (oaModConnectDef,oaString)\n" " Calls: void get(const oaModConnectDef* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModConnectDef,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModConnectDef_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModConnectDef data; int convert_status=PyoaStringAppDef_oaModConnectDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModConnectDefObject* self=(PyoaStringAppDef_oaModConnectDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModConnectDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModConnectDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModConnectDef_getDefault_doc[] = "Class: oaStringAppDef_oaModConnectDef, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModConnectDef_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModConnectDef data; int convert_status=PyoaStringAppDef_oaModConnectDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModConnectDefObject* self=(PyoaStringAppDef_oaModConnectDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModConnectDef_set_doc[] = "Class: oaStringAppDef_oaModConnectDef, Function: set\n" " Paramegers: (oaModConnectDef,oaString)\n" " Calls: void set(oaModConnectDef* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModConnectDef,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModConnectDef_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModConnectDef data; int convert_status=PyoaStringAppDef_oaModConnectDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModConnectDefObject* self=(PyoaStringAppDef_oaModConnectDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModConnectDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModConnectDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModConnectDef_isNull_doc[] = "Class: oaStringAppDef_oaModConnectDef, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModConnectDef_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModConnectDef data; int convert_status=PyoaStringAppDef_oaModConnectDef_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModConnectDef_assign_doc[] = "Class: oaStringAppDef_oaModConnectDef, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModConnectDef_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModConnectDef data; int convert_status=PyoaStringAppDef_oaModConnectDef_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModConnectDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModConnectDef_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModConnectDef_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModConnectDef_get,METH_VARARGS,oaStringAppDef_oaModConnectDef_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModConnectDef_getDefault,METH_VARARGS,oaStringAppDef_oaModConnectDef_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModConnectDef_set,METH_VARARGS,oaStringAppDef_oaModConnectDef_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModConnectDef_tp_isNull,METH_VARARGS,oaStringAppDef_oaModConnectDef_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModConnectDef_tp_assign,METH_VARARGS,oaStringAppDef_oaModConnectDef_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModConnectDef_doc[] = "Class: oaStringAppDef_oaModConnectDef\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModConnectDef)\n" " Calls: (const oaStringAppDef_oaModConnectDef&)\n" " Signature: oaStringAppDef_oaModConnectDef||cref-oaStringAppDef_oaModConnectDef,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModConnectDef_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModConnectDef", sizeof(PyoaStringAppDef_oaModConnectDefObject), 0, (destructor)oaStringAppDef_oaModConnectDef_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModConnectDef_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModConnectDef_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModConnectDef_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModConnectDef_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModConnectDef_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModConnectDef_static_find_doc[] = "Class: oaStringAppDef_oaModConnectDef, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModConnectDef* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModConnectDef|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModConnectDef* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModConnectDef|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModConnectDef_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModConnectDefp result= (oaStringAppDef_oaModConnectDef::find(p1.Data())); return PyoaStringAppDef_oaModConnectDef_FromoaStringAppDef_oaModConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModConnectDefp result= (oaStringAppDef_oaModConnectDef::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModConnectDef_FromoaStringAppDef_oaModConnectDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModConnectDef, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModConnectDef_static_get_doc[] = "Class: oaStringAppDef_oaModConnectDef, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModConnectDef* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModConnectDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModConnectDef* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModConnectDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModConnectDef* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModConnectDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModConnectDef* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModConnectDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModConnectDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModConnectDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModConnectDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModConnectDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModConnectDef_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModConnectDefp result= (oaStringAppDef_oaModConnectDef::get(p1.Data())); return PyoaStringAppDef_oaModConnectDef_FromoaStringAppDef_oaModConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModConnectDefp result= (oaStringAppDef_oaModConnectDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModConnectDef_FromoaStringAppDef_oaModConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModConnectDefp result= (oaStringAppDef_oaModConnectDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModConnectDef_FromoaStringAppDef_oaModConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModConnectDefp result= (oaStringAppDef_oaModConnectDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModConnectDef_FromoaStringAppDef_oaModConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModConnectDefp result= (oaStringAppDef_oaModConnectDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModConnectDef_FromoaStringAppDef_oaModConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModConnectDefp result= (oaStringAppDef_oaModConnectDef::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModConnectDef_FromoaStringAppDef_oaModConnectDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModConnectDef, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModConnectDef_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModConnectDef_static_find,METH_VARARGS,oaStringAppDef_oaModConnectDef_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModConnectDef_static_get,METH_VARARGS,oaStringAppDef_oaModConnectDef_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModConnectDef_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModConnectDef_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModConnectDef\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModConnectDef", (PyObject*)(&PyoaStringAppDef_oaModConnectDef_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModConnectDef\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModConnectDef_Type.tp_dict; for(method=oaStringAppDef_oaModConnectDef_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModInst // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModInst_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModInst_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModInstObject* self = (PyoaStringAppDef_oaModInstObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModInst) { PyParamoaStringAppDef_oaModInst p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModInst_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModInst, Choices are:\n" " (oaStringAppDef_oaModInst)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModInst_tp_dealloc(PyoaStringAppDef_oaModInstObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModInst_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModInst value; int convert_status=PyoaStringAppDef_oaModInst_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[46]; sprintf(buffer,"<oaStringAppDef_oaModInst::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModInst_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModInst v1; PyParamoaStringAppDef_oaModInst v2; int convert_status1=PyoaStringAppDef_oaModInst_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModInst_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModInst_Convert(PyObject* ob,PyParamoaStringAppDef_oaModInst* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModInst_Check(ob)) { result->SetData( (oaStringAppDef_oaModInst**) ((PyoaStringAppDef_oaModInstObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModInst Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModInst_FromoaStringAppDef_oaModInst(oaStringAppDef_oaModInst** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModInst* data=*value; PyObject* bself = PyoaStringAppDef_oaModInst_Type.tp_alloc(&PyoaStringAppDef_oaModInst_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModInstObject* self = (PyoaStringAppDef_oaModInstObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModInst_FromoaStringAppDef_oaModInst(oaStringAppDef_oaModInst* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModInst_Type.tp_alloc(&PyoaStringAppDef_oaModInst_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModInstObject* self = (PyoaStringAppDef_oaModInstObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModInst_get_doc[] = "Class: oaStringAppDef_oaModInst, Function: get\n" " Paramegers: (oaModInst,oaString)\n" " Calls: void get(const oaModInst* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModInst,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModInst_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModInst data; int convert_status=PyoaStringAppDef_oaModInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModInstObject* self=(PyoaStringAppDef_oaModInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModInst p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModInst_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInst_getDefault_doc[] = "Class: oaStringAppDef_oaModInst, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModInst_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModInst data; int convert_status=PyoaStringAppDef_oaModInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModInstObject* self=(PyoaStringAppDef_oaModInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInst_set_doc[] = "Class: oaStringAppDef_oaModInst, Function: set\n" " Paramegers: (oaModInst,oaString)\n" " Calls: void set(oaModInst* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModInst,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModInst_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModInst data; int convert_status=PyoaStringAppDef_oaModInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModInstObject* self=(PyoaStringAppDef_oaModInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModInst p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModInst_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInst_isNull_doc[] = "Class: oaStringAppDef_oaModInst, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModInst_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModInst data; int convert_status=PyoaStringAppDef_oaModInst_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModInst_assign_doc[] = "Class: oaStringAppDef_oaModInst, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModInst_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModInst data; int convert_status=PyoaStringAppDef_oaModInst_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModInst p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModInst_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModInst_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModInst_get,METH_VARARGS,oaStringAppDef_oaModInst_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModInst_getDefault,METH_VARARGS,oaStringAppDef_oaModInst_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModInst_set,METH_VARARGS,oaStringAppDef_oaModInst_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModInst_tp_isNull,METH_VARARGS,oaStringAppDef_oaModInst_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModInst_tp_assign,METH_VARARGS,oaStringAppDef_oaModInst_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModInst_doc[] = "Class: oaStringAppDef_oaModInst\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModInst)\n" " Calls: (const oaStringAppDef_oaModInst&)\n" " Signature: oaStringAppDef_oaModInst||cref-oaStringAppDef_oaModInst,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModInst_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModInst", sizeof(PyoaStringAppDef_oaModInstObject), 0, (destructor)oaStringAppDef_oaModInst_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModInst_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModInst_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModInst_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModInst_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModInst_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModInst_static_find_doc[] = "Class: oaStringAppDef_oaModInst, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModInst* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModInst|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModInst* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModInst|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModInst_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModInstp result= (oaStringAppDef_oaModInst::find(p1.Data())); return PyoaStringAppDef_oaModInst_FromoaStringAppDef_oaModInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstp result= (oaStringAppDef_oaModInst::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModInst_FromoaStringAppDef_oaModInst(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModInst, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInst_static_get_doc[] = "Class: oaStringAppDef_oaModInst, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModInst* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModInst* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModInst* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModInst* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModInst* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModInst* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModInst_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModInstp result= (oaStringAppDef_oaModInst::get(p1.Data())); return PyoaStringAppDef_oaModInst_FromoaStringAppDef_oaModInst(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModInstp result= (oaStringAppDef_oaModInst::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModInst_FromoaStringAppDef_oaModInst(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModInstp result= (oaStringAppDef_oaModInst::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModInst_FromoaStringAppDef_oaModInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstp result= (oaStringAppDef_oaModInst::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModInst_FromoaStringAppDef_oaModInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstp result= (oaStringAppDef_oaModInst::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModInst_FromoaStringAppDef_oaModInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstp result= (oaStringAppDef_oaModInst::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModInst_FromoaStringAppDef_oaModInst(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModInst, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModInst_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModInst_static_find,METH_VARARGS,oaStringAppDef_oaModInst_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModInst_static_get,METH_VARARGS,oaStringAppDef_oaModInst_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModInst_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModInst_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModInst\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModInst", (PyObject*)(&PyoaStringAppDef_oaModInst_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModInst\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModInst_Type.tp_dict; for(method=oaStringAppDef_oaModInst_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModInstHeader // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModInstHeader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModInstHeader_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModInstHeaderObject* self = (PyoaStringAppDef_oaModInstHeaderObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModInstHeader) { PyParamoaStringAppDef_oaModInstHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModInstHeader_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModInstHeader, Choices are:\n" " (oaStringAppDef_oaModInstHeader)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModInstHeader_tp_dealloc(PyoaStringAppDef_oaModInstHeaderObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModInstHeader_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModInstHeader value; int convert_status=PyoaStringAppDef_oaModInstHeader_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[52]; sprintf(buffer,"<oaStringAppDef_oaModInstHeader::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModInstHeader_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModInstHeader v1; PyParamoaStringAppDef_oaModInstHeader v2; int convert_status1=PyoaStringAppDef_oaModInstHeader_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModInstHeader_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModInstHeader_Convert(PyObject* ob,PyParamoaStringAppDef_oaModInstHeader* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModInstHeader_Check(ob)) { result->SetData( (oaStringAppDef_oaModInstHeader**) ((PyoaStringAppDef_oaModInstHeaderObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModInstHeader Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModInstHeader_FromoaStringAppDef_oaModInstHeader(oaStringAppDef_oaModInstHeader** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModInstHeader* data=*value; PyObject* bself = PyoaStringAppDef_oaModInstHeader_Type.tp_alloc(&PyoaStringAppDef_oaModInstHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModInstHeaderObject* self = (PyoaStringAppDef_oaModInstHeaderObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModInstHeader_FromoaStringAppDef_oaModInstHeader(oaStringAppDef_oaModInstHeader* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModInstHeader_Type.tp_alloc(&PyoaStringAppDef_oaModInstHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModInstHeaderObject* self = (PyoaStringAppDef_oaModInstHeaderObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstHeader_get_doc[] = "Class: oaStringAppDef_oaModInstHeader, Function: get\n" " Paramegers: (oaModInstHeader,oaString)\n" " Calls: void get(const oaModInstHeader* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModInstHeader,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModInstHeader_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModInstHeader data; int convert_status=PyoaStringAppDef_oaModInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModInstHeaderObject* self=(PyoaStringAppDef_oaModInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModInstHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModInstHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstHeader_getDefault_doc[] = "Class: oaStringAppDef_oaModInstHeader, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModInstHeader_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModInstHeader data; int convert_status=PyoaStringAppDef_oaModInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModInstHeaderObject* self=(PyoaStringAppDef_oaModInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstHeader_set_doc[] = "Class: oaStringAppDef_oaModInstHeader, Function: set\n" " Paramegers: (oaModInstHeader,oaString)\n" " Calls: void set(oaModInstHeader* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModInstHeader,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModInstHeader_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModInstHeader data; int convert_status=PyoaStringAppDef_oaModInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModInstHeaderObject* self=(PyoaStringAppDef_oaModInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModInstHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModInstHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstHeader_isNull_doc[] = "Class: oaStringAppDef_oaModInstHeader, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModInstHeader_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModInstHeader data; int convert_status=PyoaStringAppDef_oaModInstHeader_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModInstHeader_assign_doc[] = "Class: oaStringAppDef_oaModInstHeader, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModInstHeader_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModInstHeader data; int convert_status=PyoaStringAppDef_oaModInstHeader_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModInstHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModInstHeader_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModInstHeader_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModInstHeader_get,METH_VARARGS,oaStringAppDef_oaModInstHeader_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModInstHeader_getDefault,METH_VARARGS,oaStringAppDef_oaModInstHeader_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModInstHeader_set,METH_VARARGS,oaStringAppDef_oaModInstHeader_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModInstHeader_tp_isNull,METH_VARARGS,oaStringAppDef_oaModInstHeader_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModInstHeader_tp_assign,METH_VARARGS,oaStringAppDef_oaModInstHeader_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstHeader_doc[] = "Class: oaStringAppDef_oaModInstHeader\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModInstHeader)\n" " Calls: (const oaStringAppDef_oaModInstHeader&)\n" " Signature: oaStringAppDef_oaModInstHeader||cref-oaStringAppDef_oaModInstHeader,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModInstHeader_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModInstHeader", sizeof(PyoaStringAppDef_oaModInstHeaderObject), 0, (destructor)oaStringAppDef_oaModInstHeader_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModInstHeader_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModInstHeader_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModInstHeader_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModInstHeader_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModInstHeader_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstHeader_static_find_doc[] = "Class: oaStringAppDef_oaModInstHeader, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModInstHeader* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModInstHeader|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModInstHeader* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModInstHeader|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModInstHeader_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModInstHeaderp result= (oaStringAppDef_oaModInstHeader::find(p1.Data())); return PyoaStringAppDef_oaModInstHeader_FromoaStringAppDef_oaModInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstHeaderp result= (oaStringAppDef_oaModInstHeader::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModInstHeader_FromoaStringAppDef_oaModInstHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModInstHeader, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstHeader_static_get_doc[] = "Class: oaStringAppDef_oaModInstHeader, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModInstHeader* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModInstHeader* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModInstHeader* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModInstHeader* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModInstHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModInstHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModInstHeader_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModInstHeaderp result= (oaStringAppDef_oaModInstHeader::get(p1.Data())); return PyoaStringAppDef_oaModInstHeader_FromoaStringAppDef_oaModInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModInstHeaderp result= (oaStringAppDef_oaModInstHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModInstHeader_FromoaStringAppDef_oaModInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModInstHeaderp result= (oaStringAppDef_oaModInstHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModInstHeader_FromoaStringAppDef_oaModInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstHeaderp result= (oaStringAppDef_oaModInstHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModInstHeader_FromoaStringAppDef_oaModInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstHeaderp result= (oaStringAppDef_oaModInstHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModInstHeader_FromoaStringAppDef_oaModInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstHeaderp result= (oaStringAppDef_oaModInstHeader::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModInstHeader_FromoaStringAppDef_oaModInstHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModInstHeader, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModInstHeader_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModInstHeader_static_find,METH_VARARGS,oaStringAppDef_oaModInstHeader_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModInstHeader_static_get,METH_VARARGS,oaStringAppDef_oaModInstHeader_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModInstHeader_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModInstHeader_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModInstHeader\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModInstHeader", (PyObject*)(&PyoaStringAppDef_oaModInstHeader_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModInstHeader\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModInstHeader_Type.tp_dict; for(method=oaStringAppDef_oaModInstHeader_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModInstTerm // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModInstTerm_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModInstTerm_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModInstTermObject* self = (PyoaStringAppDef_oaModInstTermObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModInstTerm) { PyParamoaStringAppDef_oaModInstTerm p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModInstTerm_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModInstTerm, Choices are:\n" " (oaStringAppDef_oaModInstTerm)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModInstTerm_tp_dealloc(PyoaStringAppDef_oaModInstTermObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModInstTerm_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModInstTerm value; int convert_status=PyoaStringAppDef_oaModInstTerm_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[50]; sprintf(buffer,"<oaStringAppDef_oaModInstTerm::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModInstTerm_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModInstTerm v1; PyParamoaStringAppDef_oaModInstTerm v2; int convert_status1=PyoaStringAppDef_oaModInstTerm_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModInstTerm_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModInstTerm_Convert(PyObject* ob,PyParamoaStringAppDef_oaModInstTerm* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModInstTerm_Check(ob)) { result->SetData( (oaStringAppDef_oaModInstTerm**) ((PyoaStringAppDef_oaModInstTermObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModInstTerm Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModInstTerm_FromoaStringAppDef_oaModInstTerm(oaStringAppDef_oaModInstTerm** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModInstTerm* data=*value; PyObject* bself = PyoaStringAppDef_oaModInstTerm_Type.tp_alloc(&PyoaStringAppDef_oaModInstTerm_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModInstTermObject* self = (PyoaStringAppDef_oaModInstTermObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModInstTerm_FromoaStringAppDef_oaModInstTerm(oaStringAppDef_oaModInstTerm* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModInstTerm_Type.tp_alloc(&PyoaStringAppDef_oaModInstTerm_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModInstTermObject* self = (PyoaStringAppDef_oaModInstTermObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstTerm_get_doc[] = "Class: oaStringAppDef_oaModInstTerm, Function: get\n" " Paramegers: (oaModInstTerm,oaString)\n" " Calls: void get(const oaModInstTerm* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModInstTerm,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModInstTerm_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModInstTerm data; int convert_status=PyoaStringAppDef_oaModInstTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModInstTermObject* self=(PyoaStringAppDef_oaModInstTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModInstTerm p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModInstTerm_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstTerm_getDefault_doc[] = "Class: oaStringAppDef_oaModInstTerm, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModInstTerm_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModInstTerm data; int convert_status=PyoaStringAppDef_oaModInstTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModInstTermObject* self=(PyoaStringAppDef_oaModInstTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstTerm_set_doc[] = "Class: oaStringAppDef_oaModInstTerm, Function: set\n" " Paramegers: (oaModInstTerm,oaString)\n" " Calls: void set(oaModInstTerm* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModInstTerm,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModInstTerm_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModInstTerm data; int convert_status=PyoaStringAppDef_oaModInstTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModInstTermObject* self=(PyoaStringAppDef_oaModInstTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModInstTerm p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModInstTerm_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstTerm_isNull_doc[] = "Class: oaStringAppDef_oaModInstTerm, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModInstTerm_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModInstTerm data; int convert_status=PyoaStringAppDef_oaModInstTerm_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModInstTerm_assign_doc[] = "Class: oaStringAppDef_oaModInstTerm, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModInstTerm_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModInstTerm data; int convert_status=PyoaStringAppDef_oaModInstTerm_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModInstTerm p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModInstTerm_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModInstTerm_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModInstTerm_get,METH_VARARGS,oaStringAppDef_oaModInstTerm_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModInstTerm_getDefault,METH_VARARGS,oaStringAppDef_oaModInstTerm_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModInstTerm_set,METH_VARARGS,oaStringAppDef_oaModInstTerm_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModInstTerm_tp_isNull,METH_VARARGS,oaStringAppDef_oaModInstTerm_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModInstTerm_tp_assign,METH_VARARGS,oaStringAppDef_oaModInstTerm_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstTerm_doc[] = "Class: oaStringAppDef_oaModInstTerm\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModInstTerm)\n" " Calls: (const oaStringAppDef_oaModInstTerm&)\n" " Signature: oaStringAppDef_oaModInstTerm||cref-oaStringAppDef_oaModInstTerm,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModInstTerm_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModInstTerm", sizeof(PyoaStringAppDef_oaModInstTermObject), 0, (destructor)oaStringAppDef_oaModInstTerm_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModInstTerm_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModInstTerm_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModInstTerm_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModInstTerm_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModInstTerm_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstTerm_static_find_doc[] = "Class: oaStringAppDef_oaModInstTerm, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModInstTerm* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModInstTerm|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModInstTerm* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModInstTerm|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModInstTerm_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModInstTermp result= (oaStringAppDef_oaModInstTerm::find(p1.Data())); return PyoaStringAppDef_oaModInstTerm_FromoaStringAppDef_oaModInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstTermp result= (oaStringAppDef_oaModInstTerm::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModInstTerm_FromoaStringAppDef_oaModInstTerm(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModInstTerm, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModInstTerm_static_get_doc[] = "Class: oaStringAppDef_oaModInstTerm, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModInstTerm* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModInstTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModInstTerm* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModInstTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModInstTerm* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModInstTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModInstTerm* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModInstTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModInstTerm* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModInstTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModInstTerm* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModInstTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModInstTerm_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModInstTermp result= (oaStringAppDef_oaModInstTerm::get(p1.Data())); return PyoaStringAppDef_oaModInstTerm_FromoaStringAppDef_oaModInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModInstTermp result= (oaStringAppDef_oaModInstTerm::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModInstTerm_FromoaStringAppDef_oaModInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModInstTermp result= (oaStringAppDef_oaModInstTerm::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModInstTerm_FromoaStringAppDef_oaModInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstTermp result= (oaStringAppDef_oaModInstTerm::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModInstTerm_FromoaStringAppDef_oaModInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstTermp result= (oaStringAppDef_oaModInstTerm::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModInstTerm_FromoaStringAppDef_oaModInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModInstTermp result= (oaStringAppDef_oaModInstTerm::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModInstTerm_FromoaStringAppDef_oaModInstTerm(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModInstTerm, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModInstTerm_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModInstTerm_static_find,METH_VARARGS,oaStringAppDef_oaModInstTerm_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModInstTerm_static_get,METH_VARARGS,oaStringAppDef_oaModInstTerm_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModInstTerm_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModInstTerm_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModInstTerm\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModInstTerm", (PyObject*)(&PyoaStringAppDef_oaModInstTerm_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModInstTerm\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModInstTerm_Type.tp_dict; for(method=oaStringAppDef_oaModInstTerm_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModModuleInstHeader // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModModuleInstHeader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModModuleInstHeader_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModModuleInstHeaderObject* self = (PyoaStringAppDef_oaModModuleInstHeaderObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModModuleInstHeader) { PyParamoaStringAppDef_oaModModuleInstHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModModuleInstHeader_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModModuleInstHeader, Choices are:\n" " (oaStringAppDef_oaModModuleInstHeader)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModModuleInstHeader_tp_dealloc(PyoaStringAppDef_oaModModuleInstHeaderObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModModuleInstHeader_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModModuleInstHeader value; int convert_status=PyoaStringAppDef_oaModModuleInstHeader_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[58]; sprintf(buffer,"<oaStringAppDef_oaModModuleInstHeader::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModModuleInstHeader_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModModuleInstHeader v1; PyParamoaStringAppDef_oaModModuleInstHeader v2; int convert_status1=PyoaStringAppDef_oaModModuleInstHeader_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModModuleInstHeader_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModModuleInstHeader_Convert(PyObject* ob,PyParamoaStringAppDef_oaModModuleInstHeader* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModModuleInstHeader_Check(ob)) { result->SetData( (oaStringAppDef_oaModModuleInstHeader**) ((PyoaStringAppDef_oaModModuleInstHeaderObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModModuleInstHeader Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModModuleInstHeader_FromoaStringAppDef_oaModModuleInstHeader(oaStringAppDef_oaModModuleInstHeader** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModModuleInstHeader* data=*value; PyObject* bself = PyoaStringAppDef_oaModModuleInstHeader_Type.tp_alloc(&PyoaStringAppDef_oaModModuleInstHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModModuleInstHeaderObject* self = (PyoaStringAppDef_oaModModuleInstHeaderObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModModuleInstHeader_FromoaStringAppDef_oaModModuleInstHeader(oaStringAppDef_oaModModuleInstHeader* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModModuleInstHeader_Type.tp_alloc(&PyoaStringAppDef_oaModModuleInstHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModModuleInstHeaderObject* self = (PyoaStringAppDef_oaModModuleInstHeaderObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModModuleInstHeader_get_doc[] = "Class: oaStringAppDef_oaModModuleInstHeader, Function: get\n" " Paramegers: (oaModModuleInstHeader,oaString)\n" " Calls: void get(const oaModModuleInstHeader* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModModuleInstHeader,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModModuleInstHeader_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModModuleInstHeader data; int convert_status=PyoaStringAppDef_oaModModuleInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModModuleInstHeaderObject* self=(PyoaStringAppDef_oaModModuleInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModModuleInstHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModModuleInstHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModModuleInstHeader_getDefault_doc[] = "Class: oaStringAppDef_oaModModuleInstHeader, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModModuleInstHeader_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModModuleInstHeader data; int convert_status=PyoaStringAppDef_oaModModuleInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModModuleInstHeaderObject* self=(PyoaStringAppDef_oaModModuleInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModModuleInstHeader_set_doc[] = "Class: oaStringAppDef_oaModModuleInstHeader, Function: set\n" " Paramegers: (oaModModuleInstHeader,oaString)\n" " Calls: void set(oaModModuleInstHeader* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModModuleInstHeader,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModModuleInstHeader_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModModuleInstHeader data; int convert_status=PyoaStringAppDef_oaModModuleInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModModuleInstHeaderObject* self=(PyoaStringAppDef_oaModModuleInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModModuleInstHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModModuleInstHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModModuleInstHeader_isNull_doc[] = "Class: oaStringAppDef_oaModModuleInstHeader, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModModuleInstHeader_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModModuleInstHeader data; int convert_status=PyoaStringAppDef_oaModModuleInstHeader_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModModuleInstHeader_assign_doc[] = "Class: oaStringAppDef_oaModModuleInstHeader, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModModuleInstHeader_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModModuleInstHeader data; int convert_status=PyoaStringAppDef_oaModModuleInstHeader_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModModuleInstHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModModuleInstHeader_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModModuleInstHeader_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModModuleInstHeader_get,METH_VARARGS,oaStringAppDef_oaModModuleInstHeader_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModModuleInstHeader_getDefault,METH_VARARGS,oaStringAppDef_oaModModuleInstHeader_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModModuleInstHeader_set,METH_VARARGS,oaStringAppDef_oaModModuleInstHeader_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModModuleInstHeader_tp_isNull,METH_VARARGS,oaStringAppDef_oaModModuleInstHeader_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModModuleInstHeader_tp_assign,METH_VARARGS,oaStringAppDef_oaModModuleInstHeader_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModModuleInstHeader_doc[] = "Class: oaStringAppDef_oaModModuleInstHeader\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModModuleInstHeader)\n" " Calls: (const oaStringAppDef_oaModModuleInstHeader&)\n" " Signature: oaStringAppDef_oaModModuleInstHeader||cref-oaStringAppDef_oaModModuleInstHeader,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModModuleInstHeader_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModModuleInstHeader", sizeof(PyoaStringAppDef_oaModModuleInstHeaderObject), 0, (destructor)oaStringAppDef_oaModModuleInstHeader_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModModuleInstHeader_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModModuleInstHeader_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModModuleInstHeader_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModModuleInstHeader_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModModuleInstHeader_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModModuleInstHeader_static_find_doc[] = "Class: oaStringAppDef_oaModModuleInstHeader, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModModuleInstHeader* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModModuleInstHeader|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModModuleInstHeader* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModModuleInstHeader|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModModuleInstHeader_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModModuleInstHeaderp result= (oaStringAppDef_oaModModuleInstHeader::find(p1.Data())); return PyoaStringAppDef_oaModModuleInstHeader_FromoaStringAppDef_oaModModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModModuleInstHeaderp result= (oaStringAppDef_oaModModuleInstHeader::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModModuleInstHeader_FromoaStringAppDef_oaModModuleInstHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModModuleInstHeader, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModModuleInstHeader_static_get_doc[] = "Class: oaStringAppDef_oaModModuleInstHeader, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModModuleInstHeader* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModModuleInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModModuleInstHeader* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModModuleInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModModuleInstHeader* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModModuleInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModModuleInstHeader* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModModuleInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModModuleInstHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModModuleInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModModuleInstHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModModuleInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModModuleInstHeader_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModModuleInstHeaderp result= (oaStringAppDef_oaModModuleInstHeader::get(p1.Data())); return PyoaStringAppDef_oaModModuleInstHeader_FromoaStringAppDef_oaModModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModModuleInstHeaderp result= (oaStringAppDef_oaModModuleInstHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModModuleInstHeader_FromoaStringAppDef_oaModModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModModuleInstHeaderp result= (oaStringAppDef_oaModModuleInstHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModModuleInstHeader_FromoaStringAppDef_oaModModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModModuleInstHeaderp result= (oaStringAppDef_oaModModuleInstHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModModuleInstHeader_FromoaStringAppDef_oaModModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModModuleInstHeaderp result= (oaStringAppDef_oaModModuleInstHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModModuleInstHeader_FromoaStringAppDef_oaModModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModModuleInstHeaderp result= (oaStringAppDef_oaModModuleInstHeader::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModModuleInstHeader_FromoaStringAppDef_oaModModuleInstHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModModuleInstHeader, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModModuleInstHeader_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModModuleInstHeader_static_find,METH_VARARGS,oaStringAppDef_oaModModuleInstHeader_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModModuleInstHeader_static_get,METH_VARARGS,oaStringAppDef_oaModModuleInstHeader_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModModuleInstHeader_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModModuleInstHeader_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModModuleInstHeader\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModModuleInstHeader", (PyObject*)(&PyoaStringAppDef_oaModModuleInstHeader_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModModuleInstHeader\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModModuleInstHeader_Type.tp_dict; for(method=oaStringAppDef_oaModModuleInstHeader_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModNet // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModNet_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModNet_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModNetObject* self = (PyoaStringAppDef_oaModNetObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModNet) { PyParamoaStringAppDef_oaModNet p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModNet_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModNet, Choices are:\n" " (oaStringAppDef_oaModNet)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModNet_tp_dealloc(PyoaStringAppDef_oaModNetObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModNet_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModNet value; int convert_status=PyoaStringAppDef_oaModNet_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[45]; sprintf(buffer,"<oaStringAppDef_oaModNet::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModNet_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModNet v1; PyParamoaStringAppDef_oaModNet v2; int convert_status1=PyoaStringAppDef_oaModNet_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModNet_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModNet_Convert(PyObject* ob,PyParamoaStringAppDef_oaModNet* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModNet_Check(ob)) { result->SetData( (oaStringAppDef_oaModNet**) ((PyoaStringAppDef_oaModNetObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModNet Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModNet_FromoaStringAppDef_oaModNet(oaStringAppDef_oaModNet** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModNet* data=*value; PyObject* bself = PyoaStringAppDef_oaModNet_Type.tp_alloc(&PyoaStringAppDef_oaModNet_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModNetObject* self = (PyoaStringAppDef_oaModNetObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModNet_FromoaStringAppDef_oaModNet(oaStringAppDef_oaModNet* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModNet_Type.tp_alloc(&PyoaStringAppDef_oaModNet_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModNetObject* self = (PyoaStringAppDef_oaModNetObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModNet_get_doc[] = "Class: oaStringAppDef_oaModNet, Function: get\n" " Paramegers: (oaModNet,oaString)\n" " Calls: void get(const oaModNet* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModNet,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModNet_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModNet data; int convert_status=PyoaStringAppDef_oaModNet_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModNetObject* self=(PyoaStringAppDef_oaModNetObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModNet p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModNet_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModNet_getDefault_doc[] = "Class: oaStringAppDef_oaModNet, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModNet_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModNet data; int convert_status=PyoaStringAppDef_oaModNet_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModNetObject* self=(PyoaStringAppDef_oaModNetObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModNet_set_doc[] = "Class: oaStringAppDef_oaModNet, Function: set\n" " Paramegers: (oaModNet,oaString)\n" " Calls: void set(oaModNet* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModNet,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModNet_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModNet data; int convert_status=PyoaStringAppDef_oaModNet_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModNetObject* self=(PyoaStringAppDef_oaModNetObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModNet p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModNet_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModNet_isNull_doc[] = "Class: oaStringAppDef_oaModNet, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModNet_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModNet data; int convert_status=PyoaStringAppDef_oaModNet_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModNet_assign_doc[] = "Class: oaStringAppDef_oaModNet, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModNet_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModNet data; int convert_status=PyoaStringAppDef_oaModNet_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModNet p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModNet_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModNet_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModNet_get,METH_VARARGS,oaStringAppDef_oaModNet_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModNet_getDefault,METH_VARARGS,oaStringAppDef_oaModNet_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModNet_set,METH_VARARGS,oaStringAppDef_oaModNet_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModNet_tp_isNull,METH_VARARGS,oaStringAppDef_oaModNet_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModNet_tp_assign,METH_VARARGS,oaStringAppDef_oaModNet_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModNet_doc[] = "Class: oaStringAppDef_oaModNet\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModNet)\n" " Calls: (const oaStringAppDef_oaModNet&)\n" " Signature: oaStringAppDef_oaModNet||cref-oaStringAppDef_oaModNet,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModNet_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModNet", sizeof(PyoaStringAppDef_oaModNetObject), 0, (destructor)oaStringAppDef_oaModNet_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModNet_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModNet_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModNet_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModNet_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModNet_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModNet_static_find_doc[] = "Class: oaStringAppDef_oaModNet, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModNet* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModNet|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModNet* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModNet|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModNet_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModNetp result= (oaStringAppDef_oaModNet::find(p1.Data())); return PyoaStringAppDef_oaModNet_FromoaStringAppDef_oaModNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModNetp result= (oaStringAppDef_oaModNet::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModNet_FromoaStringAppDef_oaModNet(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModNet, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModNet_static_get_doc[] = "Class: oaStringAppDef_oaModNet, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModNet* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModNet|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModNet* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModNet|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModNet* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModNet|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModNet* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModNet|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModNet* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModNet|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModNet* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModNet|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModNet_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModNetp result= (oaStringAppDef_oaModNet::get(p1.Data())); return PyoaStringAppDef_oaModNet_FromoaStringAppDef_oaModNet(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModNetp result= (oaStringAppDef_oaModNet::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModNet_FromoaStringAppDef_oaModNet(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModNetp result= (oaStringAppDef_oaModNet::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModNet_FromoaStringAppDef_oaModNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModNetp result= (oaStringAppDef_oaModNet::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModNet_FromoaStringAppDef_oaModNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModNetp result= (oaStringAppDef_oaModNet::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModNet_FromoaStringAppDef_oaModNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModNetp result= (oaStringAppDef_oaModNet::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModNet_FromoaStringAppDef_oaModNet(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModNet, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModNet_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModNet_static_find,METH_VARARGS,oaStringAppDef_oaModNet_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModNet_static_get,METH_VARARGS,oaStringAppDef_oaModNet_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModNet_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModNet_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModNet\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModNet", (PyObject*)(&PyoaStringAppDef_oaModNet_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModNet\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModNet_Type.tp_dict; for(method=oaStringAppDef_oaModNet_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModTerm // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModTerm_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModTerm_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModTermObject* self = (PyoaStringAppDef_oaModTermObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModTerm) { PyParamoaStringAppDef_oaModTerm p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModTerm_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModTerm, Choices are:\n" " (oaStringAppDef_oaModTerm)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModTerm_tp_dealloc(PyoaStringAppDef_oaModTermObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModTerm_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModTerm value; int convert_status=PyoaStringAppDef_oaModTerm_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[46]; sprintf(buffer,"<oaStringAppDef_oaModTerm::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModTerm_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModTerm v1; PyParamoaStringAppDef_oaModTerm v2; int convert_status1=PyoaStringAppDef_oaModTerm_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModTerm_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModTerm_Convert(PyObject* ob,PyParamoaStringAppDef_oaModTerm* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModTerm_Check(ob)) { result->SetData( (oaStringAppDef_oaModTerm**) ((PyoaStringAppDef_oaModTermObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModTerm Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModTerm_FromoaStringAppDef_oaModTerm(oaStringAppDef_oaModTerm** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModTerm* data=*value; PyObject* bself = PyoaStringAppDef_oaModTerm_Type.tp_alloc(&PyoaStringAppDef_oaModTerm_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModTermObject* self = (PyoaStringAppDef_oaModTermObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModTerm_FromoaStringAppDef_oaModTerm(oaStringAppDef_oaModTerm* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModTerm_Type.tp_alloc(&PyoaStringAppDef_oaModTerm_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModTermObject* self = (PyoaStringAppDef_oaModTermObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModTerm_get_doc[] = "Class: oaStringAppDef_oaModTerm, Function: get\n" " Paramegers: (oaModTerm,oaString)\n" " Calls: void get(const oaModTerm* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModTerm,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModTerm_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModTerm data; int convert_status=PyoaStringAppDef_oaModTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModTermObject* self=(PyoaStringAppDef_oaModTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModTerm p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModTerm_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModTerm_getDefault_doc[] = "Class: oaStringAppDef_oaModTerm, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModTerm_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModTerm data; int convert_status=PyoaStringAppDef_oaModTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModTermObject* self=(PyoaStringAppDef_oaModTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModTerm_set_doc[] = "Class: oaStringAppDef_oaModTerm, Function: set\n" " Paramegers: (oaModTerm,oaString)\n" " Calls: void set(oaModTerm* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModTerm,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModTerm_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModTerm data; int convert_status=PyoaStringAppDef_oaModTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModTermObject* self=(PyoaStringAppDef_oaModTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModTerm p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModTerm_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModTerm_isNull_doc[] = "Class: oaStringAppDef_oaModTerm, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModTerm_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModTerm data; int convert_status=PyoaStringAppDef_oaModTerm_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModTerm_assign_doc[] = "Class: oaStringAppDef_oaModTerm, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModTerm_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModTerm data; int convert_status=PyoaStringAppDef_oaModTerm_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModTerm p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModTerm_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModTerm_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModTerm_get,METH_VARARGS,oaStringAppDef_oaModTerm_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModTerm_getDefault,METH_VARARGS,oaStringAppDef_oaModTerm_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModTerm_set,METH_VARARGS,oaStringAppDef_oaModTerm_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModTerm_tp_isNull,METH_VARARGS,oaStringAppDef_oaModTerm_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModTerm_tp_assign,METH_VARARGS,oaStringAppDef_oaModTerm_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModTerm_doc[] = "Class: oaStringAppDef_oaModTerm\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModTerm)\n" " Calls: (const oaStringAppDef_oaModTerm&)\n" " Signature: oaStringAppDef_oaModTerm||cref-oaStringAppDef_oaModTerm,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModTerm_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModTerm", sizeof(PyoaStringAppDef_oaModTermObject), 0, (destructor)oaStringAppDef_oaModTerm_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModTerm_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModTerm_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModTerm_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModTerm_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModTerm_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModTerm_static_find_doc[] = "Class: oaStringAppDef_oaModTerm, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModTerm* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModTerm|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModTerm* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModTerm|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModTerm_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModTermp result= (oaStringAppDef_oaModTerm::find(p1.Data())); return PyoaStringAppDef_oaModTerm_FromoaStringAppDef_oaModTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModTermp result= (oaStringAppDef_oaModTerm::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModTerm_FromoaStringAppDef_oaModTerm(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModTerm, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModTerm_static_get_doc[] = "Class: oaStringAppDef_oaModTerm, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModTerm* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModTerm* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModTerm* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModTerm* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModTerm* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModTerm* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModTerm_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModTermp result= (oaStringAppDef_oaModTerm::get(p1.Data())); return PyoaStringAppDef_oaModTerm_FromoaStringAppDef_oaModTerm(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModTermp result= (oaStringAppDef_oaModTerm::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModTerm_FromoaStringAppDef_oaModTerm(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModTermp result= (oaStringAppDef_oaModTerm::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModTerm_FromoaStringAppDef_oaModTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModTermp result= (oaStringAppDef_oaModTerm::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModTerm_FromoaStringAppDef_oaModTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModTermp result= (oaStringAppDef_oaModTerm::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModTerm_FromoaStringAppDef_oaModTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModTermp result= (oaStringAppDef_oaModTerm::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModTerm_FromoaStringAppDef_oaModTerm(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModTerm, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModTerm_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModTerm_static_find,METH_VARARGS,oaStringAppDef_oaModTerm_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModTerm_static_get,METH_VARARGS,oaStringAppDef_oaModTerm_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModTerm_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModTerm_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModTerm\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModTerm", (PyObject*)(&PyoaStringAppDef_oaModTerm_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModTerm\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModTerm_Type.tp_dict; for(method=oaStringAppDef_oaModTerm_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModVectorInstDef // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModVectorInstDef_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModVectorInstDef_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModVectorInstDefObject* self = (PyoaStringAppDef_oaModVectorInstDefObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModVectorInstDef) { PyParamoaStringAppDef_oaModVectorInstDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModVectorInstDef_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModVectorInstDef, Choices are:\n" " (oaStringAppDef_oaModVectorInstDef)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModVectorInstDef_tp_dealloc(PyoaStringAppDef_oaModVectorInstDefObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModVectorInstDef_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModVectorInstDef value; int convert_status=PyoaStringAppDef_oaModVectorInstDef_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[55]; sprintf(buffer,"<oaStringAppDef_oaModVectorInstDef::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModVectorInstDef_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModVectorInstDef v1; PyParamoaStringAppDef_oaModVectorInstDef v2; int convert_status1=PyoaStringAppDef_oaModVectorInstDef_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModVectorInstDef_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModVectorInstDef_Convert(PyObject* ob,PyParamoaStringAppDef_oaModVectorInstDef* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModVectorInstDef_Check(ob)) { result->SetData( (oaStringAppDef_oaModVectorInstDef**) ((PyoaStringAppDef_oaModVectorInstDefObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModVectorInstDef Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModVectorInstDef_FromoaStringAppDef_oaModVectorInstDef(oaStringAppDef_oaModVectorInstDef** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModVectorInstDef* data=*value; PyObject* bself = PyoaStringAppDef_oaModVectorInstDef_Type.tp_alloc(&PyoaStringAppDef_oaModVectorInstDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModVectorInstDefObject* self = (PyoaStringAppDef_oaModVectorInstDefObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModVectorInstDef_FromoaStringAppDef_oaModVectorInstDef(oaStringAppDef_oaModVectorInstDef* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModVectorInstDef_Type.tp_alloc(&PyoaStringAppDef_oaModVectorInstDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModVectorInstDefObject* self = (PyoaStringAppDef_oaModVectorInstDefObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModVectorInstDef_get_doc[] = "Class: oaStringAppDef_oaModVectorInstDef, Function: get\n" " Paramegers: (oaModVectorInstDef,oaString)\n" " Calls: void get(const oaModVectorInstDef* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModVectorInstDef,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModVectorInstDef_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModVectorInstDef data; int convert_status=PyoaStringAppDef_oaModVectorInstDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModVectorInstDefObject* self=(PyoaStringAppDef_oaModVectorInstDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModVectorInstDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModVectorInstDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModVectorInstDef_getDefault_doc[] = "Class: oaStringAppDef_oaModVectorInstDef, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModVectorInstDef_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModVectorInstDef data; int convert_status=PyoaStringAppDef_oaModVectorInstDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModVectorInstDefObject* self=(PyoaStringAppDef_oaModVectorInstDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModVectorInstDef_set_doc[] = "Class: oaStringAppDef_oaModVectorInstDef, Function: set\n" " Paramegers: (oaModVectorInstDef,oaString)\n" " Calls: void set(oaModVectorInstDef* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModVectorInstDef,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModVectorInstDef_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModVectorInstDef data; int convert_status=PyoaStringAppDef_oaModVectorInstDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModVectorInstDefObject* self=(PyoaStringAppDef_oaModVectorInstDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModVectorInstDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModVectorInstDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModVectorInstDef_isNull_doc[] = "Class: oaStringAppDef_oaModVectorInstDef, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModVectorInstDef_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModVectorInstDef data; int convert_status=PyoaStringAppDef_oaModVectorInstDef_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModVectorInstDef_assign_doc[] = "Class: oaStringAppDef_oaModVectorInstDef, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModVectorInstDef_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModVectorInstDef data; int convert_status=PyoaStringAppDef_oaModVectorInstDef_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModVectorInstDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModVectorInstDef_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModVectorInstDef_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModVectorInstDef_get,METH_VARARGS,oaStringAppDef_oaModVectorInstDef_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModVectorInstDef_getDefault,METH_VARARGS,oaStringAppDef_oaModVectorInstDef_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModVectorInstDef_set,METH_VARARGS,oaStringAppDef_oaModVectorInstDef_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModVectorInstDef_tp_isNull,METH_VARARGS,oaStringAppDef_oaModVectorInstDef_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModVectorInstDef_tp_assign,METH_VARARGS,oaStringAppDef_oaModVectorInstDef_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModVectorInstDef_doc[] = "Class: oaStringAppDef_oaModVectorInstDef\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModVectorInstDef)\n" " Calls: (const oaStringAppDef_oaModVectorInstDef&)\n" " Signature: oaStringAppDef_oaModVectorInstDef||cref-oaStringAppDef_oaModVectorInstDef,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModVectorInstDef_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModVectorInstDef", sizeof(PyoaStringAppDef_oaModVectorInstDefObject), 0, (destructor)oaStringAppDef_oaModVectorInstDef_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModVectorInstDef_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModVectorInstDef_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModVectorInstDef_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModVectorInstDef_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModVectorInstDef_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModVectorInstDef_static_find_doc[] = "Class: oaStringAppDef_oaModVectorInstDef, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModVectorInstDef* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModVectorInstDef|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModVectorInstDef* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModVectorInstDef|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModVectorInstDef_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModVectorInstDefp result= (oaStringAppDef_oaModVectorInstDef::find(p1.Data())); return PyoaStringAppDef_oaModVectorInstDef_FromoaStringAppDef_oaModVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModVectorInstDefp result= (oaStringAppDef_oaModVectorInstDef::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModVectorInstDef_FromoaStringAppDef_oaModVectorInstDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModVectorInstDef, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModVectorInstDef_static_get_doc[] = "Class: oaStringAppDef_oaModVectorInstDef, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModVectorInstDef* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModVectorInstDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModVectorInstDef* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModVectorInstDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModVectorInstDef* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModVectorInstDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModVectorInstDef* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModVectorInstDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModVectorInstDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModVectorInstDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModVectorInstDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModVectorInstDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModVectorInstDef_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModVectorInstDefp result= (oaStringAppDef_oaModVectorInstDef::get(p1.Data())); return PyoaStringAppDef_oaModVectorInstDef_FromoaStringAppDef_oaModVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModVectorInstDefp result= (oaStringAppDef_oaModVectorInstDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModVectorInstDef_FromoaStringAppDef_oaModVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModVectorInstDefp result= (oaStringAppDef_oaModVectorInstDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModVectorInstDef_FromoaStringAppDef_oaModVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModVectorInstDefp result= (oaStringAppDef_oaModVectorInstDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModVectorInstDef_FromoaStringAppDef_oaModVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModVectorInstDefp result= (oaStringAppDef_oaModVectorInstDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModVectorInstDef_FromoaStringAppDef_oaModVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModVectorInstDefp result= (oaStringAppDef_oaModVectorInstDef::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModVectorInstDef_FromoaStringAppDef_oaModVectorInstDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModVectorInstDef, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModVectorInstDef_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModVectorInstDef_static_find,METH_VARARGS,oaStringAppDef_oaModVectorInstDef_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModVectorInstDef_static_get,METH_VARARGS,oaStringAppDef_oaModVectorInstDef_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModVectorInstDef_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModVectorInstDef_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModVectorInstDef\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModVectorInstDef", (PyObject*)(&PyoaStringAppDef_oaModVectorInstDef_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModVectorInstDef\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModVectorInstDef_Type.tp_dict; for(method=oaStringAppDef_oaModVectorInstDef_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaModule // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModule_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaModule_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModuleObject* self = (PyoaStringAppDef_oaModuleObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaModule) { PyParamoaStringAppDef_oaModule p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModule_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaModule, Choices are:\n" " (oaStringAppDef_oaModule)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaModule_tp_dealloc(PyoaStringAppDef_oaModuleObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaModule_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaModule value; int convert_status=PyoaStringAppDef_oaModule_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[45]; sprintf(buffer,"<oaStringAppDef_oaModule::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaModule_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaModule v1; PyParamoaStringAppDef_oaModule v2; int convert_status1=PyoaStringAppDef_oaModule_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaModule_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaModule_Convert(PyObject* ob,PyParamoaStringAppDef_oaModule* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaModule_Check(ob)) { result->SetData( (oaStringAppDef_oaModule**) ((PyoaStringAppDef_oaModuleObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaModule Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModule_FromoaStringAppDef_oaModule(oaStringAppDef_oaModule** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaModule* data=*value; PyObject* bself = PyoaStringAppDef_oaModule_Type.tp_alloc(&PyoaStringAppDef_oaModule_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModuleObject* self = (PyoaStringAppDef_oaModuleObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaModule_FromoaStringAppDef_oaModule(oaStringAppDef_oaModule* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaModule_Type.tp_alloc(&PyoaStringAppDef_oaModule_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaModuleObject* self = (PyoaStringAppDef_oaModuleObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModule_get_doc[] = "Class: oaStringAppDef_oaModule, Function: get\n" " Paramegers: (oaModule,oaString)\n" " Calls: void get(const oaModule* object,oaString& value)\n" " Signature: get|void-void|cptr-oaModule,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModule_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModule data; int convert_status=PyoaStringAppDef_oaModule_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModuleObject* self=(PyoaStringAppDef_oaModuleObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModule p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModule_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModule_getDefault_doc[] = "Class: oaStringAppDef_oaModule, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaModule_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModule data; int convert_status=PyoaStringAppDef_oaModule_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModuleObject* self=(PyoaStringAppDef_oaModuleObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModule_set_doc[] = "Class: oaStringAppDef_oaModule, Function: set\n" " Paramegers: (oaModule,oaString)\n" " Calls: void set(oaModule* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaModule,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaModule_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaModule data; int convert_status=PyoaStringAppDef_oaModule_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaModuleObject* self=(PyoaStringAppDef_oaModuleObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaModule p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaModule_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModule_isNull_doc[] = "Class: oaStringAppDef_oaModule, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaModule_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModule data; int convert_status=PyoaStringAppDef_oaModule_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaModule_assign_doc[] = "Class: oaStringAppDef_oaModule, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaModule_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaModule data; int convert_status=PyoaStringAppDef_oaModule_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaModule p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaModule_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModule_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaModule_get,METH_VARARGS,oaStringAppDef_oaModule_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaModule_getDefault,METH_VARARGS,oaStringAppDef_oaModule_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaModule_set,METH_VARARGS,oaStringAppDef_oaModule_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaModule_tp_isNull,METH_VARARGS,oaStringAppDef_oaModule_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaModule_tp_assign,METH_VARARGS,oaStringAppDef_oaModule_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModule_doc[] = "Class: oaStringAppDef_oaModule\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaModule)\n" " Calls: (const oaStringAppDef_oaModule&)\n" " Signature: oaStringAppDef_oaModule||cref-oaStringAppDef_oaModule,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaModule_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaModule", sizeof(PyoaStringAppDef_oaModuleObject), 0, (destructor)oaStringAppDef_oaModule_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaModule_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaModule_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaModule_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaModule_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaModule_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaModule_static_find_doc[] = "Class: oaStringAppDef_oaModule, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModule* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaModule|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModule* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaModule|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaModule_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModulep result= (oaStringAppDef_oaModule::find(p1.Data())); return PyoaStringAppDef_oaModule_FromoaStringAppDef_oaModule(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModulep result= (oaStringAppDef_oaModule::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModule_FromoaStringAppDef_oaModule(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModule, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaModule_static_get_doc[] = "Class: oaStringAppDef_oaModule, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaModule* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaModule|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaModule* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModule|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModule* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModule|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaModule* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaModule|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaModule* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaModule|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaModule* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaModule|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaModule_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaModulep result= (oaStringAppDef_oaModule::get(p1.Data())); return PyoaStringAppDef_oaModule_FromoaStringAppDef_oaModule(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaModulep result= (oaStringAppDef_oaModule::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModule_FromoaStringAppDef_oaModule(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaModulep result= (oaStringAppDef_oaModule::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModule_FromoaStringAppDef_oaModule(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModulep result= (oaStringAppDef_oaModule::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaModule_FromoaStringAppDef_oaModule(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModulep result= (oaStringAppDef_oaModule::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaModule_FromoaStringAppDef_oaModule(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaModulep result= (oaStringAppDef_oaModule::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaModule_FromoaStringAppDef_oaModule(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaModule, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaModule_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaModule_static_find,METH_VARARGS,oaStringAppDef_oaModule_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaModule_static_get,METH_VARARGS,oaStringAppDef_oaModule_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaModule_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaModule_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaModule\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaModule", (PyObject*)(&PyoaStringAppDef_oaModule_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaModule\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaModule_Type.tp_dict; for(method=oaStringAppDef_oaModule_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaNet // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaNet_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaNet_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaNetObject* self = (PyoaStringAppDef_oaNetObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaNet) { PyParamoaStringAppDef_oaNet p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaNet_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaNet, Choices are:\n" " (oaStringAppDef_oaNet)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaNet_tp_dealloc(PyoaStringAppDef_oaNetObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaNet_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaNet value; int convert_status=PyoaStringAppDef_oaNet_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[42]; sprintf(buffer,"<oaStringAppDef_oaNet::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaNet_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaNet v1; PyParamoaStringAppDef_oaNet v2; int convert_status1=PyoaStringAppDef_oaNet_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaNet_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaNet_Convert(PyObject* ob,PyParamoaStringAppDef_oaNet* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaNet_Check(ob)) { result->SetData( (oaStringAppDef_oaNet**) ((PyoaStringAppDef_oaNetObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaNet Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaNet_FromoaStringAppDef_oaNet(oaStringAppDef_oaNet** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaNet* data=*value; PyObject* bself = PyoaStringAppDef_oaNet_Type.tp_alloc(&PyoaStringAppDef_oaNet_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaNetObject* self = (PyoaStringAppDef_oaNetObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaNet_FromoaStringAppDef_oaNet(oaStringAppDef_oaNet* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaNet_Type.tp_alloc(&PyoaStringAppDef_oaNet_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaNetObject* self = (PyoaStringAppDef_oaNetObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaNet_get_doc[] = "Class: oaStringAppDef_oaNet, Function: get\n" " Paramegers: (oaNet,oaString)\n" " Calls: void get(const oaNet* object,oaString& value)\n" " Signature: get|void-void|cptr-oaNet,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaNet_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaNet data; int convert_status=PyoaStringAppDef_oaNet_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaNetObject* self=(PyoaStringAppDef_oaNetObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaNet p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaNet_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaNet_getDefault_doc[] = "Class: oaStringAppDef_oaNet, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaNet_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaNet data; int convert_status=PyoaStringAppDef_oaNet_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaNetObject* self=(PyoaStringAppDef_oaNetObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaNet_set_doc[] = "Class: oaStringAppDef_oaNet, Function: set\n" " Paramegers: (oaNet,oaString)\n" " Calls: void set(oaNet* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaNet,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaNet_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaNet data; int convert_status=PyoaStringAppDef_oaNet_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaNetObject* self=(PyoaStringAppDef_oaNetObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaNet p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaNet_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaNet_isNull_doc[] = "Class: oaStringAppDef_oaNet, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaNet_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaNet data; int convert_status=PyoaStringAppDef_oaNet_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaNet_assign_doc[] = "Class: oaStringAppDef_oaNet, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaNet_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaNet data; int convert_status=PyoaStringAppDef_oaNet_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaNet p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaNet_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaNet_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaNet_get,METH_VARARGS,oaStringAppDef_oaNet_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaNet_getDefault,METH_VARARGS,oaStringAppDef_oaNet_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaNet_set,METH_VARARGS,oaStringAppDef_oaNet_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaNet_tp_isNull,METH_VARARGS,oaStringAppDef_oaNet_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaNet_tp_assign,METH_VARARGS,oaStringAppDef_oaNet_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaNet_doc[] = "Class: oaStringAppDef_oaNet\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaNet)\n" " Calls: (const oaStringAppDef_oaNet&)\n" " Signature: oaStringAppDef_oaNet||cref-oaStringAppDef_oaNet,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaNet_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaNet", sizeof(PyoaStringAppDef_oaNetObject), 0, (destructor)oaStringAppDef_oaNet_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaNet_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaNet_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaNet_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaNet_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaNet_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaNet_static_find_doc[] = "Class: oaStringAppDef_oaNet, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaNet* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaNet|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaNet* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaNet|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaNet_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaNetp result= (oaStringAppDef_oaNet::find(p1.Data())); return PyoaStringAppDef_oaNet_FromoaStringAppDef_oaNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaNetp result= (oaStringAppDef_oaNet::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaNet_FromoaStringAppDef_oaNet(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaNet, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaNet_static_get_doc[] = "Class: oaStringAppDef_oaNet, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaNet* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaNet|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaNet* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaNet|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaNet* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaNet|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaNet* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaNet|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaNet* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaNet|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaNet* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaNet|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaNet_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaNetp result= (oaStringAppDef_oaNet::get(p1.Data())); return PyoaStringAppDef_oaNet_FromoaStringAppDef_oaNet(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaNetp result= (oaStringAppDef_oaNet::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaNet_FromoaStringAppDef_oaNet(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaNetp result= (oaStringAppDef_oaNet::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaNet_FromoaStringAppDef_oaNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaNetp result= (oaStringAppDef_oaNet::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaNet_FromoaStringAppDef_oaNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaNetp result= (oaStringAppDef_oaNet::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaNet_FromoaStringAppDef_oaNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaNetp result= (oaStringAppDef_oaNet::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaNet_FromoaStringAppDef_oaNet(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaNet, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaNet_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaNet_static_find,METH_VARARGS,oaStringAppDef_oaNet_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaNet_static_get,METH_VARARGS,oaStringAppDef_oaNet_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaNet_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaNet_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaNet\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaNet", (PyObject*)(&PyoaStringAppDef_oaNet_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaNet\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaNet_Type.tp_dict; for(method=oaStringAppDef_oaNet_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaNode // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaNode_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaNode_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaNodeObject* self = (PyoaStringAppDef_oaNodeObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaNode) { PyParamoaStringAppDef_oaNode p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaNode_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaNode, Choices are:\n" " (oaStringAppDef_oaNode)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaNode_tp_dealloc(PyoaStringAppDef_oaNodeObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaNode_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaNode value; int convert_status=PyoaStringAppDef_oaNode_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[43]; sprintf(buffer,"<oaStringAppDef_oaNode::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaNode_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaNode v1; PyParamoaStringAppDef_oaNode v2; int convert_status1=PyoaStringAppDef_oaNode_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaNode_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaNode_Convert(PyObject* ob,PyParamoaStringAppDef_oaNode* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaNode_Check(ob)) { result->SetData( (oaStringAppDef_oaNode**) ((PyoaStringAppDef_oaNodeObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaNode Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaNode_FromoaStringAppDef_oaNode(oaStringAppDef_oaNode** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaNode* data=*value; PyObject* bself = PyoaStringAppDef_oaNode_Type.tp_alloc(&PyoaStringAppDef_oaNode_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaNodeObject* self = (PyoaStringAppDef_oaNodeObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaNode_FromoaStringAppDef_oaNode(oaStringAppDef_oaNode* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaNode_Type.tp_alloc(&PyoaStringAppDef_oaNode_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaNodeObject* self = (PyoaStringAppDef_oaNodeObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaNode_get_doc[] = "Class: oaStringAppDef_oaNode, Function: get\n" " Paramegers: (oaNode,oaString)\n" " Calls: void get(const oaNode* object,oaString& value)\n" " Signature: get|void-void|cptr-oaNode,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaNode_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaNode data; int convert_status=PyoaStringAppDef_oaNode_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaNodeObject* self=(PyoaStringAppDef_oaNodeObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaNode p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaNode_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaNode_getDefault_doc[] = "Class: oaStringAppDef_oaNode, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaNode_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaNode data; int convert_status=PyoaStringAppDef_oaNode_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaNodeObject* self=(PyoaStringAppDef_oaNodeObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaNode_set_doc[] = "Class: oaStringAppDef_oaNode, Function: set\n" " Paramegers: (oaNode,oaString)\n" " Calls: void set(oaNode* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaNode,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaNode_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaNode data; int convert_status=PyoaStringAppDef_oaNode_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaNodeObject* self=(PyoaStringAppDef_oaNodeObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaNode p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaNode_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaNode_isNull_doc[] = "Class: oaStringAppDef_oaNode, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaNode_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaNode data; int convert_status=PyoaStringAppDef_oaNode_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaNode_assign_doc[] = "Class: oaStringAppDef_oaNode, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaNode_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaNode data; int convert_status=PyoaStringAppDef_oaNode_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaNode p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaNode_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaNode_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaNode_get,METH_VARARGS,oaStringAppDef_oaNode_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaNode_getDefault,METH_VARARGS,oaStringAppDef_oaNode_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaNode_set,METH_VARARGS,oaStringAppDef_oaNode_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaNode_tp_isNull,METH_VARARGS,oaStringAppDef_oaNode_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaNode_tp_assign,METH_VARARGS,oaStringAppDef_oaNode_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaNode_doc[] = "Class: oaStringAppDef_oaNode\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaNode)\n" " Calls: (const oaStringAppDef_oaNode&)\n" " Signature: oaStringAppDef_oaNode||cref-oaStringAppDef_oaNode,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaNode_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaNode", sizeof(PyoaStringAppDef_oaNodeObject), 0, (destructor)oaStringAppDef_oaNode_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaNode_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaNode_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaNode_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaNode_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaNode_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaNode_static_find_doc[] = "Class: oaStringAppDef_oaNode, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaNode* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaNode|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaNode* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaNode|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaNode_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaNodep result= (oaStringAppDef_oaNode::find(p1.Data())); return PyoaStringAppDef_oaNode_FromoaStringAppDef_oaNode(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaNodep result= (oaStringAppDef_oaNode::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaNode_FromoaStringAppDef_oaNode(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaNode, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaNode_static_get_doc[] = "Class: oaStringAppDef_oaNode, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaNode* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaNode|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaNode* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaNode|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaNode* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaNode|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaNode* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaNode|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaNode* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaNode|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaNode* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaNode|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaNode_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaNodep result= (oaStringAppDef_oaNode::get(p1.Data())); return PyoaStringAppDef_oaNode_FromoaStringAppDef_oaNode(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaNodep result= (oaStringAppDef_oaNode::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaNode_FromoaStringAppDef_oaNode(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaNodep result= (oaStringAppDef_oaNode::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaNode_FromoaStringAppDef_oaNode(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaNodep result= (oaStringAppDef_oaNode::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaNode_FromoaStringAppDef_oaNode(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaNodep result= (oaStringAppDef_oaNode::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaNode_FromoaStringAppDef_oaNode(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaNodep result= (oaStringAppDef_oaNode::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaNode_FromoaStringAppDef_oaNode(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaNode, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaNode_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaNode_static_find,METH_VARARGS,oaStringAppDef_oaNode_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaNode_static_get,METH_VARARGS,oaStringAppDef_oaNode_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaNode_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaNode_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaNode\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaNode", (PyObject*)(&PyoaStringAppDef_oaNode_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaNode\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaNode_Type.tp_dict; for(method=oaStringAppDef_oaNode_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccAssignment // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccAssignment_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccAssignment_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccAssignmentObject* self = (PyoaStringAppDef_oaOccAssignmentObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccAssignment) { PyParamoaStringAppDef_oaOccAssignment p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccAssignment_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccAssignment, Choices are:\n" " (oaStringAppDef_oaOccAssignment)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccAssignment_tp_dealloc(PyoaStringAppDef_oaOccAssignmentObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccAssignment_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccAssignment value; int convert_status=PyoaStringAppDef_oaOccAssignment_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[52]; sprintf(buffer,"<oaStringAppDef_oaOccAssignment::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccAssignment_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccAssignment v1; PyParamoaStringAppDef_oaOccAssignment v2; int convert_status1=PyoaStringAppDef_oaOccAssignment_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccAssignment_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccAssignment_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccAssignment* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccAssignment_Check(ob)) { result->SetData( (oaStringAppDef_oaOccAssignment**) ((PyoaStringAppDef_oaOccAssignmentObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccAssignment Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccAssignment_FromoaStringAppDef_oaOccAssignment(oaStringAppDef_oaOccAssignment** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccAssignment* data=*value; PyObject* bself = PyoaStringAppDef_oaOccAssignment_Type.tp_alloc(&PyoaStringAppDef_oaOccAssignment_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccAssignmentObject* self = (PyoaStringAppDef_oaOccAssignmentObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccAssignment_FromoaStringAppDef_oaOccAssignment(oaStringAppDef_oaOccAssignment* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccAssignment_Type.tp_alloc(&PyoaStringAppDef_oaOccAssignment_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccAssignmentObject* self = (PyoaStringAppDef_oaOccAssignmentObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccAssignment_get_doc[] = "Class: oaStringAppDef_oaOccAssignment, Function: get\n" " Paramegers: (oaOccAssignment,oaString)\n" " Calls: void get(const oaOccAssignment* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccAssignment,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccAssignment_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccAssignment data; int convert_status=PyoaStringAppDef_oaOccAssignment_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccAssignmentObject* self=(PyoaStringAppDef_oaOccAssignmentObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccAssignment p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccAssignment_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccAssignment_getDefault_doc[] = "Class: oaStringAppDef_oaOccAssignment, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccAssignment_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccAssignment data; int convert_status=PyoaStringAppDef_oaOccAssignment_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccAssignmentObject* self=(PyoaStringAppDef_oaOccAssignmentObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccAssignment_set_doc[] = "Class: oaStringAppDef_oaOccAssignment, Function: set\n" " Paramegers: (oaOccAssignment,oaString)\n" " Calls: void set(oaOccAssignment* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccAssignment,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccAssignment_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccAssignment data; int convert_status=PyoaStringAppDef_oaOccAssignment_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccAssignmentObject* self=(PyoaStringAppDef_oaOccAssignmentObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccAssignment p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccAssignment_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccAssignment_isNull_doc[] = "Class: oaStringAppDef_oaOccAssignment, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccAssignment_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccAssignment data; int convert_status=PyoaStringAppDef_oaOccAssignment_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccAssignment_assign_doc[] = "Class: oaStringAppDef_oaOccAssignment, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccAssignment_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccAssignment data; int convert_status=PyoaStringAppDef_oaOccAssignment_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccAssignment p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccAssignment_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccAssignment_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccAssignment_get,METH_VARARGS,oaStringAppDef_oaOccAssignment_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccAssignment_getDefault,METH_VARARGS,oaStringAppDef_oaOccAssignment_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccAssignment_set,METH_VARARGS,oaStringAppDef_oaOccAssignment_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccAssignment_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccAssignment_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccAssignment_tp_assign,METH_VARARGS,oaStringAppDef_oaOccAssignment_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccAssignment_doc[] = "Class: oaStringAppDef_oaOccAssignment\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccAssignment)\n" " Calls: (const oaStringAppDef_oaOccAssignment&)\n" " Signature: oaStringAppDef_oaOccAssignment||cref-oaStringAppDef_oaOccAssignment,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccAssignment_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccAssignment", sizeof(PyoaStringAppDef_oaOccAssignmentObject), 0, (destructor)oaStringAppDef_oaOccAssignment_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccAssignment_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccAssignment_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccAssignment_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccAssignment_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccAssignment_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccAssignment_static_find_doc[] = "Class: oaStringAppDef_oaOccAssignment, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccAssignment* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccAssignment|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccAssignment* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccAssignment|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccAssignment_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccAssignmentp result= (oaStringAppDef_oaOccAssignment::find(p1.Data())); return PyoaStringAppDef_oaOccAssignment_FromoaStringAppDef_oaOccAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccAssignmentp result= (oaStringAppDef_oaOccAssignment::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccAssignment_FromoaStringAppDef_oaOccAssignment(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccAssignment, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccAssignment_static_get_doc[] = "Class: oaStringAppDef_oaOccAssignment, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccAssignment* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccAssignment|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccAssignment* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccAssignment|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccAssignment* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccAssignment|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccAssignment* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccAssignment|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccAssignment* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccAssignment|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccAssignment* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccAssignment|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccAssignment_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccAssignmentp result= (oaStringAppDef_oaOccAssignment::get(p1.Data())); return PyoaStringAppDef_oaOccAssignment_FromoaStringAppDef_oaOccAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccAssignmentp result= (oaStringAppDef_oaOccAssignment::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccAssignment_FromoaStringAppDef_oaOccAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccAssignmentp result= (oaStringAppDef_oaOccAssignment::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccAssignment_FromoaStringAppDef_oaOccAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccAssignmentp result= (oaStringAppDef_oaOccAssignment::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccAssignment_FromoaStringAppDef_oaOccAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccAssignmentp result= (oaStringAppDef_oaOccAssignment::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccAssignment_FromoaStringAppDef_oaOccAssignment(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccAssignmentp result= (oaStringAppDef_oaOccAssignment::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccAssignment_FromoaStringAppDef_oaOccAssignment(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccAssignment, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccAssignment_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccAssignment_static_find,METH_VARARGS,oaStringAppDef_oaOccAssignment_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccAssignment_static_get,METH_VARARGS,oaStringAppDef_oaOccAssignment_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccAssignment_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccAssignment_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccAssignment\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccAssignment", (PyObject*)(&PyoaStringAppDef_oaOccAssignment_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccAssignment\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccAssignment_Type.tp_dict; for(method=oaStringAppDef_oaOccAssignment_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccBusNetDef // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccBusNetDef_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccBusNetDef_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccBusNetDefObject* self = (PyoaStringAppDef_oaOccBusNetDefObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccBusNetDef) { PyParamoaStringAppDef_oaOccBusNetDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccBusNetDef_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccBusNetDef, Choices are:\n" " (oaStringAppDef_oaOccBusNetDef)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccBusNetDef_tp_dealloc(PyoaStringAppDef_oaOccBusNetDefObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccBusNetDef_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccBusNetDef value; int convert_status=PyoaStringAppDef_oaOccBusNetDef_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[51]; sprintf(buffer,"<oaStringAppDef_oaOccBusNetDef::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccBusNetDef_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccBusNetDef v1; PyParamoaStringAppDef_oaOccBusNetDef v2; int convert_status1=PyoaStringAppDef_oaOccBusNetDef_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccBusNetDef_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccBusNetDef_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccBusNetDef* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccBusNetDef_Check(ob)) { result->SetData( (oaStringAppDef_oaOccBusNetDef**) ((PyoaStringAppDef_oaOccBusNetDefObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccBusNetDef Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccBusNetDef_FromoaStringAppDef_oaOccBusNetDef(oaStringAppDef_oaOccBusNetDef** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccBusNetDef* data=*value; PyObject* bself = PyoaStringAppDef_oaOccBusNetDef_Type.tp_alloc(&PyoaStringAppDef_oaOccBusNetDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccBusNetDefObject* self = (PyoaStringAppDef_oaOccBusNetDefObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccBusNetDef_FromoaStringAppDef_oaOccBusNetDef(oaStringAppDef_oaOccBusNetDef* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccBusNetDef_Type.tp_alloc(&PyoaStringAppDef_oaOccBusNetDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccBusNetDefObject* self = (PyoaStringAppDef_oaOccBusNetDefObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusNetDef_get_doc[] = "Class: oaStringAppDef_oaOccBusNetDef, Function: get\n" " Paramegers: (oaOccBusNetDef,oaString)\n" " Calls: void get(const oaOccBusNetDef* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccBusNetDef,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccBusNetDef_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccBusNetDef data; int convert_status=PyoaStringAppDef_oaOccBusNetDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccBusNetDefObject* self=(PyoaStringAppDef_oaOccBusNetDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccBusNetDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccBusNetDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusNetDef_getDefault_doc[] = "Class: oaStringAppDef_oaOccBusNetDef, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccBusNetDef_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccBusNetDef data; int convert_status=PyoaStringAppDef_oaOccBusNetDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccBusNetDefObject* self=(PyoaStringAppDef_oaOccBusNetDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusNetDef_set_doc[] = "Class: oaStringAppDef_oaOccBusNetDef, Function: set\n" " Paramegers: (oaOccBusNetDef,oaString)\n" " Calls: void set(oaOccBusNetDef* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccBusNetDef,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccBusNetDef_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccBusNetDef data; int convert_status=PyoaStringAppDef_oaOccBusNetDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccBusNetDefObject* self=(PyoaStringAppDef_oaOccBusNetDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccBusNetDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccBusNetDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusNetDef_isNull_doc[] = "Class: oaStringAppDef_oaOccBusNetDef, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccBusNetDef_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccBusNetDef data; int convert_status=PyoaStringAppDef_oaOccBusNetDef_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccBusNetDef_assign_doc[] = "Class: oaStringAppDef_oaOccBusNetDef, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccBusNetDef_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccBusNetDef data; int convert_status=PyoaStringAppDef_oaOccBusNetDef_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccBusNetDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccBusNetDef_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccBusNetDef_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccBusNetDef_get,METH_VARARGS,oaStringAppDef_oaOccBusNetDef_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccBusNetDef_getDefault,METH_VARARGS,oaStringAppDef_oaOccBusNetDef_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccBusNetDef_set,METH_VARARGS,oaStringAppDef_oaOccBusNetDef_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccBusNetDef_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccBusNetDef_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccBusNetDef_tp_assign,METH_VARARGS,oaStringAppDef_oaOccBusNetDef_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusNetDef_doc[] = "Class: oaStringAppDef_oaOccBusNetDef\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccBusNetDef)\n" " Calls: (const oaStringAppDef_oaOccBusNetDef&)\n" " Signature: oaStringAppDef_oaOccBusNetDef||cref-oaStringAppDef_oaOccBusNetDef,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccBusNetDef_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccBusNetDef", sizeof(PyoaStringAppDef_oaOccBusNetDefObject), 0, (destructor)oaStringAppDef_oaOccBusNetDef_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccBusNetDef_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccBusNetDef_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccBusNetDef_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccBusNetDef_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccBusNetDef_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusNetDef_static_find_doc[] = "Class: oaStringAppDef_oaOccBusNetDef, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccBusNetDef* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccBusNetDef|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccBusNetDef* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccBusNetDef|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccBusNetDef_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccBusNetDefp result= (oaStringAppDef_oaOccBusNetDef::find(p1.Data())); return PyoaStringAppDef_oaOccBusNetDef_FromoaStringAppDef_oaOccBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccBusNetDefp result= (oaStringAppDef_oaOccBusNetDef::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccBusNetDef_FromoaStringAppDef_oaOccBusNetDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccBusNetDef, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusNetDef_static_get_doc[] = "Class: oaStringAppDef_oaOccBusNetDef, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccBusNetDef* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusNetDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccBusNetDef* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusNetDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccBusNetDef* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusNetDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccBusNetDef* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusNetDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccBusNetDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusNetDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccBusNetDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusNetDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccBusNetDef_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccBusNetDefp result= (oaStringAppDef_oaOccBusNetDef::get(p1.Data())); return PyoaStringAppDef_oaOccBusNetDef_FromoaStringAppDef_oaOccBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccBusNetDefp result= (oaStringAppDef_oaOccBusNetDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccBusNetDef_FromoaStringAppDef_oaOccBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccBusNetDefp result= (oaStringAppDef_oaOccBusNetDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccBusNetDef_FromoaStringAppDef_oaOccBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccBusNetDefp result= (oaStringAppDef_oaOccBusNetDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccBusNetDef_FromoaStringAppDef_oaOccBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccBusNetDefp result= (oaStringAppDef_oaOccBusNetDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccBusNetDef_FromoaStringAppDef_oaOccBusNetDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccBusNetDefp result= (oaStringAppDef_oaOccBusNetDef::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccBusNetDef_FromoaStringAppDef_oaOccBusNetDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccBusNetDef, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccBusNetDef_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccBusNetDef_static_find,METH_VARARGS,oaStringAppDef_oaOccBusNetDef_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccBusNetDef_static_get,METH_VARARGS,oaStringAppDef_oaOccBusNetDef_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccBusNetDef_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccBusNetDef_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccBusNetDef\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccBusNetDef", (PyObject*)(&PyoaStringAppDef_oaOccBusNetDef_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccBusNetDef\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccBusNetDef_Type.tp_dict; for(method=oaStringAppDef_oaOccBusNetDef_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccBusTermDef // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccBusTermDef_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccBusTermDef_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccBusTermDefObject* self = (PyoaStringAppDef_oaOccBusTermDefObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccBusTermDef) { PyParamoaStringAppDef_oaOccBusTermDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccBusTermDef_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccBusTermDef, Choices are:\n" " (oaStringAppDef_oaOccBusTermDef)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccBusTermDef_tp_dealloc(PyoaStringAppDef_oaOccBusTermDefObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccBusTermDef_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccBusTermDef value; int convert_status=PyoaStringAppDef_oaOccBusTermDef_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[52]; sprintf(buffer,"<oaStringAppDef_oaOccBusTermDef::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccBusTermDef_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccBusTermDef v1; PyParamoaStringAppDef_oaOccBusTermDef v2; int convert_status1=PyoaStringAppDef_oaOccBusTermDef_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccBusTermDef_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccBusTermDef_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccBusTermDef* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccBusTermDef_Check(ob)) { result->SetData( (oaStringAppDef_oaOccBusTermDef**) ((PyoaStringAppDef_oaOccBusTermDefObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccBusTermDef Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccBusTermDef_FromoaStringAppDef_oaOccBusTermDef(oaStringAppDef_oaOccBusTermDef** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccBusTermDef* data=*value; PyObject* bself = PyoaStringAppDef_oaOccBusTermDef_Type.tp_alloc(&PyoaStringAppDef_oaOccBusTermDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccBusTermDefObject* self = (PyoaStringAppDef_oaOccBusTermDefObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccBusTermDef_FromoaStringAppDef_oaOccBusTermDef(oaStringAppDef_oaOccBusTermDef* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccBusTermDef_Type.tp_alloc(&PyoaStringAppDef_oaOccBusTermDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccBusTermDefObject* self = (PyoaStringAppDef_oaOccBusTermDefObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusTermDef_get_doc[] = "Class: oaStringAppDef_oaOccBusTermDef, Function: get\n" " Paramegers: (oaOccBusTermDef,oaString)\n" " Calls: void get(const oaOccBusTermDef* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccBusTermDef,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccBusTermDef_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccBusTermDef data; int convert_status=PyoaStringAppDef_oaOccBusTermDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccBusTermDefObject* self=(PyoaStringAppDef_oaOccBusTermDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccBusTermDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccBusTermDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusTermDef_getDefault_doc[] = "Class: oaStringAppDef_oaOccBusTermDef, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccBusTermDef_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccBusTermDef data; int convert_status=PyoaStringAppDef_oaOccBusTermDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccBusTermDefObject* self=(PyoaStringAppDef_oaOccBusTermDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusTermDef_set_doc[] = "Class: oaStringAppDef_oaOccBusTermDef, Function: set\n" " Paramegers: (oaOccBusTermDef,oaString)\n" " Calls: void set(oaOccBusTermDef* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccBusTermDef,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccBusTermDef_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccBusTermDef data; int convert_status=PyoaStringAppDef_oaOccBusTermDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccBusTermDefObject* self=(PyoaStringAppDef_oaOccBusTermDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccBusTermDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccBusTermDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusTermDef_isNull_doc[] = "Class: oaStringAppDef_oaOccBusTermDef, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccBusTermDef_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccBusTermDef data; int convert_status=PyoaStringAppDef_oaOccBusTermDef_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccBusTermDef_assign_doc[] = "Class: oaStringAppDef_oaOccBusTermDef, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccBusTermDef_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccBusTermDef data; int convert_status=PyoaStringAppDef_oaOccBusTermDef_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccBusTermDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccBusTermDef_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccBusTermDef_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccBusTermDef_get,METH_VARARGS,oaStringAppDef_oaOccBusTermDef_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccBusTermDef_getDefault,METH_VARARGS,oaStringAppDef_oaOccBusTermDef_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccBusTermDef_set,METH_VARARGS,oaStringAppDef_oaOccBusTermDef_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccBusTermDef_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccBusTermDef_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccBusTermDef_tp_assign,METH_VARARGS,oaStringAppDef_oaOccBusTermDef_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusTermDef_doc[] = "Class: oaStringAppDef_oaOccBusTermDef\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccBusTermDef)\n" " Calls: (const oaStringAppDef_oaOccBusTermDef&)\n" " Signature: oaStringAppDef_oaOccBusTermDef||cref-oaStringAppDef_oaOccBusTermDef,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccBusTermDef_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccBusTermDef", sizeof(PyoaStringAppDef_oaOccBusTermDefObject), 0, (destructor)oaStringAppDef_oaOccBusTermDef_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccBusTermDef_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccBusTermDef_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccBusTermDef_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccBusTermDef_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccBusTermDef_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusTermDef_static_find_doc[] = "Class: oaStringAppDef_oaOccBusTermDef, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccBusTermDef* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccBusTermDef|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccBusTermDef* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccBusTermDef|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccBusTermDef_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccBusTermDefp result= (oaStringAppDef_oaOccBusTermDef::find(p1.Data())); return PyoaStringAppDef_oaOccBusTermDef_FromoaStringAppDef_oaOccBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccBusTermDefp result= (oaStringAppDef_oaOccBusTermDef::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccBusTermDef_FromoaStringAppDef_oaOccBusTermDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccBusTermDef, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccBusTermDef_static_get_doc[] = "Class: oaStringAppDef_oaOccBusTermDef, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccBusTermDef* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusTermDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccBusTermDef* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusTermDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccBusTermDef* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusTermDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccBusTermDef* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusTermDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccBusTermDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusTermDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccBusTermDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccBusTermDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccBusTermDef_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccBusTermDefp result= (oaStringAppDef_oaOccBusTermDef::get(p1.Data())); return PyoaStringAppDef_oaOccBusTermDef_FromoaStringAppDef_oaOccBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccBusTermDefp result= (oaStringAppDef_oaOccBusTermDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccBusTermDef_FromoaStringAppDef_oaOccBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccBusTermDefp result= (oaStringAppDef_oaOccBusTermDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccBusTermDef_FromoaStringAppDef_oaOccBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccBusTermDefp result= (oaStringAppDef_oaOccBusTermDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccBusTermDef_FromoaStringAppDef_oaOccBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccBusTermDefp result= (oaStringAppDef_oaOccBusTermDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccBusTermDef_FromoaStringAppDef_oaOccBusTermDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccBusTermDefp result= (oaStringAppDef_oaOccBusTermDef::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccBusTermDef_FromoaStringAppDef_oaOccBusTermDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccBusTermDef, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccBusTermDef_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccBusTermDef_static_find,METH_VARARGS,oaStringAppDef_oaOccBusTermDef_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccBusTermDef_static_get,METH_VARARGS,oaStringAppDef_oaOccBusTermDef_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccBusTermDef_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccBusTermDef_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccBusTermDef\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccBusTermDef", (PyObject*)(&PyoaStringAppDef_oaOccBusTermDef_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccBusTermDef\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccBusTermDef_Type.tp_dict; for(method=oaStringAppDef_oaOccBusTermDef_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccConnectDef // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccConnectDef_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccConnectDef_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccConnectDefObject* self = (PyoaStringAppDef_oaOccConnectDefObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccConnectDef) { PyParamoaStringAppDef_oaOccConnectDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccConnectDef_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccConnectDef, Choices are:\n" " (oaStringAppDef_oaOccConnectDef)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccConnectDef_tp_dealloc(PyoaStringAppDef_oaOccConnectDefObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccConnectDef_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccConnectDef value; int convert_status=PyoaStringAppDef_oaOccConnectDef_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[52]; sprintf(buffer,"<oaStringAppDef_oaOccConnectDef::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccConnectDef_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccConnectDef v1; PyParamoaStringAppDef_oaOccConnectDef v2; int convert_status1=PyoaStringAppDef_oaOccConnectDef_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccConnectDef_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccConnectDef_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccConnectDef* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccConnectDef_Check(ob)) { result->SetData( (oaStringAppDef_oaOccConnectDef**) ((PyoaStringAppDef_oaOccConnectDefObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccConnectDef Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccConnectDef_FromoaStringAppDef_oaOccConnectDef(oaStringAppDef_oaOccConnectDef** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccConnectDef* data=*value; PyObject* bself = PyoaStringAppDef_oaOccConnectDef_Type.tp_alloc(&PyoaStringAppDef_oaOccConnectDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccConnectDefObject* self = (PyoaStringAppDef_oaOccConnectDefObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccConnectDef_FromoaStringAppDef_oaOccConnectDef(oaStringAppDef_oaOccConnectDef* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccConnectDef_Type.tp_alloc(&PyoaStringAppDef_oaOccConnectDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccConnectDefObject* self = (PyoaStringAppDef_oaOccConnectDefObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccConnectDef_get_doc[] = "Class: oaStringAppDef_oaOccConnectDef, Function: get\n" " Paramegers: (oaOccConnectDef,oaString)\n" " Calls: void get(const oaOccConnectDef* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccConnectDef,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccConnectDef_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccConnectDef data; int convert_status=PyoaStringAppDef_oaOccConnectDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccConnectDefObject* self=(PyoaStringAppDef_oaOccConnectDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccConnectDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccConnectDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccConnectDef_getDefault_doc[] = "Class: oaStringAppDef_oaOccConnectDef, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccConnectDef_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccConnectDef data; int convert_status=PyoaStringAppDef_oaOccConnectDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccConnectDefObject* self=(PyoaStringAppDef_oaOccConnectDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccConnectDef_set_doc[] = "Class: oaStringAppDef_oaOccConnectDef, Function: set\n" " Paramegers: (oaOccConnectDef,oaString)\n" " Calls: void set(oaOccConnectDef* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccConnectDef,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccConnectDef_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccConnectDef data; int convert_status=PyoaStringAppDef_oaOccConnectDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccConnectDefObject* self=(PyoaStringAppDef_oaOccConnectDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccConnectDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccConnectDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccConnectDef_isNull_doc[] = "Class: oaStringAppDef_oaOccConnectDef, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccConnectDef_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccConnectDef data; int convert_status=PyoaStringAppDef_oaOccConnectDef_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccConnectDef_assign_doc[] = "Class: oaStringAppDef_oaOccConnectDef, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccConnectDef_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccConnectDef data; int convert_status=PyoaStringAppDef_oaOccConnectDef_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccConnectDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccConnectDef_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccConnectDef_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccConnectDef_get,METH_VARARGS,oaStringAppDef_oaOccConnectDef_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccConnectDef_getDefault,METH_VARARGS,oaStringAppDef_oaOccConnectDef_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccConnectDef_set,METH_VARARGS,oaStringAppDef_oaOccConnectDef_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccConnectDef_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccConnectDef_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccConnectDef_tp_assign,METH_VARARGS,oaStringAppDef_oaOccConnectDef_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccConnectDef_doc[] = "Class: oaStringAppDef_oaOccConnectDef\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccConnectDef)\n" " Calls: (const oaStringAppDef_oaOccConnectDef&)\n" " Signature: oaStringAppDef_oaOccConnectDef||cref-oaStringAppDef_oaOccConnectDef,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccConnectDef_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccConnectDef", sizeof(PyoaStringAppDef_oaOccConnectDefObject), 0, (destructor)oaStringAppDef_oaOccConnectDef_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccConnectDef_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccConnectDef_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccConnectDef_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccConnectDef_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccConnectDef_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccConnectDef_static_find_doc[] = "Class: oaStringAppDef_oaOccConnectDef, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccConnectDef* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccConnectDef|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccConnectDef* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccConnectDef|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccConnectDef_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccConnectDefp result= (oaStringAppDef_oaOccConnectDef::find(p1.Data())); return PyoaStringAppDef_oaOccConnectDef_FromoaStringAppDef_oaOccConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccConnectDefp result= (oaStringAppDef_oaOccConnectDef::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccConnectDef_FromoaStringAppDef_oaOccConnectDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccConnectDef, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccConnectDef_static_get_doc[] = "Class: oaStringAppDef_oaOccConnectDef, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccConnectDef* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccConnectDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccConnectDef* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccConnectDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccConnectDef* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccConnectDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccConnectDef* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccConnectDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccConnectDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccConnectDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccConnectDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccConnectDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccConnectDef_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccConnectDefp result= (oaStringAppDef_oaOccConnectDef::get(p1.Data())); return PyoaStringAppDef_oaOccConnectDef_FromoaStringAppDef_oaOccConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccConnectDefp result= (oaStringAppDef_oaOccConnectDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccConnectDef_FromoaStringAppDef_oaOccConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccConnectDefp result= (oaStringAppDef_oaOccConnectDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccConnectDef_FromoaStringAppDef_oaOccConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccConnectDefp result= (oaStringAppDef_oaOccConnectDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccConnectDef_FromoaStringAppDef_oaOccConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccConnectDefp result= (oaStringAppDef_oaOccConnectDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccConnectDef_FromoaStringAppDef_oaOccConnectDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccConnectDefp result= (oaStringAppDef_oaOccConnectDef::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccConnectDef_FromoaStringAppDef_oaOccConnectDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccConnectDef, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccConnectDef_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccConnectDef_static_find,METH_VARARGS,oaStringAppDef_oaOccConnectDef_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccConnectDef_static_get,METH_VARARGS,oaStringAppDef_oaOccConnectDef_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccConnectDef_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccConnectDef_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccConnectDef\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccConnectDef", (PyObject*)(&PyoaStringAppDef_oaOccConnectDef_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccConnectDef\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccConnectDef_Type.tp_dict; for(method=oaStringAppDef_oaOccConnectDef_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccInst // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccInst_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccInst_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccInstObject* self = (PyoaStringAppDef_oaOccInstObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccInst) { PyParamoaStringAppDef_oaOccInst p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccInst_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccInst, Choices are:\n" " (oaStringAppDef_oaOccInst)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccInst_tp_dealloc(PyoaStringAppDef_oaOccInstObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccInst_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccInst value; int convert_status=PyoaStringAppDef_oaOccInst_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[46]; sprintf(buffer,"<oaStringAppDef_oaOccInst::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccInst_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccInst v1; PyParamoaStringAppDef_oaOccInst v2; int convert_status1=PyoaStringAppDef_oaOccInst_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccInst_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccInst_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccInst* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccInst_Check(ob)) { result->SetData( (oaStringAppDef_oaOccInst**) ((PyoaStringAppDef_oaOccInstObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccInst Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccInst_FromoaStringAppDef_oaOccInst(oaStringAppDef_oaOccInst** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccInst* data=*value; PyObject* bself = PyoaStringAppDef_oaOccInst_Type.tp_alloc(&PyoaStringAppDef_oaOccInst_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccInstObject* self = (PyoaStringAppDef_oaOccInstObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccInst_FromoaStringAppDef_oaOccInst(oaStringAppDef_oaOccInst* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccInst_Type.tp_alloc(&PyoaStringAppDef_oaOccInst_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccInstObject* self = (PyoaStringAppDef_oaOccInstObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInst_get_doc[] = "Class: oaStringAppDef_oaOccInst, Function: get\n" " Paramegers: (oaOccInst,oaString)\n" " Calls: void get(const oaOccInst* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccInst,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccInst_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccInst data; int convert_status=PyoaStringAppDef_oaOccInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccInstObject* self=(PyoaStringAppDef_oaOccInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccInst p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccInst_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInst_getDefault_doc[] = "Class: oaStringAppDef_oaOccInst, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccInst_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccInst data; int convert_status=PyoaStringAppDef_oaOccInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccInstObject* self=(PyoaStringAppDef_oaOccInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInst_set_doc[] = "Class: oaStringAppDef_oaOccInst, Function: set\n" " Paramegers: (oaOccInst,oaString)\n" " Calls: void set(oaOccInst* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccInst,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccInst_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccInst data; int convert_status=PyoaStringAppDef_oaOccInst_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccInstObject* self=(PyoaStringAppDef_oaOccInstObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccInst p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccInst_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInst_isNull_doc[] = "Class: oaStringAppDef_oaOccInst, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccInst_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccInst data; int convert_status=PyoaStringAppDef_oaOccInst_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccInst_assign_doc[] = "Class: oaStringAppDef_oaOccInst, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccInst_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccInst data; int convert_status=PyoaStringAppDef_oaOccInst_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccInst p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccInst_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccInst_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccInst_get,METH_VARARGS,oaStringAppDef_oaOccInst_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccInst_getDefault,METH_VARARGS,oaStringAppDef_oaOccInst_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccInst_set,METH_VARARGS,oaStringAppDef_oaOccInst_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccInst_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccInst_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccInst_tp_assign,METH_VARARGS,oaStringAppDef_oaOccInst_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInst_doc[] = "Class: oaStringAppDef_oaOccInst\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccInst)\n" " Calls: (const oaStringAppDef_oaOccInst&)\n" " Signature: oaStringAppDef_oaOccInst||cref-oaStringAppDef_oaOccInst,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccInst_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccInst", sizeof(PyoaStringAppDef_oaOccInstObject), 0, (destructor)oaStringAppDef_oaOccInst_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccInst_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccInst_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccInst_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccInst_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccInst_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInst_static_find_doc[] = "Class: oaStringAppDef_oaOccInst, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccInst* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccInst|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccInst* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccInst|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccInst_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccInstp result= (oaStringAppDef_oaOccInst::find(p1.Data())); return PyoaStringAppDef_oaOccInst_FromoaStringAppDef_oaOccInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstp result= (oaStringAppDef_oaOccInst::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccInst_FromoaStringAppDef_oaOccInst(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccInst, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInst_static_get_doc[] = "Class: oaStringAppDef_oaOccInst, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccInst* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccInst* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccInst* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccInst|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccInst* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccInst* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccInst* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccInst|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccInst_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccInstp result= (oaStringAppDef_oaOccInst::get(p1.Data())); return PyoaStringAppDef_oaOccInst_FromoaStringAppDef_oaOccInst(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccInstp result= (oaStringAppDef_oaOccInst::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccInst_FromoaStringAppDef_oaOccInst(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccInstp result= (oaStringAppDef_oaOccInst::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccInst_FromoaStringAppDef_oaOccInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstp result= (oaStringAppDef_oaOccInst::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccInst_FromoaStringAppDef_oaOccInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstp result= (oaStringAppDef_oaOccInst::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccInst_FromoaStringAppDef_oaOccInst(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstp result= (oaStringAppDef_oaOccInst::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccInst_FromoaStringAppDef_oaOccInst(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccInst, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccInst_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccInst_static_find,METH_VARARGS,oaStringAppDef_oaOccInst_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccInst_static_get,METH_VARARGS,oaStringAppDef_oaOccInst_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccInst_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccInst_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccInst\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccInst", (PyObject*)(&PyoaStringAppDef_oaOccInst_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccInst\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccInst_Type.tp_dict; for(method=oaStringAppDef_oaOccInst_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccInstHeader // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccInstHeader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccInstHeader_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccInstHeaderObject* self = (PyoaStringAppDef_oaOccInstHeaderObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccInstHeader) { PyParamoaStringAppDef_oaOccInstHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccInstHeader_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccInstHeader, Choices are:\n" " (oaStringAppDef_oaOccInstHeader)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccInstHeader_tp_dealloc(PyoaStringAppDef_oaOccInstHeaderObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccInstHeader_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccInstHeader value; int convert_status=PyoaStringAppDef_oaOccInstHeader_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[52]; sprintf(buffer,"<oaStringAppDef_oaOccInstHeader::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccInstHeader_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccInstHeader v1; PyParamoaStringAppDef_oaOccInstHeader v2; int convert_status1=PyoaStringAppDef_oaOccInstHeader_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccInstHeader_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccInstHeader_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccInstHeader* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccInstHeader_Check(ob)) { result->SetData( (oaStringAppDef_oaOccInstHeader**) ((PyoaStringAppDef_oaOccInstHeaderObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccInstHeader Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccInstHeader_FromoaStringAppDef_oaOccInstHeader(oaStringAppDef_oaOccInstHeader** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccInstHeader* data=*value; PyObject* bself = PyoaStringAppDef_oaOccInstHeader_Type.tp_alloc(&PyoaStringAppDef_oaOccInstHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccInstHeaderObject* self = (PyoaStringAppDef_oaOccInstHeaderObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccInstHeader_FromoaStringAppDef_oaOccInstHeader(oaStringAppDef_oaOccInstHeader* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccInstHeader_Type.tp_alloc(&PyoaStringAppDef_oaOccInstHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccInstHeaderObject* self = (PyoaStringAppDef_oaOccInstHeaderObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstHeader_get_doc[] = "Class: oaStringAppDef_oaOccInstHeader, Function: get\n" " Paramegers: (oaOccInstHeader,oaString)\n" " Calls: void get(const oaOccInstHeader* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccInstHeader,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccInstHeader_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccInstHeader data; int convert_status=PyoaStringAppDef_oaOccInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccInstHeaderObject* self=(PyoaStringAppDef_oaOccInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccInstHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccInstHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstHeader_getDefault_doc[] = "Class: oaStringAppDef_oaOccInstHeader, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccInstHeader_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccInstHeader data; int convert_status=PyoaStringAppDef_oaOccInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccInstHeaderObject* self=(PyoaStringAppDef_oaOccInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstHeader_set_doc[] = "Class: oaStringAppDef_oaOccInstHeader, Function: set\n" " Paramegers: (oaOccInstHeader,oaString)\n" " Calls: void set(oaOccInstHeader* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccInstHeader,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccInstHeader_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccInstHeader data; int convert_status=PyoaStringAppDef_oaOccInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccInstHeaderObject* self=(PyoaStringAppDef_oaOccInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccInstHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccInstHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstHeader_isNull_doc[] = "Class: oaStringAppDef_oaOccInstHeader, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccInstHeader_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccInstHeader data; int convert_status=PyoaStringAppDef_oaOccInstHeader_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccInstHeader_assign_doc[] = "Class: oaStringAppDef_oaOccInstHeader, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccInstHeader_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccInstHeader data; int convert_status=PyoaStringAppDef_oaOccInstHeader_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccInstHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccInstHeader_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccInstHeader_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccInstHeader_get,METH_VARARGS,oaStringAppDef_oaOccInstHeader_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccInstHeader_getDefault,METH_VARARGS,oaStringAppDef_oaOccInstHeader_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccInstHeader_set,METH_VARARGS,oaStringAppDef_oaOccInstHeader_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccInstHeader_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccInstHeader_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccInstHeader_tp_assign,METH_VARARGS,oaStringAppDef_oaOccInstHeader_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstHeader_doc[] = "Class: oaStringAppDef_oaOccInstHeader\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccInstHeader)\n" " Calls: (const oaStringAppDef_oaOccInstHeader&)\n" " Signature: oaStringAppDef_oaOccInstHeader||cref-oaStringAppDef_oaOccInstHeader,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccInstHeader_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccInstHeader", sizeof(PyoaStringAppDef_oaOccInstHeaderObject), 0, (destructor)oaStringAppDef_oaOccInstHeader_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccInstHeader_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccInstHeader_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccInstHeader_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccInstHeader_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccInstHeader_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstHeader_static_find_doc[] = "Class: oaStringAppDef_oaOccInstHeader, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccInstHeader* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccInstHeader|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccInstHeader* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccInstHeader|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccInstHeader_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccInstHeaderp result= (oaStringAppDef_oaOccInstHeader::find(p1.Data())); return PyoaStringAppDef_oaOccInstHeader_FromoaStringAppDef_oaOccInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstHeaderp result= (oaStringAppDef_oaOccInstHeader::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccInstHeader_FromoaStringAppDef_oaOccInstHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccInstHeader, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstHeader_static_get_doc[] = "Class: oaStringAppDef_oaOccInstHeader, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccInstHeader* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccInstHeader* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccInstHeader* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccInstHeader* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccInstHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccInstHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccInstHeader_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccInstHeaderp result= (oaStringAppDef_oaOccInstHeader::get(p1.Data())); return PyoaStringAppDef_oaOccInstHeader_FromoaStringAppDef_oaOccInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccInstHeaderp result= (oaStringAppDef_oaOccInstHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccInstHeader_FromoaStringAppDef_oaOccInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccInstHeaderp result= (oaStringAppDef_oaOccInstHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccInstHeader_FromoaStringAppDef_oaOccInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstHeaderp result= (oaStringAppDef_oaOccInstHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccInstHeader_FromoaStringAppDef_oaOccInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstHeaderp result= (oaStringAppDef_oaOccInstHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccInstHeader_FromoaStringAppDef_oaOccInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstHeaderp result= (oaStringAppDef_oaOccInstHeader::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccInstHeader_FromoaStringAppDef_oaOccInstHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccInstHeader, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccInstHeader_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccInstHeader_static_find,METH_VARARGS,oaStringAppDef_oaOccInstHeader_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccInstHeader_static_get,METH_VARARGS,oaStringAppDef_oaOccInstHeader_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccInstHeader_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccInstHeader_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccInstHeader\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccInstHeader", (PyObject*)(&PyoaStringAppDef_oaOccInstHeader_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccInstHeader\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccInstHeader_Type.tp_dict; for(method=oaStringAppDef_oaOccInstHeader_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccInstTerm // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccInstTerm_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccInstTerm_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccInstTermObject* self = (PyoaStringAppDef_oaOccInstTermObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccInstTerm) { PyParamoaStringAppDef_oaOccInstTerm p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccInstTerm_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccInstTerm, Choices are:\n" " (oaStringAppDef_oaOccInstTerm)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccInstTerm_tp_dealloc(PyoaStringAppDef_oaOccInstTermObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccInstTerm_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccInstTerm value; int convert_status=PyoaStringAppDef_oaOccInstTerm_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[50]; sprintf(buffer,"<oaStringAppDef_oaOccInstTerm::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccInstTerm_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccInstTerm v1; PyParamoaStringAppDef_oaOccInstTerm v2; int convert_status1=PyoaStringAppDef_oaOccInstTerm_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccInstTerm_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccInstTerm_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccInstTerm* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccInstTerm_Check(ob)) { result->SetData( (oaStringAppDef_oaOccInstTerm**) ((PyoaStringAppDef_oaOccInstTermObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccInstTerm Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccInstTerm_FromoaStringAppDef_oaOccInstTerm(oaStringAppDef_oaOccInstTerm** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccInstTerm* data=*value; PyObject* bself = PyoaStringAppDef_oaOccInstTerm_Type.tp_alloc(&PyoaStringAppDef_oaOccInstTerm_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccInstTermObject* self = (PyoaStringAppDef_oaOccInstTermObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccInstTerm_FromoaStringAppDef_oaOccInstTerm(oaStringAppDef_oaOccInstTerm* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccInstTerm_Type.tp_alloc(&PyoaStringAppDef_oaOccInstTerm_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccInstTermObject* self = (PyoaStringAppDef_oaOccInstTermObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstTerm_get_doc[] = "Class: oaStringAppDef_oaOccInstTerm, Function: get\n" " Paramegers: (oaOccInstTerm,oaString)\n" " Calls: void get(const oaOccInstTerm* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccInstTerm,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccInstTerm_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccInstTerm data; int convert_status=PyoaStringAppDef_oaOccInstTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccInstTermObject* self=(PyoaStringAppDef_oaOccInstTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccInstTerm p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccInstTerm_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstTerm_getDefault_doc[] = "Class: oaStringAppDef_oaOccInstTerm, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccInstTerm_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccInstTerm data; int convert_status=PyoaStringAppDef_oaOccInstTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccInstTermObject* self=(PyoaStringAppDef_oaOccInstTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstTerm_set_doc[] = "Class: oaStringAppDef_oaOccInstTerm, Function: set\n" " Paramegers: (oaOccInstTerm,oaString)\n" " Calls: void set(oaOccInstTerm* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccInstTerm,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccInstTerm_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccInstTerm data; int convert_status=PyoaStringAppDef_oaOccInstTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccInstTermObject* self=(PyoaStringAppDef_oaOccInstTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccInstTerm p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccInstTerm_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstTerm_isNull_doc[] = "Class: oaStringAppDef_oaOccInstTerm, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccInstTerm_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccInstTerm data; int convert_status=PyoaStringAppDef_oaOccInstTerm_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccInstTerm_assign_doc[] = "Class: oaStringAppDef_oaOccInstTerm, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccInstTerm_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccInstTerm data; int convert_status=PyoaStringAppDef_oaOccInstTerm_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccInstTerm p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccInstTerm_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccInstTerm_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccInstTerm_get,METH_VARARGS,oaStringAppDef_oaOccInstTerm_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccInstTerm_getDefault,METH_VARARGS,oaStringAppDef_oaOccInstTerm_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccInstTerm_set,METH_VARARGS,oaStringAppDef_oaOccInstTerm_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccInstTerm_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccInstTerm_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccInstTerm_tp_assign,METH_VARARGS,oaStringAppDef_oaOccInstTerm_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstTerm_doc[] = "Class: oaStringAppDef_oaOccInstTerm\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccInstTerm)\n" " Calls: (const oaStringAppDef_oaOccInstTerm&)\n" " Signature: oaStringAppDef_oaOccInstTerm||cref-oaStringAppDef_oaOccInstTerm,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccInstTerm_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccInstTerm", sizeof(PyoaStringAppDef_oaOccInstTermObject), 0, (destructor)oaStringAppDef_oaOccInstTerm_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccInstTerm_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccInstTerm_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccInstTerm_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccInstTerm_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccInstTerm_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstTerm_static_find_doc[] = "Class: oaStringAppDef_oaOccInstTerm, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccInstTerm* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccInstTerm|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccInstTerm* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccInstTerm|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccInstTerm_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccInstTermp result= (oaStringAppDef_oaOccInstTerm::find(p1.Data())); return PyoaStringAppDef_oaOccInstTerm_FromoaStringAppDef_oaOccInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstTermp result= (oaStringAppDef_oaOccInstTerm::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccInstTerm_FromoaStringAppDef_oaOccInstTerm(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccInstTerm, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccInstTerm_static_get_doc[] = "Class: oaStringAppDef_oaOccInstTerm, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccInstTerm* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccInstTerm* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccInstTerm* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccInstTerm* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccInstTerm* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccInstTerm* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccInstTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccInstTerm_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccInstTermp result= (oaStringAppDef_oaOccInstTerm::get(p1.Data())); return PyoaStringAppDef_oaOccInstTerm_FromoaStringAppDef_oaOccInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccInstTermp result= (oaStringAppDef_oaOccInstTerm::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccInstTerm_FromoaStringAppDef_oaOccInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccInstTermp result= (oaStringAppDef_oaOccInstTerm::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccInstTerm_FromoaStringAppDef_oaOccInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstTermp result= (oaStringAppDef_oaOccInstTerm::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccInstTerm_FromoaStringAppDef_oaOccInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstTermp result= (oaStringAppDef_oaOccInstTerm::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccInstTerm_FromoaStringAppDef_oaOccInstTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccInstTermp result= (oaStringAppDef_oaOccInstTerm::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccInstTerm_FromoaStringAppDef_oaOccInstTerm(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccInstTerm, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccInstTerm_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccInstTerm_static_find,METH_VARARGS,oaStringAppDef_oaOccInstTerm_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccInstTerm_static_get,METH_VARARGS,oaStringAppDef_oaOccInstTerm_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccInstTerm_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccInstTerm_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccInstTerm\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccInstTerm", (PyObject*)(&PyoaStringAppDef_oaOccInstTerm_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccInstTerm\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccInstTerm_Type.tp_dict; for(method=oaStringAppDef_oaOccInstTerm_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccModuleInstHeader // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccModuleInstHeader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccModuleInstHeader_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccModuleInstHeaderObject* self = (PyoaStringAppDef_oaOccModuleInstHeaderObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccModuleInstHeader) { PyParamoaStringAppDef_oaOccModuleInstHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccModuleInstHeader_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccModuleInstHeader, Choices are:\n" " (oaStringAppDef_oaOccModuleInstHeader)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccModuleInstHeader_tp_dealloc(PyoaStringAppDef_oaOccModuleInstHeaderObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccModuleInstHeader_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccModuleInstHeader value; int convert_status=PyoaStringAppDef_oaOccModuleInstHeader_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[58]; sprintf(buffer,"<oaStringAppDef_oaOccModuleInstHeader::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccModuleInstHeader_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccModuleInstHeader v1; PyParamoaStringAppDef_oaOccModuleInstHeader v2; int convert_status1=PyoaStringAppDef_oaOccModuleInstHeader_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccModuleInstHeader_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccModuleInstHeader_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccModuleInstHeader* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccModuleInstHeader_Check(ob)) { result->SetData( (oaStringAppDef_oaOccModuleInstHeader**) ((PyoaStringAppDef_oaOccModuleInstHeaderObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccModuleInstHeader Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccModuleInstHeader_FromoaStringAppDef_oaOccModuleInstHeader(oaStringAppDef_oaOccModuleInstHeader** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccModuleInstHeader* data=*value; PyObject* bself = PyoaStringAppDef_oaOccModuleInstHeader_Type.tp_alloc(&PyoaStringAppDef_oaOccModuleInstHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccModuleInstHeaderObject* self = (PyoaStringAppDef_oaOccModuleInstHeaderObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccModuleInstHeader_FromoaStringAppDef_oaOccModuleInstHeader(oaStringAppDef_oaOccModuleInstHeader* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccModuleInstHeader_Type.tp_alloc(&PyoaStringAppDef_oaOccModuleInstHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccModuleInstHeaderObject* self = (PyoaStringAppDef_oaOccModuleInstHeaderObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccModuleInstHeader_get_doc[] = "Class: oaStringAppDef_oaOccModuleInstHeader, Function: get\n" " Paramegers: (oaOccModuleInstHeader,oaString)\n" " Calls: void get(const oaOccModuleInstHeader* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccModuleInstHeader,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccModuleInstHeader_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccModuleInstHeader data; int convert_status=PyoaStringAppDef_oaOccModuleInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccModuleInstHeaderObject* self=(PyoaStringAppDef_oaOccModuleInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccModuleInstHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccModuleInstHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccModuleInstHeader_getDefault_doc[] = "Class: oaStringAppDef_oaOccModuleInstHeader, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccModuleInstHeader_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccModuleInstHeader data; int convert_status=PyoaStringAppDef_oaOccModuleInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccModuleInstHeaderObject* self=(PyoaStringAppDef_oaOccModuleInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccModuleInstHeader_set_doc[] = "Class: oaStringAppDef_oaOccModuleInstHeader, Function: set\n" " Paramegers: (oaOccModuleInstHeader,oaString)\n" " Calls: void set(oaOccModuleInstHeader* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccModuleInstHeader,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccModuleInstHeader_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccModuleInstHeader data; int convert_status=PyoaStringAppDef_oaOccModuleInstHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccModuleInstHeaderObject* self=(PyoaStringAppDef_oaOccModuleInstHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccModuleInstHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccModuleInstHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccModuleInstHeader_isNull_doc[] = "Class: oaStringAppDef_oaOccModuleInstHeader, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccModuleInstHeader_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccModuleInstHeader data; int convert_status=PyoaStringAppDef_oaOccModuleInstHeader_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccModuleInstHeader_assign_doc[] = "Class: oaStringAppDef_oaOccModuleInstHeader, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccModuleInstHeader_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccModuleInstHeader data; int convert_status=PyoaStringAppDef_oaOccModuleInstHeader_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccModuleInstHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccModuleInstHeader_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccModuleInstHeader_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccModuleInstHeader_get,METH_VARARGS,oaStringAppDef_oaOccModuleInstHeader_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccModuleInstHeader_getDefault,METH_VARARGS,oaStringAppDef_oaOccModuleInstHeader_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccModuleInstHeader_set,METH_VARARGS,oaStringAppDef_oaOccModuleInstHeader_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccModuleInstHeader_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccModuleInstHeader_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccModuleInstHeader_tp_assign,METH_VARARGS,oaStringAppDef_oaOccModuleInstHeader_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccModuleInstHeader_doc[] = "Class: oaStringAppDef_oaOccModuleInstHeader\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccModuleInstHeader)\n" " Calls: (const oaStringAppDef_oaOccModuleInstHeader&)\n" " Signature: oaStringAppDef_oaOccModuleInstHeader||cref-oaStringAppDef_oaOccModuleInstHeader,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccModuleInstHeader_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccModuleInstHeader", sizeof(PyoaStringAppDef_oaOccModuleInstHeaderObject), 0, (destructor)oaStringAppDef_oaOccModuleInstHeader_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccModuleInstHeader_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccModuleInstHeader_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccModuleInstHeader_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccModuleInstHeader_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccModuleInstHeader_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccModuleInstHeader_static_find_doc[] = "Class: oaStringAppDef_oaOccModuleInstHeader, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccModuleInstHeader* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccModuleInstHeader|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccModuleInstHeader* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccModuleInstHeader|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccModuleInstHeader_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccModuleInstHeaderp result= (oaStringAppDef_oaOccModuleInstHeader::find(p1.Data())); return PyoaStringAppDef_oaOccModuleInstHeader_FromoaStringAppDef_oaOccModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccModuleInstHeaderp result= (oaStringAppDef_oaOccModuleInstHeader::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccModuleInstHeader_FromoaStringAppDef_oaOccModuleInstHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccModuleInstHeader, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccModuleInstHeader_static_get_doc[] = "Class: oaStringAppDef_oaOccModuleInstHeader, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccModuleInstHeader* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccModuleInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccModuleInstHeader* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccModuleInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccModuleInstHeader* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccModuleInstHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccModuleInstHeader* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccModuleInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccModuleInstHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccModuleInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccModuleInstHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccModuleInstHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccModuleInstHeader_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccModuleInstHeaderp result= (oaStringAppDef_oaOccModuleInstHeader::get(p1.Data())); return PyoaStringAppDef_oaOccModuleInstHeader_FromoaStringAppDef_oaOccModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccModuleInstHeaderp result= (oaStringAppDef_oaOccModuleInstHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccModuleInstHeader_FromoaStringAppDef_oaOccModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccModuleInstHeaderp result= (oaStringAppDef_oaOccModuleInstHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccModuleInstHeader_FromoaStringAppDef_oaOccModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccModuleInstHeaderp result= (oaStringAppDef_oaOccModuleInstHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccModuleInstHeader_FromoaStringAppDef_oaOccModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccModuleInstHeaderp result= (oaStringAppDef_oaOccModuleInstHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccModuleInstHeader_FromoaStringAppDef_oaOccModuleInstHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccModuleInstHeaderp result= (oaStringAppDef_oaOccModuleInstHeader::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccModuleInstHeader_FromoaStringAppDef_oaOccModuleInstHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccModuleInstHeader, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccModuleInstHeader_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccModuleInstHeader_static_find,METH_VARARGS,oaStringAppDef_oaOccModuleInstHeader_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccModuleInstHeader_static_get,METH_VARARGS,oaStringAppDef_oaOccModuleInstHeader_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccModuleInstHeader_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccModuleInstHeader_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccModuleInstHeader\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccModuleInstHeader", (PyObject*)(&PyoaStringAppDef_oaOccModuleInstHeader_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccModuleInstHeader\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccModuleInstHeader_Type.tp_dict; for(method=oaStringAppDef_oaOccModuleInstHeader_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccNet // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccNet_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccNet_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccNetObject* self = (PyoaStringAppDef_oaOccNetObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccNet) { PyParamoaStringAppDef_oaOccNet p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccNet_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccNet, Choices are:\n" " (oaStringAppDef_oaOccNet)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccNet_tp_dealloc(PyoaStringAppDef_oaOccNetObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccNet_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccNet value; int convert_status=PyoaStringAppDef_oaOccNet_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[45]; sprintf(buffer,"<oaStringAppDef_oaOccNet::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccNet_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccNet v1; PyParamoaStringAppDef_oaOccNet v2; int convert_status1=PyoaStringAppDef_oaOccNet_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccNet_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccNet_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccNet* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccNet_Check(ob)) { result->SetData( (oaStringAppDef_oaOccNet**) ((PyoaStringAppDef_oaOccNetObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccNet Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccNet_FromoaStringAppDef_oaOccNet(oaStringAppDef_oaOccNet** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccNet* data=*value; PyObject* bself = PyoaStringAppDef_oaOccNet_Type.tp_alloc(&PyoaStringAppDef_oaOccNet_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccNetObject* self = (PyoaStringAppDef_oaOccNetObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccNet_FromoaStringAppDef_oaOccNet(oaStringAppDef_oaOccNet* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccNet_Type.tp_alloc(&PyoaStringAppDef_oaOccNet_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccNetObject* self = (PyoaStringAppDef_oaOccNetObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccNet_get_doc[] = "Class: oaStringAppDef_oaOccNet, Function: get\n" " Paramegers: (oaOccNet,oaString)\n" " Calls: void get(const oaOccNet* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccNet,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccNet_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccNet data; int convert_status=PyoaStringAppDef_oaOccNet_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccNetObject* self=(PyoaStringAppDef_oaOccNetObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccNet p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccNet_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccNet_getDefault_doc[] = "Class: oaStringAppDef_oaOccNet, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccNet_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccNet data; int convert_status=PyoaStringAppDef_oaOccNet_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccNetObject* self=(PyoaStringAppDef_oaOccNetObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccNet_set_doc[] = "Class: oaStringAppDef_oaOccNet, Function: set\n" " Paramegers: (oaOccNet,oaString)\n" " Calls: void set(oaOccNet* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccNet,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccNet_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccNet data; int convert_status=PyoaStringAppDef_oaOccNet_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccNetObject* self=(PyoaStringAppDef_oaOccNetObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccNet p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccNet_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccNet_isNull_doc[] = "Class: oaStringAppDef_oaOccNet, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccNet_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccNet data; int convert_status=PyoaStringAppDef_oaOccNet_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccNet_assign_doc[] = "Class: oaStringAppDef_oaOccNet, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccNet_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccNet data; int convert_status=PyoaStringAppDef_oaOccNet_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccNet p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccNet_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccNet_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccNet_get,METH_VARARGS,oaStringAppDef_oaOccNet_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccNet_getDefault,METH_VARARGS,oaStringAppDef_oaOccNet_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccNet_set,METH_VARARGS,oaStringAppDef_oaOccNet_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccNet_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccNet_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccNet_tp_assign,METH_VARARGS,oaStringAppDef_oaOccNet_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccNet_doc[] = "Class: oaStringAppDef_oaOccNet\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccNet)\n" " Calls: (const oaStringAppDef_oaOccNet&)\n" " Signature: oaStringAppDef_oaOccNet||cref-oaStringAppDef_oaOccNet,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccNet_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccNet", sizeof(PyoaStringAppDef_oaOccNetObject), 0, (destructor)oaStringAppDef_oaOccNet_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccNet_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccNet_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccNet_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccNet_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccNet_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccNet_static_find_doc[] = "Class: oaStringAppDef_oaOccNet, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccNet* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccNet|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccNet* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccNet|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccNet_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccNetp result= (oaStringAppDef_oaOccNet::find(p1.Data())); return PyoaStringAppDef_oaOccNet_FromoaStringAppDef_oaOccNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccNetp result= (oaStringAppDef_oaOccNet::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccNet_FromoaStringAppDef_oaOccNet(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccNet, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccNet_static_get_doc[] = "Class: oaStringAppDef_oaOccNet, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccNet* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccNet|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccNet* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccNet|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccNet* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccNet|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccNet* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccNet|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccNet* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccNet|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccNet* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccNet|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccNet_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccNetp result= (oaStringAppDef_oaOccNet::get(p1.Data())); return PyoaStringAppDef_oaOccNet_FromoaStringAppDef_oaOccNet(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccNetp result= (oaStringAppDef_oaOccNet::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccNet_FromoaStringAppDef_oaOccNet(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccNetp result= (oaStringAppDef_oaOccNet::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccNet_FromoaStringAppDef_oaOccNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccNetp result= (oaStringAppDef_oaOccNet::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccNet_FromoaStringAppDef_oaOccNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccNetp result= (oaStringAppDef_oaOccNet::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccNet_FromoaStringAppDef_oaOccNet(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccNetp result= (oaStringAppDef_oaOccNet::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccNet_FromoaStringAppDef_oaOccNet(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccNet, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccNet_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccNet_static_find,METH_VARARGS,oaStringAppDef_oaOccNet_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccNet_static_get,METH_VARARGS,oaStringAppDef_oaOccNet_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccNet_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccNet_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccNet\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccNet", (PyObject*)(&PyoaStringAppDef_oaOccNet_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccNet\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccNet_Type.tp_dict; for(method=oaStringAppDef_oaOccNet_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccShape // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccShape_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccShape_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccShapeObject* self = (PyoaStringAppDef_oaOccShapeObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccShape) { PyParamoaStringAppDef_oaOccShape p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccShape_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccShape, Choices are:\n" " (oaStringAppDef_oaOccShape)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccShape_tp_dealloc(PyoaStringAppDef_oaOccShapeObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccShape_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccShape value; int convert_status=PyoaStringAppDef_oaOccShape_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[47]; sprintf(buffer,"<oaStringAppDef_oaOccShape::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccShape_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccShape v1; PyParamoaStringAppDef_oaOccShape v2; int convert_status1=PyoaStringAppDef_oaOccShape_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccShape_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccShape_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccShape* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccShape_Check(ob)) { result->SetData( (oaStringAppDef_oaOccShape**) ((PyoaStringAppDef_oaOccShapeObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccShape Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccShape_FromoaStringAppDef_oaOccShape(oaStringAppDef_oaOccShape** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccShape* data=*value; PyObject* bself = PyoaStringAppDef_oaOccShape_Type.tp_alloc(&PyoaStringAppDef_oaOccShape_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccShapeObject* self = (PyoaStringAppDef_oaOccShapeObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccShape_FromoaStringAppDef_oaOccShape(oaStringAppDef_oaOccShape* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccShape_Type.tp_alloc(&PyoaStringAppDef_oaOccShape_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccShapeObject* self = (PyoaStringAppDef_oaOccShapeObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccShape_get_doc[] = "Class: oaStringAppDef_oaOccShape, Function: get\n" " Paramegers: (oaOccShape,oaString)\n" " Calls: void get(const oaOccShape* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccShape,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccShape_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccShape data; int convert_status=PyoaStringAppDef_oaOccShape_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccShapeObject* self=(PyoaStringAppDef_oaOccShapeObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccShape p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccShape_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccShape_getDefault_doc[] = "Class: oaStringAppDef_oaOccShape, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccShape_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccShape data; int convert_status=PyoaStringAppDef_oaOccShape_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccShapeObject* self=(PyoaStringAppDef_oaOccShapeObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccShape_set_doc[] = "Class: oaStringAppDef_oaOccShape, Function: set\n" " Paramegers: (oaOccShape,oaString)\n" " Calls: void set(oaOccShape* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccShape,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccShape_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccShape data; int convert_status=PyoaStringAppDef_oaOccShape_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccShapeObject* self=(PyoaStringAppDef_oaOccShapeObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccShape p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccShape_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccShape_isNull_doc[] = "Class: oaStringAppDef_oaOccShape, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccShape_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccShape data; int convert_status=PyoaStringAppDef_oaOccShape_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccShape_assign_doc[] = "Class: oaStringAppDef_oaOccShape, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccShape_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccShape data; int convert_status=PyoaStringAppDef_oaOccShape_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccShape p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccShape_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccShape_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccShape_get,METH_VARARGS,oaStringAppDef_oaOccShape_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccShape_getDefault,METH_VARARGS,oaStringAppDef_oaOccShape_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccShape_set,METH_VARARGS,oaStringAppDef_oaOccShape_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccShape_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccShape_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccShape_tp_assign,METH_VARARGS,oaStringAppDef_oaOccShape_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccShape_doc[] = "Class: oaStringAppDef_oaOccShape\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccShape)\n" " Calls: (const oaStringAppDef_oaOccShape&)\n" " Signature: oaStringAppDef_oaOccShape||cref-oaStringAppDef_oaOccShape,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccShape_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccShape", sizeof(PyoaStringAppDef_oaOccShapeObject), 0, (destructor)oaStringAppDef_oaOccShape_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccShape_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccShape_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccShape_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccShape_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccShape_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccShape_static_find_doc[] = "Class: oaStringAppDef_oaOccShape, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccShape* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccShape|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccShape* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccShape|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccShape_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccShapep result= (oaStringAppDef_oaOccShape::find(p1.Data())); return PyoaStringAppDef_oaOccShape_FromoaStringAppDef_oaOccShape(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccShapep result= (oaStringAppDef_oaOccShape::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccShape_FromoaStringAppDef_oaOccShape(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccShape, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccShape_static_get_doc[] = "Class: oaStringAppDef_oaOccShape, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccShape* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccShape|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccShape* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccShape|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccShape* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccShape|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccShape* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccShape|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccShape* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccShape|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccShape* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccShape|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccShape_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccShapep result= (oaStringAppDef_oaOccShape::get(p1.Data())); return PyoaStringAppDef_oaOccShape_FromoaStringAppDef_oaOccShape(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccShapep result= (oaStringAppDef_oaOccShape::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccShape_FromoaStringAppDef_oaOccShape(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccShapep result= (oaStringAppDef_oaOccShape::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccShape_FromoaStringAppDef_oaOccShape(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccShapep result= (oaStringAppDef_oaOccShape::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccShape_FromoaStringAppDef_oaOccShape(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccShapep result= (oaStringAppDef_oaOccShape::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccShape_FromoaStringAppDef_oaOccShape(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccShapep result= (oaStringAppDef_oaOccShape::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccShape_FromoaStringAppDef_oaOccShape(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccShape, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccShape_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccShape_static_find,METH_VARARGS,oaStringAppDef_oaOccShape_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccShape_static_get,METH_VARARGS,oaStringAppDef_oaOccShape_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccShape_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccShape_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccShape\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccShape", (PyObject*)(&PyoaStringAppDef_oaOccShape_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccShape\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccShape_Type.tp_dict; for(method=oaStringAppDef_oaOccShape_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccTerm // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccTerm_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccTerm_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccTermObject* self = (PyoaStringAppDef_oaOccTermObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccTerm) { PyParamoaStringAppDef_oaOccTerm p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccTerm_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccTerm, Choices are:\n" " (oaStringAppDef_oaOccTerm)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccTerm_tp_dealloc(PyoaStringAppDef_oaOccTermObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccTerm_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccTerm value; int convert_status=PyoaStringAppDef_oaOccTerm_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[46]; sprintf(buffer,"<oaStringAppDef_oaOccTerm::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccTerm_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccTerm v1; PyParamoaStringAppDef_oaOccTerm v2; int convert_status1=PyoaStringAppDef_oaOccTerm_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccTerm_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccTerm_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccTerm* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccTerm_Check(ob)) { result->SetData( (oaStringAppDef_oaOccTerm**) ((PyoaStringAppDef_oaOccTermObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccTerm Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccTerm_FromoaStringAppDef_oaOccTerm(oaStringAppDef_oaOccTerm** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccTerm* data=*value; PyObject* bself = PyoaStringAppDef_oaOccTerm_Type.tp_alloc(&PyoaStringAppDef_oaOccTerm_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccTermObject* self = (PyoaStringAppDef_oaOccTermObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccTerm_FromoaStringAppDef_oaOccTerm(oaStringAppDef_oaOccTerm* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccTerm_Type.tp_alloc(&PyoaStringAppDef_oaOccTerm_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccTermObject* self = (PyoaStringAppDef_oaOccTermObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccTerm_get_doc[] = "Class: oaStringAppDef_oaOccTerm, Function: get\n" " Paramegers: (oaOccTerm,oaString)\n" " Calls: void get(const oaOccTerm* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccTerm,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccTerm_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccTerm data; int convert_status=PyoaStringAppDef_oaOccTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccTermObject* self=(PyoaStringAppDef_oaOccTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccTerm p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccTerm_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccTerm_getDefault_doc[] = "Class: oaStringAppDef_oaOccTerm, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccTerm_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccTerm data; int convert_status=PyoaStringAppDef_oaOccTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccTermObject* self=(PyoaStringAppDef_oaOccTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccTerm_set_doc[] = "Class: oaStringAppDef_oaOccTerm, Function: set\n" " Paramegers: (oaOccTerm,oaString)\n" " Calls: void set(oaOccTerm* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccTerm,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccTerm_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccTerm data; int convert_status=PyoaStringAppDef_oaOccTerm_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccTermObject* self=(PyoaStringAppDef_oaOccTermObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccTerm p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccTerm_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccTerm_isNull_doc[] = "Class: oaStringAppDef_oaOccTerm, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccTerm_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccTerm data; int convert_status=PyoaStringAppDef_oaOccTerm_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccTerm_assign_doc[] = "Class: oaStringAppDef_oaOccTerm, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccTerm_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccTerm data; int convert_status=PyoaStringAppDef_oaOccTerm_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccTerm p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccTerm_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccTerm_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccTerm_get,METH_VARARGS,oaStringAppDef_oaOccTerm_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccTerm_getDefault,METH_VARARGS,oaStringAppDef_oaOccTerm_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccTerm_set,METH_VARARGS,oaStringAppDef_oaOccTerm_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccTerm_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccTerm_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccTerm_tp_assign,METH_VARARGS,oaStringAppDef_oaOccTerm_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccTerm_doc[] = "Class: oaStringAppDef_oaOccTerm\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccTerm)\n" " Calls: (const oaStringAppDef_oaOccTerm&)\n" " Signature: oaStringAppDef_oaOccTerm||cref-oaStringAppDef_oaOccTerm,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccTerm_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccTerm", sizeof(PyoaStringAppDef_oaOccTermObject), 0, (destructor)oaStringAppDef_oaOccTerm_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccTerm_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccTerm_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccTerm_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccTerm_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccTerm_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccTerm_static_find_doc[] = "Class: oaStringAppDef_oaOccTerm, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccTerm* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccTerm|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccTerm* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccTerm|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccTerm_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccTermp result= (oaStringAppDef_oaOccTerm::find(p1.Data())); return PyoaStringAppDef_oaOccTerm_FromoaStringAppDef_oaOccTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccTermp result= (oaStringAppDef_oaOccTerm::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccTerm_FromoaStringAppDef_oaOccTerm(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccTerm, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccTerm_static_get_doc[] = "Class: oaStringAppDef_oaOccTerm, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccTerm* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccTerm* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccTerm* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccTerm|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccTerm* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccTerm* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccTerm* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccTerm|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccTerm_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccTermp result= (oaStringAppDef_oaOccTerm::get(p1.Data())); return PyoaStringAppDef_oaOccTerm_FromoaStringAppDef_oaOccTerm(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccTermp result= (oaStringAppDef_oaOccTerm::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccTerm_FromoaStringAppDef_oaOccTerm(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccTermp result= (oaStringAppDef_oaOccTerm::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccTerm_FromoaStringAppDef_oaOccTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccTermp result= (oaStringAppDef_oaOccTerm::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccTerm_FromoaStringAppDef_oaOccTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccTermp result= (oaStringAppDef_oaOccTerm::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccTerm_FromoaStringAppDef_oaOccTerm(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccTermp result= (oaStringAppDef_oaOccTerm::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccTerm_FromoaStringAppDef_oaOccTerm(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccTerm, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccTerm_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccTerm_static_find,METH_VARARGS,oaStringAppDef_oaOccTerm_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccTerm_static_get,METH_VARARGS,oaStringAppDef_oaOccTerm_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccTerm_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccTerm_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccTerm\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccTerm", (PyObject*)(&PyoaStringAppDef_oaOccTerm_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccTerm\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccTerm_Type.tp_dict; for(method=oaStringAppDef_oaOccTerm_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccVectorInstDef // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccVectorInstDef_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccVectorInstDef_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccVectorInstDefObject* self = (PyoaStringAppDef_oaOccVectorInstDefObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccVectorInstDef) { PyParamoaStringAppDef_oaOccVectorInstDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccVectorInstDef_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccVectorInstDef, Choices are:\n" " (oaStringAppDef_oaOccVectorInstDef)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccVectorInstDef_tp_dealloc(PyoaStringAppDef_oaOccVectorInstDefObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccVectorInstDef_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccVectorInstDef value; int convert_status=PyoaStringAppDef_oaOccVectorInstDef_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[55]; sprintf(buffer,"<oaStringAppDef_oaOccVectorInstDef::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccVectorInstDef_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccVectorInstDef v1; PyParamoaStringAppDef_oaOccVectorInstDef v2; int convert_status1=PyoaStringAppDef_oaOccVectorInstDef_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccVectorInstDef_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccVectorInstDef_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccVectorInstDef* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccVectorInstDef_Check(ob)) { result->SetData( (oaStringAppDef_oaOccVectorInstDef**) ((PyoaStringAppDef_oaOccVectorInstDefObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccVectorInstDef Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccVectorInstDef_FromoaStringAppDef_oaOccVectorInstDef(oaStringAppDef_oaOccVectorInstDef** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccVectorInstDef* data=*value; PyObject* bself = PyoaStringAppDef_oaOccVectorInstDef_Type.tp_alloc(&PyoaStringAppDef_oaOccVectorInstDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccVectorInstDefObject* self = (PyoaStringAppDef_oaOccVectorInstDefObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccVectorInstDef_FromoaStringAppDef_oaOccVectorInstDef(oaStringAppDef_oaOccVectorInstDef* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccVectorInstDef_Type.tp_alloc(&PyoaStringAppDef_oaOccVectorInstDef_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccVectorInstDefObject* self = (PyoaStringAppDef_oaOccVectorInstDefObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccVectorInstDef_get_doc[] = "Class: oaStringAppDef_oaOccVectorInstDef, Function: get\n" " Paramegers: (oaOccVectorInstDef,oaString)\n" " Calls: void get(const oaOccVectorInstDef* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccVectorInstDef,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccVectorInstDef_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccVectorInstDef data; int convert_status=PyoaStringAppDef_oaOccVectorInstDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccVectorInstDefObject* self=(PyoaStringAppDef_oaOccVectorInstDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccVectorInstDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccVectorInstDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccVectorInstDef_getDefault_doc[] = "Class: oaStringAppDef_oaOccVectorInstDef, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccVectorInstDef_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccVectorInstDef data; int convert_status=PyoaStringAppDef_oaOccVectorInstDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccVectorInstDefObject* self=(PyoaStringAppDef_oaOccVectorInstDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccVectorInstDef_set_doc[] = "Class: oaStringAppDef_oaOccVectorInstDef, Function: set\n" " Paramegers: (oaOccVectorInstDef,oaString)\n" " Calls: void set(oaOccVectorInstDef* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccVectorInstDef,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccVectorInstDef_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccVectorInstDef data; int convert_status=PyoaStringAppDef_oaOccVectorInstDef_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccVectorInstDefObject* self=(PyoaStringAppDef_oaOccVectorInstDefObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccVectorInstDef p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccVectorInstDef_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccVectorInstDef_isNull_doc[] = "Class: oaStringAppDef_oaOccVectorInstDef, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccVectorInstDef_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccVectorInstDef data; int convert_status=PyoaStringAppDef_oaOccVectorInstDef_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccVectorInstDef_assign_doc[] = "Class: oaStringAppDef_oaOccVectorInstDef, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccVectorInstDef_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccVectorInstDef data; int convert_status=PyoaStringAppDef_oaOccVectorInstDef_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccVectorInstDef p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccVectorInstDef_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccVectorInstDef_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccVectorInstDef_get,METH_VARARGS,oaStringAppDef_oaOccVectorInstDef_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccVectorInstDef_getDefault,METH_VARARGS,oaStringAppDef_oaOccVectorInstDef_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccVectorInstDef_set,METH_VARARGS,oaStringAppDef_oaOccVectorInstDef_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccVectorInstDef_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccVectorInstDef_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccVectorInstDef_tp_assign,METH_VARARGS,oaStringAppDef_oaOccVectorInstDef_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccVectorInstDef_doc[] = "Class: oaStringAppDef_oaOccVectorInstDef\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccVectorInstDef)\n" " Calls: (const oaStringAppDef_oaOccVectorInstDef&)\n" " Signature: oaStringAppDef_oaOccVectorInstDef||cref-oaStringAppDef_oaOccVectorInstDef,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccVectorInstDef_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccVectorInstDef", sizeof(PyoaStringAppDef_oaOccVectorInstDefObject), 0, (destructor)oaStringAppDef_oaOccVectorInstDef_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccVectorInstDef_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccVectorInstDef_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccVectorInstDef_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccVectorInstDef_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccVectorInstDef_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccVectorInstDef_static_find_doc[] = "Class: oaStringAppDef_oaOccVectorInstDef, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccVectorInstDef* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccVectorInstDef|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccVectorInstDef* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccVectorInstDef|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccVectorInstDef_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccVectorInstDefp result= (oaStringAppDef_oaOccVectorInstDef::find(p1.Data())); return PyoaStringAppDef_oaOccVectorInstDef_FromoaStringAppDef_oaOccVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccVectorInstDefp result= (oaStringAppDef_oaOccVectorInstDef::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccVectorInstDef_FromoaStringAppDef_oaOccVectorInstDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccVectorInstDef, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccVectorInstDef_static_get_doc[] = "Class: oaStringAppDef_oaOccVectorInstDef, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccVectorInstDef* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccVectorInstDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccVectorInstDef* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccVectorInstDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccVectorInstDef* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccVectorInstDef|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccVectorInstDef* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccVectorInstDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccVectorInstDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccVectorInstDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccVectorInstDef* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccVectorInstDef|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccVectorInstDef_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccVectorInstDefp result= (oaStringAppDef_oaOccVectorInstDef::get(p1.Data())); return PyoaStringAppDef_oaOccVectorInstDef_FromoaStringAppDef_oaOccVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccVectorInstDefp result= (oaStringAppDef_oaOccVectorInstDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccVectorInstDef_FromoaStringAppDef_oaOccVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccVectorInstDefp result= (oaStringAppDef_oaOccVectorInstDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccVectorInstDef_FromoaStringAppDef_oaOccVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccVectorInstDefp result= (oaStringAppDef_oaOccVectorInstDef::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccVectorInstDef_FromoaStringAppDef_oaOccVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccVectorInstDefp result= (oaStringAppDef_oaOccVectorInstDef::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccVectorInstDef_FromoaStringAppDef_oaOccVectorInstDef(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccVectorInstDefp result= (oaStringAppDef_oaOccVectorInstDef::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccVectorInstDef_FromoaStringAppDef_oaOccVectorInstDef(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccVectorInstDef, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccVectorInstDef_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccVectorInstDef_static_find,METH_VARARGS,oaStringAppDef_oaOccVectorInstDef_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccVectorInstDef_static_get,METH_VARARGS,oaStringAppDef_oaOccVectorInstDef_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccVectorInstDef_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccVectorInstDef_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccVectorInstDef\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccVectorInstDef", (PyObject*)(&PyoaStringAppDef_oaOccVectorInstDef_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccVectorInstDef\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccVectorInstDef_Type.tp_dict; for(method=oaStringAppDef_oaOccVectorInstDef_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOccurrence // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccurrence_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOccurrence_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccurrenceObject* self = (PyoaStringAppDef_oaOccurrenceObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOccurrence) { PyParamoaStringAppDef_oaOccurrence p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccurrence_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOccurrence, Choices are:\n" " (oaStringAppDef_oaOccurrence)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOccurrence_tp_dealloc(PyoaStringAppDef_oaOccurrenceObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOccurrence_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOccurrence value; int convert_status=PyoaStringAppDef_oaOccurrence_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[49]; sprintf(buffer,"<oaStringAppDef_oaOccurrence::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOccurrence_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOccurrence v1; PyParamoaStringAppDef_oaOccurrence v2; int convert_status1=PyoaStringAppDef_oaOccurrence_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOccurrence_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccurrence_Convert(PyObject* ob,PyParamoaStringAppDef_oaOccurrence* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOccurrence_Check(ob)) { result->SetData( (oaStringAppDef_oaOccurrence**) ((PyoaStringAppDef_oaOccurrenceObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOccurrence Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccurrence_FromoaStringAppDef_oaOccurrence(oaStringAppDef_oaOccurrence** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOccurrence* data=*value; PyObject* bself = PyoaStringAppDef_oaOccurrence_Type.tp_alloc(&PyoaStringAppDef_oaOccurrence_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccurrenceObject* self = (PyoaStringAppDef_oaOccurrenceObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOccurrence_FromoaStringAppDef_oaOccurrence(oaStringAppDef_oaOccurrence* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOccurrence_Type.tp_alloc(&PyoaStringAppDef_oaOccurrence_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOccurrenceObject* self = (PyoaStringAppDef_oaOccurrenceObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccurrence_get_doc[] = "Class: oaStringAppDef_oaOccurrence, Function: get\n" " Paramegers: (oaOccurrence,oaString)\n" " Calls: void get(const oaOccurrence* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOccurrence,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccurrence_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccurrence data; int convert_status=PyoaStringAppDef_oaOccurrence_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccurrenceObject* self=(PyoaStringAppDef_oaOccurrenceObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccurrence p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccurrence_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccurrence_getDefault_doc[] = "Class: oaStringAppDef_oaOccurrence, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOccurrence_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccurrence data; int convert_status=PyoaStringAppDef_oaOccurrence_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccurrenceObject* self=(PyoaStringAppDef_oaOccurrenceObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccurrence_set_doc[] = "Class: oaStringAppDef_oaOccurrence, Function: set\n" " Paramegers: (oaOccurrence,oaString)\n" " Calls: void set(oaOccurrence* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOccurrence,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOccurrence_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOccurrence data; int convert_status=PyoaStringAppDef_oaOccurrence_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOccurrenceObject* self=(PyoaStringAppDef_oaOccurrenceObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOccurrence p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOccurrence_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccurrence_isNull_doc[] = "Class: oaStringAppDef_oaOccurrence, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOccurrence_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccurrence data; int convert_status=PyoaStringAppDef_oaOccurrence_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOccurrence_assign_doc[] = "Class: oaStringAppDef_oaOccurrence, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOccurrence_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOccurrence data; int convert_status=PyoaStringAppDef_oaOccurrence_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOccurrence p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOccurrence_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccurrence_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOccurrence_get,METH_VARARGS,oaStringAppDef_oaOccurrence_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOccurrence_getDefault,METH_VARARGS,oaStringAppDef_oaOccurrence_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOccurrence_set,METH_VARARGS,oaStringAppDef_oaOccurrence_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOccurrence_tp_isNull,METH_VARARGS,oaStringAppDef_oaOccurrence_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOccurrence_tp_assign,METH_VARARGS,oaStringAppDef_oaOccurrence_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccurrence_doc[] = "Class: oaStringAppDef_oaOccurrence\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOccurrence)\n" " Calls: (const oaStringAppDef_oaOccurrence&)\n" " Signature: oaStringAppDef_oaOccurrence||cref-oaStringAppDef_oaOccurrence,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOccurrence_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOccurrence", sizeof(PyoaStringAppDef_oaOccurrenceObject), 0, (destructor)oaStringAppDef_oaOccurrence_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOccurrence_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOccurrence_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOccurrence_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOccurrence_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOccurrence_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOccurrence_static_find_doc[] = "Class: oaStringAppDef_oaOccurrence, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccurrence* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOccurrence|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccurrence* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOccurrence|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOccurrence_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccurrencep result= (oaStringAppDef_oaOccurrence::find(p1.Data())); return PyoaStringAppDef_oaOccurrence_FromoaStringAppDef_oaOccurrence(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccurrencep result= (oaStringAppDef_oaOccurrence::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccurrence_FromoaStringAppDef_oaOccurrence(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccurrence, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOccurrence_static_get_doc[] = "Class: oaStringAppDef_oaOccurrence, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOccurrence* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOccurrence|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOccurrence* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccurrence|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccurrence* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccurrence|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOccurrence* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOccurrence|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOccurrence* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOccurrence|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOccurrence* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOccurrence|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOccurrence_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOccurrencep result= (oaStringAppDef_oaOccurrence::get(p1.Data())); return PyoaStringAppDef_oaOccurrence_FromoaStringAppDef_oaOccurrence(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOccurrencep result= (oaStringAppDef_oaOccurrence::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccurrence_FromoaStringAppDef_oaOccurrence(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOccurrencep result= (oaStringAppDef_oaOccurrence::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccurrence_FromoaStringAppDef_oaOccurrence(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccurrencep result= (oaStringAppDef_oaOccurrence::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOccurrence_FromoaStringAppDef_oaOccurrence(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccurrencep result= (oaStringAppDef_oaOccurrence::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOccurrence_FromoaStringAppDef_oaOccurrence(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOccurrencep result= (oaStringAppDef_oaOccurrence::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOccurrence_FromoaStringAppDef_oaOccurrence(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOccurrence, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOccurrence_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOccurrence_static_find,METH_VARARGS,oaStringAppDef_oaOccurrence_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOccurrence_static_get,METH_VARARGS,oaStringAppDef_oaOccurrence_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOccurrence_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOccurrence_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOccurrence\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOccurrence", (PyObject*)(&PyoaStringAppDef_oaOccurrence_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOccurrence\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOccurrence_Type.tp_dict; for(method=oaStringAppDef_oaOccurrence_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaOpPointHeader // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOpPointHeader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaOpPointHeader_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOpPointHeaderObject* self = (PyoaStringAppDef_oaOpPointHeaderObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaOpPointHeader) { PyParamoaStringAppDef_oaOpPointHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOpPointHeader_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaOpPointHeader, Choices are:\n" " (oaStringAppDef_oaOpPointHeader)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaOpPointHeader_tp_dealloc(PyoaStringAppDef_oaOpPointHeaderObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaOpPointHeader_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaOpPointHeader value; int convert_status=PyoaStringAppDef_oaOpPointHeader_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[52]; sprintf(buffer,"<oaStringAppDef_oaOpPointHeader::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaOpPointHeader_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaOpPointHeader v1; PyParamoaStringAppDef_oaOpPointHeader v2; int convert_status1=PyoaStringAppDef_oaOpPointHeader_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaOpPointHeader_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaOpPointHeader_Convert(PyObject* ob,PyParamoaStringAppDef_oaOpPointHeader* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaOpPointHeader_Check(ob)) { result->SetData( (oaStringAppDef_oaOpPointHeader**) ((PyoaStringAppDef_oaOpPointHeaderObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaOpPointHeader Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOpPointHeader_FromoaStringAppDef_oaOpPointHeader(oaStringAppDef_oaOpPointHeader** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaOpPointHeader* data=*value; PyObject* bself = PyoaStringAppDef_oaOpPointHeader_Type.tp_alloc(&PyoaStringAppDef_oaOpPointHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOpPointHeaderObject* self = (PyoaStringAppDef_oaOpPointHeaderObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaOpPointHeader_FromoaStringAppDef_oaOpPointHeader(oaStringAppDef_oaOpPointHeader* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaOpPointHeader_Type.tp_alloc(&PyoaStringAppDef_oaOpPointHeader_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaOpPointHeaderObject* self = (PyoaStringAppDef_oaOpPointHeaderObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOpPointHeader_get_doc[] = "Class: oaStringAppDef_oaOpPointHeader, Function: get\n" " Paramegers: (oaOpPointHeader,oaString)\n" " Calls: void get(const oaOpPointHeader* object,oaString& value)\n" " Signature: get|void-void|cptr-oaOpPointHeader,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOpPointHeader_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOpPointHeader data; int convert_status=PyoaStringAppDef_oaOpPointHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOpPointHeaderObject* self=(PyoaStringAppDef_oaOpPointHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOpPointHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOpPointHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOpPointHeader_getDefault_doc[] = "Class: oaStringAppDef_oaOpPointHeader, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaOpPointHeader_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOpPointHeader data; int convert_status=PyoaStringAppDef_oaOpPointHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOpPointHeaderObject* self=(PyoaStringAppDef_oaOpPointHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOpPointHeader_set_doc[] = "Class: oaStringAppDef_oaOpPointHeader, Function: set\n" " Paramegers: (oaOpPointHeader,oaString)\n" " Calls: void set(oaOpPointHeader* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaOpPointHeader,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaOpPointHeader_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaOpPointHeader data; int convert_status=PyoaStringAppDef_oaOpPointHeader_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaOpPointHeaderObject* self=(PyoaStringAppDef_oaOpPointHeaderObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaOpPointHeader p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaOpPointHeader_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOpPointHeader_isNull_doc[] = "Class: oaStringAppDef_oaOpPointHeader, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaOpPointHeader_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOpPointHeader data; int convert_status=PyoaStringAppDef_oaOpPointHeader_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaOpPointHeader_assign_doc[] = "Class: oaStringAppDef_oaOpPointHeader, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaOpPointHeader_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaOpPointHeader data; int convert_status=PyoaStringAppDef_oaOpPointHeader_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaOpPointHeader p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaOpPointHeader_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOpPointHeader_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaOpPointHeader_get,METH_VARARGS,oaStringAppDef_oaOpPointHeader_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaOpPointHeader_getDefault,METH_VARARGS,oaStringAppDef_oaOpPointHeader_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaOpPointHeader_set,METH_VARARGS,oaStringAppDef_oaOpPointHeader_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaOpPointHeader_tp_isNull,METH_VARARGS,oaStringAppDef_oaOpPointHeader_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaOpPointHeader_tp_assign,METH_VARARGS,oaStringAppDef_oaOpPointHeader_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOpPointHeader_doc[] = "Class: oaStringAppDef_oaOpPointHeader\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaOpPointHeader)\n" " Calls: (const oaStringAppDef_oaOpPointHeader&)\n" " Signature: oaStringAppDef_oaOpPointHeader||cref-oaStringAppDef_oaOpPointHeader,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaOpPointHeader_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaOpPointHeader", sizeof(PyoaStringAppDef_oaOpPointHeaderObject), 0, (destructor)oaStringAppDef_oaOpPointHeader_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaOpPointHeader_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaOpPointHeader_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaOpPointHeader_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaOpPointHeader_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaOpPointHeader_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaOpPointHeader_static_find_doc[] = "Class: oaStringAppDef_oaOpPointHeader, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOpPointHeader* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaOpPointHeader|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOpPointHeader* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaOpPointHeader|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaOpPointHeader_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOpPointHeaderp result= (oaStringAppDef_oaOpPointHeader::find(p1.Data())); return PyoaStringAppDef_oaOpPointHeader_FromoaStringAppDef_oaOpPointHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOpPointHeaderp result= (oaStringAppDef_oaOpPointHeader::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOpPointHeader_FromoaStringAppDef_oaOpPointHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOpPointHeader, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaOpPointHeader_static_get_doc[] = "Class: oaStringAppDef_oaOpPointHeader, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaOpPointHeader* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaOpPointHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaOpPointHeader* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOpPointHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOpPointHeader* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOpPointHeader|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaOpPointHeader* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaOpPointHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaOpPointHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaOpPointHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaOpPointHeader* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaOpPointHeader|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaOpPointHeader_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaOpPointHeaderp result= (oaStringAppDef_oaOpPointHeader::get(p1.Data())); return PyoaStringAppDef_oaOpPointHeader_FromoaStringAppDef_oaOpPointHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaOpPointHeaderp result= (oaStringAppDef_oaOpPointHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOpPointHeader_FromoaStringAppDef_oaOpPointHeader(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaOpPointHeaderp result= (oaStringAppDef_oaOpPointHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOpPointHeader_FromoaStringAppDef_oaOpPointHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOpPointHeaderp result= (oaStringAppDef_oaOpPointHeader::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaOpPointHeader_FromoaStringAppDef_oaOpPointHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOpPointHeaderp result= (oaStringAppDef_oaOpPointHeader::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaOpPointHeader_FromoaStringAppDef_oaOpPointHeader(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaOpPointHeaderp result= (oaStringAppDef_oaOpPointHeader::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaOpPointHeader_FromoaStringAppDef_oaOpPointHeader(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaOpPointHeader, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaOpPointHeader_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaOpPointHeader_static_find,METH_VARARGS,oaStringAppDef_oaOpPointHeader_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaOpPointHeader_static_get,METH_VARARGS,oaStringAppDef_oaOpPointHeader_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaOpPointHeader_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaOpPointHeader_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaOpPointHeader\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaOpPointHeader", (PyObject*)(&PyoaStringAppDef_oaOpPointHeader_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaOpPointHeader\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaOpPointHeader_Type.tp_dict; for(method=oaStringAppDef_oaOpPointHeader_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaParasiticNetwork // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaParasiticNetwork_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaParasiticNetwork_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaParasiticNetworkObject* self = (PyoaStringAppDef_oaParasiticNetworkObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaParasiticNetwork) { PyParamoaStringAppDef_oaParasiticNetwork p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaParasiticNetwork_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaParasiticNetwork, Choices are:\n" " (oaStringAppDef_oaParasiticNetwork)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaParasiticNetwork_tp_dealloc(PyoaStringAppDef_oaParasiticNetworkObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaParasiticNetwork_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaParasiticNetwork value; int convert_status=PyoaStringAppDef_oaParasiticNetwork_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[55]; sprintf(buffer,"<oaStringAppDef_oaParasiticNetwork::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaParasiticNetwork_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaParasiticNetwork v1; PyParamoaStringAppDef_oaParasiticNetwork v2; int convert_status1=PyoaStringAppDef_oaParasiticNetwork_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaParasiticNetwork_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaParasiticNetwork_Convert(PyObject* ob,PyParamoaStringAppDef_oaParasiticNetwork* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaParasiticNetwork_Check(ob)) { result->SetData( (oaStringAppDef_oaParasiticNetwork**) ((PyoaStringAppDef_oaParasiticNetworkObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaParasiticNetwork Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaParasiticNetwork_FromoaStringAppDef_oaParasiticNetwork(oaStringAppDef_oaParasiticNetwork** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaParasiticNetwork* data=*value; PyObject* bself = PyoaStringAppDef_oaParasiticNetwork_Type.tp_alloc(&PyoaStringAppDef_oaParasiticNetwork_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaParasiticNetworkObject* self = (PyoaStringAppDef_oaParasiticNetworkObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaParasiticNetwork_FromoaStringAppDef_oaParasiticNetwork(oaStringAppDef_oaParasiticNetwork* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaParasiticNetwork_Type.tp_alloc(&PyoaStringAppDef_oaParasiticNetwork_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaParasiticNetworkObject* self = (PyoaStringAppDef_oaParasiticNetworkObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaParasiticNetwork_get_doc[] = "Class: oaStringAppDef_oaParasiticNetwork, Function: get\n" " Paramegers: (oaParasiticNetwork,oaString)\n" " Calls: void get(const oaParasiticNetwork* object,oaString& value)\n" " Signature: get|void-void|cptr-oaParasiticNetwork,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaParasiticNetwork_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaParasiticNetwork data; int convert_status=PyoaStringAppDef_oaParasiticNetwork_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaParasiticNetworkObject* self=(PyoaStringAppDef_oaParasiticNetworkObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaParasiticNetwork p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaParasiticNetwork_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaParasiticNetwork_getDefault_doc[] = "Class: oaStringAppDef_oaParasiticNetwork, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaParasiticNetwork_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaParasiticNetwork data; int convert_status=PyoaStringAppDef_oaParasiticNetwork_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaParasiticNetworkObject* self=(PyoaStringAppDef_oaParasiticNetworkObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaParasiticNetwork_set_doc[] = "Class: oaStringAppDef_oaParasiticNetwork, Function: set\n" " Paramegers: (oaParasiticNetwork,oaString)\n" " Calls: void set(oaParasiticNetwork* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaParasiticNetwork,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaParasiticNetwork_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaParasiticNetwork data; int convert_status=PyoaStringAppDef_oaParasiticNetwork_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaParasiticNetworkObject* self=(PyoaStringAppDef_oaParasiticNetworkObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaParasiticNetwork p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaParasiticNetwork_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaParasiticNetwork_isNull_doc[] = "Class: oaStringAppDef_oaParasiticNetwork, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaParasiticNetwork_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaParasiticNetwork data; int convert_status=PyoaStringAppDef_oaParasiticNetwork_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaParasiticNetwork_assign_doc[] = "Class: oaStringAppDef_oaParasiticNetwork, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaParasiticNetwork_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaParasiticNetwork data; int convert_status=PyoaStringAppDef_oaParasiticNetwork_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaParasiticNetwork p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaParasiticNetwork_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaParasiticNetwork_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaParasiticNetwork_get,METH_VARARGS,oaStringAppDef_oaParasiticNetwork_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaParasiticNetwork_getDefault,METH_VARARGS,oaStringAppDef_oaParasiticNetwork_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaParasiticNetwork_set,METH_VARARGS,oaStringAppDef_oaParasiticNetwork_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaParasiticNetwork_tp_isNull,METH_VARARGS,oaStringAppDef_oaParasiticNetwork_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaParasiticNetwork_tp_assign,METH_VARARGS,oaStringAppDef_oaParasiticNetwork_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaParasiticNetwork_doc[] = "Class: oaStringAppDef_oaParasiticNetwork\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaParasiticNetwork)\n" " Calls: (const oaStringAppDef_oaParasiticNetwork&)\n" " Signature: oaStringAppDef_oaParasiticNetwork||cref-oaStringAppDef_oaParasiticNetwork,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaParasiticNetwork_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaParasiticNetwork", sizeof(PyoaStringAppDef_oaParasiticNetworkObject), 0, (destructor)oaStringAppDef_oaParasiticNetwork_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaParasiticNetwork_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaParasiticNetwork_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaParasiticNetwork_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaParasiticNetwork_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaParasiticNetwork_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaParasiticNetwork_static_find_doc[] = "Class: oaStringAppDef_oaParasiticNetwork, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaParasiticNetwork* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaParasiticNetwork|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaParasiticNetwork* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaParasiticNetwork|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaParasiticNetwork_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaParasiticNetworkp result= (oaStringAppDef_oaParasiticNetwork::find(p1.Data())); return PyoaStringAppDef_oaParasiticNetwork_FromoaStringAppDef_oaParasiticNetwork(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaParasiticNetworkp result= (oaStringAppDef_oaParasiticNetwork::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaParasiticNetwork_FromoaStringAppDef_oaParasiticNetwork(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaParasiticNetwork, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaParasiticNetwork_static_get_doc[] = "Class: oaStringAppDef_oaParasiticNetwork, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaParasiticNetwork* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaParasiticNetwork|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaParasiticNetwork* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaParasiticNetwork|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaParasiticNetwork* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaParasiticNetwork|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaParasiticNetwork* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaParasiticNetwork|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaParasiticNetwork* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaParasiticNetwork|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaParasiticNetwork* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaParasiticNetwork|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaParasiticNetwork_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaParasiticNetworkp result= (oaStringAppDef_oaParasiticNetwork::get(p1.Data())); return PyoaStringAppDef_oaParasiticNetwork_FromoaStringAppDef_oaParasiticNetwork(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaParasiticNetworkp result= (oaStringAppDef_oaParasiticNetwork::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaParasiticNetwork_FromoaStringAppDef_oaParasiticNetwork(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaParasiticNetworkp result= (oaStringAppDef_oaParasiticNetwork::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaParasiticNetwork_FromoaStringAppDef_oaParasiticNetwork(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaParasiticNetworkp result= (oaStringAppDef_oaParasiticNetwork::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaParasiticNetwork_FromoaStringAppDef_oaParasiticNetwork(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaParasiticNetworkp result= (oaStringAppDef_oaParasiticNetwork::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaParasiticNetwork_FromoaStringAppDef_oaParasiticNetwork(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaParasiticNetworkp result= (oaStringAppDef_oaParasiticNetwork::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaParasiticNetwork_FromoaStringAppDef_oaParasiticNetwork(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaParasiticNetwork, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaParasiticNetwork_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaParasiticNetwork_static_find,METH_VARARGS,oaStringAppDef_oaParasiticNetwork_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaParasiticNetwork_static_get,METH_VARARGS,oaStringAppDef_oaParasiticNetwork_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaParasiticNetwork_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaParasiticNetwork_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaParasiticNetwork\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaParasiticNetwork", (PyObject*)(&PyoaStringAppDef_oaParasiticNetwork_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaParasiticNetwork\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaParasiticNetwork_Type.tp_dict; for(method=oaStringAppDef_oaParasiticNetwork_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaPin // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaPin_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaPin_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaPinObject* self = (PyoaStringAppDef_oaPinObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaPin) { PyParamoaStringAppDef_oaPin p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaPin_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaPin, Choices are:\n" " (oaStringAppDef_oaPin)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaPin_tp_dealloc(PyoaStringAppDef_oaPinObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaPin_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaPin value; int convert_status=PyoaStringAppDef_oaPin_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[42]; sprintf(buffer,"<oaStringAppDef_oaPin::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaPin_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaPin v1; PyParamoaStringAppDef_oaPin v2; int convert_status1=PyoaStringAppDef_oaPin_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaPin_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaPin_Convert(PyObject* ob,PyParamoaStringAppDef_oaPin* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaPin_Check(ob)) { result->SetData( (oaStringAppDef_oaPin**) ((PyoaStringAppDef_oaPinObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaPin Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaPin_FromoaStringAppDef_oaPin(oaStringAppDef_oaPin** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaPin* data=*value; PyObject* bself = PyoaStringAppDef_oaPin_Type.tp_alloc(&PyoaStringAppDef_oaPin_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaPinObject* self = (PyoaStringAppDef_oaPinObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaPin_FromoaStringAppDef_oaPin(oaStringAppDef_oaPin* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaPin_Type.tp_alloc(&PyoaStringAppDef_oaPin_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaPinObject* self = (PyoaStringAppDef_oaPinObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaPin_get_doc[] = "Class: oaStringAppDef_oaPin, Function: get\n" " Paramegers: (oaPin,oaString)\n" " Calls: void get(const oaPin* object,oaString& value)\n" " Signature: get|void-void|cptr-oaPin,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaPin_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaPin data; int convert_status=PyoaStringAppDef_oaPin_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaPinObject* self=(PyoaStringAppDef_oaPinObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaPin p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaPin_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaPin_getDefault_doc[] = "Class: oaStringAppDef_oaPin, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaPin_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaPin data; int convert_status=PyoaStringAppDef_oaPin_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaPinObject* self=(PyoaStringAppDef_oaPinObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaPin_set_doc[] = "Class: oaStringAppDef_oaPin, Function: set\n" " Paramegers: (oaPin,oaString)\n" " Calls: void set(oaPin* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaPin,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaPin_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaPin data; int convert_status=PyoaStringAppDef_oaPin_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaPinObject* self=(PyoaStringAppDef_oaPinObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaPin p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaPin_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaPin_isNull_doc[] = "Class: oaStringAppDef_oaPin, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaPin_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaPin data; int convert_status=PyoaStringAppDef_oaPin_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaPin_assign_doc[] = "Class: oaStringAppDef_oaPin, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaPin_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaPin data; int convert_status=PyoaStringAppDef_oaPin_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaPin p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaPin_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaPin_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaPin_get,METH_VARARGS,oaStringAppDef_oaPin_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaPin_getDefault,METH_VARARGS,oaStringAppDef_oaPin_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaPin_set,METH_VARARGS,oaStringAppDef_oaPin_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaPin_tp_isNull,METH_VARARGS,oaStringAppDef_oaPin_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaPin_tp_assign,METH_VARARGS,oaStringAppDef_oaPin_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaPin_doc[] = "Class: oaStringAppDef_oaPin\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaPin)\n" " Calls: (const oaStringAppDef_oaPin&)\n" " Signature: oaStringAppDef_oaPin||cref-oaStringAppDef_oaPin,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaPin_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaPin", sizeof(PyoaStringAppDef_oaPinObject), 0, (destructor)oaStringAppDef_oaPin_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaPin_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaPin_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaPin_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaPin_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaPin_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaPin_static_find_doc[] = "Class: oaStringAppDef_oaPin, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaPin* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaPin|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaPin* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaPin|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaPin_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaPinp result= (oaStringAppDef_oaPin::find(p1.Data())); return PyoaStringAppDef_oaPin_FromoaStringAppDef_oaPin(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPinp result= (oaStringAppDef_oaPin::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaPin_FromoaStringAppDef_oaPin(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaPin, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaPin_static_get_doc[] = "Class: oaStringAppDef_oaPin, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaPin* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaPin|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaPin* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaPin|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaPin* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaPin|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaPin* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaPin|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaPin* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaPin|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaPin* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaPin|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaPin_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaPinp result= (oaStringAppDef_oaPin::get(p1.Data())); return PyoaStringAppDef_oaPin_FromoaStringAppDef_oaPin(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaPinp result= (oaStringAppDef_oaPin::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaPin_FromoaStringAppDef_oaPin(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaPinp result= (oaStringAppDef_oaPin::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaPin_FromoaStringAppDef_oaPin(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPinp result= (oaStringAppDef_oaPin::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaPin_FromoaStringAppDef_oaPin(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPinp result= (oaStringAppDef_oaPin::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaPin_FromoaStringAppDef_oaPin(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPinp result= (oaStringAppDef_oaPin::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaPin_FromoaStringAppDef_oaPin(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaPin, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaPin_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaPin_static_find,METH_VARARGS,oaStringAppDef_oaPin_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaPin_static_get,METH_VARARGS,oaStringAppDef_oaPin_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaPin_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaPin_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaPin\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaPin", (PyObject*)(&PyoaStringAppDef_oaPin_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaPin\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaPin_Type.tp_dict; for(method=oaStringAppDef_oaPin_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaPoleResidue // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaPoleResidue_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaPoleResidue_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaPoleResidueObject* self = (PyoaStringAppDef_oaPoleResidueObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaPoleResidue) { PyParamoaStringAppDef_oaPoleResidue p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaPoleResidue_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaPoleResidue, Choices are:\n" " (oaStringAppDef_oaPoleResidue)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaPoleResidue_tp_dealloc(PyoaStringAppDef_oaPoleResidueObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaPoleResidue_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaPoleResidue value; int convert_status=PyoaStringAppDef_oaPoleResidue_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[50]; sprintf(buffer,"<oaStringAppDef_oaPoleResidue::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaPoleResidue_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaPoleResidue v1; PyParamoaStringAppDef_oaPoleResidue v2; int convert_status1=PyoaStringAppDef_oaPoleResidue_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaPoleResidue_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaPoleResidue_Convert(PyObject* ob,PyParamoaStringAppDef_oaPoleResidue* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaPoleResidue_Check(ob)) { result->SetData( (oaStringAppDef_oaPoleResidue**) ((PyoaStringAppDef_oaPoleResidueObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaPoleResidue Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaPoleResidue_FromoaStringAppDef_oaPoleResidue(oaStringAppDef_oaPoleResidue** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaPoleResidue* data=*value; PyObject* bself = PyoaStringAppDef_oaPoleResidue_Type.tp_alloc(&PyoaStringAppDef_oaPoleResidue_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaPoleResidueObject* self = (PyoaStringAppDef_oaPoleResidueObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaPoleResidue_FromoaStringAppDef_oaPoleResidue(oaStringAppDef_oaPoleResidue* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaPoleResidue_Type.tp_alloc(&PyoaStringAppDef_oaPoleResidue_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaPoleResidueObject* self = (PyoaStringAppDef_oaPoleResidueObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaPoleResidue_get_doc[] = "Class: oaStringAppDef_oaPoleResidue, Function: get\n" " Paramegers: (oaPoleResidue,oaString)\n" " Calls: void get(const oaPoleResidue* object,oaString& value)\n" " Signature: get|void-void|cptr-oaPoleResidue,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaPoleResidue_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaPoleResidue data; int convert_status=PyoaStringAppDef_oaPoleResidue_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaPoleResidueObject* self=(PyoaStringAppDef_oaPoleResidueObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaPoleResidue p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaPoleResidue_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaPoleResidue_getDefault_doc[] = "Class: oaStringAppDef_oaPoleResidue, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaPoleResidue_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaPoleResidue data; int convert_status=PyoaStringAppDef_oaPoleResidue_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaPoleResidueObject* self=(PyoaStringAppDef_oaPoleResidueObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaPoleResidue_set_doc[] = "Class: oaStringAppDef_oaPoleResidue, Function: set\n" " Paramegers: (oaPoleResidue,oaString)\n" " Calls: void set(oaPoleResidue* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaPoleResidue,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaPoleResidue_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaPoleResidue data; int convert_status=PyoaStringAppDef_oaPoleResidue_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaPoleResidueObject* self=(PyoaStringAppDef_oaPoleResidueObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaPoleResidue p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaPoleResidue_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaPoleResidue_isNull_doc[] = "Class: oaStringAppDef_oaPoleResidue, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaPoleResidue_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaPoleResidue data; int convert_status=PyoaStringAppDef_oaPoleResidue_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaPoleResidue_assign_doc[] = "Class: oaStringAppDef_oaPoleResidue, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaPoleResidue_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaPoleResidue data; int convert_status=PyoaStringAppDef_oaPoleResidue_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaPoleResidue p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaPoleResidue_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaPoleResidue_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaPoleResidue_get,METH_VARARGS,oaStringAppDef_oaPoleResidue_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaPoleResidue_getDefault,METH_VARARGS,oaStringAppDef_oaPoleResidue_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaPoleResidue_set,METH_VARARGS,oaStringAppDef_oaPoleResidue_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaPoleResidue_tp_isNull,METH_VARARGS,oaStringAppDef_oaPoleResidue_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaPoleResidue_tp_assign,METH_VARARGS,oaStringAppDef_oaPoleResidue_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaPoleResidue_doc[] = "Class: oaStringAppDef_oaPoleResidue\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaPoleResidue)\n" " Calls: (const oaStringAppDef_oaPoleResidue&)\n" " Signature: oaStringAppDef_oaPoleResidue||cref-oaStringAppDef_oaPoleResidue,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaPoleResidue_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaPoleResidue", sizeof(PyoaStringAppDef_oaPoleResidueObject), 0, (destructor)oaStringAppDef_oaPoleResidue_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaPoleResidue_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaPoleResidue_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaPoleResidue_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaPoleResidue_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaPoleResidue_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaPoleResidue_static_find_doc[] = "Class: oaStringAppDef_oaPoleResidue, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaPoleResidue* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaPoleResidue|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaPoleResidue* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaPoleResidue|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaPoleResidue_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaPoleResiduep result= (oaStringAppDef_oaPoleResidue::find(p1.Data())); return PyoaStringAppDef_oaPoleResidue_FromoaStringAppDef_oaPoleResidue(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPoleResiduep result= (oaStringAppDef_oaPoleResidue::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaPoleResidue_FromoaStringAppDef_oaPoleResidue(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaPoleResidue, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaPoleResidue_static_get_doc[] = "Class: oaStringAppDef_oaPoleResidue, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaPoleResidue* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaPoleResidue|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaPoleResidue* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaPoleResidue|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaPoleResidue* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaPoleResidue|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaPoleResidue* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaPoleResidue|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaPoleResidue* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaPoleResidue|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaPoleResidue* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaPoleResidue|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaPoleResidue_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaPoleResiduep result= (oaStringAppDef_oaPoleResidue::get(p1.Data())); return PyoaStringAppDef_oaPoleResidue_FromoaStringAppDef_oaPoleResidue(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaPoleResiduep result= (oaStringAppDef_oaPoleResidue::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaPoleResidue_FromoaStringAppDef_oaPoleResidue(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaPoleResiduep result= (oaStringAppDef_oaPoleResidue::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaPoleResidue_FromoaStringAppDef_oaPoleResidue(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPoleResiduep result= (oaStringAppDef_oaPoleResidue::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaPoleResidue_FromoaStringAppDef_oaPoleResidue(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPoleResiduep result= (oaStringAppDef_oaPoleResidue::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaPoleResidue_FromoaStringAppDef_oaPoleResidue(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPoleResiduep result= (oaStringAppDef_oaPoleResidue::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaPoleResidue_FromoaStringAppDef_oaPoleResidue(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaPoleResidue, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaPoleResidue_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaPoleResidue_static_find,METH_VARARGS,oaStringAppDef_oaPoleResidue_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaPoleResidue_static_get,METH_VARARGS,oaStringAppDef_oaPoleResidue_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaPoleResidue_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaPoleResidue_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaPoleResidue\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaPoleResidue", (PyObject*)(&PyoaStringAppDef_oaPoleResidue_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaPoleResidue\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaPoleResidue_Type.tp_dict; for(method=oaStringAppDef_oaPoleResidue_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; } /******************************************************************** * Copyright 2002-2008 LSI Corporation * * 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 "pyoa_header.h" // ================================================================== // Wrapper Implementation for Class: oaStringAppDef_oaProp // ================================================================== // ================================================================== // Alloc/Dealloc Routines // ================================================================== // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaProp_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { try { int is_raw=(type==&PyoaStringAppDef_oaProp_Type); PyObject* bself = type->tp_alloc(type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaPropObject* self = (PyoaStringAppDef_oaPropObject*)bself; self->locks = NULL; self->borrow = 0; static char *kwlist [] = { NULL } ; // Case: (oaStringAppDef_oaProp) { PyParamoaStringAppDef_oaProp p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaProp_Convert,&p1)) { self->data=p1.Data(); self->value=&(self->data); return bself; } } PyErr_Clear(); // Case: () { if (PyArg_ParseTuple(args,(char*)"")) { self->data=NULL; self->value=&(self->data); return bself; } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Constructor found for class: oaStringAppDef_oaProp, Choices are:\n" " (oaStringAppDef_oaProp)\n" ); Py_DECREF(self); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static void oaStringAppDef_oaProp_tp_dealloc(PyoaStringAppDef_oaPropObject* self) { self->ob_type->tp_free((PyObject*)self); } // ------------------------------------------------------------------ static PyObject* oaStringAppDef_oaProp_tp_repr(PyObject *ob) { PyParamoaStringAppDef_oaProp value; int convert_status=PyoaStringAppDef_oaProp_Convert(ob,&value); assert(convert_status!=0); PyObject* result; char buffer[43]; sprintf(buffer,"<oaStringAppDef_oaProp::" DISPLAY_FORMAT ">",POINTER_AS_DISPLAY(value.DataCall())); result=PyString_FromString(buffer); return result; } // ------------------------------------------------------------------ static int oaStringAppDef_oaProp_tp_compare(PyObject *ob1,PyObject* ob2) { PyParamoaStringAppDef_oaProp v1; PyParamoaStringAppDef_oaProp v2; int convert_status1=PyoaStringAppDef_oaProp_Convert(ob1,&v1); int convert_status2=PyoaStringAppDef_oaProp_Convert(ob2,&v2); assert(convert_status1!=0); assert(convert_status2!=0); if (v1.DataCall()==v2.DataCall()) return 0; return 1; } // ------------------------------------------------------------------ int PyoaStringAppDef_oaProp_Convert(PyObject* ob,PyParamoaStringAppDef_oaProp* result) { if (ob == NULL) return 1; if (PyoaStringAppDef_oaProp_Check(ob)) { result->SetData( (oaStringAppDef_oaProp**) ((PyoaStringAppDef_oaPropObject*)ob)->value); return 1; } PyErr_SetString(PyExc_TypeError, "Convertion of parameter to class: oaStringAppDef_oaProp Failed"); return 0; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaProp_FromoaStringAppDef_oaProp(oaStringAppDef_oaProp** value,int borrow,PyObject* lock) { if (value && *value) { oaStringAppDef_oaProp* data=*value; PyObject* bself = PyoaStringAppDef_oaProp_Type.tp_alloc(&PyoaStringAppDef_oaProp_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaPropObject* self = (PyoaStringAppDef_oaPropObject*)bself; self->value = (oaObject**) value; self->data = NULL; self->locks = NULL; self->borrow = 0; // Ignore borrow flag, since we copied if (lock) PyoaLockObject(self->locks,lock); return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ PyObject* PyoaStringAppDef_oaProp_FromoaStringAppDef_oaProp(oaStringAppDef_oaProp* data) { if (data) { PyObject* bself = PyoaStringAppDef_oaProp_Type.tp_alloc(&PyoaStringAppDef_oaProp_Type,0); if (bself == NULL) return bself; PyoaStringAppDef_oaPropObject* self = (PyoaStringAppDef_oaPropObject*)bself; self->data = (oaObject*) data; self->value = &(self->data); self->borrow = 0; self->locks = NULL; return bself; } Py_INCREF(Py_None); return Py_None; } // ------------------------------------------------------------------ // FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaProp_get_doc[] = "Class: oaStringAppDef_oaProp, Function: get\n" " Paramegers: (oaProp,oaString)\n" " Calls: void get(const oaProp* object,oaString& value)\n" " Signature: get|void-void|cptr-oaProp,ref-oaString,\n" " This function returns the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaProp_get(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaProp data; int convert_status=PyoaStringAppDef_oaProp_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaPropObject* self=(PyoaStringAppDef_oaPropObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaProp p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaProp_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->get(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaProp_getDefault_doc[] = "Class: oaStringAppDef_oaProp, Function: getDefault\n" " Paramegers: (oaString)\n" " Calls: void getDefault(oaString& value) const\n" " Signature: getDefault|void-void|ref-oaString,\n" " BrowseData: 0,oaString\n" " This function fills out the default value for this string extension.\n" " value\n" " The string to be filled out with the default value\n" ; static PyObject* oaStringAppDef_oaProp_getDefault(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaProp data; int convert_status=PyoaStringAppDef_oaProp_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaPropObject* self=(PyoaStringAppDef_oaPropObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { data.DataCall()->getDefault(p1.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaProp_set_doc[] = "Class: oaStringAppDef_oaProp, Function: set\n" " Paramegers: (oaProp,oaString)\n" " Calls: void set(oaProp* object,const oaString& value)\n" " Signature: set|void-void|ptr-oaProp,cref-oaString,\n" " This function sets the value of this string extension.\n" " object\n" " The object type with which this extension is associated\n" " value\n" " The value of the string extension\n" " oacInvalidDesignObjectForAppDef\n" ; static PyObject* oaStringAppDef_oaProp_set(PyObject* ob, PyObject *args) { try { PyParamoaStringAppDef_oaProp data; int convert_status=PyoaStringAppDef_oaProp_Convert(ob,&data); assert(convert_status!=0); PyoaStringAppDef_oaPropObject* self=(PyoaStringAppDef_oaPropObject*)ob; if (!PyValidateDbObject(data.Data(),0)) return NULL; PyParamoaProp p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaProp_Convert,&p1, &PyoaString_Convert,&p2)) { if (!PyValidateDbObject(p1.Data(),1)) return NULL; data.DataCall()->set(p1.Data(),p2.Data()); Py_INCREF(Py_None); return Py_None; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaProp_isNull_doc[] = "Class: oaStringAppDef_oaProp, Function: isNull\n" " Parameters: () \n" " This functions returns 1 if the DbPointer is NULL, and 0 otherwise.\n" ; static PyObject* oaStringAppDef_oaProp_tp_isNull(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaProp data; int convert_status=PyoaStringAppDef_oaProp_Convert(ob,&data); assert(convert_status!=0); if (data.DataCall()==NULL) return PyInt_FromLong(1); else return PyInt_FromLong(0); } static char oaStringAppDef_oaProp_assign_doc[] = "Class: oaStringAppDef_oaProp, Function: set\n" " Paramegers: (oaDouble)\n" " This function sets the current value.\n" ; static PyObject* oaStringAppDef_oaProp_tp_assign(PyObject* ob, PyObject *args) { PyParamoaStringAppDef_oaProp data; int convert_status=PyoaStringAppDef_oaProp_Convert(ob,&data); assert(convert_status!=0); try { PyParamoaStringAppDef_oaProp p1; if (PyArg_ParseTuple(args,(char*)"O&", &PyoaStringAppDef_oaProp_Convert,&p1)) { data.Data()=p1.Data(); Py_INCREF(ob); return ob; } return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ // Function Methods Table: // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaProp_methodlist[] = { {"get",(PyCFunction)oaStringAppDef_oaProp_get,METH_VARARGS,oaStringAppDef_oaProp_get_doc}, {"getDefault",(PyCFunction)oaStringAppDef_oaProp_getDefault,METH_VARARGS,oaStringAppDef_oaProp_getDefault_doc}, {"set",(PyCFunction)oaStringAppDef_oaProp_set,METH_VARARGS,oaStringAppDef_oaProp_set_doc}, {"isNull",(PyCFunction)oaStringAppDef_oaProp_tp_isNull,METH_VARARGS,oaStringAppDef_oaProp_isNull_doc}, {"assign",(PyCFunction)oaStringAppDef_oaProp_tp_assign,METH_VARARGS,oaStringAppDef_oaProp_assign_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Object: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaProp_doc[] = "Class: oaStringAppDef_oaProp\n" " The oaStringAppDef class implements an application-specific extension to a particular type of data in a database.\n" " When these classes are created, a string field is added to each object of the specified dataType. The default value of the string field is the empty string. Applications can use the new string field for whatever purpose is necessary.\n" " For additional information on defining and using AppDefs, see oaAppDef and Extending the Database in the Programmer's Guide.\n" "Constructors:\n" " Paramegers: (oaStringAppDef_oaProp)\n" " Calls: (const oaStringAppDef_oaProp&)\n" " Signature: oaStringAppDef_oaProp||cref-oaStringAppDef_oaProp,\n" ; // ------------------------------------------------------------------ PyTypeObject PyoaStringAppDef_oaProp_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "oaStringAppDef_oaProp", sizeof(PyoaStringAppDef_oaPropObject), 0, (destructor)oaStringAppDef_oaProp_tp_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)oaStringAppDef_oaProp_tp_compare, /* tp_compare */ (reprfunc)oaStringAppDef_oaProp_tp_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_as_hash */ 0, /* tp_as_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ oaStringAppDef_oaProp_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompre */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ oaStringAppDef_oaProp_methodlist, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyoaAppDef_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ oaStringAppDef_oaProp_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; // ------------------------------------------------------------------ // Static FunctionMethods: // ------------------------------------------------------------------ // ------------------------------------------------------------------ static char oaStringAppDef_oaProp_static_find_doc[] = "Class: oaStringAppDef_oaProp, Function: find\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaProp* find(const oaString& name)\n" " Signature: find|ptr-oaStringAppDef_oaProp|cref-oaString,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' if it exists.\n" " name\n" " The name of the oaAppDef object to look for\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaProp* find(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: find|ptr-oaStringAppDef_oaProp|cref-oaString,cptr-oaAppObjectDef,\n" " This function returns an oaStringAppDef object with this dataType and the specified 'name' that is associated with the specified object extension 'objDef'.\n" " name\n" " The name of the oaAppDef object to look for\n" " objDef\n" " A constant pointer to the object extension\n" ; static PyObject* oaStringAppDef_oaProp_static_find(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaPropp result= (oaStringAppDef_oaProp::find(p1.Data())); return PyoaStringAppDef_oaProp_FromoaStringAppDef_oaProp(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPropp result= (oaStringAppDef_oaProp::find(p1.Data(),p2.Data())); return PyoaStringAppDef_oaProp_FromoaStringAppDef_oaProp(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaProp, function: find, Choices are:\n" " (oaString)\n" " (oaString,oaAppObjectDef)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static char oaStringAppDef_oaProp_static_get_doc[] = "Class: oaStringAppDef_oaProp, Function: get\n" " Paramegers: (oaString)\n" " Calls: oaStringAppDef_oaProp* get(const oaString& name)\n" " Signature: get|ptr-oaStringAppDef_oaProp|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString)\n" " Calls: oaStringAppDef_oaProp* get(const oaString& name,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaProp|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaProp* get(const oaString& name,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaProp|cref-oaString,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name . You can create a string extension on any object except another extension.\n" " name\n" " The name given to the oaStringAppDef object\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef)\n" " Calls: oaStringAppDef_oaProp* get(const oaString& name,const oaAppObjectDef* objDef)\n" " Signature: get|ptr-oaStringAppDef_oaProp|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString)\n" " Calls: oaStringAppDef_oaProp* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue)\n" " Signature: get|ptr-oaStringAppDef_oaProp|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" " Paramegers: (oaString,oaAppObjectDef,oaString,oaBoolean)\n" " Calls: oaStringAppDef_oaProp* get(const oaString& name,const oaAppObjectDef* objDef,const oaString& defValue,oaBoolean persist)\n" " Signature: get|ptr-oaStringAppDef_oaProp|cref-oaString,cptr-oaAppObjectDef,cref-oaString,simple-oaBoolean,\n" " This function constructs an oaStringAppDef class string extension with the specified name for the specified object extension.\n" " name\n" " The name of the string extension\n" " objDef\n" " The object extension with which to associate the extension\n" " defValue\n" " An optional default value\n" " persist\n" " Saves the oaStringAppDef data in the database\n" " oacAppDefExists\n" ; static PyObject* oaStringAppDef_oaProp_static_get(PyObject* ob, PyObject *args) { try { // Case: (oaString) { PyParamoaString p1; if (PyArg_ParseTuple(args,"O&", &PyoaString_Convert,&p1)) { oaStringAppDef_oaPropp result= (oaStringAppDef_oaProp::get(p1.Data())); return PyoaStringAppDef_oaProp_FromoaStringAppDef_oaProp(result); } } PyErr_Clear(); // Case: (oaString,oaString) { PyParamoaString p1; PyParamoaString p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2)) { oaStringAppDef_oaPropp result= (oaStringAppDef_oaProp::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaProp_FromoaStringAppDef_oaProp(result); } } PyErr_Clear(); // Case: (oaString,oaString,oaBoolean) { PyParamoaString p1; PyParamoaString p2; PyParamoaBoolean p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaString_Convert,&p2, &PyoaBoolean_Convert,&p3)) { oaStringAppDef_oaPropp result= (oaStringAppDef_oaProp::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaProp_FromoaStringAppDef_oaProp(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef) { PyParamoaString p1; PyParamoaAppObjectDef p2; if (PyArg_ParseTuple(args,"O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPropp result= (oaStringAppDef_oaProp::get(p1.Data(),p2.Data())); return PyoaStringAppDef_oaProp_FromoaStringAppDef_oaProp(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; if (PyArg_ParseTuple(args,"O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPropp result= (oaStringAppDef_oaProp::get(p1.Data(),p2.Data(),p3.Data())); return PyoaStringAppDef_oaProp_FromoaStringAppDef_oaProp(result); } } PyErr_Clear(); // Case: (oaString,oaAppObjectDef,oaString,oaBoolean) { PyParamoaString p1; PyParamoaAppObjectDef p2; PyParamoaString p3; PyParamoaBoolean p4; if (PyArg_ParseTuple(args,"O&O&O&O&", &PyoaString_Convert,&p1, &PyoaAppObjectDef_Convert,&p2, &PyoaString_Convert,&p3, &PyoaBoolean_Convert,&p4)) { if (!PyValidateDbObject(p2.Data(),2)) return NULL; oaStringAppDef_oaPropp result= (oaStringAppDef_oaProp::get(p1.Data(),p2.Data(),p3.Data(),p4.Data())); return PyoaStringAppDef_oaProp_FromoaStringAppDef_oaProp(result); } } PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "No Arg-Matching Function found for class: oaStringAppDef_oaProp, function: get, Choices are:\n" " (oaString)\n" " (oaString,oaString)\n" " (oaString,oaString,oaBoolean)\n" " (oaString,oaAppObjectDef)\n" " (oaString,oaAppObjectDef,oaString)\n" " (oaString,oaAppObjectDef,oaString,oaBoolean)\n" ); return NULL; } catch (oaException &excp) { PyErr_OpenAccess(excp); return NULL; } } // ------------------------------------------------------------------ static PyMethodDef oaStringAppDef_oaProp_staticmethodlist[] = { {"static_find",(PyCFunction)oaStringAppDef_oaProp_static_find,METH_VARARGS,oaStringAppDef_oaProp_static_find_doc}, {"static_get",(PyCFunction)oaStringAppDef_oaProp_static_get,METH_VARARGS,oaStringAppDef_oaProp_static_get_doc}, {NULL,NULL,0,NULL} }; // ------------------------------------------------------------------ // Type Init: // ------------------------------------------------------------------ int PyoaStringAppDef_oaProp_TypeInit(PyObject* mod_dict) { if (PyType_Ready(&PyoaStringAppDef_oaProp_Type)<0) { printf("** PyType_Ready failed for: oaStringAppDef_oaProp\n"); return -1; } if (PyDict_SetItemString(mod_dict,"oaStringAppDef_oaProp", (PyObject*)(&PyoaStringAppDef_oaProp_Type))<0) { printf("** Failed to add type name to module dictionary for: oaStringAppDef_oaProp\n"); return -1; } PyObject *dict, *value; PyMethodDef *method; dict=PyoaStringAppDef_oaProp_Type.tp_dict; for(method=oaStringAppDef_oaProp_staticmethodlist;method->ml_name!=NULL;method++) { value=PyCFunction_New(method,NULL); if (value==NULL) return -1; if (PyDict_SetItemString(dict,method->ml_name,value)!=0) { Py_DECREF(value); printf("** Failed to add static function to module dictionary for: %s\n", method->ml_name); return -1; } Py_DECREF(value); } return 0; }
[ "henrik@arcturus.(none)" ]
[ [ [ 1, 34550 ] ] ]
68e992f4149e0385611e7958a3c1e3647659773c
c5ecda551cefa7aaa54b787850b55a2d8fd12387
/src/WorkLayer/WebServer.cpp
f9d817470b0e9159a0613bee6ac70e8d92178a39
[]
no_license
firespeed79/easymule
b2520bfc44977c4e0643064bbc7211c0ce30cf66
3f890fa7ed2526c782cfcfabb5aac08c1e70e033
refs/heads/master
2021-05-28T20:52:15.983758
2007-12-05T09:41:56
2007-12-05T09:41:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
181,758
cpp
#include "stdafx.h" #include <locale.h> //#include "emule.h" #include "StringConversion.h" #include "WebServer.h" #include "ClientCredits.h" #include "ClientList.h" #include "DownloadQueue.h" #include "ED2KLink.h" //#include "emuledlg.h" #include "FriendList.h" #include "MD5Sum.h" #include "ini2.h" #include "Kademlia/Kademlia/Kademlia.h" #include "KademliaWnd.h" #include "KadSearchListCtrl.h" #include "kademlia/kademlia/Entry.h" #include "KnownFileList.h" #include "ListenSocket.h" #include "Log.h" #include "MenuCmds.h" #include "OtherFunctions.h" #include "Preferences.h" #include "Server.h" #include "ServerList.h" //#include "ServerWnd.h" #include "SearchList.h" //#include "SearchDlg.h" #include "SearchParams.h" #include "SharedFileList.h" #include "Sockets.h" //#include "StatisticsDlg.h" #include "Opcodes.h" #include "QArray.h" //#include "TransferWnd.h" #include "UploadQueue.h" #include "UpDownClient.h" #include "UserMsgs.h" #include "GlobalVariable.h" #include "GlobalVariable.h" #include "UIMessage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #define HTTPInit _T("Server: eMule\r\nConnection: close\r\nContent-Type: text/html\r\n") #define HTTPInitGZ _T("Server: eMule\r\nConnection: close\r\nContent-Type: text/html\r\nContent-Encoding: gzip\r\n") #define HTTPENCODING _T("utf-8") #define WEB_SERVER_TEMPLATES_VERSION 7 //SyruS CQArray-Sorting operators bool operator > (QueueUsers & first, QueueUsers & second) { return (first.sIndex.CompareNoCase(second.sIndex) > 0); } bool operator < (QueueUsers & first, QueueUsers & second) { return (first.sIndex.CompareNoCase(second.sIndex) < 0); } bool operator > (SearchFileStruct & first, SearchFileStruct & second) { return (first.m_strIndex.CompareNoCase(second.m_strIndex) > 0); } bool operator < (SearchFileStruct & first, SearchFileStruct & second) { return (first.m_strIndex.CompareNoCase(second.m_strIndex) < 0); } static BOOL WSdownloadColumnHidden[8]; static BOOL WSuploadColumnHidden[5]; static BOOL WSqueueColumnHidden[4]; static BOOL WSsharedColumnHidden[7]; static BOOL WSserverColumnHidden[10]; static BOOL WSsearchColumnHidden[4]; CWebServer::CWebServer(void) { m_Params.sLastModified.Empty(); m_Params.sETag.Empty(); m_iSearchSortby=3; m_bSearchAsc = false; m_bServerWorking = false; m_nIntruderDetect = 0; m_nStartTempDisabledTime = 0; m_bIsTempDisabled = false; CIni ini( thePrefs.GetConfigFile(),_T("WebServer")); ini.SerGet(true, WSdownloadColumnHidden, ARRSIZE(WSdownloadColumnHidden), _T("downloadColumnHidden")); ini.SerGet(true, WSuploadColumnHidden, ARRSIZE(WSuploadColumnHidden), _T("uploadColumnHidden")); ini.SerGet(true, WSqueueColumnHidden, ARRSIZE(WSqueueColumnHidden), _T("queueColumnHidden")); ini.SerGet(true, WSsearchColumnHidden, ARRSIZE(WSsearchColumnHidden), _T("searchColumnHidden")); ini.SerGet(true, WSsharedColumnHidden, ARRSIZE(WSsharedColumnHidden), _T("sharedColumnHidden")); ini.SerGet(true, WSserverColumnHidden, ARRSIZE(WSserverColumnHidden), _T("serverColumnHidden")); m_Params.bShowUploadQueue = ini.GetBool(_T("ShowUploadQueue"),false); m_Params.bShowUploadQueueBanned = ini.GetBool(_T("ShowUploadQueueBanned"),false); m_Params.bShowUploadQueueFriend = ini.GetBool(_T("ShowUploadQueueFriend"),false); m_Params.bDownloadSortReverse = ini.GetBool(_T("DownloadSortReverse"),true); m_Params.bUploadSortReverse = ini.GetBool(_T("UploadSortReverse"),true); m_Params.bQueueSortReverse = ini.GetBool(_T("QueueSortReverse"),true); m_Params.bServerSortReverse = ini.GetBool(_T("ServerSortReverse"),true); m_Params.bSharedSortReverse = ini.GetBool(_T("SharedSortReverse"),true); m_Params.DownloadSort = (DownloadSort)ini.GetInt(_T("DownloadSort"),DOWN_SORT_NAME); m_Params.UploadSort = (UploadSort)ini.GetInt(_T("UploadSort"),UP_SORT_FILENAME); m_Params.QueueSort = (QueueSort)ini.GetInt(_T("QueueSort"),QU_SORT_FILENAME); m_Params.ServerSort = (ServerSort)ini.GetInt(_T("ServerSort"),SERVER_SORT_NAME); m_Params.SharedSort = (SharedSort)ini.GetInt(_T("SharedSort"),SHARED_SORT_NAME); } CWebServer::~CWebServer(void) { // save layout settings CIni ini( thePrefs.GetConfigFile(), _T("WebServer")); ini.WriteBool( _T("ShowUploadQueue"), m_Params.bShowUploadQueue ); ini.WriteBool( _T("ShowUploadQueueBanned"), m_Params.bShowUploadQueueBanned ); ini.WriteBool( _T("ShowUploadQueueFriend"), m_Params.bShowUploadQueueFriend ); ini.WriteBool( _T("DownloadSortReverse"), m_Params.bDownloadSortReverse ); ini.WriteBool( _T("UploadSortReverse"), m_Params.bUploadSortReverse ); ini.WriteBool( _T("QueueSortReverse"), m_Params.bQueueSortReverse ); ini.WriteBool( _T("ServerSortReverse"), m_Params.bServerSortReverse ); ini.WriteBool( _T("SharedSortReverse"), m_Params.bSharedSortReverse ); ini.WriteInt( _T("DownloadSort"), m_Params.DownloadSort); ini.WriteInt( _T("UploadSort"), m_Params.UploadSort); ini.WriteInt( _T("QueueSort"), m_Params.QueueSort); ini.WriteInt( _T("ServerSort"), m_Params.ServerSort); ini.WriteInt( _T("SharedSort"), m_Params.SharedSort); if (m_bServerWorking) StopSockets(); } void CWebServer::SaveWIConfigArray(BOOL array[], int size, LPCTSTR key) { CIni ini(thePrefs.GetConfigFile(), _T("WebServer")); ini.SerGet(false, array, size, key); } void CWebServer::ReloadTemplates() { CString sPrevLocale(_tsetlocale(LC_TIME, NULL)); _tsetlocale(LC_TIME, _T("English")); CTime t = CTime::GetCurrentTime(); m_Params.sLastModified = t.FormatGmt("%a, %d %b %Y %H:%M:%S GMT"); m_Params.sETag = MD5Sum(m_Params.sLastModified).GetHash(); _tsetlocale(LC_TIME, sPrevLocale); CString sFile = thePrefs.GetTemplate(); CStdioFile file; if (file.Open(sFile, CFile::modeRead|CFile::shareDenyWrite|CFile::typeText)) { CString sAll, sLine; for(;;) { if(!file.ReadString(sLine)) break; sAll += sLine; sAll += _T('\n'); } file.Close(); CString sVersion = _LoadTemplate(sAll,_T("TMPL_VERSION")); long lVersion = _tstol(sVersion); if(lVersion < WEB_SERVER_TEMPLATES_VERSION) { if(thePrefs.GetWSIsEnabled() || m_bServerWorking) { CString buffer; buffer.Format(GetResString(IDS_WS_ERR_LOADTEMPLATE), sFile); AddLogLine(true, buffer); AfxMessageBox(buffer ,MB_OK); } if (m_bServerWorking) StopSockets(); m_bServerWorking = false; thePrefs.SetWSIsEnabled(false); } else { m_Templates.sHeader = _LoadTemplate(sAll,_T("TMPL_HEADER")); m_Templates.sHeaderStylesheet = _LoadTemplate(sAll,_T("TMPL_HEADER_STYLESHEET")); m_Templates.sFooter = _LoadTemplate(sAll,_T("TMPL_FOOTER")); m_Templates.sServerList = _LoadTemplate(sAll,_T("TMPL_SERVER_LIST")); m_Templates.sServerLine = _LoadTemplate(sAll,_T("TMPL_SERVER_LINE")); m_Templates.sTransferImages = _LoadTemplate(sAll,_T("TMPL_TRANSFER_IMAGES")); m_Templates.sTransferList = _LoadTemplate(sAll,_T("TMPL_TRANSFER_LIST")); m_Templates.sTransferDownHeader = _LoadTemplate(sAll,_T("TMPL_TRANSFER_DOWN_HEADER")); m_Templates.sTransferDownFooter = _LoadTemplate(sAll,_T("TMPL_TRANSFER_DOWN_FOOTER")); m_Templates.sTransferDownLine = _LoadTemplate(sAll,_T("TMPL_TRANSFER_DOWN_LINE")); m_Templates.sTransferUpHeader = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_HEADER")); m_Templates.sTransferUpFooter = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_FOOTER")); m_Templates.sTransferUpLine = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_LINE")); m_Templates.sTransferUpQueueShow = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_QUEUE_SHOW")); m_Templates.sTransferUpQueueHide = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_QUEUE_HIDE")); m_Templates.sTransferUpQueueLine = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_QUEUE_LINE")); m_Templates.sTransferUpQueueBannedShow = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_QUEUE_BANNED_SHOW")); m_Templates.sTransferUpQueueBannedHide = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_QUEUE_BANNED_HIDE")); m_Templates.sTransferUpQueueBannedLine = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_QUEUE_BANNED_LINE")); m_Templates.sTransferUpQueueFriendShow = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_QUEUE_FRIEND_SHOW")); m_Templates.sTransferUpQueueFriendHide = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_QUEUE_FRIEND_HIDE")); m_Templates.sTransferUpQueueFriendLine = _LoadTemplate(sAll,_T("TMPL_TRANSFER_UP_QUEUE_FRIEND_LINE")); m_Templates.sSharedList = _LoadTemplate(sAll,_T("TMPL_SHARED_LIST")); m_Templates.sSharedLine = _LoadTemplate(sAll,_T("TMPL_SHARED_LINE")); m_Templates.sGraphs = _LoadTemplate(sAll,_T("TMPL_GRAPHS")); m_Templates.sLog = _LoadTemplate(sAll,_T("TMPL_LOG")); m_Templates.sServerInfo = _LoadTemplate(sAll,_T("TMPL_SERVERINFO")); m_Templates.sDebugLog = _LoadTemplate(sAll,_T("TMPL_DEBUGLOG")); m_Templates.sStats = _LoadTemplate(sAll,_T("TMPL_STATS")); m_Templates.sPreferences = _LoadTemplate(sAll,_T("TMPL_PREFERENCES")); m_Templates.sLogin = _LoadTemplate(sAll,_T("TMPL_LOGIN")); m_Templates.sAddServerBox = _LoadTemplate(sAll,_T("TMPL_ADDSERVERBOX")); m_Templates.sSearch = _LoadTemplate(sAll,_T("TMPL_SEARCH")); m_Templates.iProgressbarWidth = (uint16)_tstoi(_LoadTemplate(sAll,_T("PROGRESSBARWIDTH"))); m_Templates.sSearchHeader = _LoadTemplate(sAll,_T("TMPL_SEARCH_RESULT_HEADER")); m_Templates.sSearchResultLine = _LoadTemplate(sAll,_T("TMPL_SEARCH_RESULT_LINE")); m_Templates.sProgressbarImgs = _LoadTemplate(sAll,_T("PROGRESSBARIMGS")); m_Templates.sProgressbarImgsPercent = _LoadTemplate(sAll,_T("PROGRESSBARPERCENTIMG")); m_Templates.sCatArrow= _LoadTemplate(sAll,_T("TMPL_CATARROW")); m_Templates.sDownArrow= _LoadTemplate(sAll,_T("TMPL_DOWNARROW")); m_Templates.sUpArrow= _LoadTemplate(sAll,_T("TMPL_UPARROW")); m_Templates.strDownDoubleArrow = _LoadTemplate(sAll,_T("TMPL_DNDOUBLEARROW")); m_Templates.strUpDoubleArrow = _LoadTemplate(sAll,_T("TMPL_UPDOUBLEARROW")); m_Templates.sKad = _LoadTemplate(sAll,_T("TMPL_KADDLG")); m_Templates.sBootstrapLine= _LoadTemplate(sAll,_T("TMPL_BOOTSTRAPLINE")); m_Templates.sMyInfoLog= _LoadTemplate(sAll,_T("TMPL_MYINFO")); m_Templates.sCommentList= _LoadTemplate(sAll,_T("TMPL_COMMENTLIST")); m_Templates.sCommentListLine= _LoadTemplate(sAll,_T("TMPL_COMMENTLIST_LINE")); m_Templates.sProgressbarImgsPercent.Replace(_T("[PROGRESSGIFNAME]"),_T("%s")); m_Templates.sProgressbarImgsPercent.Replace(_T("[PROGRESSGIFINTERNAL]"),_T("%i")); m_Templates.sProgressbarImgs.Replace(_T("[PROGRESSGIFNAME]"),_T("%s")); m_Templates.sProgressbarImgs.Replace(_T("[PROGRESSGIFINTERNAL]"),_T("%i")); } } else if(m_bServerWorking) { AddLogLine(true, GetResString(IDS_WEB_ERR_CANTLOAD), sFile); StopSockets(); m_bServerWorking = false; thePrefs.SetWSIsEnabled(false); } } CString CWebServer::_LoadTemplate(CString sAll, CString sTemplateName) { CString sRet; int nStart = sAll.Find(_T("<--") + sTemplateName + _T("-->")); int nEnd = sAll.Find(_T("<--") + sTemplateName + _T("_END-->")); if(nStart != -1 && nEnd != -1 && nStart<nEnd) { nStart += sTemplateName.GetLength() + 7; sRet = sAll.Mid(nStart, nEnd - nStart - 1); } else { if (sTemplateName=="TMPL_VERSION") AddLogLine(true, GetResString(IDS_WS_ERR_LOADTEMPLATE), sTemplateName); if (nStart==-1) AddLogLine(false, GetResString(IDS_WEB_ERR_CANTLOAD), sTemplateName); } return sRet; } void CWebServer::RestartServer() { //Cax2 - restarts the server with the new port settings StopSockets(); if (m_bServerWorking) StartSockets(this); } void CWebServer::StartServer(void) { if(m_bServerWorking != thePrefs.GetWSIsEnabled()) m_bServerWorking = thePrefs.GetWSIsEnabled(); else return; if (m_bServerWorking) { ReloadTemplates(); if (m_bServerWorking) { StartSockets(this); m_nIntruderDetect = 0; m_nStartTempDisabledTime = 0; m_bIsTempDisabled = false; } } else StopSockets(); if(thePrefs.GetWSIsEnabled() && m_bServerWorking) AddLogLine(false, _T("%s: %s"),_GetPlainResString(IDS_PW_WS), _GetPlainResString(IDS_ENABLED).MakeLower()); else AddLogLine(false, _T("%s: %s"),_GetPlainResString(IDS_PW_WS), _GetPlainResString(IDS_DISABLED).MakeLower()); } void CWebServer::_RemoveServer(CString sIP, int nPort) { /*CServer* server=*/CGlobalVariable::serverlist->GetServerByAddress(sIP, (uint16)nPort); // Comment UI //if (server!=NULL) // SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION, WEBGUIIA_SERVER_REMOVE, (LPARAM)server); } void CWebServer::_AddToStatic(CString sIP, int nPort) { /*CServer* server=*/CGlobalVariable::serverlist->GetServerByAddress(sIP, (uint16)nPort); // Comment UI //if (server!=NULL) // SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION, WEBGUIIA_ADD_TO_STATIC, (LPARAM)server); } void CWebServer::_RemoveFromStatic(CString sIP, int nPort) { /*CServer* server=*/CGlobalVariable::serverlist->GetServerByAddress(sIP, (uint16)nPort); // Comment UI //if (server!=NULL) // SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_REMOVE_FROM_STATIC, (LPARAM)server); } void CWebServer::AddStatsLine(UpDown line) { m_Params.PointsForWeb.Add(line); if(m_Params.PointsForWeb.GetCount() > WEB_GRAPH_WIDTH) m_Params.PointsForWeb.RemoveAt(0); } CString CWebServer::_SpecialChars(CString str, bool noquote /*=false*/) { str.Replace(_T("&"),_T("&amp;")); str.Replace(_T("<"),_T("&lt;")); str.Replace(_T(">"),_T("&gt;")); str.Replace(_T("\""),_T("&quot;")); if(noquote) { str.Replace(_T("'"), _T("&#8217;")); str.Replace(_T("\n"), _T("\\n")); } return str; } void CWebServer::_ConnectToServer(CString sIP, int nPort) { /*CServer* server=*/CGlobalVariable::serverlist->GetServerByAddress(sIP, (uint16)nPort); // Comment UI //if (server!=NULL) // SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_CONNECTTOSERVER,(LPARAM)server); } void CWebServer::ProcessURL(ThreadData Data) { if (CGlobalVariable::m_app_state!=APP_STATE_RUNNING) return; CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return; SetThreadLocale(thePrefs.GetLanguageID()); //(0.29b)////////////////////////////////////////////////////////////////// // Here we are in real trouble! We are accessing the entire emule main thread // data without any syncronization!! Either we use the message pump for m_pdlgEmule // or use some hundreds of critical sections... For now, an exception handler // shoul avoid the worse things. ////////////////////////////////////////////////////////////////////////// CoInitialize(NULL); #ifndef _DEBUG try{ #endif bool isUseGzip = thePrefs.GetWebUseGzip(); bool justAddLink,login=false; CString Out; CString OutE; // List Entry Templates CString OutS; // ServerStatus Templates TCHAR *gzipOut = NULL; long gzipLen=0; CString HTTPProcessData; srand ( time(NULL) ); USES_CONVERSION; uint32 myip= inet_addr(T2CA(ipstr(Data.inadr))); DWORD now=::GetTickCount(); // check for being banned int myfaults=0; int i=0; while (i<pThis->m_Params.badlogins.GetSize() ) { if ( pThis->m_Params.badlogins[i].timestamp < now-MIN2MS(15) ) { pThis->m_Params.badlogins.RemoveAt(i); // remove outdated entries continue; } if ( pThis->m_Params.badlogins[i].datalen==myip) myfaults++; i++; } if (myfaults>4) { Data.pSocket->SendContent(T2CA(HTTPInit), _GetPlainResString(IDS_ACCESSDENIED)); CoUninitialize(); return; } justAddLink=false; long lSession = 0; if(!_ParseURL(Data.sURL, _T("ses")).IsEmpty()) lSession = _tstol(_ParseURL(Data.sURL, _T("ses"))); if (_ParseURL(Data.sURL, _T("w")) == _T("password")) { CString test=MD5Sum(_ParseURL(Data.sURL, _T("p"))).GetHash(); CString ip=ipstr(Data.inadr); if (_ParseURL(Data.sURL, _T("c")) != _T("")) { // just sent password to add link remotely. Don't start a session. justAddLink = true; } if(MD5Sum(_ParseURL(Data.sURL, _T("p"))).GetHash() == thePrefs.GetWSPass()) { if (!justAddLink) { // user wants to login Session ses; ses.admin=true; ses.startTime = CTime::GetCurrentTime(); ses.lSession = lSession = GetRandomUInt32(); ses.lastcat= 0- thePrefs.GetCatFilter(0); pThis->m_Params.Sessions.Add(ses); } // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_UPDATEMYINFO,0); AddLogLine(true,GetResString(IDS_WEB_ADMINLOGIN)+_T(" (%s)"),ip); login=true; } else if(thePrefs.GetWSIsLowUserEnabled() && thePrefs.GetWSLowPass()!=_T("") && MD5Sum(_ParseURL(Data.sURL, _T("p"))).GetHash() == thePrefs.GetWSLowPass()) { Session ses; ses.admin=false; ses.startTime = CTime::GetCurrentTime(); ses.lSession = lSession = GetRandomUInt32(); pThis->m_Params.Sessions.Add(ses); // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_UPDATEMYINFO,0); AddLogLine(true,GetResString(IDS_WEB_GUESTLOGIN)+_T(" (%s)"),ip); login=true; } else { LogWarning(LOG_STATUSBAR,GetResString(IDS_WEB_BADLOGINATTEMPT)+_T(" (%s)"),ip); BadLogin newban={myip, now}; // save failed attempt (ip,time) pThis->m_Params.badlogins.Add(newban); login=false; myfaults++; if (myfaults>4) { Data.pSocket->SendContent(T2CA(HTTPInit), _GetPlainResString(IDS_ACCESSDENIED)); CoUninitialize(); return; } } isUseGzip = false; // [Julien] if (login) { // on login, forget previous failed attempts i=0; while (i<pThis->m_Params.badlogins.GetSize() ) { if ( pThis->m_Params.badlogins[i].datalen==myip ) { pThis->m_Params.badlogins.RemoveAt(i); continue; } i++; } } } CString sSession; sSession.Format(_T("%ld"), lSession); if (_ParseURL(Data.sURL, _T("w")) == "logout") _RemoveSession(Data, lSession); if(_IsLoggedIn(Data, lSession)) { if (_ParseURL(Data.sURL, _T("w")) == "close" && IsSessionAdmin(Data,sSession) && thePrefs.GetWebAdminAllowedHiLevFunc() ) { CGlobalVariable::m_app_state = APP_STATE_SHUTTINGDOWN; _RemoveSession(Data, lSession); // send answer ... Out += _GetLoginScreen(Data); Data.pSocket->SendContent(T2CA(HTTPInit), Out); // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WM_CLOSE,0,0); CoUninitialize(); return; } else if (_ParseURL(Data.sURL, _T("w")) == _T("shutdown") && IsSessionAdmin(Data,sSession)) { _RemoveSession(Data, lSession); // send answer ... Out += _GetLoginScreen(Data); Data.pSocket->SendContent(T2CA(HTTPInit), Out); // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION, WEBGUIIA_WINFUNC,1); CoUninitialize(); return; } else if (_ParseURL(Data.sURL, _T("w")) == _T("reboot") && IsSessionAdmin(Data,sSession)) { _RemoveSession(Data, lSession); // send answer ... Out += _GetLoginScreen(Data); Data.pSocket->SendContent(T2CA(HTTPInit), Out); // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION, WEBGUIIA_WINFUNC,2); CoUninitialize(); return; } else if (_ParseURL(Data.sURL, _T("w")) == _T("commentlist")) { CString Out=_GetCommentlist(Data); if (!Out.IsEmpty()) { Data.pSocket->SendContent(T2CA(HTTPInit), Out); CoUninitialize(); return; } } else if (_ParseURL(Data.sURL, _T("w")) == _T("getfile") && IsSessionAdmin(Data,sSession)) { uchar FileHash[16]; CKnownFile* kf=CGlobalVariable::sharedfiles->GetFileByID(_GetFileHash(_ParseURL(Data.sURL, _T("filehash")),FileHash) ); if (kf) { if (thePrefs.GetMaxWebUploadFileSizeMB() != 0 && kf->GetFileSize() > (uint64)thePrefs.GetMaxWebUploadFileSizeMB()*1024*1024) { Data.pSocket->SendReply( "HTTP/1.1 403 Forbidden\r\n" ); CoUninitialize(); return; } else { CFile file; if(file.Open(kf->GetFilePath(), CFile::modeRead|CFile::shareDenyWrite|CFile::typeBinary)) { EMFileSize filesize= kf->GetFileSize(); #define SENDFILEBUFSIZE 2048 char* buffer=(char*)malloc(SENDFILEBUFSIZE); if (!buffer) { Data.pSocket->SendReply( "HTTP/1.1 500 Internal Server Error\r\n" ); CoUninitialize(); return; } char szBuf[512]; int nLen = _snprintf(szBuf, _countof(szBuf), "HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nContent-Description: \"%s\"\r\nContent-Disposition: attachment; filename=\"%s\";\r\nContent-Transfer-Encoding: binary\r\nContent-Length: %I64u\r\n\r\n", T2CA(kf->GetFileName()), T2CA(kf->GetFileName()), (uint64)filesize); Data.pSocket->SendData(szBuf, nLen); DWORD r=1; while (filesize > (uint64)0 && r) { r=file.Read(buffer,SENDFILEBUFSIZE); filesize -= (uint64)r; Data.pSocket->SendData(buffer, r); } file.Close(); free(buffer); CoUninitialize(); return; } else { Data.pSocket->SendReply( "HTTP/1.1 404 File not found\r\n" ); CoUninitialize(); return; } } } } Out += _GetHeader(Data, lSession); CString sPage = _ParseURL(Data.sURL, _T("w")); if (sPage == _T("server")) Out += _GetServerList(Data); else if (sPage == _T("shared")) Out += _GetSharedFilesList(Data); else if (sPage == _T("transfer")) Out += _GetTransferList(Data); else if (sPage == _T("search")) Out += _GetSearch(Data); else if (sPage == _T("graphs")) Out += _GetGraphs(Data); else if (sPage == _T("log")) Out += _GetLog(Data); if (sPage == _T("sinfo")) Out += _GetServerInfo(Data); if (sPage == _T("debuglog")) Out += _GetDebugLog(Data); if (sPage == _T("myinfo")) Out += _GetMyInfo(Data); if (sPage == _T("stats")) Out += _GetStats(Data); if (sPage == _T("kad")) Out += _GetKadDlg(Data); if (sPage == _T("options")) { isUseGzip = false; Out += _GetPreferences(Data); } Out += _GetFooter(Data); if (sPage.IsEmpty()) isUseGzip = false; if(isUseGzip) { bool bOk = false; try { const CStringA* pstrOutA; CStringA strA(wc2utf8(Out)); pstrOutA = &strA; uLongf destLen = pstrOutA->GetLength() + 1024; gzipOut = new TCHAR[destLen]; if(_GzipCompress((Bytef*)gzipOut, &destLen, (const Bytef*)(LPCSTR)*pstrOutA, pstrOutA->GetLength(), Z_DEFAULT_COMPRESSION) == Z_OK) { bOk = true; gzipLen = destLen; } } catch(...) { ASSERT(0); } if(!bOk) { isUseGzip = false; delete[] gzipOut; gzipOut = NULL; } } } else if(justAddLink && login) { Out += _GetRemoteLinkAddedOk(Data); } else { isUseGzip = false; if(justAddLink) Out += _GetRemoteLinkAddedFailed(Data); else Out += _GetLoginScreen(Data); } // send answer ... if(!isUseGzip) Data.pSocket->SendContent(T2CA(HTTPInit), Out); else Data.pSocket->SendContent(T2CA(HTTPInitGZ), gzipOut, gzipLen); delete[] gzipOut; #ifndef _DEBUG } catch(...){ AddDebugLogLine( DLP_VERYHIGH, false, _T("*** Unknown exception in CWebServer::ProcessURL\n") ); ASSERT(0); } #endif CoUninitialize(); } CString CWebServer::_ParseURLArray(CString URL, CString fieldname) { CString res,temp; while (URL.GetLength()>0) { int pos=URL.MakeLower().Find(fieldname.MakeLower() +_T("=")); if (pos>-1) { temp=_ParseURL(URL,fieldname); if (temp==_T("")) break; res.Append(temp+_T("|")); URL.Delete(pos,10); } else break; } return res; } CString CWebServer::_ParseURL(CString URL, CString fieldname) { CString value = _T(""); CString Parameter = _T(""); int findPos = -1; int findLength = 0; if (URL.Find(_T("?")) > -1) { Parameter = URL.Mid(URL.Find(_T("?"))+1, URL.GetLength()-URL.Find(_T("?"))-1); // search the fieldname beginning / middle and strip the rest... if (Parameter.Find(fieldname + _T("=")) == 0) { findPos = 0; findLength = fieldname.GetLength() + 1; } if (Parameter.Find(_T("&") + fieldname + _T("=")) > -1) { findPos = Parameter.Find(_T("&") + fieldname + _T("=")); findLength = fieldname.GetLength() + 2; } if (findPos > -1) { Parameter = Parameter.Mid(findPos + findLength, Parameter.GetLength()); if (Parameter.Find(_T("&")) > -1) { Parameter = Parameter.Mid(0, Parameter.Find(_T("&"))); } value = Parameter; // decode value ... value.Replace(_T("+"), _T(" ")); value=URLDecode(value); } } value = OptUtf8ToStr(value); return value; } CString CWebServer::_GetHeader(ThreadData Data, long lSession) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString sSession; sSession.Format(_T("%ld"), lSession); CString Out = pThis->m_Templates.sHeader; Out.Replace(_T("[CharSet]"), HTTPENCODING ); // Auto-refresh code CString sRefresh, strDummyNumber, strCat; CString sPage = _ParseURL(Data.sURL, _T("w")); bool bAdmin = IsSessionAdmin(Data,sSession); strCat=_T("&cat=") +_ParseURL(Data.sURL, _T("cat")); if (sPage == _T("options") || sPage == _T("stats") || sPage == _T("password")) sRefresh.Format(_T("0")); else sRefresh.Format(_T("%d"), thePrefs.GetWebPageRefresh()*1000); strDummyNumber.Format(_T("%d"), rand()); CString strVersionCheck; // Comment UI //strVersionCheck.Format(_T("/en/version_check.php?version=%i&language=%i"),theApp.m_uCurVersionCheck,thePrefs.GetLanguageID()); strVersionCheck = thePrefs.GetVersionCheckBaseURL()+strVersionCheck; Out.Replace(_T("[admin]"), (bAdmin && thePrefs.GetWebAdminAllowedHiLevFunc() ) ? _T("admin") : _T("")); Out.Replace(_T("[Session]"), sSession); Out.Replace(_T("[RefreshVal]"), sRefresh); Out.Replace(_T("[wCommand]"), _ParseURL(Data.sURL, _T("w")) + strCat + _T("&dummy=") + strDummyNumber); Out.Replace(_T("[eMuleAppName]"), _T("eMule")); Out.Replace(_T("[version]"), CGlobalVariable::GetCurVersionLong()); Out.Replace(_T("[StyleSheet]"), pThis->m_Templates.sHeaderStylesheet); Out.Replace(_T("[WebControl]"), _GetPlainResString(IDS_WEB_CONTROL)); Out.Replace(_T("[Transfer]"), _GetPlainResString(IDS_CD_TRANS)); Out.Replace(_T("[Server]"), _GetPlainResString(IDS_SV_SERVERLIST)); Out.Replace(_T("[Shared]"), _GetPlainResString(IDS_SHAREDFILES)); Out.Replace(_T("[Graphs]"), _GetPlainResString(IDS_GRAPHS)); Out.Replace(_T("[Log]"), _GetPlainResString(IDS_SV_LOG)); Out.Replace(_T("[ServerInfo]"), _GetPlainResString(IDS_SV_SERVERINFO)); Out.Replace(_T("[DebugLog]"), _GetPlainResString(IDS_SV_DEBUGLOG)); Out.Replace(_T("[MyInfo]"), _GetPlainResString(IDS_MYINFO)); Out.Replace(_T("[Stats]"), _GetPlainResString(IDS_SF_STATISTICS)); Out.Replace(_T("[Options]"), _GetPlainResString(IDS_EM_PREFS)); Out.Replace(_T("[Ed2klink]"), _GetPlainResString(IDS_SW_LINK)); Out.Replace(_T("[Close]"), _GetPlainResString(IDS_WEB_SHUTDOWN)); Out.Replace(_T("[Reboot]"), _GetPlainResString(IDS_WEB_REBOOT)); Out.Replace(_T("[Shutdown]"), _GetPlainResString(IDS_WEB_SHUTDOWNSYSTEM)); Out.Replace(_T("[WebOptions]"), _GetPlainResString(IDS_WEB_ADMINMENU)); Out.Replace(_T("[Logout]"), _GetPlainResString(IDS_WEB_LOGOUT)); Out.Replace(_T("[Search]"), _GetPlainResString(IDS_SW_SEARCHBOX)); Out.Replace(_T("[Download]"), _GetPlainResString(IDS_SW_DOWNLOAD)); Out.Replace(_T("[Start]"), _GetPlainResString(IDS_SW_START)); Out.Replace(_T("[Version]"), _GetPlainResString(IDS_VERSION)); Out.Replace(_T("[VersionCheck]"), strVersionCheck); Out.Replace(_T("[Kad]"), _GetPlainResString(IDS_KADEMLIA)); Out.Replace(_T("[FileIsHashing]"), _GetPlainResString(IDS_HASHING)); Out.Replace(_T("[FileIsErroneous]"), _GetPlainResString(IDS_ERRORLIKE)); Out.Replace(_T("[FileIsCompleting]"), _GetPlainResString(IDS_COMPLETING)); Out.Replace(_T("[FileDetails]"), _GetPlainResString(IDS_FD_TITLE)); Out.Replace(_T("[FileComments]"), _GetPlainResString(IDS_CMT_SHOWALL)); Out.Replace(_T("[ClearCompleted]"), _GetPlainResString(IDS_DL_CLEAR)); Out.Replace(_T("[RunFile]"), _GetPlainResString(IDS_DOWNLOAD)); Out.Replace(_T("[Resume]"), _GetPlainResString(IDS_DL_RESUME)); Out.Replace(_T("[Stop]"), _GetPlainResString(IDS_DL_STOP)); Out.Replace(_T("[Pause]"), _GetPlainResString(IDS_DL_PAUSE)); Out.Replace(_T("[ConfirmCancel]"), _GetPlainResString(IDS_Q_CANCELDL2)); Out.Replace(_T("[Cancel]"), _GetPlainResString(IDS_MAIN_BTN_CANCEL)); Out.Replace(_T("[GetFLC]"), _GetPlainResString(IDS_DOWNLOADMOVIECHUNKS)); Out.Replace(_T("[Rename]"), _GetPlainResString(IDS_RENAME)); Out.Replace(_T("[Connect]"), _GetPlainResString(IDS_IRC_CONNECT)); Out.Replace(_T("[ConfirmRemove]"), _GetPlainResString(IDS_WEB_CONFIRM_REMOVE_SERVER)); Out.Replace(_T("[ConfirmClose]"), _GetPlainResString(IDS_WEB_MAIN_CLOSE)); Out.Replace(_T("[ConfirmReboot]"), _GetPlainResString(IDS_WEB_MAIN_REBOOT)); Out.Replace(_T("[ConfirmShutdown]"), _GetPlainResString(IDS_WEB_MAIN_SHUTDOWN)); Out.Replace(_T("[RemoveServer]"), _GetPlainResString(IDS_REMOVETHIS)); Out.Replace(_T("[StaticServer]"), _GetPlainResString(IDS_STATICSERVER)); Out.Replace(_T("[Friend]"), _GetPlainResString(IDS_PW_FRIENDS)); Out.Replace(_T("[PriorityVeryLow]"), _GetPlainResString(IDS_PRIOVERYLOW)); Out.Replace(_T("[PriorityLow]"), _GetPlainResString(IDS_PRIOLOW)); Out.Replace(_T("[PriorityNormal]"), _GetPlainResString(IDS_PRIONORMAL)); Out.Replace(_T("[PriorityHigh]"), _GetPlainResString(IDS_PRIOHIGH)); Out.Replace(_T("[PriorityRelease]"), _GetPlainResString(IDS_PRIORELEASE)); Out.Replace(_T("[PriorityAuto]"), _GetPlainResString(IDS_PRIOAUTO)); CString HTTPConState,HTTPConText,HTTPHelp; CString HTTPHelpU = _T("0"); CString HTTPHelpM = _T("0"); CString HTTPHelpV = _T("0"); CString HTTPHelpF = _T("0"); TCHAR HTTPHeader[100] = _T(""); CString sCmd = _ParseURL(Data.sURL, _T("c")); bool disconnectissued = (sCmd.CompareNoCase(_T("disconnect")) == 0); bool connectissued = (sCmd.CompareNoCase(_T("connect")) == 0); if ((CGlobalVariable::serverconnect->IsConnecting() && !disconnectissued) || connectissued) { HTTPConState = "connecting"; HTTPConText = _GetPlainResString(IDS_CONNECTING); } else if (CGlobalVariable::serverconnect->IsConnected() && !disconnectissued) { if(!CGlobalVariable::serverconnect->IsLowID()) HTTPConState = "high"; else HTTPConState = "low"; CServer* cur_server = CGlobalVariable::serverlist->GetServerByAddress( CGlobalVariable::serverconnect->GetCurrentServer()->GetAddress(), CGlobalVariable::serverconnect->GetCurrentServer()->GetPort() ); if (cur_server) { if(cur_server->GetListName().GetLength() > SHORT_LENGTH) HTTPConText = CString(cur_server->GetListName().Left(SHORT_LENGTH-3) + _T("...")); else HTTPConText = CString(cur_server->GetListName()); if (IsSessionAdmin(Data,sSession)) HTTPConText+=_T(" (<a href=\"?ses=") + sSession + _T("&w=server&c=disconnect\">")+_GetPlainResString(IDS_IRC_DISCONNECT)+_T("</a>)"); _stprintf(HTTPHeader, _T("%s"), CastItoIShort(cur_server->GetUsers())); HTTPHelpU = CString(HTTPHeader); _stprintf(HTTPHeader, _T("%s"), CastItoIShort(cur_server->GetMaxUsers())); HTTPHelpM = CString(HTTPHeader); _stprintf(HTTPHeader, _T("%s"), CastItoIShort(cur_server->GetFiles())); HTTPHelpF = CString(HTTPHeader); if ( cur_server->GetMaxUsers() > 0 ) _stprintf(HTTPHeader, _T("%.1f "), (static_cast<double>(cur_server->GetUsers()) / cur_server->GetMaxUsers()) * 100.0); else _stprintf(HTTPHeader, _T("%.1f "), 0.0); HTTPHelpV = CString(HTTPHeader); } } else { HTTPConState = "disconnected"; HTTPConText = _GetPlainResString(IDS_DISCONNECTED); if (IsSessionAdmin(Data,sSession)) HTTPConText+=_T(" (<a href=\"?ses=") + sSession + _T("&w=server&c=connect\">")+_GetPlainResString(IDS_CONNECTTOANYSERVER)+_T("</a>)"); } uint32 allUsers = 0; uint32 allFiles = 0; for (uint32 sc=0;sc<CGlobalVariable::serverlist->GetServerCount();sc++) { CServer* cur_server = CGlobalVariable::serverlist->GetServerAt(sc); allUsers += cur_server->GetUsers(); allFiles += cur_server->GetFiles(); } Out.Replace(_T("[AllUsers]"), CastItoIShort(allUsers)); Out.Replace(_T("[AllFiles]"), CastItoIShort(allFiles)); Out.Replace(_T("[ConState]"), HTTPConState); Out.Replace(_T("[ConText]"), HTTPConText); // kad status if (Kademlia::CKademlia::IsConnected()) { if (Kademlia::CKademlia::IsFirewalled()) { HTTPConText=GetResString(IDS_FIREWALLED); HTTPConText.AppendFormat(_T(" (<a href=\"?ses=%s&w=kad&c=rcfirewall\">%s</a>"), sSession , GetResString(IDS_KAD_RECHECKFW) ); HTTPConText.AppendFormat(_T(", <a href=\"?ses=%s&w=kad&c=disconnect\">%s</a>)"), sSession , GetResString(IDS_IRC_DISCONNECT) ); } else { HTTPConText=GetResString(IDS_CONNECTED); HTTPConText.AppendFormat(_T(" (<a href=\"?ses=%s&w=kad&c=disconnect\">%s</a>)"), sSession , GetResString(IDS_IRC_DISCONNECT) ); } } else { if (Kademlia::CKademlia::IsRunning()) { HTTPConText=GetResString(IDS_CONNECTING); } else { HTTPConText=GetResString(IDS_DISCONNECTED); HTTPConText.AppendFormat(_T(" (<a href=\"?ses=%s&w=kad&c=connect\">%s</a>)"), sSession , GetResString(IDS_IRC_CONNECT) ); } } Out.Replace(_T("[KadConText]"), HTTPConText); if(thePrefs.GetMaxUpload() == UNLIMITED) _stprintf(HTTPHeader, _T("%.1f"), static_cast<double>(100 * CGlobalVariable::uploadqueue->GetDatarate()) / 1024 / thePrefs.GetMaxGraphUploadRate(true)); else _stprintf(HTTPHeader, _T("%.1f"), static_cast<double>(100 * CGlobalVariable::uploadqueue->GetDatarate()) / 1024 / thePrefs.GetMaxUpload()); Out.Replace(_T("[UploadValue]"), HTTPHeader); if(thePrefs.GetMaxDownload() == UNLIMITED) _stprintf(HTTPHeader, _T("%.1f"), static_cast<double>(100 * CGlobalVariable::downloadqueue->GetDatarate()) / 1024 / thePrefs.GetMaxGraphDownloadRate()); else _stprintf(HTTPHeader, _T("%.1f"), static_cast<double>(100 * CGlobalVariable::downloadqueue->GetDatarate()) / 1024 / thePrefs.GetMaxDownload()); Out.Replace(_T("[DownloadValue]"), HTTPHeader); _stprintf(HTTPHeader, _T("%.1f"), (static_cast<double>(CGlobalVariable::listensocket->GetOpenSockets()))/(thePrefs.GetMaxConnections())*100.0); Out.Replace(_T("[ConnectionValue]"), HTTPHeader); _stprintf(HTTPHeader, _T("%.1f"), (static_cast<double>(CGlobalVariable::uploadqueue->GetDatarate())/1024.0)); Out.Replace(_T("[CurUpload]"), HTTPHeader); _stprintf(HTTPHeader, _T("%.1f"), (static_cast<double>(CGlobalVariable::downloadqueue->GetDatarate())/1024.0)); Out.Replace(_T("[CurDownload]"), HTTPHeader); _stprintf(HTTPHeader, _T("%.0f"), (static_cast<double>(CGlobalVariable::listensocket->GetOpenSockets()))); Out.Replace(_T("[CurConnection]"), HTTPHeader); uint32 dwMax; dwMax = thePrefs.GetMaxUpload(); if (dwMax == UNLIMITED) HTTPHelp = GetResString(IDS_PW_UNLIMITED); else HTTPHelp.Format(_T("%u"), dwMax); Out.Replace(_T("[MaxUpload]"), HTTPHelp); dwMax = thePrefs.GetMaxDownload(); if (dwMax == UNLIMITED) HTTPHelp = GetResString(IDS_PW_UNLIMITED); else HTTPHelp.Format(_T("%u"), dwMax); Out.Replace(_T("[MaxDownload]"), HTTPHelp); dwMax = thePrefs.GetMaxConnections(); if (dwMax == UNLIMITED) HTTPHelp = GetResString(IDS_PW_UNLIMITED); else HTTPHelp.Format(_T("%u"), dwMax); Out.Replace(_T("[MaxConnection]"), HTTPHelp); Out.Replace(_T("[UserValue]"), HTTPHelpV); Out.Replace(_T("[MaxUsers]"), HTTPHelpM); Out.Replace(_T("[CurUsers]"), HTTPHelpU); Out.Replace(_T("[CurFiles]"), HTTPHelpF); Out.Replace(_T("[Connection]"), _GetPlainResString(IDS_PW_CONNECTION)); Out.Replace(_T("[QuickStats]"), _GetPlainResString(IDS_STATUS)); Out.Replace(_T("[Users]"), _GetPlainResString(IDS_UUSERS)); Out.Replace(_T("[Files]"), _GetPlainResString(IDS_FILES)); Out.Replace(_T("[Con]"), _GetPlainResString(IDS_ST_ACTIVEC)); Out.Replace(_T("[Up]"), _GetPlainResString(IDS_PW_CON_UPLBL)); Out.Replace(_T("[Down]"), _GetPlainResString(IDS_PW_CON_DOWNLBL)); if (thePrefs.GetCatCount()>1) InsertCatBox(Out,0,pThis->m_Templates.sCatArrow,false,false,sSession,_T(""),true); else Out.Replace(_T("[CATBOXED2K]"),_T("")); return Out; } CString CWebServer::_GetFooter(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); return pThis->m_Templates.sFooter; } CString CWebServer::_GetServerList(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString sSession = _ParseURL(Data.sURL, _T("ses")); bool bAdmin = IsSessionAdmin(Data,sSession); CString sAddServerBox = _GetAddServerBox(Data); CString sCmd = _ParseURL(Data.sURL, _T("c")); CString sIP = _ParseURL(Data.sURL, _T("ip")); int nPort = _tstoi(_ParseURL(Data.sURL, _T("port"))); if (bAdmin && sCmd.CompareNoCase(_T("connect")) == 0) { // Comment UI /*if(sIP.IsEmpty()) SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_CONNECTTOSERVER,0); else _ConnectToServer(sIP, nPort);*/ } else if (bAdmin && sCmd.CompareNoCase(_T("disconnect")) == 0) { // Comment UI /*if (CGlobalVariable::serverconnect->IsConnecting()) SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION, WEBGUIIA_STOPCONNECTING,NULL); else SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_DISCONNECT,1);*/ } else if (bAdmin && sCmd.CompareNoCase(_T("remove")) == 0) { if(!sIP.IsEmpty()) _RemoveServer(sIP, nPort); } else if (bAdmin && sCmd.CollateNoCase(_T("addtostatic")) == 0) { if(!sIP.IsEmpty()) _AddToStatic(sIP, nPort); } else if (bAdmin && sCmd.CompareNoCase(_T("removefromstatic")) == 0) { if(!sIP.IsEmpty()) _RemoveFromStatic(sIP, nPort); } else if (bAdmin && sCmd.CompareNoCase(_T("priolow")) == 0) { if(!sIP.IsEmpty()) { CServer* server=CGlobalVariable::serverlist->GetServerByAddress(sIP, (uint16)nPort); if (server) { server->SetPreference(SRV_PR_LOW); // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_UPDATESERVER,(LPARAM)server); } } } else if (bAdmin && sCmd.CompareNoCase(_T("prionormal")) == 0) { if(!sIP.IsEmpty()) { CServer* server=CGlobalVariable::serverlist->GetServerByAddress(sIP, (uint16)nPort); if (server) { server->SetPreference(SRV_PR_NORMAL); // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_UPDATESERVER,(LPARAM)server); } } } else if (bAdmin && sCmd.CompareNoCase(_T("priohigh")) == 0) { if(!sIP.IsEmpty()) { CServer* server=CGlobalVariable::serverlist->GetServerByAddress(sIP, (uint16)nPort); if (server) { server->SetPreference(SRV_PR_HIGH); // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_UPDATESERVER,(LPARAM)server); } } } else if (sCmd.CompareNoCase(_T("menu")) == 0) { int iMenu = _tstol( _ParseURL(Data.sURL, _T("m")) ); bool bValue = _ParseURL(Data.sURL, _T("v"))==_T("1"); WSserverColumnHidden[iMenu] = bValue; SaveWIConfigArray(WSserverColumnHidden, ARRSIZE(WSserverColumnHidden), _T("serverColumnHidden")); } CString strTmp = _ParseURL(Data.sURL, _T("sortreverse")); CString sSort = _ParseURL(Data.sURL, _T("sort")); if (!sSort.IsEmpty()) { bool bDirection = false; if(sSort == "state") pThis->m_Params.ServerSort = SERVER_SORT_STATE; else if(sSort == "name") { pThis->m_Params.ServerSort = SERVER_SORT_NAME; bDirection = true; } else if(sSort == "ip") pThis->m_Params.ServerSort = SERVER_SORT_IP; else if(sSort == "description") { pThis->m_Params.ServerSort = SERVER_SORT_DESCRIPTION; bDirection = true; } else if(sSort == "ping") pThis->m_Params.ServerSort = SERVER_SORT_PING; else if(sSort == "users") pThis->m_Params.ServerSort = SERVER_SORT_USERS; else if(sSort == "files") pThis->m_Params.ServerSort = SERVER_SORT_FILES; else if(sSort == "priority") pThis->m_Params.ServerSort = SERVER_SORT_PRIORITY; else if(sSort == "failed") pThis->m_Params.ServerSort = SERVER_SORT_FAILED; else if(sSort == "limit") pThis->m_Params.ServerSort = SERVER_SORT_LIMIT; else if(sSort == "version") pThis->m_Params.ServerSort = SERVER_SORT_VERSION; if (strTmp.IsEmpty()) pThis->m_Params.bServerSortReverse = bDirection; } if (!strTmp.IsEmpty()) pThis->m_Params.bServerSortReverse = (strTmp == "true"); CString Out = pThis->m_Templates.sServerList; Out.Replace(_T("[AddServerBox]"), sAddServerBox); Out.Replace(_T("[Session]"), sSession); strTmp = (pThis->m_Params.bServerSortReverse) ? _T("&sortreverse=false") : _T("&sortreverse=true"); if(pThis->m_Params.ServerSort == SERVER_SORT_STATE) Out.Replace(_T("[SortState]"), strTmp); else Out.Replace(_T("[SortState]"), _T("")); if(pThis->m_Params.ServerSort == SERVER_SORT_NAME) Out.Replace(_T("[SortName]"), strTmp); else Out.Replace(_T("[SortName]"), _T("")); if(pThis->m_Params.ServerSort == SERVER_SORT_IP) Out.Replace(_T("[SortIP]"), strTmp); else Out.Replace(_T("[SortIP]"), _T("")); if(pThis->m_Params.ServerSort == SERVER_SORT_DESCRIPTION) Out.Replace(_T("[SortDescription]"), strTmp); else Out.Replace(_T("[SortDescription]"), _T("")); if(pThis->m_Params.ServerSort == SERVER_SORT_PING) Out.Replace(_T("[SortPing]"), strTmp); else Out.Replace(_T("[SortPing]"), _T("")); if(pThis->m_Params.ServerSort == SERVER_SORT_USERS) Out.Replace(_T("[SortUsers]"), strTmp); else Out.Replace(_T("[SortUsers]"), _T("")); if(pThis->m_Params.ServerSort == SERVER_SORT_FILES) Out.Replace(_T("[SortFiles]"), strTmp); else Out.Replace(_T("[SortFiles]"), _T("")); if(pThis->m_Params.ServerSort == SERVER_SORT_PRIORITY) Out.Replace(_T("[SortPriority]"), strTmp); else Out.Replace(_T("[SortPriority]"), _T("")); if(pThis->m_Params.ServerSort == SERVER_SORT_FAILED) Out.Replace(_T("[SortFailed]"), strTmp); else Out.Replace(_T("[SortFailed]"), _T("")); if(pThis->m_Params.ServerSort == SERVER_SORT_LIMIT) Out.Replace(_T("[SortLimit]"), strTmp); else Out.Replace(_T("[SortLimit]"), _T("")); if(pThis->m_Params.ServerSort == SERVER_SORT_VERSION) Out.Replace(_T("[SortVersion]"), strTmp); else Out.Replace(_T("[SortVersion]"), _T("")); Out.Replace(_T("[ServerList]"), _GetPlainResString(IDS_SV_SERVERLIST)); const TCHAR *pcSortIcon = (pThis->m_Params.bServerSortReverse) ? pThis->m_Templates.sUpArrow : pThis->m_Templates.sDownArrow; _GetPlainResString(&strTmp, IDS_SL_SERVERNAME); if (!WSserverColumnHidden[0]) { Out.Replace(_T("[ServernameI]"), (pThis->m_Params.ServerSort == SERVER_SORT_NAME) ? pcSortIcon : _T("") ); Out.Replace(_T("[ServernameH]"), strTmp); } else { Out.Replace(_T("[ServernameI]"), _T("")); Out.Replace(_T("[ServernameH]"), _T("")); } Out.Replace(_T("[ServernameM]"), strTmp); _GetPlainResString(&strTmp, IDS_IP); if (!WSserverColumnHidden[1]) { Out.Replace(_T("[AddressI]"), (pThis->m_Params.ServerSort == SERVER_SORT_IP) ? pcSortIcon : _T("")); Out.Replace(_T("[AddressH]"), strTmp); } else { Out.Replace(_T("[AddressI]"), _T("")); Out.Replace(_T("[AddressH]"), _T("")); } Out.Replace(_T("[AddressM]"), strTmp); _GetPlainResString(&strTmp, IDS_DESCRIPTION); if (!WSserverColumnHidden[2]) { Out.Replace(_T("[DescriptionI]"), (pThis->m_Params.ServerSort == SERVER_SORT_DESCRIPTION) ? pcSortIcon : _T("")); Out.Replace(_T("[DescriptionH]"), strTmp); } else { Out.Replace(_T("[DescriptionI]"), _T("")); Out.Replace(_T("[DescriptionH]"), _T("")); } Out.Replace(_T("[DescriptionM]"), strTmp); _GetPlainResString(&strTmp, IDS_PING); if (!WSserverColumnHidden[3]) { Out.Replace(_T("[PingI]"), (pThis->m_Params.ServerSort == SERVER_SORT_PING) ? pcSortIcon : _T("")); Out.Replace(_T("[PingH]"), strTmp); } else { Out.Replace(_T("[PingI]"), _T("")); Out.Replace(_T("[PingH]"), _T("")); } Out.Replace(_T("[PingM]"), strTmp); _GetPlainResString(&strTmp, IDS_UUSERS); if (!WSserverColumnHidden[4]) { Out.Replace(_T("[UsersI]"), (pThis->m_Params.ServerSort == SERVER_SORT_USERS) ? pcSortIcon : _T("")); Out.Replace(_T("[UsersH]"), strTmp); } else { Out.Replace(_T("[UsersI]"), _T("")); Out.Replace(_T("[UsersH]"), _T("")); } Out.Replace(_T("[UsersM]"), strTmp); _GetPlainResString(&strTmp, IDS_FILES); if (!WSserverColumnHidden[5]) { Out.Replace(_T("[FilesI]"), (pThis->m_Params.ServerSort == SERVER_SORT_FILES) ? pcSortIcon : _T("")); Out.Replace(_T("[FilesH]"), strTmp); } else { Out.Replace(_T("[FilesI]"), _T("")); Out.Replace(_T("[FilesH]"), _T("")); } Out.Replace(_T("[FilesM]"), strTmp); _GetPlainResString(&strTmp, IDS_PRIORITY); if (!WSserverColumnHidden[6]) { Out.Replace(_T("[PriorityI]"), (pThis->m_Params.ServerSort == SERVER_SORT_PRIORITY) ? pcSortIcon : _T("")); Out.Replace(_T("[PriorityH]"), strTmp); } else { Out.Replace(_T("[PriorityI]"), _T("")); Out.Replace(_T("[PriorityH]"), _T("")); } Out.Replace(_T("[PriorityM]"), strTmp); _GetPlainResString(&strTmp, IDS_UFAILED); if (!WSserverColumnHidden[7]) { Out.Replace(_T("[FailedI]"), (pThis->m_Params.ServerSort == SERVER_SORT_FAILED) ? pcSortIcon : _T("")); Out.Replace(_T("[FailedH]"), strTmp); } else { Out.Replace(_T("[FailedI]"), _T("")); Out.Replace(_T("[FailedH]"), _T("")); } Out.Replace(_T("[FailedM]"), strTmp); _GetPlainResString(&strTmp, IDS_SERVER_LIMITS); if (!WSserverColumnHidden[8]) { Out.Replace(_T("[LimitI]"), (pThis->m_Params.ServerSort == SERVER_SORT_LIMIT) ? pcSortIcon : _T("")); Out.Replace(_T("[LimitH]"), strTmp); } else { Out.Replace(_T("[LimitI]"), _T("")); Out.Replace(_T("[LimitH]"), _T("")); } Out.Replace(_T("[LimitM]"), strTmp); _GetPlainResString(&strTmp, IDS_SV_SERVERINFO); if (!WSserverColumnHidden[9]) { Out.Replace(_T("[VersionI]"), (pThis->m_Params.ServerSort == SERVER_SORT_VERSION) ? pcSortIcon : _T("")); Out.Replace(_T("[VersionH]"), strTmp); } else { Out.Replace(_T("[VersionI]"), _T("")); Out.Replace(_T("[VersionH]"), _T("")); } Out.Replace(_T("[VersionM]"), strTmp); Out.Replace(_T("[Actions]"), _GetPlainResString(IDS_WEB_ACTIONS)); CArray<ServerEntry> ServerArray; CServer *tempServer; // Populating array for (uint32 sc=0;sc<CGlobalVariable::serverlist->GetServerCount();sc++) { CServer* cur_file = CGlobalVariable::serverlist->GetServerAt(sc); ServerEntry Entry; Entry.sServerName = _SpecialChars(cur_file->GetListName()); Entry.sServerIP = cur_file->GetAddress(); Entry.nServerPort = cur_file->GetPort(); Entry.sServerDescription = _SpecialChars(cur_file->GetDescription()); Entry.nServerPing = cur_file->GetPing(); Entry.nServerUsers = cur_file->GetUsers(); Entry.nServerMaxUsers = cur_file->GetMaxUsers(); Entry.nServerFiles = cur_file->GetFiles(); Entry.bServerStatic = cur_file->IsStaticMember(); if(cur_file->GetPreference()== SRV_PR_HIGH) { Entry.sServerPriority = _GetPlainResString(IDS_PRIOHIGH); Entry.nServerPriority = 2; } else if(cur_file->GetPreference()== SRV_PR_NORMAL) { Entry.sServerPriority = _GetPlainResString(IDS_PRIONORMAL); Entry.nServerPriority = 1; } else if(cur_file->GetPreference()== SRV_PR_LOW) { Entry.sServerPriority = _GetPlainResString(IDS_PRIOLOW); Entry.nServerPriority = 0; } Entry.nServerFailed = cur_file->GetFailedCount(); Entry.nServerSoftLimit = cur_file->GetSoftFiles(); Entry.nServerHardLimit = cur_file->GetHardFiles(); Entry.sServerVersion = cur_file->GetVersion(); if (inet_addr(CStringA(Entry.sServerIP)) != INADDR_NONE) { int counter=0; CString temp,newip; for(int j=0; j<4; j++) { temp = Entry.sServerIP.Tokenize(_T("."),counter); if (temp.GetLength() == 1) newip.AppendFormat(_T("00") + temp); else if (temp.GetLength() == 2) newip.AppendFormat(_T("0") + temp); else if (temp.GetLength() == 3) newip.AppendFormat(_T("") + temp); } Entry.sServerFullIP = newip; } else Entry.sServerFullIP = Entry.sServerIP; if (cur_file->GetFailedCount() > 0) Entry.sServerState = "failed"; else Entry.sServerState = _T("disconnected"); if (CGlobalVariable::serverconnect->IsConnecting()) { Entry.sServerState = _T("connecting"); } else if (CGlobalVariable::serverconnect->IsConnected()) { tempServer = CGlobalVariable::serverconnect->GetCurrentServer(); if (tempServer->GetFullIP() == cur_file->GetFullIP()) { if (!CGlobalVariable::serverconnect->IsLowID()) Entry.sServerState = _T("high"); else Entry.sServerState = _T("low"); } } ServerArray.Add(Entry); } // Sorting (simple bubble sort, we don't have tons of data here) bool bSorted = true; for(int nMax = 0;bSorted && nMax < ServerArray.GetCount()*2; nMax++) { bSorted = false; for(int i = 0; i < ServerArray.GetCount() - 1; i++) { bool bSwap = false; switch(pThis->m_Params.ServerSort) { case SERVER_SORT_STATE: bSwap = ServerArray[i].sServerState.CompareNoCase(ServerArray[i+1].sServerState) > 0; break; case SERVER_SORT_NAME: bSwap = ServerArray[i].sServerName.CompareNoCase(ServerArray[i+1].sServerName) < 0; break; case SERVER_SORT_IP: bSwap = ServerArray[i].sServerFullIP < ServerArray[i+1].sServerFullIP; break; case SERVER_SORT_DESCRIPTION: bSwap = ServerArray[i].sServerDescription.CompareNoCase(ServerArray[i+1].sServerDescription) < 0; break; case SERVER_SORT_PING: bSwap = ServerArray[i].nServerPing < ServerArray[i+1].nServerPing; break; case SERVER_SORT_USERS: bSwap = ServerArray[i].nServerUsers < ServerArray[i+1].nServerUsers; break; case SERVER_SORT_FILES: bSwap = ServerArray[i].nServerFiles < ServerArray[i+1].nServerFiles; break; case SERVER_SORT_PRIORITY: bSwap = ServerArray[i].nServerPriority < ServerArray[i+1].nServerPriority; break; case SERVER_SORT_FAILED: bSwap = ServerArray[i].nServerFailed < ServerArray[i+1].nServerFailed; break; case SERVER_SORT_LIMIT: bSwap = ServerArray[i].nServerSoftLimit < ServerArray[i+1].nServerSoftLimit; break; case SERVER_SORT_VERSION: bSwap = ServerArray[i].sServerVersion < ServerArray[i+1].sServerVersion; break; } if(pThis->m_Params.bServerSortReverse) bSwap = !bSwap; if(bSwap) { bSorted = true; ServerEntry TmpEntry = ServerArray[i]; ServerArray[i] = ServerArray[i+1]; ServerArray[i+1] = TmpEntry; } } } // Displaying const TCHAR *pcTmp, *pcTmp2; CString sList, HTTPProcessData, sServerPort, ed2k; CString OutE = pThis->m_Templates.sServerLine; OutE.Replace(_T("[admin]"), (bAdmin) ? _T("admin") : _T("")); OutE.Replace(_T("[session]"), sSession); for(int i = 0; i < ServerArray.GetCount(); i++) { HTTPProcessData = OutE; // Copy Entry Line to Temp sServerPort.Format(_T("%u"), ServerArray[i].nServerPort); ed2k.Format(_T("ed2k://|server|%s|%s|/"), ServerArray[i].sServerIP, sServerPort); if (ServerArray[i].sServerIP == _ParseURL(Data.sURL,_T("ip")) && sServerPort == _ParseURL(Data.sURL,_T("port"))) pcTmp = _T("checked"); else pcTmp = _T("checked_no"); HTTPProcessData.Replace(_T("[LastChangedDataset]"), pcTmp); if (ServerArray[i].bServerStatic) { pcTmp = _T("staticsrv"); pcTmp2 = _T("static"); } else { pcTmp = _T(""); pcTmp2 = _T("none"); } HTTPProcessData.Replace(_T("[isstatic]"), pcTmp); HTTPProcessData.Replace(_T("[ServerType]"), pcTmp2); const TCHAR *pcSrvPriority = _T(""); switch(ServerArray[i].nServerPriority) { case 0: pcSrvPriority = _T("Low"); break; case 1: pcSrvPriority = _T("Normal"); break; case 2: pcSrvPriority = _T("High"); break; } HTTPProcessData.Replace(_T("[ed2k]"), ed2k); HTTPProcessData.Replace(_T("[ip]"), ServerArray[i].sServerIP); HTTPProcessData.Replace(_T("[port]"), sServerPort); HTTPProcessData.Replace(_T("[server-priority]"), pcSrvPriority); // DonGato: reduced large servernames or descriptions if (!WSserverColumnHidden[0]) { if(ServerArray[i].sServerName.GetLength() > SHORT_LENGTH) HTTPProcessData.Replace(_T("[Servername]"), _T("<acronym title=\"") + ServerArray[i].sServerName + _T("\">") + ServerArray[i].sServerName.Left(SHORT_LENGTH-3) + _T("...") + _T("</acronym>")); else HTTPProcessData.Replace(_T("[Servername]"), ServerArray[i].sServerName); } else HTTPProcessData.Replace(_T("[Servername]"), _T("")); if (!WSserverColumnHidden[1]) { CString sPort; sPort.Format(_T(":%d"), ServerArray[i].nServerPort); HTTPProcessData.Replace(_T("[Address]"), ServerArray[i].sServerIP + sPort); } else HTTPProcessData.Replace(_T("[Address]"), _T("")); if (!WSserverColumnHidden[2]) { if(ServerArray[i].sServerDescription.GetLength() > SHORT_LENGTH) HTTPProcessData.Replace(_T("[Description]"), _T("<acronym title=\"") + ServerArray[i].sServerDescription + _T("\">") + ServerArray[i].sServerDescription.Left(SHORT_LENGTH-3) + _T("...") + _T("</acronym>")); else HTTPProcessData.Replace(_T("[Description]"), ServerArray[i].sServerDescription); } else HTTPProcessData.Replace(_T("[Description]"), _T("")); if (!WSserverColumnHidden[3]) { CString sPing; sPing.Format(_T("%d"), ServerArray[i].nServerPing); HTTPProcessData.Replace(_T("[Ping]"), sPing); } else HTTPProcessData.Replace(_T("[Ping]"), _T("")); CString sT; if (!WSserverColumnHidden[4]) { if(ServerArray[i].nServerUsers > 0) { if(ServerArray[i].nServerMaxUsers > 0) sT.Format(_T("%s (%s)"), CastItoIShort(ServerArray[i].nServerUsers), CastItoIShort(ServerArray[i].nServerMaxUsers)); else sT.Format(_T("%s"), CastItoIShort(ServerArray[i].nServerUsers)); } HTTPProcessData.Replace(_T("[Users]"), sT); } else HTTPProcessData.Replace(_T("[Users]"), _T("")); if (!WSserverColumnHidden[5] && (ServerArray[i].nServerFiles > 0)) { HTTPProcessData.Replace(_T("[Files]"), CastItoIShort(ServerArray[i].nServerFiles)); } else HTTPProcessData.Replace(_T("[Files]"), _T("")); if (!WSserverColumnHidden[6]) HTTPProcessData.Replace(_T("[Priority]"), ServerArray[i].sServerPriority); else HTTPProcessData.Replace(_T("[Priority]"), _T("")); if (!WSserverColumnHidden[7]) { CString sFailed; sFailed.Format(_T("%d"), ServerArray[i].nServerFailed); HTTPProcessData.Replace(_T("[Failed]"), sFailed); } else HTTPProcessData.Replace(_T("[Failed]"), _T("")); if (!WSserverColumnHidden[8]) { CString strTemp; strTemp.Format( _T("%s (%s)"), CastItoIShort(ServerArray[i].nServerSoftLimit), CastItoIShort(ServerArray[i].nServerHardLimit) ); HTTPProcessData.Replace(_T("[Limit]"), strTemp); } else HTTPProcessData.Replace(_T("[Limit]"), _T("")); if (!WSserverColumnHidden[9]) { if(ServerArray[i].sServerVersion.GetLength() > SHORT_LENGTH_MIN) HTTPProcessData.Replace(_T("[Version]"), _T("<acronym title=\"") + ServerArray[i].sServerVersion + _T("\">") + ServerArray[i].sServerVersion.Left(SHORT_LENGTH-3) + _T("...") + _T("</acronym>")); else HTTPProcessData.Replace(_T("[Version]"), ServerArray[i].sServerVersion); } else HTTPProcessData.Replace(_T("[Version]"), _T("")); HTTPProcessData.Replace(_T("[ServerState]"), ServerArray[i].sServerState); sList += HTTPProcessData; } Out.Replace(_T("[ServersList]"), sList); Out.Replace(_T("[Session]"), sSession); return Out; } CString CWebServer::_GetTransferList(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString HTTPTemp; CString sSession = _ParseURL(Data.sURL, _T("ses")); long lSession = _tstol(_ParseURL(Data.sURL, _T("ses"))); bool bAdmin = IsSessionAdmin(Data,sSession); // cat int cat; CString catp=_ParseURL(Data.sURL,_T("cat")); if (catp.IsEmpty()) cat=_GetLastUserCat(Data,lSession); else { cat=_tstoi(catp); _SetLastUserCat(Data,lSession,cat); } // commands CString sCat; (cat!=0)?sCat.Format(_T("&cat=%i"),cat):sCat=_T(""); CString Out; if (thePrefs.GetCatCount()>1) InsertCatBox(Out,cat,_T(""),true,true,sSession,_T("")); else Out.Replace(_T("[CATBOX]"),_T("")); CString sClear(_ParseURL(Data.sURL, _T("clearcompleted"))); if (bAdmin && !sClear.IsEmpty()) { if (sClear.CompareNoCase(_T("all")) == 0) { // Comment UI //theApp.emuledlg->SendMessage(WEB_CLEAR_COMPLETED, (WPARAM)0, (LPARAM)cat ); } else { uchar FileHash[16]; if (!sClear.IsEmpty()) { _GetFileHash(sClear, FileHash); uchar* pFileHash = new uchar[16]; md4cpy(pFileHash, FileHash); // Comment UI //theApp.emuledlg->SendMessage(WEB_CLEAR_COMPLETED, (WPARAM)1, reinterpret_cast<LPARAM>(pFileHash)); } } } HTTPTemp = _ParseURL(Data.sURL, _T("ed2k")); // Comment UI //if (bAdmin && !HTTPTemp.IsEmpty()) // theApp.emuledlg->SendMessage(WEB_ADDDOWNLOADS, (WPARAM)(LPCTSTR)HTTPTemp, cat); HTTPTemp = _ParseURL(Data.sURL, _T("c")); if (HTTPTemp.CompareNoCase(_T("menudown")) == 0) { int iMenu = _tstol(_ParseURL(Data.sURL, _T("m"))); bool bValue = _tstol(_ParseURL(Data.sURL, _T("v")))!=0; WSdownloadColumnHidden[iMenu] = bValue; CIni ini(thePrefs.GetConfigFile(), _T("WebServer")); SaveWIConfigArray(WSdownloadColumnHidden, ARRSIZE(WSdownloadColumnHidden), _T("downloadColumnHidden")); } else if (HTTPTemp.CompareNoCase(_T("menuup")) == 0) { int iMenu = _tstol(_ParseURL(Data.sURL, _T("m"))); bool bValue = _tstol(_ParseURL(Data.sURL, _T("v")))!=0; WSuploadColumnHidden[iMenu] = bValue; SaveWIConfigArray(WSuploadColumnHidden, ARRSIZE(WSuploadColumnHidden), _T("uploadColumnHidden")); } else if (HTTPTemp.CompareNoCase(_T("menuqueue")) == 0) { int iMenu = _tstol(_ParseURL(Data.sURL, _T("m"))); bool bValue = _tstol(_ParseURL(Data.sURL, _T("v")))!=0; WSqueueColumnHidden[iMenu] = bValue; SaveWIConfigArray(WSqueueColumnHidden, ARRSIZE(WSqueueColumnHidden), _T("queueColumnHidden")); } else if (HTTPTemp.CompareNoCase(_T("menuprio")) == 0) { if(bAdmin) { CString sPrio(_ParseURL(Data.sURL, _T("p"))); int prio = PR_NORMAL; if(sPrio.CompareNoCase(_T("low")) == 0) prio = PR_LOW; else if(sPrio.CompareNoCase(_T("normal")) == 0) prio = PR_NORMAL; else if(sPrio.CompareNoCase(_T("high")) == 0) prio = PR_HIGH; else if(sPrio.CompareNoCase(_T("auto")) == 0) prio = PR_AUTO; // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_CATPRIO, (WPARAM)cat,(LPARAM)prio); } } if (bAdmin) { CString sOp(_ParseURL(Data.sURL, _T("op"))); if (!sOp.IsEmpty()) { CString sFile(_ParseURL(Data.sURL, _T("file"))); uchar FileHash[16], UserHash[16]; if (!sFile.IsEmpty()) { CPartFile *found_file = CGlobalVariable::downloadqueue->GetFileByID(_GetFileHash(sFile, FileHash)); if(found_file) { // SyruS all actions require a found file (removed double-check inside) if (sOp.CompareNoCase(_T("stop")) == 0) found_file->StopFile(); else if (sOp.CompareNoCase(_T("pause")) == 0) found_file->PauseFile(); else if (sOp.CompareNoCase(_T("resume")) == 0) found_file->ResumeFile(); else if (sOp.CompareNoCase(_T("cancel")) == 0) { found_file->DeleteFile(); // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_UPD_CATTABS,0); } else if (sOp.CompareNoCase(_T("getflc")) == 0) found_file->GetPreviewPrio(); else if (sOp.CompareNoCase(_T("rename")) == 0) { CString sNewName(_ParseURL(Data.sURL, _T("name"))); // Comment UI //theApp.emuledlg->SendMessage(WEB_FILE_RENAME, (WPARAM)found_file, (LPARAM)(LPCTSTR)sNewName); } else if (sOp.CompareNoCase(_T("priolow")) == 0) { found_file->SetAutoDownPriority(false); found_file->SetDownPriority(PR_LOW); } else if (sOp.CompareNoCase(_T("prionormal")) == 0) { found_file->SetAutoDownPriority(false); found_file->SetDownPriority(PR_NORMAL); } else if (sOp.CompareNoCase(_T("priohigh")) == 0) { found_file->SetAutoDownPriority(false); found_file->SetDownPriority(PR_HIGH); } else if (sOp.CompareNoCase(_T("prioauto")) == 0) { found_file->SetAutoDownPriority(true); found_file->SetDownPriority(PR_HIGH); } else if (sOp.CompareNoCase(_T("setcat")) == 0) { CString newcat=_ParseURL(Data.sURL, _T("filecat")); if (!newcat.IsEmpty()) found_file->SetCategory(_tstol(newcat)); } } } else { CString sUser(_ParseURL(Data.sURL, _T("userhash"))); if (_GetFileHash(sUser, UserHash) != 0) { CUpDownClient* cur_client = CGlobalVariable::clientlist->FindClientByUserHash(UserHash); if(cur_client) { // Comment UI /*if (sOp.CompareNoCase(_T("addfriend")) == 0) SendMessage(theApp.emuledlg->m_hWnd,WEB_ADDREMOVEFRIEND,(WPARAM)cur_client,(LPARAM)1); else if (sOp.CompareNoCase(_T("removefriend")) == 0) { CFriend* f=theApp.friendlist->SearchFriend(UserHash,0,0); if (f) SendMessage(theApp.emuledlg->m_hWnd,WEB_ADDREMOVEFRIEND,(WPARAM)f,(LPARAM)0); }*/ } } } } } CString strTmp = _ParseURL(Data.sURL, _T("sortreverse")); CString sSort(_ParseURL(Data.sURL, _T("sort"))); bool bDirection; if (!sSort.IsEmpty()) { bDirection = false; if(sSort.CompareNoCase(_T("dstate")) == 0) pThis->m_Params.DownloadSort = DOWN_SORT_STATE; else if(sSort.CompareNoCase(_T("dtype")) == 0) pThis->m_Params.DownloadSort = DOWN_SORT_TYPE; else if(sSort.CompareNoCase(_T("dname")) == 0) { pThis->m_Params.DownloadSort = DOWN_SORT_NAME; bDirection = true; } else if(sSort.CompareNoCase(_T("dsize")) == 0) pThis->m_Params.DownloadSort = DOWN_SORT_SIZE; else if(sSort.CompareNoCase(_T("dtransferred")) == 0) pThis->m_Params.DownloadSort = DOWN_SORT_TRANSFERRED; else if(sSort.CompareNoCase(_T("dspeed")) == 0) pThis->m_Params.DownloadSort = DOWN_SORT_SPEED; else if(sSort.CompareNoCase(_T("dprogress")) == 0) pThis->m_Params.DownloadSort = DOWN_SORT_PROGRESS; else if(sSort.CompareNoCase(_T("dsources")) == 0) pThis->m_Params.DownloadSort = DOWN_SORT_SOURCES; else if(sSort.CompareNoCase(_T("dpriority")) == 0) pThis->m_Params.DownloadSort = DOWN_SORT_PRIORITY; else if(sSort.CompareNoCase(_T("dcategory")) == 0) { pThis->m_Params.DownloadSort = DOWN_SORT_CATEGORY; bDirection = true; } else if(sSort.CompareNoCase(_T("uuser")) == 0) { pThis->m_Params.UploadSort = UP_SORT_USER; bDirection = true; } else if(sSort.CompareNoCase(_T("uclient")) == 0) pThis->m_Params.UploadSort = UP_SORT_CLIENT; else if(sSort.CompareNoCase(_T("uversion")) == 0) pThis->m_Params.UploadSort = UP_SORT_VERSION; else if(sSort.CompareNoCase(_T("ufilename")) == 0) { pThis->m_Params.UploadSort = UP_SORT_FILENAME; bDirection = true; } else if(sSort.CompareNoCase(_T("utransferred")) == 0) pThis->m_Params.UploadSort = UP_SORT_TRANSFERRED; else if(sSort.CompareNoCase(_T("uspeed")) == 0) pThis->m_Params.UploadSort = UP_SORT_SPEED; else if(sSort.CompareNoCase(_T("qclient")) == 0) pThis->m_Params.QueueSort = QU_SORT_CLIENT; else if(sSort.CompareNoCase(_T("quser")) == 0) { pThis->m_Params.QueueSort = QU_SORT_USER; bDirection = true; } else if(sSort.CompareNoCase(_T("qversion")) == 0) pThis->m_Params.QueueSort = QU_SORT_VERSION; else if(sSort.CompareNoCase(_T("qfilename")) == 0) { pThis->m_Params.QueueSort = QU_SORT_FILENAME; bDirection = true; } else if(sSort.CompareNoCase(_T("qscore")) == 0) pThis->m_Params.QueueSort = QU_SORT_SCORE; if (strTmp.IsEmpty()) { if (sSort.GetAt(0) == 'd') pThis->m_Params.bDownloadSortReverse = bDirection; else if (sSort.GetAt(0) == 'u') pThis->m_Params.bUploadSortReverse = bDirection; else if (sSort.GetAt(0) == 'q') pThis->m_Params.bQueueSortReverse = bDirection; } } if (!strTmp.IsEmpty()) { bDirection = (strTmp == "true"); if (sSort.GetAt(0) == 'd') pThis->m_Params.bDownloadSortReverse = bDirection; else if (sSort.GetAt(0) == 'u') pThis->m_Params.bUploadSortReverse = bDirection; else if (sSort.GetAt(0) == 'q') pThis->m_Params.bQueueSortReverse = bDirection; } HTTPTemp.SetString(_ParseURL(Data.sURL, _T("showuploadqueue"))); if (HTTPTemp.CompareNoCase(_T("true")) == 0) pThis->m_Params.bShowUploadQueue = true; else if (HTTPTemp.CompareNoCase(_T("false")) == 0) pThis->m_Params.bShowUploadQueue = false; HTTPTemp.SetString(_ParseURL(Data.sURL, _T("showuploadqueuebanned"))); if (HTTPTemp.CompareNoCase(_T("true")) == 0) pThis->m_Params.bShowUploadQueueBanned = true; else if (HTTPTemp.CompareNoCase(_T("false")) == 0) pThis->m_Params.bShowUploadQueueBanned = false; HTTPTemp.SetString(_ParseURL(Data.sURL, _T("showuploadqueuefriend"))); if (HTTPTemp.CompareNoCase(_T("true")) == 0) pThis->m_Params.bShowUploadQueueFriend = true; else if (HTTPTemp.CompareNoCase(_T("false")) == 0) pThis->m_Params.bShowUploadQueueFriend = false; Out += pThis->m_Templates.sTransferImages; Out += pThis->m_Templates.sTransferList; Out.Replace(_T("[DownloadHeader]"), pThis->m_Templates.sTransferDownHeader); Out.Replace(_T("[DownloadFooter]"), pThis->m_Templates.sTransferDownFooter); Out.Replace(_T("[UploadHeader]"), pThis->m_Templates.sTransferUpHeader); Out.Replace(_T("[UploadFooter]"), pThis->m_Templates.sTransferUpFooter); InsertCatBox(Out,cat,pThis->m_Templates.sCatArrow,true,true,sSession,_T("")); strTmp = (pThis->m_Params.bDownloadSortReverse) ? _T("&sortreverse=false") : _T("&sortreverse=true"); if(pThis->m_Params.DownloadSort == DOWN_SORT_STATE) Out.Replace(_T("[SortDState]"), strTmp); else Out.Replace(_T("[SortDState]"), _T("")); if(pThis->m_Params.DownloadSort == DOWN_SORT_TYPE) Out.Replace(_T("[SortDType]"), strTmp); else Out.Replace(_T("[SortDType]"), _T("")); if(pThis->m_Params.DownloadSort == DOWN_SORT_NAME) Out.Replace(_T("[SortDName]"), strTmp); else Out.Replace(_T("[SortDName]"), _T("")); if(pThis->m_Params.DownloadSort == DOWN_SORT_SIZE) Out.Replace(_T("[SortDSize]"), strTmp); else Out.Replace(_T("[SortDSize]"), _T("")); if(pThis->m_Params.DownloadSort == DOWN_SORT_TRANSFERRED) Out.Replace(_T("[SortDTransferred]"), strTmp); else Out.Replace(_T("[SortDTransferred]"), _T("")); if(pThis->m_Params.DownloadSort == DOWN_SORT_SPEED) Out.Replace(_T("[SortDSpeed]"), strTmp); else Out.Replace(_T("[SortDSpeed]"), _T("")); if(pThis->m_Params.DownloadSort == DOWN_SORT_PROGRESS) Out.Replace(_T("[SortDProgress]"), strTmp); else Out.Replace(_T("[SortDProgress]"), _T("")); if(pThis->m_Params.DownloadSort == DOWN_SORT_SOURCES) Out.Replace(_T("[SortDSources]"), strTmp); else Out.Replace(_T("[SortDSources]"), _T("")); if(pThis->m_Params.DownloadSort == DOWN_SORT_PRIORITY) Out.Replace(_T("[SortDPriority]"), strTmp); else Out.Replace(_T("[SortDPriority]"), _T("")); if(pThis->m_Params.DownloadSort == DOWN_SORT_CATEGORY) Out.Replace(_T("[SortDCategory]"), strTmp); else Out.Replace(_T("[SortDCategory]"), _T("")); strTmp = (pThis->m_Params.bUploadSortReverse) ? _T("&sortreverse=false") : _T("&sortreverse=true"); if(pThis->m_Params.UploadSort == UP_SORT_CLIENT) Out.Replace(_T("[SortUClient]"), strTmp); else Out.Replace(_T("[SortUClient]"), _T("")); if(pThis->m_Params.UploadSort == UP_SORT_USER) Out.Replace(_T("[SortUUser]"), strTmp); else Out.Replace(_T("[SortUUser]"), _T("")); if(pThis->m_Params.UploadSort == UP_SORT_VERSION) Out.Replace(_T("[SortUVersion]"), strTmp); else Out.Replace(_T("[SortUVersion]"), _T("")); if(pThis->m_Params.UploadSort == UP_SORT_FILENAME) Out.Replace(_T("[SortUFilename]"), strTmp); else Out.Replace(_T("[SortUFilename]"), _T("")); if(pThis->m_Params.UploadSort == UP_SORT_TRANSFERRED) Out.Replace(_T("[SortUTransferred]"), strTmp); else Out.Replace(_T("[SortUTransferred]"), _T("")); if(pThis->m_Params.UploadSort == UP_SORT_SPEED) Out.Replace(_T("[SortUSpeed]"), strTmp); else Out.Replace(_T("[SortUSpeed]"), _T("")); const TCHAR *pcSortIcon = (pThis->m_Params.bDownloadSortReverse) ? pThis->m_Templates.sUpArrow : pThis->m_Templates.sDownArrow; _GetPlainResString(&strTmp, IDS_DL_FILENAME); if (!WSdownloadColumnHidden[0]) { Out.Replace(_T("[DFilenameI]"), (pThis->m_Params.DownloadSort == DOWN_SORT_NAME) ? pcSortIcon : _T("")); Out.Replace(_T("[DFilename]"), strTmp); } else { Out.Replace(_T("[DFilenameI]"), _T("")); Out.Replace(_T("[DFilename]"), _T("")); } Out.Replace(_T("[DFilenameM]"), strTmp); _GetPlainResString(&strTmp, IDS_DL_SIZE); if (!WSdownloadColumnHidden[1]) { Out.Replace(_T("[DSizeI]"), (pThis->m_Params.DownloadSort == DOWN_SORT_SIZE) ? pcSortIcon : _T("")); Out.Replace(_T("[DSize]"), strTmp); } else { Out.Replace(_T("[DSizeI]"), _T("")); Out.Replace(_T("[DSize]"), _T("")); } Out.Replace(_T("[DSizeM]"), strTmp); _GetPlainResString(&strTmp, IDS_DL_TRANSFCOMPL); if (!WSdownloadColumnHidden[2]) { Out.Replace(_T("[DTransferredI]"), (pThis->m_Params.DownloadSort == DOWN_SORT_TRANSFERRED) ? pcSortIcon : _T("")); Out.Replace(_T("[DTransferred]"), strTmp); } else { Out.Replace(_T("[DTransferredI]"), _T("")); Out.Replace(_T("[DTransferred]"), _T("")); } Out.Replace(_T("[DTransferredM]"), strTmp); _GetPlainResString(&strTmp, IDS_DL_PROGRESS); if (!WSdownloadColumnHidden[3]) { Out.Replace(_T("[DProgressI]"), (pThis->m_Params.DownloadSort == DOWN_SORT_PROGRESS) ? pcSortIcon : _T("")); Out.Replace(_T("[DProgress]"), strTmp); } else { Out.Replace(_T("[DProgressI]"), _T("")); Out.Replace(_T("[DProgress]"), _T("")); } Out.Replace(_T("[DProgressM]"), strTmp); _GetPlainResString(&strTmp, IDS_DL_SPEED); if (!WSdownloadColumnHidden[4]) { Out.Replace(_T("[DSpeedI]"), (pThis->m_Params.DownloadSort == DOWN_SORT_SPEED) ? pcSortIcon : _T("")); Out.Replace(_T("[DSpeed]"), strTmp); } else { Out.Replace(_T("[DSpeedI]"), _T("")); Out.Replace(_T("[DSpeed]"), _T("")); } Out.Replace(_T("[DSpeedM]"), strTmp); _GetPlainResString(&strTmp, IDS_DL_SOURCES); if (!WSdownloadColumnHidden[5]) { Out.Replace(_T("[DSourcesI]"), (pThis->m_Params.DownloadSort == DOWN_SORT_SOURCES) ? pcSortIcon : _T("")); Out.Replace(_T("[DSources]"), strTmp); } else { Out.Replace(_T("[DSourcesI]"), _T("")); Out.Replace(_T("[DSources]"), _T("")); } Out.Replace(_T("[DSourcesM]"), strTmp); _GetPlainResString(&strTmp, IDS_PRIORITY); if (!WSdownloadColumnHidden[6]) { Out.Replace(_T("[DPriorityI]"), (pThis->m_Params.DownloadSort == DOWN_SORT_PRIORITY) ? pcSortIcon : _T("")); Out.Replace(_T("[DPriority]"), strTmp); } else { Out.Replace(_T("[DPriorityI]"), _T("")); Out.Replace(_T("[DPriority]"), _T("")); } Out.Replace(_T("[DPriorityM]"), strTmp); _GetPlainResString(&strTmp, IDS_CAT); if (!WSdownloadColumnHidden[7]) { Out.Replace(_T("[DCategoryI]"), (pThis->m_Params.DownloadSort == DOWN_SORT_CATEGORY) ? pcSortIcon : _T("")); Out.Replace(_T("[DCategory]"), strTmp); } else { Out.Replace(_T("[DCategoryI]"), _T("")); Out.Replace(_T("[DCategory]"), _T("")); } Out.Replace(_T("[DCategoryM]"), strTmp); // add 8th columns here pcSortIcon = (pThis->m_Params.bUploadSortReverse) ? pThis->m_Templates.sUpArrow : pThis->m_Templates.sDownArrow; _GetPlainResString(&strTmp, IDS_QL_USERNAME); if (!WSuploadColumnHidden[0]) { Out.Replace(_T("[UUserI]"), (pThis->m_Params.UploadSort == UP_SORT_USER) ? pcSortIcon : _T("")); Out.Replace(_T("[UUser]"), strTmp); } else { Out.Replace(_T("[UUserI]"), _T("")); Out.Replace(_T("[UUser]"), _T("")); } Out.Replace(_T("[UUserM]"), strTmp); _GetPlainResString(&strTmp, IDS_CD_VERSION); if (!WSuploadColumnHidden[1]) { Out.Replace(_T("[UVersionI]"), (pThis->m_Params.UploadSort == UP_SORT_VERSION) ? pcSortIcon : _T("")); Out.Replace(_T("[UVersion]"), strTmp); } else { Out.Replace(_T("[UVersionI]"), _T("")); Out.Replace(_T("[UVersion]"), _T("")); } Out.Replace(_T("[UVersionM]"), strTmp); _GetPlainResString(&strTmp, IDS_DL_FILENAME); if (!WSuploadColumnHidden[2]) { Out.Replace(_T("[UFilenameI]"), (pThis->m_Params.UploadSort == UP_SORT_FILENAME) ? pcSortIcon : _T("")); Out.Replace(_T("[UFilename]"), strTmp); } else { Out.Replace(_T("[UFilenameI]"), _T("")); Out.Replace(_T("[UFilename]"), _T("")); } Out.Replace(_T("[UFilenameM]"), strTmp); _GetPlainResString(&strTmp, IDS_STATS_SRATIO); if (!WSuploadColumnHidden[3]) { Out.Replace(_T("[UTransferredI]"), (pThis->m_Params.UploadSort == UP_SORT_TRANSFERRED) ? pcSortIcon : _T("")); Out.Replace(_T("[UTransferred]"), strTmp); } else { Out.Replace(_T("[UTransferredI]"), _T("")); Out.Replace(_T("[UTransferred]"), _T("")); } Out.Replace(_T("[UTransferredM]"), strTmp); _GetPlainResString(&strTmp, IDS_DL_SPEED); if (!WSuploadColumnHidden[4]) { Out.Replace(_T("[USpeedI]"), (pThis->m_Params.UploadSort == UP_SORT_SPEED) ? pcSortIcon : _T("")); Out.Replace(_T("[USpeed]"), strTmp); } else { Out.Replace(_T("[USpeedI]"), _T("")); Out.Replace(_T("[USpeed]"), _T("")); } Out.Replace(_T("[USpeedM]"), strTmp); Out.Replace(_T("[DownloadList]"), _GetPlainResString(IDS_TW_DOWNLOADS)); Out.Replace(_T("[UploadList]"), _GetPlainResString(IDS_TW_UPLOADS)); Out.Replace(_T("[Actions]"), _GetPlainResString(IDS_WEB_ACTIONS)); Out.Replace(_T("[TotalDown]"), _GetPlainResString(IDS_INFLST_USER_TOTALDOWNLOAD)); Out.Replace(_T("[TotalUp]"), _GetPlainResString(IDS_INFLST_USER_TOTALUPLOAD)); Out.Replace(_T("[admin]"), (bAdmin) ? _T("admin") : _T("")); InsertCatBox(Out,cat,_T(""),true,true,sSession,_T("")); CArray<DownloadFiles> FilesArray; CArray<CPartFile*,CPartFile*> partlist; // Comment UI SendMessage(CGlobalVariable::m_hListenWnd,WM_GET_PARTLIST,0,(WPARAM)&partlist); //theApp.emuledlg->transferwnd->downloadlistctrl.GetDisplayedFiles(&partlist); // Populating array for (int i=0;i<partlist.GetCount();i++) { CPartFile* pPartFile=partlist.GetAt(i); if (pPartFile) { if (cat<0) { switch (cat) { case -1 : if (pPartFile->GetCategory()!=0) continue; break; case -2 : if (!pPartFile->IsPartFile()) continue; break; case -3 : if (pPartFile->IsPartFile()) continue; break; case -4 : if (!((pPartFile->GetStatus()==PS_READY|| pPartFile->GetStatus()==PS_EMPTY) && pPartFile->GetTransferringSrcCount()==0)) continue; break; case -5 : if (!((pPartFile->GetStatus()==PS_READY|| pPartFile->GetStatus()==PS_EMPTY) && pPartFile->GetTransferringSrcCount()>0)) continue; break; case -6 : if (pPartFile->GetStatus()!=PS_ERROR) continue; break; case -7 : if (pPartFile->GetStatus()!=PS_PAUSED && !pPartFile->IsStopped()) continue; break; case -8 : if (pPartFile->lastseencomplete==NULL) continue; break; case -9 : if (!pPartFile->IsMovie()) continue; break; case -10 : if (ED2KFT_AUDIO != GetED2KFileTypeID(pPartFile->GetFileName())) continue; break; case -11 : if (!pPartFile->IsArchive()) continue; break; case -12 : if (ED2KFT_CDIMAGE != GetED2KFileTypeID(pPartFile->GetFileName())) continue; break; case -13 : if (ED2KFT_DOCUMENT != GetED2KFileTypeID(pPartFile->GetFileName())) continue; break; case -14 : if (ED2KFT_IMAGE != GetED2KFileTypeID(pPartFile->GetFileName())) continue; break; case -15 : if (ED2KFT_PROGRAM != GetED2KFileTypeID(pPartFile->GetFileName())) continue; break; //JOHNTODO: Not too sure here.. I was going to add Collections but noticed something strange.. Are these supposed to match the list in PartFile around line 5132? Because they do not.. } } else if (cat>0 && pPartFile->GetCategory() != (UINT)cat) continue; DownloadFiles dFile; dFile.sFileName = _SpecialChars(pPartFile->GetFileName()); dFile.sFileType = GetWebImageNameForFileType(dFile.sFileName); dFile.sFileNameJS = _SpecialChars(pPartFile->GetFileName()); //for javascript dFile.m_qwFileSize = pPartFile->GetFileSize(); dFile.m_qwFileTransferred = pPartFile->GetCompletedSize(); dFile.m_dblCompleted = pPartFile->GetPercentCompleted(); dFile.lFileSpeed = pPartFile->GetDatarate(); if ( pPartFile->HasComment() || pPartFile->HasRating()) { dFile.iComment= pPartFile->HasBadRating()?2:1; } else dFile.iComment = 0; dFile.iFileState=pPartFile->getPartfileStatusRang(); if(pPartFile->GetDatarate() > 0) { dFile.sFileState = _T("downloading"); } else { dFile.sFileState = _T("waiting"); } switch(pPartFile->GetStatus()) { case PS_HASHING: dFile.sFileState = _T("hashing"); break; case PS_WAITINGFORHASH: dFile.sFileState = _T("waitinghash"); break; case PS_ERROR: dFile.sFileState = _T("error"); break; case PS_COMPLETING: dFile.sFileState = _T("completing"); break; case PS_COMPLETE: dFile.sFileState = _T("complete"); break; case PS_PAUSED: if (!pPartFile->IsStopped()) dFile.sFileState = _T("paused"); else dFile.sFileState = _T("stopped"); break; default: break; } dFile.bFileAutoPrio = pPartFile->IsAutoDownPriority(); dFile.nFilePrio = pPartFile->GetDownPriority(); int pCat = pPartFile->GetCategory(); CString strCategory = thePrefs.GetCategory(pCat)->strTitle; strCategory.Replace(_T("'"),_T("\'")); dFile.sCategory = strCategory; dFile.sFileHash = md4str(pPartFile->GetFileHash()); dFile.lSourceCount = pPartFile->GetSourceCount(); dFile.lNotCurrentSourceCount = pPartFile->GetNotCurrentSourcesCount(); dFile.lTransferringSourceCount = pPartFile->GetTransferringSrcCount(); dFile.bIsComplete = !pPartFile->IsPartFile(); dFile.bIsPreview = pPartFile->IsReadyForPreview(); dFile.bIsGetFLC = pPartFile->GetPreviewPrio(); // Comment UI /*if (CGlobalVariable::serverconnect->IsConnected() && !CGlobalVariable::serverconnect->IsLowID()) dFile.sED2kLink = theApp.CreateED2kSourceLink(pPartFile); else dFile.sED2kLink = CreateED2kLink(pPartFile);*/ dFile.sFileInfo = _SpecialChars(pPartFile->GetInfoSummary(),false); FilesArray.Add(dFile); } } // Sorting (simple bubble sort, we don't have tons of data here) bool bSorted = true; for(int nMax = 0;bSorted && nMax < FilesArray.GetCount()*2; nMax++) { bSorted = false; for(int i = 0; i < FilesArray.GetCount() - 1; i++) { bool bSwap = false; switch(pThis->m_Params.DownloadSort) { case DOWN_SORT_STATE: bSwap = FilesArray[i].iFileState<FilesArray[i+1].iFileState; break; case DOWN_SORT_TYPE: bSwap = FilesArray[i].sFileType.CompareNoCase(FilesArray[i+1].sFileType) < 0; break; case DOWN_SORT_NAME: bSwap = FilesArray[i].sFileName.CompareNoCase(FilesArray[i+1].sFileName) < 0; break; case DOWN_SORT_SIZE: bSwap = FilesArray[i].m_qwFileSize < FilesArray[i+1].m_qwFileSize; break; case DOWN_SORT_TRANSFERRED: bSwap = FilesArray[i].m_qwFileTransferred < FilesArray[i+1].m_qwFileTransferred; break; case DOWN_SORT_SPEED: bSwap = FilesArray[i].lFileSpeed < FilesArray[i+1].lFileSpeed; break; case DOWN_SORT_PROGRESS: bSwap = FilesArray[i].m_dblCompleted < FilesArray[i+1].m_dblCompleted ; break; case DOWN_SORT_SOURCES: bSwap = FilesArray[i].lSourceCount < FilesArray[i+1].lSourceCount ; break; case DOWN_SORT_PRIORITY: bSwap = FilesArray[i].nFilePrio < FilesArray[i+1].nFilePrio ; break; case DOWN_SORT_CATEGORY: bSwap = FilesArray[i].sCategory.CompareNoCase(FilesArray[i+1].sCategory) < 0; break; } if(pThis->m_Params.bDownloadSortReverse) bSwap = !bSwap; if(bSwap) { bSorted = true; DownloadFiles TmpFile = FilesArray[i]; FilesArray[i] = FilesArray[i+1]; FilesArray[i+1] = TmpFile; } } } // uint32 dwClientSoft; CArray<UploadUsers> UploadArray; CUpDownClient* cur_client; for (POSITION pos = CGlobalVariable::uploadqueue->GetFirstFromUploadList(); pos != 0;CGlobalVariable::uploadqueue->GetNextFromUploadList(pos)) { cur_client = CGlobalVariable::uploadqueue->GetQueueClientAt(pos); UploadUsers dUser; CString sTemp; dUser.sUserHash = md4str(cur_client->GetUserHash()); if (cur_client->GetDatarate() > 0) { dUser.sActive = _T("downloading"); dUser.sClientState = _T("uploading"); } else { dUser.sActive = _T("waiting"); dUser.sClientState = _T("connecting"); } dUser.sFileInfo = _SpecialChars(GetClientSummary(cur_client),false); dUser.sFileInfo.Replace(_T("\\"),_T("\\\\")); dUser.sFileInfo.Replace(_T("\n"), _T("<br />")); dUser.sFileInfo.Replace(_T("'"),_T("&#8217;")); sTemp= GetClientversionImage(cur_client) ; dUser.sClientSoft = sTemp; if (cur_client->IsBanned()) dUser.sClientExtra = _T("banned"); else if (cur_client->IsFriend()) dUser.sClientExtra = _T("friend"); else if (cur_client->Credits()->GetScoreRatio(cur_client->GetIP()) > 1) dUser.sClientExtra = _T("credit"); else dUser.sClientExtra = _T("none"); dUser.sUserName = _SpecialChars(cur_client->GetUserName()); CString cun(cur_client->GetUserName()); if(cun.GetLength() > SHORT_LENGTH_MIN) dUser.sUserName = _SpecialChars(cun.Left(SHORT_LENGTH_MIN-3)) + _T("..."); CKnownFile* file = CGlobalVariable::sharedfiles->GetFileByID(cur_client->GetUploadFileID() ); if (file) dUser.sFileName = _SpecialChars(CString(file->GetFileName())); else dUser.sFileName = _GetPlainResString(IDS_REQ_UNKNOWNFILE); dUser.nTransferredDown = cur_client->GetTransferredDown(); dUser.nTransferredUp = cur_client->GetTransferredUp(); int iDataRate = cur_client->GetDatarate(); dUser.nDataRate = ((iDataRate == -1) ? 0 : iDataRate); dUser.sClientNameVersion = cur_client->GetClientSoftVer(); UploadArray.Add(dUser); } // Sorting (simple bubble sort, we don't have tons of data here) bSorted = true; for(int nMax = 0;bSorted && nMax < UploadArray.GetCount()*2; nMax++) { bSorted = false; for(int i = 0; i < UploadArray.GetCount() - 1; i++) { bool bSwap = false; switch(pThis->m_Params.UploadSort) { case UP_SORT_CLIENT: bSwap = UploadArray[i].sClientSoft.CompareNoCase(UploadArray[i+1].sClientSoft) < 0; break; case UP_SORT_USER: bSwap = UploadArray[i].sUserName.CompareNoCase(UploadArray[i+1].sUserName) < 0; break; case UP_SORT_VERSION: bSwap = UploadArray[i].sClientNameVersion.CompareNoCase(UploadArray[i+1].sClientNameVersion) < 0; break; case UP_SORT_FILENAME: bSwap = UploadArray[i].sFileName.CompareNoCase(UploadArray[i+1].sFileName) < 0; break; case UP_SORT_TRANSFERRED: bSwap = UploadArray[i].nTransferredUp < UploadArray[i+1].nTransferredUp; break; case UP_SORT_SPEED: bSwap = UploadArray[i].nDataRate < UploadArray[i+1].nDataRate; break; } if(pThis->m_Params.bUploadSortReverse) bSwap = !bSwap; if(bSwap) { bSorted = true; UploadUsers TmpUser = UploadArray[i]; UploadArray[i] = UploadArray[i+1]; UploadArray[i+1] = TmpUser; } } } Out=_CreateTransferList(Out, pThis, &Data, &FilesArray, &UploadArray,bAdmin); Out.Replace(_T("[Session]"), sSession); Out.Replace(_T("[CatSel]"), sCat); return Out; } CString CWebServer::_CreateTransferList(CString Out, CWebServer *pThis, ThreadData* Data, void* _FilesArray, void* _UploadArray, bool bAdmin) { CArray<DownloadFiles>* FilesArray=(CArray<DownloadFiles>*)_FilesArray; CArray<UploadUsers>* UploadArray=(CArray<UploadUsers>*)_UploadArray; // Displaying CString sDownList, HTTPProcessData; CString OutE = pThis->m_Templates.sTransferDownLine; CString HTTPTemp; int nCountQueue = 0; int nCountQueueBanned = 0; int nCountQueueFriend = 0; int nCountQueueSecure = 0; int nCountQueueBannedSecure = 0; int nCountQueueFriendSecure = 0; double fTotalSize = 0, fTotalTransferred = 0, fTotalSpeed = 0; CQArray<QueueUsers, QueueUsers> QueueArray; for (POSITION pos = CGlobalVariable::uploadqueue->waitinglist.GetHeadPosition(); pos != NULL;) { CUpDownClient* cur_client = CGlobalVariable::uploadqueue->waitinglist.GetNext(pos); QueueUsers dUser; CString sTemp; bool bSecure = (cur_client->Credits()->GetCurrentIdentState(cur_client->GetIP()) == IS_IDENTIFIED); if (cur_client->IsBanned()) { dUser.sClientExtra = _T("banned"); nCountQueueBanned++; if (bSecure) nCountQueueBannedSecure++; } else if (cur_client->IsFriend()) { dUser.sClientExtra = _T("friend"); nCountQueueFriend++; if (bSecure) nCountQueueFriendSecure++; } else { dUser.sClientExtra = _T("none"); nCountQueue++; if (bSecure) nCountQueueSecure++; } CString usn(cur_client->GetUserName()); if( usn.GetLength() > SHORT_LENGTH_MIN) dUser.sUserName = _SpecialChars(usn.Left((SHORT_LENGTH_MIN-3)) + _T("...")); else dUser.sUserName = _SpecialChars(usn); dUser.sClientNameVersion = cur_client->GetClientSoftVer(); CKnownFile* file = CGlobalVariable::sharedfiles->GetFileByID(cur_client->GetUploadFileID() ); if (file) dUser.sFileName = _SpecialChars(CString(file->GetFileName())); else dUser.sFileName = _GetPlainResString(IDS_REQ_UNKNOWNFILE); dUser.sClientState = dUser.sClientExtra; dUser.sClientStateSpecial = _T("connecting"); dUser.nScore = cur_client->GetScore(false); sTemp=GetClientversionImage(cur_client); dUser.sClientSoft = sTemp; dUser.sUserHash = md4str(cur_client->GetUserHash()); //SyruS CQArray-Sorting setting sIndex according to param switch(pThis->m_Params.QueueSort) { case QU_SORT_CLIENT: dUser.sIndex = dUser.sClientSoft; break; case QU_SORT_USER: dUser.sIndex = dUser.sUserName; break; case QU_SORT_VERSION: dUser.sIndex = dUser.sClientNameVersion; break; case QU_SORT_FILENAME: dUser.sIndex = dUser.sFileName; break; case QU_SORT_SCORE: dUser.sIndex.Format(_T("%09u"), dUser.nScore); break; default: dUser.sIndex.Empty(); } QueueArray.Add(dUser); } int nNextPos = 0; // position in queue of the user with the highest score -> next upload user uint32 nNextScore = 0; // highest score -> next upload user for(int i = 0; i < QueueArray.GetCount(); i++) { if (QueueArray[i].nScore > nNextScore) { nNextPos = i; nNextScore = QueueArray[i].nScore; } } if (CGlobalVariable::uploadqueue->waitinglist.GetHeadPosition() != 0) { QueueArray[nNextPos].sClientState = _T("next"); QueueArray[nNextPos].sClientStateSpecial = QueueArray[nNextPos].sClientState; } if ((nCountQueue > 0 && pThis->m_Params.bShowUploadQueue) || (nCountQueueBanned > 0 && pThis->m_Params.bShowUploadQueueBanned) || (nCountQueueFriend > 0 && pThis->m_Params.bShowUploadQueueFriend)) { #ifdef _DEBUG DWORD dwStart = ::GetTickCount(); #endif QueueArray.QuickSort(pThis->m_Params.bQueueSortReverse); #ifdef _DEBUG AddDebugLogLine(false, _T("WebServer: Waitingqueue with %u elements sorted in %u ms"), QueueArray.GetSize(), ::GetTickCount()-dwStart); #endif } for(int i = 0; i < FilesArray->GetCount(); i++) { HTTPProcessData = OutE; DownloadFiles dwnlf=FilesArray->GetAt(i); if (dwnlf.sFileHash == _ParseURL(Data->sURL,_T("file")) ) HTTPProcessData.Replace(_T("[LastChangedDataset]"), _T("checked")); else HTTPProcessData.Replace(_T("[LastChangedDataset]"), _T("checked_no")); CString ed2k; //ed2klink CString state; //state CString isgetflc; //getflc CString fname; //filename CString fsize; //filesize CString session; //session CString filehash; //filehash CString downpriority; //priority //CPartFile *found_file = CGlobalVariable::downloadqueue->GetFileByID(_GetFileHash(dwnlf.sFileHash, FileHashA4AF)); dwnlf.sFileInfo.Replace(_T("\\"),_T("\\\\")); CString strFInfo = dwnlf.sFileInfo; strFInfo.Replace(_T("'"),_T("&#8217;")); strFInfo.Replace(_T("\n"), _T("\\n")); dwnlf.sFileInfo.Replace(_T("\n"), _T("<br />")); if (!dwnlf.iComment) { HTTPProcessData.Replace(_T("[HASCOMMENT]"), _T("<!--") ); HTTPProcessData.Replace(_T("[HASCOMMENT_END]"), _T("-->") ); } else { HTTPProcessData.Replace(_T("[HASCOMMENT]"), _T("") ); HTTPProcessData.Replace(_T("[HASCOMMENT_END]"), _T("") ); } if (dwnlf.sFileState.CompareNoCase(_T("downloading"))==0 || dwnlf.sFileState.CompareNoCase(_T("waiting"))==0 ) { HTTPProcessData.Replace(_T("[ISACTIVE]"), _T("<!--") ); HTTPProcessData.Replace(_T("[ISACTIVE_END]"), _T("-->") ); HTTPProcessData.Replace(_T("[!ISACTIVE]"), _T("") ); HTTPProcessData.Replace(_T("[!ISACTIVE_END]"), _T("") ); } else { HTTPProcessData.Replace(_T("[ISACTIVE]"), _T("") ); HTTPProcessData.Replace(_T("[ISACTIVE_END]"), _T("") ); HTTPProcessData.Replace(_T("[!ISACTIVE]"), _T("<!--") ); HTTPProcessData.Replace(_T("[!ISACTIVE_END]"), _T("-->") ); } CString JSED2kLink=dwnlf.sED2kLink; JSED2kLink.Replace(_T("'"),_T("&#8217;")); ed2k = JSED2kLink; fname = dwnlf.sFileNameJS; state = dwnlf.sFileState; fsize.Format(_T("%d"),dwnlf.m_qwFileSize); filehash = dwnlf.sFileHash; session = _ParseURL(Data->sURL, _T("ses")); if (dwnlf.bIsPreview) isgetflc = _T(""); else if(dwnlf.bIsGetFLC) isgetflc = _T("enabled"); else isgetflc = _T("disabled"); if(dwnlf.bFileAutoPrio) downpriority = _T("Auto"); else { switch(dwnlf.nFilePrio) { case 0: downpriority = _T("Low"); break; case 1: downpriority = _T("Normal"); break; case 2: downpriority = _T("High"); break; } } HTTPProcessData.Replace(_T("[admin]"), ( bAdmin ) ? _T("admin") : _T("")); HTTPProcessData.Replace(_T("[finfo]"), strFInfo); HTTPProcessData.Replace(_T("[fcomments]"), (dwnlf.iComment==0)?_T(""):_T("yes") ); HTTPProcessData.Replace(_T("[ed2k]"), ed2k); HTTPProcessData.Replace(_T("[DownState]"), state); HTTPProcessData.Replace(_T("[isgetflc]"), isgetflc); HTTPProcessData.Replace(_T("[fname]"), fname); HTTPProcessData.Replace(_T("[fsize]"), fsize); HTTPProcessData.Replace(_T("[session]"), session); HTTPProcessData.Replace(_T("[filehash]"), filehash); HTTPProcessData.Replace(_T("[down-priority]"), downpriority); HTTPProcessData.Replace(_T("[FileType]"), dwnlf.sFileType); HTTPProcessData.Replace(_T("[downloadable]"), (bAdmin && (thePrefs.GetMaxWebUploadFileSizeMB()==0 ||dwnlf.m_qwFileSize<thePrefs.GetMaxWebUploadFileSizeMB()*1024*1024))?_T("yes"):_T("no") ); // comment icon if (!dwnlf.iComment) HTTPProcessData.Replace(_T("[FileCommentIcon]"), _T("none") ); else if (dwnlf.iComment==1) HTTPProcessData.Replace(_T("[FileCommentIcon]"), _T("cmtgood") ); else if (dwnlf.iComment==2) HTTPProcessData.Replace(_T("[FileCommentIcon]"), _T("cmtbad") ); if (!dwnlf.bIsPreview && dwnlf.bIsGetFLC) HTTPProcessData.Replace(_T("[FileIsGetFLC]"), _T("getflc")); else HTTPProcessData.Replace(_T("[FileIsGetFLC]"), _T("halfnone")); if (!WSdownloadColumnHidden[0]) { if(dwnlf.sFileName.GetLength() > (SHORT_LENGTH_MAX)) HTTPProcessData.Replace(_T("[ShortFileName]"), dwnlf.sFileName.Left(SHORT_LENGTH_MAX-3) + _T("...")); else HTTPProcessData.Replace(_T("[ShortFileName]"), dwnlf.sFileName); } else HTTPProcessData.Replace(_T("[ShortFileName]"), _T("")); HTTPProcessData.Replace(_T("[FileInfo]"), dwnlf.sFileInfo); fTotalSize += dwnlf.m_qwFileSize; if (!WSdownloadColumnHidden[1]) HTTPProcessData.Replace(_T("[2]"), CastItoXBytes(dwnlf.m_qwFileSize)); else HTTPProcessData.Replace(_T("[2]"), _T("")); if (!WSdownloadColumnHidden[2]) { if(dwnlf.m_qwFileTransferred > 0) { fTotalTransferred += dwnlf.m_qwFileTransferred; HTTPProcessData.Replace(_T("[3]"), CastItoXBytes(dwnlf.m_qwFileTransferred)); } else HTTPProcessData.Replace(_T("[3]"), _T("-")); } else HTTPProcessData.Replace(_T("[3]"), _T("")); if (!WSdownloadColumnHidden[3]) HTTPProcessData.Replace(_T("[DownloadBar]"), _GetDownloadGraph( *Data,dwnlf.sFileHash)); else HTTPProcessData.Replace(_T("[DownloadBar]"), _T("")); HTTPTemp.Empty(); if (!WSdownloadColumnHidden[4]) { if(dwnlf.lFileSpeed > 0.0f) { fTotalSpeed += dwnlf.lFileSpeed; HTTPTemp.Format(_T("%8.2f"), dwnlf.lFileSpeed/1024.0); HTTPProcessData.Replace(_T("[4]"), HTTPTemp); } else HTTPProcessData.Replace(_T("[4]"), _T("-")); } else HTTPProcessData.Replace(_T("[4]"), _T("")); if (!WSdownloadColumnHidden[5]) { if(dwnlf.lSourceCount > 0) { HTTPTemp.Format(_T("%i&nbsp;/&nbsp;%8i&nbsp;(%i)"), dwnlf.lSourceCount-dwnlf.lNotCurrentSourceCount, dwnlf.lSourceCount, dwnlf.lTransferringSourceCount); HTTPProcessData.Replace(_T("[5]"), HTTPTemp); } else HTTPProcessData.Replace(_T("[5]"), _T("-")); } else HTTPProcessData.Replace(_T("[5]"), _T("")); if (!WSdownloadColumnHidden[6]) { if(dwnlf.bFileAutoPrio) { switch(dwnlf.nFilePrio) { case 0: HTTPTemp=GetResString(IDS_PRIOAUTOLOW); break; case 1: HTTPTemp=GetResString(IDS_PRIOAUTONORMAL); break; case 2: HTTPTemp=GetResString(IDS_PRIOAUTOHIGH); break; } } else { switch(dwnlf.nFilePrio) { case 0: HTTPTemp=GetResString(IDS_PRIOLOW); break; case 1: HTTPTemp=GetResString(IDS_PRIONORMAL); break; case 2: HTTPTemp=GetResString(IDS_PRIOHIGH); break; } } HTTPProcessData.Replace(_T("[PrioVal]"), HTTPTemp); } else HTTPProcessData.Replace(_T("[PrioVal]"), _T("")); if (!WSdownloadColumnHidden[7]) HTTPProcessData.Replace(_T("[Category]"), dwnlf.sCategory); else HTTPProcessData.Replace(_T("[Category]"), _T("")); InsertCatBox(HTTPProcessData,0,_T(""),false,false,session,dwnlf.sFileHash); sDownList += HTTPProcessData; } Out.Replace(_T("[DownloadFilesList]"), sDownList); Out.Replace(_T("[TotalDownSize]"), CastItoXBytes(fTotalSize)); Out.Replace(_T("[TotalDownTransferred]"), CastItoXBytes(fTotalTransferred)); HTTPTemp.Format(_T("%8.2f"), fTotalSpeed/1024.0); Out.Replace(_T("[TotalDownSpeed]"), HTTPTemp); HTTPTemp.Format(_T("%s: %i"), GetResString(IDS_SF_FILE), FilesArray->GetCount()); Out.Replace(_T("[TotalFiles]"), HTTPTemp); HTTPTemp.Format(_T("%i"),pThis->m_Templates.iProgressbarWidth); Out.Replace(_T("[PROGRESSBARWIDTHVAL]"),HTTPTemp); fTotalSize = 0; fTotalTransferred = 0; fTotalSpeed = 0; CString sUpList; const TCHAR *pcTmp; OutE = pThis->m_Templates.sTransferUpLine; OutE.Replace(_T("[admin]"), (bAdmin) ? _T("admin") : _T("")); for(int i = 0; i < UploadArray->GetCount(); i++) { UploadUsers ulu=UploadArray->GetAt(i); HTTPProcessData = OutE; HTTPProcessData.Replace(_T("[UserHash]"), ulu.sUserHash); HTTPProcessData.Replace(_T("[UpState]"), ulu.sActive); HTTPProcessData.Replace(_T("[FileInfo]"), ulu.sFileInfo); HTTPProcessData.Replace(_T("[ClientState]"), ulu.sClientState); HTTPProcessData.Replace(_T("[ClientSoft]"), ulu.sClientSoft); HTTPProcessData.Replace(_T("[ClientExtra]"), ulu.sClientExtra); pcTmp = (!WSuploadColumnHidden[0]) ? ulu.sUserName.GetString() : _T(""); HTTPProcessData.Replace(_T("[1]"), pcTmp); pcTmp = (!WSuploadColumnHidden[1]) ? ulu.sClientNameVersion.GetString() : _T(""); HTTPProcessData.Replace(_T("[ClientSoftV]"), pcTmp); pcTmp = (!WSuploadColumnHidden[2]) ? ulu.sFileName.GetString() : _T(""); HTTPProcessData.Replace(_T("[2]"), pcTmp); pcTmp = _T(""); if (!WSuploadColumnHidden[3]) { fTotalSize += ulu.nTransferredDown; fTotalTransferred += ulu.nTransferredUp; HTTPTemp.Format(_T("%s / %s"), CastItoXBytes(ulu.nTransferredDown),CastItoXBytes(ulu.nTransferredUp)); pcTmp = HTTPTemp; } HTTPProcessData.Replace(_T("[3]"), pcTmp); pcTmp = _T(""); if (!WSuploadColumnHidden[4]) { fTotalSpeed += ulu.nDataRate; HTTPTemp.Format(_T("%8.2f "), max((double)ulu.nDataRate/1024, 0.0)); pcTmp = HTTPTemp; } HTTPProcessData.Replace(_T("[4]"), pcTmp); sUpList += HTTPProcessData; } Out.Replace(_T("[UploadFilesList]"), sUpList); HTTPTemp.Format(_T("%s / %s"), CastItoXBytes(fTotalSize), CastItoXBytes(fTotalTransferred)); Out.Replace(_T("[TotalUpTransferred]"), HTTPTemp); HTTPTemp.Format(_T("%8.2f "), max(fTotalSpeed/1024, 0.0)); Out.Replace(_T("[TotalUpSpeed]"), HTTPTemp); if(pThis->m_Params.bShowUploadQueue) { Out.Replace(_T("[UploadQueue]"), pThis->m_Templates.sTransferUpQueueShow); Out.Replace(_T("[UploadQueueList]"), _GetPlainResString(IDS_ONQUEUE)); CString sQueue; OutE = pThis->m_Templates.sTransferUpQueueLine; OutE.Replace(_T("[admin]"), (bAdmin) ? _T("admin") : _T("")); for(int i = 0; i < QueueArray.GetCount(); i++) { TCHAR HTTPTempC[100] = _T(""); if (QueueArray[i].sClientExtra == "none") { HTTPProcessData = OutE; pcTmp = (!WSqueueColumnHidden[0]) ? QueueArray[i].sUserName.GetString() : _T(""); HTTPProcessData.Replace(_T("[UserName]"), pcTmp); pcTmp = (!WSqueueColumnHidden[1]) ? QueueArray[i].sClientNameVersion.GetString() : _T(""); HTTPProcessData.Replace(_T("[ClientSoftV]"), pcTmp); pcTmp = (!WSqueueColumnHidden[2]) ? QueueArray[i].sFileName.GetString() : _T(""); HTTPProcessData.Replace(_T("[FileName]"), pcTmp); pcTmp = _T(""); if (!WSqueueColumnHidden[3]) { _stprintf(HTTPTempC, _T("%i") , QueueArray[i].nScore); pcTmp = HTTPTempC; } HTTPProcessData.Replace(_T("[Score]"), pcTmp); HTTPProcessData.Replace(_T("[ClientState]"), QueueArray[i].sClientState); HTTPProcessData.Replace(_T("[ClientStateSpecial]"), QueueArray[i].sClientStateSpecial); HTTPProcessData.Replace(_T("[ClientSoft]"), QueueArray[i].sClientSoft); HTTPProcessData.Replace(_T("[ClientExtra]"), QueueArray[i].sClientExtra); HTTPProcessData.Replace(_T("[UserHash]"), QueueArray[i].sUserHash); sQueue += HTTPProcessData; } } Out.Replace(_T("[QueueList]"), sQueue); } else Out.Replace(_T("[UploadQueue]"), pThis->m_Templates.sTransferUpQueueHide); if(pThis->m_Params.bShowUploadQueueBanned) { Out.Replace(_T("[UploadQueueBanned]"), pThis->m_Templates.sTransferUpQueueBannedShow); Out.Replace(_T("[UploadQueueBannedList]"), _GetPlainResString(IDS_BANNED)); CString sQueueBanned; OutE = pThis->m_Templates.sTransferUpQueueBannedLine; for(int i = 0; i < QueueArray.GetCount(); i++) { TCHAR HTTPTempC[100] = _T(""); if (QueueArray[i].sClientExtra == _T("banned")) { HTTPProcessData = OutE; pcTmp = (!WSqueueColumnHidden[0]) ? QueueArray[i].sUserName.GetString() : _T(""); HTTPProcessData.Replace(_T("[UserName]"), pcTmp); pcTmp = (!WSqueueColumnHidden[1]) ? QueueArray[i].sClientNameVersion.GetString() : _T(""); HTTPProcessData.Replace(_T("[ClientSoftV]"), pcTmp); pcTmp = (!WSqueueColumnHidden[2]) ? QueueArray[i].sFileName.GetString() : _T(""); HTTPProcessData.Replace(_T("[FileName]"), pcTmp); pcTmp = _T(""); if (!WSqueueColumnHidden[3]) { _stprintf(HTTPTempC, _T("%i") , QueueArray[i].nScore); pcTmp = HTTPTempC; } HTTPProcessData.Replace(_T("[Score]"), pcTmp); HTTPProcessData.Replace(_T("[ClientState]"), QueueArray[i].sClientState); HTTPProcessData.Replace(_T("[ClientStateSpecial]"), QueueArray[i].sClientStateSpecial); HTTPProcessData.Replace(_T("[ClientSoft]"), QueueArray[i].sClientSoft); HTTPProcessData.Replace(_T("[ClientExtra]"), QueueArray[i].sClientExtra); HTTPProcessData.Replace(_T("[UserHash]"), QueueArray[i].sUserHash); sQueueBanned += HTTPProcessData; } } Out.Replace(_T("[QueueListBanned]"), sQueueBanned); } else Out.Replace(_T("[UploadQueueBanned]"), pThis->m_Templates.sTransferUpQueueBannedHide); if(pThis->m_Params.bShowUploadQueueFriend) { Out.Replace(_T("[UploadQueueFriend]"), pThis->m_Templates.sTransferUpQueueFriendShow); Out.Replace(_T("[UploadQueueFriendList]"), _GetPlainResString(IDS_IRC_ADDTOFRIENDLIST)); CString sQueueFriend; OutE = pThis->m_Templates.sTransferUpQueueFriendLine; for(int i = 0; i < QueueArray.GetCount(); i++) { TCHAR HTTPTempC[100] = _T(""); if (QueueArray[i].sClientExtra == "friend") { HTTPProcessData = OutE; pcTmp = (!WSqueueColumnHidden[0]) ? QueueArray[i].sUserName.GetString() : _T(""); HTTPProcessData.Replace(_T("[UserName]"), pcTmp); pcTmp = (!WSqueueColumnHidden[1]) ? QueueArray[i].sClientNameVersion.GetString() : _T(""); HTTPProcessData.Replace(_T("[ClientSoftV]"), pcTmp); pcTmp = (!WSqueueColumnHidden[2]) ? QueueArray[i].sFileName.GetString() : _T(""); HTTPProcessData.Replace(_T("[FileName]"), pcTmp); pcTmp = _T(""); if (!WSqueueColumnHidden[3]) { _stprintf(HTTPTempC, _T("%i") , QueueArray[i].nScore); pcTmp = HTTPTempC; } HTTPProcessData.Replace(_T("[Score]"), pcTmp); HTTPProcessData.Replace(_T("[ClientState]"), QueueArray[i].sClientState); HTTPProcessData.Replace(_T("[ClientStateSpecial]"), QueueArray[i].sClientStateSpecial); HTTPProcessData.Replace(_T("[ClientSoft]"), QueueArray[i].sClientSoft); HTTPProcessData.Replace(_T("[ClientExtra]"), QueueArray[i].sClientExtra); HTTPProcessData.Replace(_T("[UserHash]"), QueueArray[i].sUserHash); sQueueFriend += HTTPProcessData; } } Out.Replace(_T("[QueueListFriend]"), sQueueFriend); } else Out.Replace(_T("[UploadQueueFriend]"), pThis->m_Templates.sTransferUpQueueFriendHide); CString mCounter; mCounter.Format(_T("%i"),nCountQueue); Out.Replace(_T("[CounterQueue]"), mCounter); mCounter.Format(_T("%i"),nCountQueueBanned); Out.Replace(_T("[CounterQueueBanned]"), mCounter); mCounter.Format(_T("%i"),nCountQueueFriend); Out.Replace(_T("[CounterQueueFriend]"), mCounter); mCounter.Format(_T("%i"),nCountQueueSecure); Out.Replace(_T("[CounterQueueSecure]"), mCounter); mCounter.Format(_T("%i"),nCountQueueBannedSecure); Out.Replace(_T("[CounterQueueBannedSecure]"), mCounter); mCounter.Format(_T("%i"),nCountQueueFriendSecure); Out.Replace(_T("[CounterQueueFriendSecure]"), mCounter); mCounter.Format(_T("%i"),nCountQueue+nCountQueueBanned+nCountQueueFriend); Out.Replace(_T("[CounterAll]"), mCounter); mCounter.Format(_T("%i"),nCountQueueSecure+nCountQueueBannedSecure+nCountQueueFriendSecure); Out.Replace(_T("[CounterAllSecure]"), mCounter); Out.Replace(_T("[ShowUploadQueue]"), _GetPlainResString(IDS_VIEWQUEUE)); Out.Replace(_T("[ShowUploadQueueList]"), _GetPlainResString(IDS_WEB_SHOW_UPLOAD_QUEUE)); Out.Replace(_T("[ShowUploadQueueListBanned]"), _GetPlainResString(IDS_WEB_SHOW_UPLOAD_QUEUE_BANNED)); Out.Replace(_T("[ShowUploadQueueListFriend]"), _GetPlainResString(IDS_WEB_SHOW_UPLOAD_QUEUE_FRIEND)); CString strTmp = (pThis->m_Params.bQueueSortReverse) ? _T("&sortreverse=false") : _T("&sortreverse=true"); if(pThis->m_Params.QueueSort == QU_SORT_CLIENT) Out.Replace(_T("[SortQClient]"), strTmp); else Out.Replace(_T("[SortQClient]"), _T("")); if(pThis->m_Params.QueueSort == QU_SORT_USER) Out.Replace(_T("[SortQUser]"), strTmp); else Out.Replace(_T("[SortQUser]"), _T("")); if(pThis->m_Params.QueueSort == QU_SORT_VERSION) Out.Replace(_T("[SortQVersion]"), strTmp); else Out.Replace(_T("[SortQVersion]"), _T("")); if(pThis->m_Params.QueueSort == QU_SORT_FILENAME) Out.Replace(_T("[SortQFilename]"), strTmp); else Out.Replace(_T("[SortQFilename]"), _T("")); if(pThis->m_Params.QueueSort == QU_SORT_SCORE) Out.Replace(_T("[SortQScore]"), strTmp); else Out.Replace(_T("[SortQScore]"), _T("")); CString pcSortIcon = (pThis->m_Params.bQueueSortReverse) ? pThis->m_Templates.sUpArrow : pThis->m_Templates.sDownArrow; _GetPlainResString(&strTmp, IDS_QL_USERNAME); if (!WSqueueColumnHidden[0]) { Out.Replace(_T("[UserNameTitleI]"), (pThis->m_Params.QueueSort == QU_SORT_USER) ? pcSortIcon : _T("")); Out.Replace(_T("[UserNameTitle]"), strTmp); } else { Out.Replace(_T("[UserNameTitleI]"), _T("")); Out.Replace(_T("[UserNameTitle]"), _T("")); } Out.Replace(_T("[UserNameTitleM]"), strTmp); _GetPlainResString(&strTmp, IDS_CD_CSOFT); if (!WSqueueColumnHidden[1]) { Out.Replace(_T("[VersionI]"), (pThis->m_Params.QueueSort == QU_SORT_VERSION) ? pcSortIcon : _T("")); Out.Replace(_T("[Version]"), strTmp); } else { Out.Replace(_T("[VersionI]"), _T("")); Out.Replace(_T("[Version]"), _T("")); } Out.Replace(_T("[VersionM]"), strTmp); _GetPlainResString(&strTmp, IDS_DL_FILENAME); if (!WSqueueColumnHidden[2]) { Out.Replace(_T("[FileNameTitleI]"), (pThis->m_Params.QueueSort == QU_SORT_FILENAME) ? pcSortIcon : _T("")); Out.Replace(_T("[FileNameTitle]"), strTmp); } else { Out.Replace(_T("[FileNameTitleI]"), _T("")); Out.Replace(_T("[FileNameTitle]"), _T("")); } Out.Replace(_T("[FileNameTitleM]"), strTmp); _GetPlainResString(&strTmp, IDS_SCORE); if (!WSqueueColumnHidden[3]) { Out.Replace(_T("[ScoreTitleI]"), (pThis->m_Params.QueueSort == QU_SORT_SCORE) ? pcSortIcon : _T("")); Out.Replace(_T("[ScoreTitle]"), strTmp); } else { Out.Replace(_T("[ScoreTitleI]"), _T("")); Out.Replace(_T("[ScoreTitle]"), _T("")); } Out.Replace(_T("[ScoreTitleM]"), strTmp); return Out; } CString CWebServer::_GetSharedFilesList(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString sSession = _ParseURL(Data.sURL, _T("ses")); bool bAdmin = IsSessionAdmin(Data,sSession); CString strSort = _ParseURL(Data.sURL, _T("sort")); CString strTmp = _ParseURL(Data.sURL, _T("sortreverse")); if (!strSort.IsEmpty()) { bool bDirection = false; if (strSort == "state") pThis->m_Params.SharedSort = SHARED_SORT_STATE; else if (strSort == "type") pThis->m_Params.SharedSort = SHARED_SORT_TYPE; else if (strSort == "name") { pThis->m_Params.SharedSort = SHARED_SORT_NAME; bDirection = true; } else if (strSort == "size") pThis->m_Params.SharedSort = SHARED_SORT_SIZE; else if (strSort == "transferred") pThis->m_Params.SharedSort = SHARED_SORT_TRANSFERRED; else if (strSort == "alltimetransferred") pThis->m_Params.SharedSort = SHARED_SORT_ALL_TIME_TRANSFERRED; else if (strSort == "requests") pThis->m_Params.SharedSort = SHARED_SORT_REQUESTS; else if (strSort == "alltimerequests") pThis->m_Params.SharedSort = SHARED_SORT_ALL_TIME_REQUESTS; else if (strSort == "accepts") pThis->m_Params.SharedSort = SHARED_SORT_ACCEPTS; else if (strSort == "alltimeaccepts") pThis->m_Params.SharedSort = SHARED_SORT_ALL_TIME_ACCEPTS; else if (strSort == "completes") pThis->m_Params.SharedSort = SHARED_SORT_COMPLETES; else if (strSort == "priority") pThis->m_Params.SharedSort = SHARED_SORT_PRIORITY; if (strTmp.IsEmpty()) pThis->m_Params.bSharedSortReverse = bDirection; } if (!strTmp.IsEmpty()) pThis->m_Params.bSharedSortReverse = (strTmp == "true"); if(!_ParseURL(Data.sURL, _T("hash")).IsEmpty() && !_ParseURL(Data.sURL, _T("prio")).IsEmpty() && IsSessionAdmin(Data,sSession)) { CKnownFile* cur_file; uchar fileid[16]; CString hash = _ParseURL(Data.sURL, _T("hash")); if (hash.GetLength()==32 && DecodeBase16(hash, hash.GetLength(), fileid, ARRSIZE(fileid))) { cur_file = CGlobalVariable::sharedfiles->GetFileByID(fileid); if (cur_file != 0) { cur_file->SetAutoUpPriority(false); strTmp = _ParseURL(Data.sURL, _T("prio")); if (strTmp == _T("verylow")) cur_file->SetUpPriority(PR_VERYLOW); else if (strTmp == _T("low")) cur_file->SetUpPriority(PR_LOW); else if (strTmp == _T("normal")) cur_file->SetUpPriority(PR_NORMAL); else if (strTmp == _T("high")) cur_file->SetUpPriority(PR_HIGH); else if (strTmp == _T("release")) cur_file->SetUpPriority(PR_VERYHIGH); else if (strTmp == _T("auto")) { cur_file->SetAutoUpPriority(true); cur_file->UpdateAutoUpPriority(); } // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION, WEBGUIIA_UPD_SFUPDATE, (LPARAM)cur_file); } } } CString sCmd = _ParseURL(Data.sURL, _T("c")); if (sCmd.CompareNoCase(_T("menu")) == 0) { int iMenu = _tstoi(_ParseURL(Data.sURL, _T("m"))); bool bValue = _tstoi(_ParseURL(Data.sURL, _T("v")))!=0; WSsharedColumnHidden[iMenu] = bValue; SaveWIConfigArray(WSsharedColumnHidden, ARRSIZE(WSsharedColumnHidden), _T("sharedColumnHidden")); } // Comment UI //if(_ParseURL(Data.sURL, _T("reload")) == _T("true")) // SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_SHARED_FILES_RELOAD,0); CString Out = pThis->m_Templates.sSharedList; strTmp = (pThis->m_Params.bSharedSortReverse) ? _T("false") : _T("true") ; //State sorting link if(pThis->m_Params.SharedSort == SHARED_SORT_STATE) Out.Replace(_T("[SortState]"), _T("sort=state&sortreverse=") + strTmp); else Out.Replace(_T("[SortState]"), _T("sort=state")); //Type sorting link if(pThis->m_Params.SharedSort == SHARED_SORT_TYPE) Out.Replace(_T("[SortType]"), _T("sort=type&sortreverse=") + strTmp); else Out.Replace(_T("[SortType]"), _T("sort=type")); //Name sorting link if(pThis->m_Params.SharedSort == SHARED_SORT_NAME) Out.Replace(_T("[SortName]"), _T("sort=name&sortreverse=") + strTmp); else Out.Replace(_T("[SortName]"), _T("sort=name")); //Size sorting Link if(pThis->m_Params.SharedSort == SHARED_SORT_SIZE) Out.Replace(_T("[SortSize]"), _T("sort=size&sortreverse=") + strTmp); else Out.Replace(_T("[SortSize]"), _T("sort=size")); //Complete Sources sorting Link if(pThis->m_Params.SharedSort == SHARED_SORT_COMPLETES) Out.Replace(_T("[SortCompletes]"), _T("sort=completes&sortreverse=") + strTmp); else Out.Replace(_T("[SortCompletes]"), _T("sort=completes")); //Priority sorting Link if(pThis->m_Params.SharedSort == SHARED_SORT_PRIORITY) Out.Replace(_T("[SortPriority]"), _T("sort=priority&sortreverse=") + strTmp); else Out.Replace(_T("[SortPriority]"), _T("sort=priority")); //Transferred sorting link if(pThis->m_Params.SharedSort == SHARED_SORT_TRANSFERRED) { if(pThis->m_Params.bSharedSortReverse) Out.Replace(_T("[SortTransferred]"), _T("sort=alltimetransferred&sortreverse=") + strTmp); else Out.Replace(_T("[SortTransferred]"), _T("sort=transferred&sortreverse=") + strTmp); } else if(pThis->m_Params.SharedSort == SHARED_SORT_ALL_TIME_TRANSFERRED) { if(pThis->m_Params.bSharedSortReverse) Out.Replace(_T("[SortTransferred]"), _T("sort=transferred&sortreverse=") + strTmp); else Out.Replace(_T("[SortTransferred]"), _T("sort=alltimetransferred&sortreverse=") + strTmp); } else Out.Replace(_T("[SortTransferred]"), _T("&sort=transferred&sortreverse=false")); //Request sorting link if(pThis->m_Params.SharedSort == SHARED_SORT_REQUESTS) { if(pThis->m_Params.bSharedSortReverse) Out.Replace(_T("[SortRequests]"), _T("sort=alltimerequests&sortreverse=") + strTmp); else Out.Replace(_T("[SortRequests]"), _T("sort=requests&sortreverse=") + strTmp); } else if(pThis->m_Params.SharedSort == SHARED_SORT_ALL_TIME_REQUESTS) { if(pThis->m_Params.bSharedSortReverse) Out.Replace(_T("[SortRequests]"), _T("sort=requests&sortreverse=") + strTmp); else Out.Replace(_T("[SortRequests]"), _T("sort=alltimerequests&sortreverse=") + strTmp); } else Out.Replace(_T("[SortRequests]"), _T("&sort=requests&sortreverse=false")); //Accepts sorting link if(pThis->m_Params.SharedSort == SHARED_SORT_ACCEPTS) { if(pThis->m_Params.bSharedSortReverse) Out.Replace(_T("[SortAccepts]"), _T("sort=alltimeaccepts&sortreverse=") + strTmp); else Out.Replace(_T("[SortAccepts]"), _T("sort=accepts&sortreverse=") + strTmp); } else if(pThis->m_Params.SharedSort == SHARED_SORT_ALL_TIME_ACCEPTS) { if(pThis->m_Params.bSharedSortReverse) Out.Replace(_T("[SortAccepts]"), _T("sort=accepts&sortreverse=") + strTmp); else Out.Replace(_T("[SortAccepts]"), _T("sort=alltimeaccepts&sortreverse=") + strTmp); } else Out.Replace(_T("[SortAccepts]"), _T("&sort=accepts&sortreverse=false")); if(_ParseURL(Data.sURL, _T("reload")) == "true") { // Comment UI /*CString strResultLog = _SpecialChars(theApp.emuledlg->GetLastLogEntry() ); //Pick-up last line of the log strResultLog = strResultLog.TrimRight('\n'); int iStringIndex = strResultLog.ReverseFind('\n'); if (iStringIndex != -1) strResultLog = strResultLog.Mid(iStringIndex); Out.Replace(_T("[Message]"), strResultLog);*/ } else Out.Replace(_T("[Message]"), _T("")); const TCHAR *pcSortIcon = (pThis->m_Params.bSharedSortReverse) ? pThis->m_Templates.sUpArrow : pThis->m_Templates.sDownArrow; const TCHAR *pcIconTmp; _GetPlainResString(&strTmp, IDS_DL_FILENAME); if (!WSsharedColumnHidden[0]) { Out.Replace(_T("[FilenameI]"), (pThis->m_Params.SharedSort == SHARED_SORT_NAME) ? pcSortIcon : _T("")); Out.Replace(_T("[Filename]"), strTmp); } else { Out.Replace(_T("[FilenameI]"), _T("")); Out.Replace(_T("[Filename]"), _T("")); } Out.Replace(_T("[FilenameM]"), strTmp); _GetPlainResString(&strTmp, IDS_SF_TRANSFERRED); if (!WSsharedColumnHidden[1]) { pcIconTmp = (pThis->m_Params.SharedSort == SHARED_SORT_TRANSFERRED) ? pcSortIcon : _T(""); if (pThis->m_Params.SharedSort == SHARED_SORT_ALL_TIME_TRANSFERRED) pcIconTmp = (pThis->m_Params.bSharedSortReverse) ? pThis->m_Templates.strUpDoubleArrow : pThis->m_Templates.strDownDoubleArrow; Out.Replace(_T("[FileTransferredI]"), pcIconTmp); Out.Replace(_T("[FileTransferred]"), strTmp); } else { Out.Replace(_T("[FileTransferredI]"), _T("")); Out.Replace(_T("[FileTransferred]"), _T("")); } Out.Replace(_T("[FileTransferredM]"), strTmp); _GetPlainResString(&strTmp, IDS_SF_REQUESTS); if (!WSsharedColumnHidden[2]) { pcIconTmp = (pThis->m_Params.SharedSort == SHARED_SORT_REQUESTS) ? pcSortIcon : _T(""); if (pThis->m_Params.SharedSort == SHARED_SORT_ALL_TIME_REQUESTS) pcIconTmp = (pThis->m_Params.bSharedSortReverse) ? pThis->m_Templates.strUpDoubleArrow : pThis->m_Templates.strDownDoubleArrow; Out.Replace(_T("[FileRequestsI]"), pcIconTmp); Out.Replace(_T("[FileRequests]"), strTmp); } else { Out.Replace(_T("[FileRequestsI]"), _T("")); Out.Replace(_T("[FileRequests]"), _T("")); } Out.Replace(_T("[FileRequestsM]"), strTmp); _GetPlainResString(&strTmp, IDS_SF_ACCEPTS); if (!WSsharedColumnHidden[3]) { pcIconTmp = (pThis->m_Params.SharedSort == SHARED_SORT_ACCEPTS) ? pcSortIcon : _T(""); if (pThis->m_Params.SharedSort == SHARED_SORT_ALL_TIME_ACCEPTS) pcIconTmp = (pThis->m_Params.bSharedSortReverse) ? pThis->m_Templates.strUpDoubleArrow : pThis->m_Templates.strDownDoubleArrow; Out.Replace(_T("[FileAcceptsI]"), pcIconTmp); Out.Replace(_T("[FileAccepts]"), strTmp); } else { Out.Replace(_T("[FileAcceptsI]"), _T("")); Out.Replace(_T("[FileAccepts]"), _T("")); } Out.Replace(_T("[FileAcceptsM]"), strTmp); _GetPlainResString(&strTmp, IDS_DL_SIZE); if (!WSsharedColumnHidden[4]) { Out.Replace(_T("[SizeI]"), (pThis->m_Params.SharedSort == SHARED_SORT_SIZE) ? pcSortIcon : _T("")); Out.Replace(_T("[Size]"), strTmp); } else { Out.Replace(_T("[SizeI]"), _T("")); Out.Replace(_T("[Size]"), _T("")); } Out.Replace(_T("[SizeM]"), strTmp); _GetPlainResString(&strTmp, IDS_COMPLSOURCES); if (!WSsharedColumnHidden[5]) { Out.Replace(_T("[CompletesI]"), (pThis->m_Params.SharedSort == SHARED_SORT_COMPLETES) ? pcSortIcon : _T("")); Out.Replace(_T("[Completes]"), strTmp); } else { Out.Replace(_T("[CompletesI]"), _T("")); Out.Replace(_T("[Completes]"), _T("")); } Out.Replace(_T("[CompletesM]"), strTmp); _GetPlainResString(&strTmp, IDS_PRIORITY); if (!WSsharedColumnHidden[6]) { Out.Replace(_T("[PriorityI]"), (pThis->m_Params.SharedSort == SHARED_SORT_PRIORITY) ? pcSortIcon : _T("")); Out.Replace(_T("[Priority]"), strTmp); } else { Out.Replace(_T("[PriorityI]"), _T("")); Out.Replace(_T("[Priority]"), _T("")); } Out.Replace(_T("[PriorityM]"), strTmp); Out.Replace(_T("[Actions]"), _GetPlainResString(IDS_WEB_ACTIONS)); Out.Replace(_T("[Reload]"), _GetPlainResString(IDS_SF_RELOAD)); Out.Replace(_T("[Session]"), sSession); Out.Replace(_T("[SharedList]"), _GetPlainResString(IDS_SHAREDFILES)); CString OutE = pThis->m_Templates.sSharedLine; CArray<SharedFiles> SharedArray; // Populating array for (int ix=0;ix<CGlobalVariable::sharedfiles->GetCount();ix++) { CCKey bufKey; CKnownFile* cur_file = CGlobalVariable::sharedfiles->GetFileByIndex(ix); // uint16 nCountLo, nCountHi; uint32 dwResId; bool bPartFile = cur_file->IsPartFile(); SharedFiles dFile; //dFile.sFileName = _SpecialChars(cur_file->GetFileName()); dFile.bIsPartFile = cur_file->IsPartFile(); dFile.sFileName = cur_file->GetFileName(); if(bPartFile) dFile.sFileState = _T("filedown"); else dFile.sFileState = _T("file"); dFile.sFileType = GetWebImageNameForFileType(dFile.sFileName); dFile.m_qwFileSize = cur_file->GetFileSize(); // Comment UI /*if (CGlobalVariable::serverconnect->IsConnected()) dFile.sED2kLink = theApp.CreateED2kSourceLink(cur_file); else dFile.sED2kLink = CreateED2kLink(cur_file);*/ dFile.nFileTransferred = cur_file->statistic.GetTransferred(); dFile.nFileAllTimeTransferred = cur_file->statistic.GetAllTimeTransferred(); dFile.nFileRequests = cur_file->statistic.GetRequests(); dFile.nFileAllTimeRequests = cur_file->statistic.GetAllTimeRequests(); dFile.nFileAccepts = cur_file->statistic.GetAccepts(); dFile.nFileAllTimeAccepts = cur_file->statistic.GetAllTimeAccepts(); dFile.sFileHash = md4str(cur_file->GetFileHash()); if (cur_file->m_nCompleteSourcesCountLo == 0) dFile.sFileCompletes.Format(_T("< %u"), cur_file->m_nCompleteSourcesCountHi); else if (cur_file->m_nCompleteSourcesCountLo == cur_file->m_nCompleteSourcesCountHi) dFile.sFileCompletes.Format(_T("%u"), cur_file->m_nCompleteSourcesCountLo); else dFile.sFileCompletes.Format(_T("%u - %u"), cur_file->m_nCompleteSourcesCountLo, cur_file->m_nCompleteSourcesCountHi); if (cur_file->IsAutoUpPriority()) { if (cur_file->GetUpPriority() == PR_NORMAL) dwResId = IDS_PRIOAUTONORMAL; else if (cur_file->GetUpPriority() == PR_HIGH) dwResId = IDS_PRIOAUTOHIGH; else if (cur_file->GetUpPriority() == PR_VERYHIGH) dwResId = IDS_PRIOAUTORELEASE; else //PR_LOW dwResId = IDS_PRIOAUTOLOW; } else { if (cur_file->GetUpPriority() == PR_LOW) dwResId = IDS_PRIOLOW; else if (cur_file->GetUpPriority() == PR_NORMAL) dwResId = IDS_PRIONORMAL; else if (cur_file->GetUpPriority() == PR_HIGH) dwResId = IDS_PRIOHIGH; else if (cur_file->GetUpPriority() == PR_VERYHIGH) dwResId = IDS_PRIORELEASE; else //PR_VERYLOW dwResId = IDS_PRIOVERYLOW; } dFile.sFilePriority=GetResString(dwResId); dFile.nFilePriority = cur_file->GetUpPriority(); dFile.bFileAutoPriority = cur_file->IsAutoUpPriority(); SharedArray.Add(dFile); } // Sorting (simple bubble sort, we don't have tons of data here) bool bSorted = true; for(int nMax = 0;bSorted && nMax < SharedArray.GetCount()*2; nMax++) { bSorted = false; for(int i = 0; i < SharedArray.GetCount() - 1; i++) { bool bSwap = false; switch(pThis->m_Params.SharedSort) { case SHARED_SORT_STATE: bSwap = SharedArray[i].sFileState.CompareNoCase(SharedArray[i+1].sFileState) > 0; break; case SHARED_SORT_TYPE: bSwap = SharedArray[i].sFileType.CompareNoCase(SharedArray[i+1].sFileType) > 0; break; case SHARED_SORT_NAME: bSwap = SharedArray[i].sFileName.CompareNoCase(SharedArray[i+1].sFileName) < 0; break; case SHARED_SORT_SIZE: bSwap = SharedArray[i].m_qwFileSize < SharedArray[i+1].m_qwFileSize; break; case SHARED_SORT_TRANSFERRED: bSwap = SharedArray[i].nFileTransferred < SharedArray[i+1].nFileTransferred; break; case SHARED_SORT_ALL_TIME_TRANSFERRED: bSwap = SharedArray[i].nFileAllTimeTransferred < SharedArray[i+1].nFileAllTimeTransferred; break; case SHARED_SORT_REQUESTS: bSwap = SharedArray[i].nFileRequests < SharedArray[i+1].nFileRequests; break; case SHARED_SORT_ALL_TIME_REQUESTS: bSwap = SharedArray[i].nFileAllTimeRequests < SharedArray[i+1].nFileAllTimeRequests; break; case SHARED_SORT_ACCEPTS: bSwap = SharedArray[i].nFileAccepts < SharedArray[i+1].nFileAccepts; break; case SHARED_SORT_ALL_TIME_ACCEPTS: bSwap = SharedArray[i].nFileAllTimeAccepts < SharedArray[i+1].nFileAllTimeAccepts; break; case SHARED_SORT_COMPLETES: bSwap = SharedArray[i].dblFileCompletes < SharedArray[i+1].dblFileCompletes; break; case SHARED_SORT_PRIORITY: //Very low priority is define equal to 4 ! Must adapte sorting code if(SharedArray[i].nFilePriority == 4) { if(SharedArray[i+1].nFilePriority == 4) bSwap = false; else bSwap = true; } else if(SharedArray[i+1].nFilePriority == 4) { if(SharedArray[i].nFilePriority == 4) bSwap = true; else bSwap = false; } else bSwap = SharedArray[i].nFilePriority < SharedArray[i+1].nFilePriority; break; } if(pThis->m_Params.bSharedSortReverse) bSwap = !bSwap; if(bSwap) { bSorted = true; SharedFiles TmpFile = SharedArray[i]; SharedArray[i] = SharedArray[i+1]; SharedArray[i+1] = TmpFile; } } } // Displaying CString sSharedList, HTTPProcessData; for(int i = 0; i < SharedArray.GetCount(); i++) { TCHAR HTTPTempC[100] = _T(""); HTTPProcessData = OutE; if (SharedArray[i].sFileHash == _ParseURL(Data.sURL,_T("hash")) ) HTTPProcessData.Replace(_T("[LastChangedDataset]"), _T("checked")); else HTTPProcessData.Replace(_T("[LastChangedDataset]"), _T("checked_no")); CString ed2k; //ed2klink CString session; //session CString hash; //hash CString fname; //filename CString sharedpriority; //priority switch(SharedArray[i].nFilePriority) { case PR_VERYLOW: sharedpriority = _T("VeryLow"); break; case PR_LOW: sharedpriority = _T("Low"); break; case PR_NORMAL: sharedpriority = _T("Normal"); break; case PR_HIGH: sharedpriority = _T("High"); break; case PR_VERYHIGH: sharedpriority = _T("Release"); break; } if (SharedArray[i].bFileAutoPriority) sharedpriority = _T("Auto"); CString JSED2kLink=SharedArray[i].sED2kLink; JSED2kLink.Replace(_T("'"),_T("&#8217;")); ed2k = JSED2kLink; session = sSession; hash = SharedArray[i].sFileHash; fname = SharedArray[i].sFileName; fname.Replace(_T("'"),_T("&#8217;")); CKnownFile* cur_file; uchar fileid[16]; if (hash.GetLength()==32 && DecodeBase16(hash, hash.GetLength(), fileid, ARRSIZE(fileid))) HTTPProcessData.Replace(_T("[hash]"), hash); cur_file=CGlobalVariable::sharedfiles->GetFileByID(fileid); if (cur_file != NULL) { if (cur_file->GetUpPriority() == PR_VERYHIGH) HTTPProcessData.Replace(_T("[FileIsPriority]"), _T("release")); else HTTPProcessData.Replace(_T("[FileIsPriority]"), _T("none")); } HTTPProcessData.Replace(_T("[admin]"), (bAdmin) ? _T("admin") : _T("")); HTTPProcessData.Replace(_T("[ed2k]"), ed2k); HTTPProcessData.Replace(_T("[fname]"), fname); HTTPProcessData.Replace(_T("[session]"), session); HTTPProcessData.Replace(_T("[shared-priority]"), sharedpriority); //DonGato: priority change HTTPProcessData.Replace(_T("[FileName]"), _SpecialChars(SharedArray[i].sFileName)); HTTPProcessData.Replace(_T("[FileType]"), SharedArray[i].sFileType); HTTPProcessData.Replace(_T("[FileState]"), SharedArray[i].sFileState); bool downloadable=!cur_file->IsPartFile() && (thePrefs.GetMaxWebUploadFileSizeMB() == 0 || SharedArray[i].m_qwFileSize < thePrefs.GetMaxWebUploadFileSizeMB()*1024*1024); HTTPProcessData.Replace(_T("[Downloadable]"), downloadable?_T("yes"):_T("no") ); HTTPProcessData.Replace(_T("[IFDOWNLOADABLE]"), downloadable?_T(""):_T("<!--") ); HTTPProcessData.Replace(_T("[/IFDOWNLOADABLE]"), downloadable?_T(""):_T("-->") ); if (!WSsharedColumnHidden[0]) { if(SharedArray[i].sFileName.GetLength() > SHORT_LENGTH) HTTPProcessData.Replace(_T("[ShortFileName]"), _SpecialChars(SharedArray[i].sFileName.Left(SHORT_LENGTH-3)) + _T("...")); else HTTPProcessData.Replace(_T("[ShortFileName]"), _SpecialChars(SharedArray[i].sFileName)); } else HTTPProcessData.Replace(_T("[ShortFileName]"), _T("")); if (!WSsharedColumnHidden[1]) { _stprintf(HTTPTempC, _T("%s"),CastItoXBytes(SharedArray[i].nFileTransferred)); HTTPProcessData.Replace(_T("[FileTransferred]"), CString(HTTPTempC)); _stprintf(HTTPTempC, _T("%s"),CastItoXBytes(SharedArray[i].nFileAllTimeTransferred)); HTTPProcessData.Replace(_T("[FileAllTimeTransferred]"), _T(" (") +CString(HTTPTempC)+_T(")") ); } else { HTTPProcessData.Replace(_T("[FileTransferred]"), _T("")); HTTPProcessData.Replace(_T("[FileAllTimeTransferred]"), _T("")); } if (!WSsharedColumnHidden[2]) { _stprintf(HTTPTempC, _T("%i"), SharedArray[i].nFileRequests); HTTPProcessData.Replace(_T("[FileRequests]"), CString(HTTPTempC)); _stprintf(HTTPTempC, _T("%i"), SharedArray[i].nFileAllTimeRequests); HTTPProcessData.Replace(_T("[FileAllTimeRequests]"), _T(" (") + CString(HTTPTempC)+ _T(")")); } else { HTTPProcessData.Replace(_T("[FileRequests]"), _T("")); HTTPProcessData.Replace(_T("[FileAllTimeRequests]"), _T("")); } if (!WSsharedColumnHidden[3]) { _stprintf(HTTPTempC, _T("%i"), SharedArray[i].nFileAccepts); HTTPProcessData.Replace(_T("[FileAccepts]"), CString(HTTPTempC)); _stprintf(HTTPTempC, _T("%i"), SharedArray[i].nFileAllTimeAccepts); HTTPProcessData.Replace(_T("[FileAllTimeAccepts]"), _T(" (")+CString(HTTPTempC)+ _T(")")); } else { HTTPProcessData.Replace(_T("[FileAccepts]"), _T("")); HTTPProcessData.Replace(_T("[FileAllTimeAccepts]"), _T("")); } if (!WSsharedColumnHidden[4]) { _stprintf(HTTPTempC, _T("%s"),CastItoXBytes(SharedArray[i].m_qwFileSize)); HTTPProcessData.Replace(_T("[FileSize]"), CString(HTTPTempC)); } else HTTPProcessData.Replace(_T("[FileSize]"), _T("")); if (!WSsharedColumnHidden[5]) HTTPProcessData.Replace(_T("[Completes]"), SharedArray[i].sFileCompletes); else HTTPProcessData.Replace(_T("[Completes]"), _T("")); if (!WSsharedColumnHidden[6]) HTTPProcessData.Replace(_T("[Priority]"), SharedArray[i].sFilePriority); else HTTPProcessData.Replace(_T("[Priority]"), _T("")); HTTPProcessData.Replace(_T("[FileHash]"), SharedArray[i].sFileHash); sSharedList += HTTPProcessData; } Out.Replace(_T("[SharedFilesList]"), sSharedList); Out.Replace(_T("[Session]"), sSession); return Out; } CString CWebServer::_GetGraphs(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString Out = pThis->m_Templates.sGraphs; CString strGraphDownload, strGraphUpload, strGraphCons; for(int i = 0; i < WEB_GRAPH_WIDTH; i++) { if(i < pThis->m_Params.PointsForWeb.GetCount()) { if(i != 0) { strGraphDownload += _T(','); strGraphUpload += _T(','); strGraphCons += _T(','); } // download strGraphDownload.AppendFormat(_T("%u"), (uint32)(pThis->m_Params.PointsForWeb[i].download*1024)); // upload strGraphUpload.AppendFormat(_T("%u"), (uint32)(pThis->m_Params.PointsForWeb[i].upload*1024)); // connections strGraphCons.AppendFormat(_T("%u"), (uint32)(pThis->m_Params.PointsForWeb[i].connections)); } } Out.Replace(_T("[GraphDownload]"), strGraphDownload); Out.Replace(_T("[GraphUpload]"), strGraphUpload); Out.Replace(_T("[GraphConnections]"), strGraphCons); Out.Replace(_T("[TxtDownload]"), _GetPlainResString(IDS_TW_DOWNLOADS)); Out.Replace(_T("[TxtUpload]"), _GetPlainResString(IDS_TW_UPLOADS)); Out.Replace(_T("[TxtTime]"), _GetPlainResString(IDS_TIME)); Out.Replace(_T("[KByteSec]"), _GetPlainResString(IDS_KBYTESPERSEC)); Out.Replace(_T("[TxtConnections]"), _GetPlainResString(IDS_SP_ACTCON)); Out.Replace(_T("[ScaleTime]"), CastSecondsToHM(thePrefs.GetTrafficOMeterInterval() * WEB_GRAPH_WIDTH)); CString s1; s1.Format(_T("%u"), thePrefs.GetMaxGraphDownloadRate()+4 ); Out.Replace(_T("[MaxDownload]"), s1); s1.Format(_T("%u"), thePrefs.GetMaxGraphUploadRate(true)+4 ); Out.Replace(_T("[MaxUpload]"), s1); s1.Format(_T("%u"), thePrefs.GetMaxConnections()+20); Out.Replace(_T("[MaxConnections]"), s1); return Out; } CString CWebServer::_GetAddServerBox(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString sSession = _ParseURL(Data.sURL, _T("ses")); if (!IsSessionAdmin(Data,sSession)) return _T(""); CString Out = pThis->m_Templates.sAddServerBox; /*CString resultlog = _SpecialChars(theApp.emuledlg->GetLastLogEntry() ); //Pick-up last line of the log if(_ParseURL(Data.sURL, _T("addserver")) == "true") { CString strServerAddress = _ParseURL(Data.sURL, _T("serveraddr")).Trim(); CString strServerPort = _ParseURL(Data.sURL, _T("serverport")).Trim(); if (!strServerAddress.IsEmpty() && !strServerPort.IsEmpty()) { CString strServerName = _ParseURL(Data.sURL, _T("servername")).Trim(); if (strServerName.IsEmpty()) strServerName = strServerAddress; CServer* nsrv = new CServer((uint16)_tstoi(strServerPort), strServerAddress); nsrv->SetListName(strServerName); if (!theApp.emuledlg->serverwnd->serverlistctrl.AddServer(nsrv,true)) { delete nsrv; Out.Replace(_T("[Message]"), _GetPlainResString(IDS_ERROR)); } else { if (_ParseURL(Data.sURL, _T("priority")) == _T("low")) nsrv->SetPreference(PR_LOW); else if (_ParseURL(Data.sURL, _T("priority")) == _T("normal")) nsrv->SetPreference(PR_NORMAL); else if (_ParseURL(Data.sURL, _T("priority")) == _T("high")) nsrv->SetPreference(PR_HIGH); SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_UPDATESERVER,(LPARAM)nsrv); if(_ParseURL(Data.sURL, _T("addtostatic")) == _T("true")) { _AddToStatic(_ParseURL(Data.sURL, _T("serveraddr")),_tstoi(_ParseURL(Data.sURL, _T("serverport")))); resultlog += _T("<br />"); resultlog += _SpecialChars(theApp.emuledlg->GetLastLogEntry() ); //Pick-up last line of the log } resultlog = resultlog.TrimRight('\n'); resultlog = resultlog.Mid(resultlog.ReverseFind('\n')); Out.Replace(_T("[Message]"), resultlog); if(_ParseURL(Data.sURL, _T("connectnow")) == _T("true")) _ConnectToServer(_ParseURL(Data.sURL, _T("serveraddr")),_tstoi(_ParseURL(Data.sURL, _T("serverport")))); } } else Out.Replace(_T("[Message]"), _GetPlainResString(IDS_ERROR)); } else if(_ParseURL(Data.sURL, _T("updateservermetfromurl")) == _T("true")) { CString url=_ParseURL(Data.sURL, _T("servermeturl")); const TCHAR* urlbuf=url; SendMessage(theApp.emuledlg->m_hWnd, WEB_GUI_INTERACTION, WEBGUIIA_UPDATESERVERMETFROMURL, (LPARAM)urlbuf); CString resultlog = _SpecialChars(theApp.emuledlg->GetLastLogEntry() ); resultlog = resultlog.TrimRight('\n'); resultlog = resultlog.Mid(resultlog.ReverseFind('\n')); Out.Replace(_T("[Message]"),resultlog); } else Out.Replace(_T("[Message]"), _T("")); Out.Replace(_T("[AddServer]"), _GetPlainResString(IDS_SV_NEWSERVER)); Out.Replace(_T("[IP]"), _GetPlainResString(IDS_SV_ADDRESS)); Out.Replace(_T("[Port]"), _GetPlainResString(IDS_PORT)); Out.Replace(_T("[Name]"), _GetPlainResString(IDS_SW_NAME)); Out.Replace(_T("[Static]"), _GetPlainResString(IDS_STATICSERVER)); Out.Replace(_T("[ConnectNow]"), _GetPlainResString(IDS_IRC_CONNECT)); Out.Replace(_T("[Priority]"), _GetPlainResString(IDS_PRIORITY)); Out.Replace(_T("[Low]"), _GetPlainResString(IDS_PRIOLOW)); Out.Replace(_T("[Normal]"), _GetPlainResString(IDS_PRIONORMAL)); Out.Replace(_T("[High]"), _GetPlainResString(IDS_PRIOHIGH)); Out.Replace(_T("[Add]"), _GetPlainResString(IDS_SV_ADD)); Out.Replace(_T("[UpdateServerMetFromURL]"), _GetPlainResString(IDS_SV_MET)); Out.Replace(_T("[URL]"), _GetPlainResString(IDS_SV_URL)); Out.Replace(_T("[Apply]"), _GetPlainResString(IDS_PW_APPLY)); Out.Replace(_T("[URL_Disconnect]"), IsSessionAdmin(Data,sSession)?CString(_T("?ses=") + sSession + _T("&w=server&c=disconnect") ):GetPermissionDenied()); Out.Replace(_T("[URL_Connect]"), IsSessionAdmin(Data,sSession)?CString(_T("?ses=") + sSession + _T("&w=server&c=connect")):GetPermissionDenied()); Out.Replace(_T("[Disconnect]"), _GetPlainResString(IDS_IRC_DISCONNECT)); Out.Replace(_T("[Connect]"), _GetPlainResString(IDS_CONNECTTOANYSERVER)); Out.Replace(_T("[ServerOptions]"), CString(_GetPlainResString(IDS_FSTAT_CONNECTION))); Out.Replace(_T("[Execute]"), _GetPlainResString(IDS_IRC_PERFORM));*/ return Out; } CString CWebServer::_GetLog(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString sSession = _ParseURL(Data.sURL, _T("ses")); CString Out = pThis->m_Templates.sLog; // Comment UI /*if (_ParseURL(Data.sURL, _T("clear")) == _T("yes") && IsSessionAdmin(Data,sSession)) theApp.emuledlg->ResetLog(); Out.Replace(_T("[Clear]"), _GetPlainResString(IDS_PW_RESET)); Out.Replace(_T("[Log]"), _SpecialChars(theApp.emuledlg->GetAllLogEntries(),false)+ _T("<br /><a name=\"end\"></a>") ); Out.Replace(_T("[Session]"), sSession);*/ return Out; } CString CWebServer::_GetServerInfo(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString sSession = _ParseURL(Data.sURL, _T("ses")); CString Out = pThis->m_Templates.sServerInfo; // Comment UI /*if (_ParseURL(Data.sURL, _T("clear")) == _T("yes") && IsSessionAdmin(Data,sSession)) theApp.emuledlg->ResetServerInfo(); Out.Replace(_T("[Clear]"), _GetPlainResString(IDS_PW_RESET)); Out.Replace(_T("[ServerInfo]"), _SpecialChars(theApp.emuledlg->GetServerInfoText(),false )+ _T("<br /><a name=\"end\"></a>") ); Out.Replace(_T("[Session]"), sSession);*/ return Out; } CString CWebServer::_GetDebugLog(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString sSession = _ParseURL(Data.sURL, _T("ses")); CString Out = pThis->m_Templates.sDebugLog; /*if (_ParseURL(Data.sURL, _T("clear")) == _T("yes") && IsSessionAdmin(Data,sSession)) theApp.emuledlg->ResetDebugLog(); Out.Replace(_T("[Clear]"), _GetPlainResString(IDS_PW_RESET)); Out.Replace(_T("[DebugLog]"), _SpecialChars(theApp.emuledlg->GetAllDebugLogEntries() ,false)+ _T("<br /><a name=\"end\"></a>") ); Out.Replace(_T("[Session]"), sSession);*/ return Out; } CString CWebServer::_GetMyInfo(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString sSession = _ParseURL(Data.sURL, _T("ses")); CString Out = pThis->m_Templates.sMyInfoLog; //Out.Replace(_T("[MYINFOLOG]"), theApp.emuledlg->serverwnd->GetMyInfoString() ); return Out; } CString CWebServer::_GetKadDlg(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); //if (!thePrefs.GetNetworkKademlia()) { // CString buffer; // buffer.Format(_T("<br /><center>[KADDEACTIVATED]</center>") ); // return buffer; //} CString sSession = _ParseURL(Data.sURL, _T("ses")); CString Out = pThis->m_Templates.sKad; // Comment UI /*if (_ParseURL(Data.sURL, _T("bootstrap")) != _T("") && IsSessionAdmin(Data,sSession) ) { CString dest=_ParseURL(Data.sURL, _T("ip")); CString ip=_ParseURL(Data.sURL, _T("port")); dest.Append(_T(":")+ip); const TCHAR* ipbuf=dest; SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_KAD_BOOTSTRAP, (LPARAM)ipbuf ); } if (_ParseURL(Data.sURL, _T("c")) == _T("connect") && IsSessionAdmin(Data,sSession) ) { SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_KAD_START, 0 ); } if (_ParseURL(Data.sURL, _T("c")) == _T("disconnect") && IsSessionAdmin(Data,sSession) ) { SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_KAD_STOP, 0 ); } if (_ParseURL(Data.sURL, _T("c")) == _T("rcfirewall") && IsSessionAdmin(Data,sSession) ) { SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_KAD_RCFW, 0 ); }*/ // check the condition if bootstrap is possible if ( /*Kademlia::CKademlia::IsRunning() && */ !Kademlia::CKademlia::IsConnected()) { Out.Replace(_T("[BOOTSTRAPLINE]"), pThis->m_Templates.sBootstrapLine ); } else Out.Replace(_T("[BOOTSTRAPLINE]"), _T("") ); // Infos CString buffer; if (Kademlia::CKademlia::IsConnected()) { if (Kademlia::CKademlia::IsFirewalled()) { Out.Replace(_T("[KADSTATUS]"), GetResString(IDS_FIREWALLED)); buffer.Format(_T("<a href=\"?ses=%s&w=kad&c=rcfirewall\">%s</a>"), sSession , GetResString(IDS_KAD_RECHECKFW) ); buffer.AppendFormat(_T("<br /><a href=\"?ses=%s&w=kad&c=disconnect\">%s</a>"), sSession , GetResString(IDS_IRC_DISCONNECT) ); } else { Out.Replace(_T("[KADSTATUS]"), GetResString(IDS_CONNECTED)); buffer.Format(_T("<a href=\"?ses=%s&w=kad&c=disconnect\">%s</a>"), sSession , GetResString(IDS_IRC_DISCONNECT) ); } } else { if (Kademlia::CKademlia::IsRunning()) { Out.Replace(_T("[KADSTATUS]"), GetResString(IDS_CONNECTING)); buffer.Format(_T("<a href=\"?ses=%s&w=kad&c=disconnect\">%s</a>"), sSession , GetResString(IDS_IRC_DISCONNECT) ); } else { Out.Replace(_T("[KADSTATUS]"), GetResString(IDS_DISCONNECTED)); buffer.Format(_T("<a href=\"?ses=%s&w=kad&c=connect\">%s</a>"), sSession , GetResString(IDS_IRC_CONNECT) ); } } Out.Replace(_T("[KADACTION]"), buffer); // kadstats // labels buffer.Format(_T("%s<br />%s"),GetResString(IDS_KADCONTACTLAB), GetResString(IDS_KADSEARCHLAB)); Out.Replace(_T("[KADSTATSLABELS]"),buffer); // numbers // Comment UI //buffer.Format(_T("%i<br />%i"), theApp.emuledlg->kademliawnd->GetContactCount(), // theApp.emuledlg->kademliawnd->searchList->GetItemCount()); Out.Replace(_T("[KADSTATSDATA]"),buffer); Out.Replace(_T("[BS_IP]"),GetResString(IDS_IP)); Out.Replace(_T("[BS_PORT]"),GetResString(IDS_PORT)); Out.Replace(_T("[BOOTSTRAP]"),GetResString(IDS_BOOTSTRAP)); Out.Replace(_T("[KADSTAT]"),GetResString(IDS_STATSSETUPINFO)); Out.Replace(_T("[STATUS]"),GetResString(IDS_STATUS)); Out.Replace(_T("[KAD]"),GetResString(IDS_KADEMLIA)); Out.Replace(_T("[Session]"), sSession); return Out; } CString CWebServer::_GetStats(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString sSession = _ParseURL(Data.sURL, _T("ses")); // refresh statistics // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION, WEBGUIIA_SHOWSTATISTICS, 1); CString Out = pThis->m_Templates.sStats; // eklmn: new stats // Comment UI //Out.Replace(_T("[Stats]"), theApp.emuledlg->statisticswnd->stattree.GetHTMLForExport()); return Out; } CString CWebServer::_GetPreferences(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString sSession = _ParseURL(Data.sURL, _T("ses")); CString Out = pThis->m_Templates.sPreferences; Out.Replace(_T("[Session]"), sSession); if ((_ParseURL(Data.sURL, _T("saveprefs")) == "true") && IsSessionAdmin(Data,sSession) ) { if(_ParseURL(Data.sURL, _T("gzip")) == "true" || _ParseURL(Data.sURL, _T("gzip")).MakeLower() == _T("on")) thePrefs.SetWebUseGzip(true); if(_ParseURL(Data.sURL, _T("gzip")) == "false" || _ParseURL(Data.sURL, _T("gzip")).IsEmpty()) thePrefs.SetWebUseGzip(false); if(!_ParseURL(Data.sURL, _T("refresh")).IsEmpty()) thePrefs.SetWebPageRefresh(_tstoi(_ParseURL(Data.sURL, _T("refresh")))); CString strTmp = _ParseURL(Data.sURL, _T("maxcapdown")); if(!strTmp.IsEmpty()) thePrefs.SetMaxGraphDownloadRate( _tstoi(strTmp)); strTmp = _ParseURL(Data.sURL, _T("maxcapup")); if(!strTmp.IsEmpty()) thePrefs.SetMaxGraphUploadRate( _tstoi(strTmp)); uint32 dwSpeed; strTmp = _ParseURL(Data.sURL, _T("maxdown")); if (!strTmp.IsEmpty()) { dwSpeed = _tstoi(strTmp); thePrefs.SetMaxDownload(dwSpeed>0?dwSpeed:UNLIMITED); } strTmp = _ParseURL(Data.sURL, _T("maxup")); if (!strTmp.IsEmpty()) { dwSpeed = _tstoi(strTmp); thePrefs.SetMaxUpload(dwSpeed>0?dwSpeed:UNLIMITED); } if(!_ParseURL(Data.sURL, _T("maxsources")).IsEmpty()) thePrefs.SetMaxSourcesPerFile(_tstoi(_ParseURL(Data.sURL, _T("maxsources")))); if(!_ParseURL(Data.sURL, _T("maxconnections")).IsEmpty()) thePrefs.SetMaxConnections(_tstoi(_ParseURL(Data.sURL, _T("maxconnections")))); if(!_ParseURL(Data.sURL, _T("maxconnectionsperfive")).IsEmpty()) thePrefs.SetMaxConsPerFive(_tstoi(_ParseURL(Data.sURL, _T("maxconnectionsperfive")))); } // Fill form if(thePrefs.GetWebUseGzip()) Out.Replace(_T("[UseGzipVal]"), _T("checked")); else Out.Replace(_T("[UseGzipVal]"), _T("")); CString sRefresh; sRefresh.Format(_T("%d"), thePrefs.GetWebPageRefresh()); Out.Replace(_T("[RefreshVal]"), sRefresh); sRefresh.Format(_T("%d"), thePrefs.GetMaxSourcePerFileDefault()); Out.Replace(_T("[MaxSourcesVal]"), sRefresh); sRefresh.Format(_T("%d"), thePrefs.GetMaxConnections()); Out.Replace(_T("[MaxConnectionsVal]"), sRefresh); sRefresh.Format(_T("%d"), thePrefs.GetMaxConperFive()); Out.Replace(_T("[MaxConnectionsPer5Val]"), sRefresh); Out.Replace(_T("[KBS]"), _GetPlainResString(IDS_KBYTESPERSEC)+_T(":")); Out.Replace(_T("[LimitForm]"), _GetPlainResString(IDS_WEB_CONLIMITS)+_T(":")); Out.Replace(_T("[MaxSources]"), _GetPlainResString(IDS_PW_MAXSOURCES)+_T(":")); Out.Replace(_T("[MaxConnections]"), _GetPlainResString(IDS_PW_MAXC)+_T(":")); Out.Replace(_T("[MaxConnectionsPer5]"), _GetPlainResString(IDS_MAXCON5SECLABEL)+_T(":")); Out.Replace(_T("[UseGzipForm]"), _GetPlainResString(IDS_WEB_GZIP_COMPRESSION)); Out.Replace(_T("[UseGzipComment]"), _GetPlainResString(IDS_WEB_GZIP_COMMENT)); Out.Replace(_T("[RefreshTimeForm]"), _GetPlainResString(IDS_WEB_REFRESH_TIME)); Out.Replace(_T("[RefreshTimeComment]"), _GetPlainResString(IDS_WEB_REFRESH_COMMENT)); Out.Replace(_T("[SpeedForm]"), _GetPlainResString(IDS_SPEED_LIMITS)); Out.Replace(_T("[SpeedCapForm]"), _GetPlainResString(IDS_CAPACITY_LIMITS)); Out.Replace(_T("[MaxCapDown]"), _GetPlainResString(IDS_PW_CON_DOWNLBL)); Out.Replace(_T("[MaxCapUp]"), _GetPlainResString(IDS_PW_CON_UPLBL)); Out.Replace(_T("[MaxDown]"), _GetPlainResString(IDS_PW_CON_DOWNLBL)); Out.Replace(_T("[MaxUp]"), _GetPlainResString(IDS_PW_CON_UPLBL)); Out.Replace(_T("[WebControl]"), _GetPlainResString(IDS_WEB_CONTROL)); Out.Replace(_T("[eMuleAppName]"), _T("eMule") ); Out.Replace(_T("[Apply]"), _GetPlainResString(IDS_PW_APPLY)); CString m_sTestURL; // Comment UI //m_sTestURL.Format(PORTTESTURL, thePrefs.GetPort(),thePrefs.GetUDPPort(), thePrefs.GetLanguageID() ); // the portcheck will need to do an obfuscated callback too if obfuscation is requested, so we have to provide our userhash so it can create the key if (thePrefs.IsClientCryptLayerRequested()) m_sTestURL += _T("&obfuscated_test=") + md4str(thePrefs.GetUserHash()); Out.Replace(_T("[CONNECTIONTESTLINK]"), m_sTestURL); Out.Replace(_T("[CONNECTIONTESTLABEL]"), GetResString(IDS_CONNECTIONTEST)); CString sT; sT.Format(_T("%u"), thePrefs.GetMaxDownload()==UNLIMITED?0:thePrefs.GetMaxDownload()); Out.Replace(_T("[MaxDownVal]"), sT); sT.Format(_T("%u"), thePrefs.GetMaxUpload()==UNLIMITED?0:thePrefs.GetMaxUpload()); Out.Replace(_T("[MaxUpVal]"), sT); sT.Format(_T("%u"), thePrefs.GetMaxGraphDownloadRate() ); Out.Replace(_T("[MaxCapDownVal]"), sT); sT.Format(_T("%u"), thePrefs.GetMaxGraphUploadRate(true) ); Out.Replace(_T("[MaxCapUpVal]"), sT); return Out; } CString CWebServer::_GetLoginScreen(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString sSession = _ParseURL(Data.sURL, _T("ses")); CString Out; Out += pThis->m_Templates.sLogin; Out.Replace(_T("[CharSet]"), HTTPENCODING ); Out.Replace(_T("[eMuleAppName]"), _T("eMule") ); Out.Replace(_T("[version]"), CGlobalVariable::GetCurVersionLong() ); Out.Replace(_T("[Login]"), _GetPlainResString(IDS_WEB_LOGIN)); Out.Replace(_T("[EnterPassword]"), _GetPlainResString(IDS_WEB_ENTER_PASSWORD)); Out.Replace(_T("[LoginNow]"), _GetPlainResString(IDS_WEB_LOGIN_NOW)); Out.Replace(_T("[WebControl]"), _GetPlainResString(IDS_WEB_CONTROL)); if(pThis->m_nIntruderDetect >= 1) Out.Replace(_T("[FailedLogin]"), _T("<p class=\"failed\">") + _GetPlainResString(IDS_WEB_BADLOGINATTEMPT) + _T("</p>")); else Out.Replace(_T("[FailedLogin]"), _T("&nbsp;") ); return Out; } // We have to add gz-header and some other stuff // to standard zlib functions // in order to use gzip in web pages int CWebServer::_GzipCompress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level) { const static int gz_magic[2] = {0x1f, 0x8b}; // gzip magic header int err; uLong crc; z_stream stream = {0}; stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; stream.opaque = (voidpf)0; crc = crc32(0L, Z_NULL, 0); // init Zlib stream // NOTE windowBits is passed < 0 to suppress zlib header err = deflateInit2(&stream, level, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); if (err != Z_OK) return err; sprintf((char*)dest , "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, 255); // wire buffers stream.next_in = (Bytef*) source ; stream.avail_in = (uInt)sourceLen; stream.next_out = ((Bytef*) dest) + 10; stream.avail_out = *destLen - 18; // doit err = deflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { deflateEnd(&stream); return err; } err = deflateEnd(&stream); crc = crc32(crc, (const Bytef *) source , sourceLen ); //CRC *(((Bytef*) dest)+10+stream.total_out) = (Bytef)(crc & 0xFF); *(((Bytef*) dest)+10+stream.total_out+1) = (Bytef)((crc>>8) & 0xFF); *(((Bytef*) dest)+10+stream.total_out+2) = (Bytef)((crc>>16) & 0xFF); *(((Bytef*) dest)+10+stream.total_out+3) = (Bytef)((crc>>24) & 0xFF); // Length *(((Bytef*) dest)+10+stream.total_out+4) = (Bytef)( sourceLen & 0xFF); *(((Bytef*) dest)+10+stream.total_out+5) = (Bytef)(( sourceLen >>8) & 0xFF); *(((Bytef*) dest)+10+stream.total_out+6) = (Bytef)(( sourceLen >>16) & 0xFF); *(((Bytef*) dest)+10+stream.total_out+7) = (Bytef)(( sourceLen >>24) & 0xFF); // return destLength *destLen = 10 + stream.total_out + 8; return err; } bool CWebServer::_IsLoggedIn(ThreadData Data, long lSession) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return false; _RemoveTimeOuts(Data); // find our session // i should have used CMap there, but i like CArray more ;-) for(int i = 0; i < pThis->m_Params.Sessions.GetSize(); i++) { if(pThis->m_Params.Sessions[i].lSession == lSession && lSession != 0) { // if found, also reset expiration time pThis->m_Params.Sessions[i].startTime = CTime::GetCurrentTime(); return true; } } return false; } void CWebServer::_RemoveTimeOuts(ThreadData Data) { // remove expired sessions CWebServer *pThis = (CWebServer *)Data.pThis; pThis->UpdateSessionCount(); } bool CWebServer::_RemoveSession(ThreadData Data, long lSession) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return false; // find our session for(int i = 0; i < pThis->m_Params.Sessions.GetSize(); i++) { if(pThis->m_Params.Sessions[i].lSession == lSession && lSession != 0) { pThis->m_Params.Sessions.RemoveAt(i); CString t_ulCurIP; t_ulCurIP.Format(_T("%u.%u.%u.%u"),(byte)pThis->m_ulCurIP,(byte)(pThis->m_ulCurIP>>8),(byte)(pThis->m_ulCurIP>>16),(byte)(pThis->m_ulCurIP>>24)); AddLogLine(true, GetResString(IDS_WEB_SESSIONEND),t_ulCurIP); // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_UPDATEMYINFO,0); return true; } } return false; } Session CWebServer::GetSessionByID(ThreadData Data,long sessionID) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis != NULL) { for(int i = 0; i < pThis->m_Params.Sessions.GetSize(); i++) { if(pThis->m_Params.Sessions[i].lSession == sessionID && sessionID != 0) return pThis->m_Params.Sessions.GetAt(i); } } Session ses; ses.admin=false; ses.startTime = 0; return ses; } bool CWebServer::IsSessionAdmin(ThreadData Data, const CString &strSsessionID) { long sessionID = _tstol(strSsessionID); CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis != NULL) { for(int i = 0; i < pThis->m_Params.Sessions.GetSize(); i++) { if(pThis->m_Params.Sessions[i].lSession == sessionID && sessionID != 0) return pThis->m_Params.Sessions[i].admin; } } return false; } CString CWebServer::GetPermissionDenied() { return _T("javascript:alert(\'")+_GetPlainResString(IDS_ACCESSDENIED)+_T("\')"); } CString CWebServer::_GetPlainResString(UINT nID, bool noquote) { CString sRet = GetResString(nID); sRet.Remove(_T('&')); if(noquote) { sRet.Replace(_T("'"), _T("&#8217;")); sRet.Replace(_T("\n"), _T("\\n")); } return sRet; } void CWebServer::_GetPlainResString(CString *pstrOut, UINT nID, bool noquote) { *pstrOut=_GetPlainResString(nID,noquote); } // Ornis: creating the progressbar. colored if ressources are given/available CString CWebServer::_GetDownloadGraph(ThreadData Data, CString filehash) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CPartFile* pPartFile; uchar fileid[16]; if (filehash.GetLength()!=32 || !DecodeBase16(filehash, filehash.GetLength(), fileid, ARRSIZE(fileid))) return _T(""); CString Out; CString progresscolor[12]; pPartFile = CGlobalVariable::downloadqueue->GetFileByID(fileid); if (pPartFile != NULL && (pPartFile->GetStatus() == PS_PAUSED ) ) { // Color style (paused files) progresscolor[0]=_T("p_green.gif"); progresscolor[1]=_T("p_black.gif"); progresscolor[2]=_T("p_yellow.gif"); progresscolor[3]=_T("p_red.gif"); progresscolor[4]=_T("p_blue1.gif"); progresscolor[5]=_T("p_blue2.gif"); progresscolor[6]=_T("p_blue3.gif"); progresscolor[7]=_T("p_blue4.gif"); progresscolor[8]=_T("p_blue5.gif"); progresscolor[9]=_T("p_blue6.gif"); progresscolor[10]=_T("p_greenpercent.gif"); progresscolor[11]=_T("transparent.gif"); } else { // Color style (active files) progresscolor[0]=_T("green.gif"); progresscolor[1]=_T("black.gif"); progresscolor[2]=_T("yellow.gif"); progresscolor[3]=_T("red.gif"); progresscolor[4]=_T("blue1.gif"); progresscolor[5]=_T("blue2.gif"); progresscolor[6]=_T("blue3.gif"); progresscolor[7]=_T("blue4.gif"); progresscolor[8]=_T("blue5.gif"); progresscolor[9]=_T("blue6.gif"); progresscolor[10]=_T("greenpercent.gif"); progresscolor[11]=_T("transparent.gif"); } if (pPartFile == NULL || !pPartFile->IsPartFile()) { Out.AppendFormat(pThis->m_Templates.sProgressbarImgsPercent+_T("<br />"), progresscolor[10], pThis->m_Templates.iProgressbarWidth); Out.AppendFormat(pThis->m_Templates.sProgressbarImgs,progresscolor[0], pThis->m_Templates.iProgressbarWidth); } else { CString s_ChunkBar=pPartFile->GetProgressString(pThis->m_Templates.iProgressbarWidth); // and now make a graph out of the array - need to be in a progressive way BYTE lastcolor=1; uint16 lastindex=0; int compl = static_cast<int>((pThis->m_Templates.iProgressbarWidth / 100.0) * pPartFile->GetPercentCompleted()); Out.AppendFormat(pThis->m_Templates.sProgressbarImgsPercent+_T("<br />"), progresscolor[(compl > 0) ? 10 : 11], (compl > 0) ? compl : 5); for (uint16 i=0;i<pThis->m_Templates.iProgressbarWidth;i++) { if (lastcolor!= _tstoi(s_ChunkBar.Mid(i,1))) { if (i>lastindex) { Out.AppendFormat(pThis->m_Templates.sProgressbarImgs, progresscolor[lastcolor], i-lastindex); } lastcolor=(BYTE)_tstoi(s_ChunkBar.Mid(i,1)); lastindex=i; } } Out.AppendFormat(pThis->m_Templates.sProgressbarImgs, progresscolor[lastcolor], pThis->m_Templates.iProgressbarWidth-lastindex); } return Out; } CString CWebServer::_GetSearch(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); int cat=_tstoi(_ParseURL(Data.sURL, _T("cat"))); CString sSession = _ParseURL(Data.sURL, _T("ses")); CString Out = pThis->m_Templates.sSearch; if (!_ParseURL(Data.sURL, _T("downloads")).IsEmpty() && IsSessionAdmin(Data,sSession)) { CString downloads=_ParseURLArray(Data.sURL,_T("downloads")); CString resToken; int curPos=0; resToken= downloads.Tokenize(_T("|"),curPos); while (!resToken.IsEmpty()) { // Comment UI //if (resToken.GetLength()==32) // SendMessage(theApp.emuledlg->m_hWnd,WEB_ADDDOWNLOADS, (LPARAM)(LPCTSTR)resToken, cat); resToken= downloads.Tokenize(_T("|"),curPos); } } CString sCat; if (cat != 0) sCat.Format(_T("%i"), cat); CString sCmd = _ParseURL(Data.sURL, _T("c")); if (sCmd.CompareNoCase(_T("menu")) == 0) { int iMenu = _tstoi(_ParseURL(Data.sURL, _T("m"))); bool bValue = _tstoi(_ParseURL(Data.sURL, _T("v")))!=0; WSsearchColumnHidden[iMenu] = bValue; SaveWIConfigArray(WSsearchColumnHidden,ARRSIZE(WSsearchColumnHidden) ,_T("searchColumnHidden")); } if(_ParseURL(Data.sURL, _T("tosearch")) != _T("") && IsSessionAdmin(Data,sSession) ) { // perform search // Comment UI //SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION, WEBGUIIA_DELETEALLSEARCHES, 0); // get method CString method=(_ParseURL(Data.sURL, _T("method"))); SSearchParams* pParams = new SSearchParams; pParams->strExpression = _ParseURL(Data.sURL, _T("tosearch")); pParams->strFileType = _ParseURL(Data.sURL, _T("type")); pParams->bUnicode = (_ParseURL(Data.sURL, _T("unicode")).MakeLower() == _T("on")); // for safety: this string is sent to servers and/or kad nodes, validate it! if (!pParams->strFileType.IsEmpty() && pParams->strFileType != ED2KFTSTR_ARCHIVE && pParams->strFileType != ED2KFTSTR_AUDIO && pParams->strFileType != ED2KFTSTR_CDIMAGE && pParams->strFileType != ED2KFTSTR_DOCUMENT && pParams->strFileType != ED2KFTSTR_IMAGE && pParams->strFileType != ED2KFTSTR_PROGRAM && pParams->strFileType != ED2KFTSTR_VIDEO && pParams->strFileType != ED2KFTSTR_EMULECOLLECTION){ ASSERT(0); pParams->strFileType.Empty(); } pParams->ullMinSize = _tstoi64(_ParseURL(Data.sURL, _T("min")))*1048576ui64; pParams->ullMaxSize = _tstoi64(_ParseURL(Data.sURL, _T("max")))*1048576ui64; if (pParams->ullMaxSize < pParams->ullMinSize) pParams->ullMaxSize = 0; pParams->uAvailability = (_ParseURL(Data.sURL, _T("avail"))==_T(""))?0:_tstoi(_ParseURL(Data.sURL, _T("avail"))); if (pParams->uAvailability > 1000000) pParams->uAvailability = 1000000; pParams->strExtension = _ParseURL(Data.sURL, _T("ext")); if (method == _T("kademlia")) pParams->eType = SearchTypeKademlia; else if (method == _T("global")) pParams->eType = SearchTypeEd2kGlobal; else pParams->eType = SearchTypeEd2kServer; CString strResponse = _GetPlainResString(IDS_SW_SEARCHINGINFO); try { // Comment UI /*if (pParams->eType != SearchTypeKademlia){ //if (!theApp.emuledlg->searchwnd->DoNewEd2kSearch(pParams)){ if (SendMessage(CGlobalVariable::m_hListenWnd, WM_SEARCH_NEWED2KSEARCH, 0, LPARAM(pParams))){ delete pParams; strResponse = _GetPlainResString(IDS_ERR_NOTCONNECTED); } else Sleep(2000); // wait for some results to come in (thanks thread) } else{ //if (!theApp.emuledlg->searchwnd->DoNewKadSearch(pParams)){ if (SendMessage(CGlobalVariable::m_hListenWnd, WM_SEARCH_NEWKADSEARCH, 0, LPARAM(pParams))){ delete pParams; strResponse = _GetPlainResString(IDS_ERR_NOTCONNECTEDKAD); } }*/ } catch (/*CMsgBoxException* ex*/ ...) { /*strResponse=_GetPlainResString(IDS_ERROR);*/ /* strResponse = ex->m_strMsg; PlainString(strResponse, false); ex->Delete(); */ /*ASSERT(0); delete pParams;*/ } Out.Replace(_T("[Message]"),strResponse); } else if(_ParseURL(Data.sURL, _T("tosearch")) != _T("") && !IsSessionAdmin(Data,sSession) ) { Out.Replace(_T("[Message]"),_GetPlainResString(IDS_ACCESSDENIED)); } else Out.Replace(_T("[Message]"), _GetPlainResString(IDS_SW_REFETCHRES)); CString sSort = _ParseURL(Data.sURL, _T("sort")); if (sSort.GetLength()>0) pThis->m_iSearchSortby=_tstoi(sSort); sSort = _ParseURL(Data.sURL, _T("sortAsc")); if (sSort.GetLength()>0) pThis->m_bSearchAsc=_tstoi(sSort)!=0; CString result=pThis->m_Templates.sSearchHeader; CQArray<SearchFileStruct, SearchFileStruct> SearchFileArray; CGlobalVariable::searchlist->GetWebList(&SearchFileArray, pThis->m_iSearchSortby); SearchFileArray.QuickSort(pThis->m_bSearchAsc); uchar aFileHash[16]; uchar nRed, nGreen, nBlue; CKnownFile* sameFile; CString strOverlayImage; CString strSourcesImage; CString strColorPrefix; CString strColorSuffix = _T("</font>"); CString strSources; CString strFilename; CString strTemp, strTemp2; SearchFileStruct structFile; for (uint16 i = 0; i < SearchFileArray.GetCount(); ++i) { structFile = SearchFileArray.GetAt(i); nRed = nGreen = nBlue = 255; DecodeBase16(structFile.m_strFileHash, 32, aFileHash, ARRSIZE(aFileHash)); strOverlayImage = _T("none"); if (CGlobalVariable::downloadqueue->GetFileByID(aFileHash)!=NULL) { nBlue = 128; nGreen = 128; } else { sameFile = CGlobalVariable::sharedfiles->GetFileByID(aFileHash); if (sameFile == NULL) sameFile = CGlobalVariable::knownfiles->FindKnownFileByID(aFileHash); if (sameFile == NULL) { //strOverlayImage = _T("none"); } else { //strOverlayImage = _T("release"); nBlue = 128; nRed = 128; } } strColorPrefix.Format(_T("<font color=#%02x%02x%02x>"), nRed, nGreen, nBlue); if (structFile.m_uSourceCount < 5) strSourcesImage = _T("0"); else if (structFile.m_uSourceCount > 4 && structFile.m_uSourceCount < 10) strSourcesImage = _T("5"); else if (structFile.m_uSourceCount > 9 && structFile.m_uSourceCount < 25) strSourcesImage = _T("10"); else if (structFile.m_uSourceCount > 24 && structFile.m_uSourceCount < 50) strSourcesImage = _T("25"); else strSourcesImage = _T("50"); strSources.Format(_T("%u(%u)"), structFile.m_uSourceCount, structFile.m_dwCompleteSourceCount); strFilename = structFile.m_strFileName; strFilename.Replace(_T("'"),_T("\\'")); strTemp2.Format(_T("ed2k://|file|%s|%I64u|%s|/"), strFilename, structFile.m_uFileSize, structFile.m_strFileHash); strTemp.Format(pThis->m_Templates.sSearchResultLine, strSourcesImage, strTemp2, strOverlayImage, GetWebImageNameForFileType(structFile.m_strFileName), (!WSsearchColumnHidden[0]) ? strColorPrefix + StringLimit(structFile.m_strFileName,70) + strColorSuffix : _T(""), (!WSsearchColumnHidden[1]) ? strColorPrefix + CastItoXBytes(structFile.m_uFileSize) + strColorSuffix : _T(""), (!WSsearchColumnHidden[2]) ? strColorPrefix + structFile.m_strFileHash + strColorSuffix : _T(""), (!WSsearchColumnHidden[3]) ? strColorPrefix + strSources + strColorSuffix : _T(""), structFile.m_strFileHash ); result.Append(strTemp); } if (thePrefs.GetCatCount()>1) InsertCatBox(Out,0,pThis->m_Templates.sCatArrow,false,false,sSession,_T("")); else Out.Replace(_T("[CATBOX]"),_T("")); Out.Replace(_T("[SEARCHINFOMSG]"),_T("")); Out.Replace(_T("[RESULTLIST]"), result); Out.Replace(_T("[Result]"), GetResString(IDS_SW_RESULT)); Out.Replace(_T("[Session]"), sSession); Out.Replace(_T("[Name]"), _GetPlainResString(IDS_SW_NAME)); Out.Replace(_T("[Type]"), _GetPlainResString(IDS_TYPE)); Out.Replace(_T("[Any]"), _GetPlainResString(IDS_SEARCH_ANY)); Out.Replace(_T("[Audio]"), _GetPlainResString(IDS_SEARCH_AUDIO)); Out.Replace(_T("[Image]"), _GetPlainResString(IDS_SEARCH_PICS)); Out.Replace(_T("[Video]"), _GetPlainResString(IDS_SEARCH_VIDEO)); Out.Replace(_T("[Document]"), _GetPlainResString(IDS_SEARCH_DOC)); Out.Replace(_T("[CDImage]"), _GetPlainResString(IDS_SEARCH_CDIMG)); Out.Replace(_T("[Program]"), _GetPlainResString(IDS_SEARCH_PRG)); Out.Replace(_T("[Archive]"), _GetPlainResString(IDS_SEARCH_ARC)); Out.Replace(_T("[Search]"), _GetPlainResString(IDS_SW_SEARCHBOX)); Out.Replace(_T("[Unicode]"), _GetPlainResString(IDS_SEARCH_UNICODE)); Out.Replace(_T("[Size]"), _GetPlainResString(IDS_DL_SIZE)); Out.Replace(_T("[Start]"), _GetPlainResString(IDS_SW_START)); Out.Replace(_T("[USESSERVER]"), _GetPlainResString(IDS_SERVER)); Out.Replace(_T("[USEKADEMLIA]"), _GetPlainResString(IDS_KADEMLIA)); Out.Replace(_T("[METHOD]"), _GetPlainResString(IDS_METHOD)); Out.Replace(_T("[SizeMin]"), _GetPlainResString(IDS_SEARCHMINSIZE)); Out.Replace(_T("[SizeMax]"), _GetPlainResString(IDS_SEARCHMAXSIZE)); Out.Replace(_T("[Availabl]"), _GetPlainResString(IDS_SEARCHAVAIL)); Out.Replace(_T("[Extention]"), _GetPlainResString(IDS_SEARCHEXTENTION)); Out.Replace(_T("[Global]"), _GetPlainResString(IDS_SW_GLOBAL)); Out.Replace(_T("[MB]"), _GetPlainResString(IDS_MBYTES)); Out.Replace(_T("[Apply]"), _GetPlainResString(IDS_PW_APPLY)); Out.Replace(_T("[CatSel]"), sCat); Out.Replace(_T("[Ed2klink]"), _GetPlainResString(IDS_SW_LINK)); /* CString checked; if(thePrefs.GetMethod()==1) checked = _T("checked"); Out.Replace(_T("[checked]"), checked); */ const TCHAR *pcSortIcon = (pThis->m_bSearchAsc) ? pThis->m_Templates.sUpArrow : pThis->m_Templates.sDownArrow; CString strTmp; _GetPlainResString(&strTmp, IDS_DL_FILENAME); if (!WSsearchColumnHidden[0]) { Out.Replace(_T("[FilenameI]"), (pThis->m_iSearchSortby == 0) ? pcSortIcon : _T("")); Out.Replace(_T("[FilenameH]"), strTmp); } else { Out.Replace(_T("[FilenameI]"), _T("")); Out.Replace(_T("[FilenameH]"), _T("")); } Out.Replace(_T("[FilenameM]"), strTmp); _GetPlainResString(&strTmp, IDS_DL_SIZE); if (!WSsearchColumnHidden[1]) { Out.Replace(_T("[FilesizeI]"), (pThis->m_iSearchSortby == 1) ? pcSortIcon : _T("")); Out.Replace(_T("[FilesizeH]"), strTmp); } else { Out.Replace(_T("[FilesizeI]"), _T("")); Out.Replace(_T("[FilesizeH]"), _T("")); } Out.Replace(_T("[FilesizeM]"), strTmp); _GetPlainResString(&strTmp, IDS_FILEHASH); if (!WSsearchColumnHidden[2]) { Out.Replace(_T("[FilehashI]"), (pThis->m_iSearchSortby == 2) ? pcSortIcon : _T("")); Out.Replace(_T("[FilehashH]"), strTmp); } else { Out.Replace(_T("[FilehashI]"), _T("")); Out.Replace(_T("[FilehashH]"), _T("")); } Out.Replace(_T("[FilehashM]"), strTmp); _GetPlainResString(&strTmp, IDS_DL_SOURCES); if (!WSsearchColumnHidden[3]) { Out.Replace(_T("[SourcesI]"), (pThis->m_iSearchSortby == 3) ? pcSortIcon : _T("")); Out.Replace(_T("[SourcesH]"), strTmp); } else { Out.Replace(_T("[SourcesI]"), _T("")); Out.Replace(_T("[SourcesH]"), _T("")); } Out.Replace(_T("[SourcesM]"), strTmp); Out.Replace(_T("[Download]"), _GetPlainResString(IDS_DOWNLOAD)); strTmp.Format(_T("%i"),(pThis->m_iSearchSortby!=0 || (pThis->m_iSearchSortby==0 && pThis->m_bSearchAsc==0 ))?1:0 ); Out.Replace(_T("[SORTASCVALUE0]"), strTmp); strTmp.Format(_T("%i"),(pThis->m_iSearchSortby!=1 || (pThis->m_iSearchSortby==1 && pThis->m_bSearchAsc==0 ))?1:0 ); Out.Replace(_T("[SORTASCVALUE1]"), strTmp); strTmp.Format(_T("%i"),(pThis->m_iSearchSortby!=2 || (pThis->m_iSearchSortby==2 && pThis->m_bSearchAsc==0 ))?1:0 ); Out.Replace(_T("[SORTASCVALUE2]"), strTmp); strTmp.Format(_T("%i"),(pThis->m_iSearchSortby!=3 || (pThis->m_iSearchSortby==3 && pThis->m_bSearchAsc==0 ))?1:0 ); Out.Replace(_T("[SORTASCVALUE3]"), strTmp); strTmp.Format(_T("%i"),(pThis->m_iSearchSortby!=4 || (pThis->m_iSearchSortby==4 && pThis->m_bSearchAsc==0 ))?1:0 ); Out.Replace(_T("[SORTASCVALUE4]"), strTmp); strTmp.Format(_T("%i"),(pThis->m_iSearchSortby!=5 || (pThis->m_iSearchSortby==5 && pThis->m_bSearchAsc==0 ))?1:0 ); Out.Replace(_T("[SORTASCVALUE5]"), strTmp); return Out; } int CWebServer::UpdateSessionCount() { /*int oldvalue=*/m_Params.Sessions.GetSize(); for(int i = 0; i < m_Params.Sessions.GetSize();) { CTimeSpan ts = CTime::GetCurrentTime() - m_Params.Sessions[i].startTime; if(thePrefs.GetWebTimeoutMins()>0 && ts.GetTotalSeconds() > thePrefs.GetWebTimeoutMins()*60 ) m_Params.Sessions.RemoveAt(i); else i++; } // Comment UI //if (oldvalue!= m_Params.Sessions.GetCount()) // SendMessage(theApp.emuledlg->m_hWnd,WEB_GUI_INTERACTION,WEBGUIIA_UPDATEMYINFO,0); return m_Params.Sessions.GetCount(); } void CWebServer::InsertCatBox(CString &Out,int preselect,CString boxlabel,bool jump,bool extraCats,CString sSession,CString sFileHash, bool ed2kbox) { CString tempBuf = _T("<form action=\"\">"); tempBuf.Append(boxlabel); tempBuf += _T("<select name=\"cat\" size=\"1\""); if (jump) tempBuf += _T(" onchange=GotoCat(this.form.cat.options[this.form.cat.selectedIndex].value)>"); else tempBuf += _T(">"); for (int i = 0; i < thePrefs.GetCatCount(); i++) { CString strCategory = thePrefs.GetCategory(i)->strTitle; strCategory.Replace(_T("'"),_T("\'")); tempBuf.AppendFormat( _T("<option%s value=\"%i\">%s</option>\n"), (i == preselect) ? _T(" selected") : _T(""), i, strCategory); } if (extraCats) { if (thePrefs.GetCatCount() > 1) { tempBuf += _T("<option>-------------------</option>\n"); } for (int i = 1; i<16; i++) { tempBuf.AppendFormat( _T("<option%s value=\"%i\">%s</option>\n") , (0-i == preselect) ? _T(" selected") : _T(""), 0-i, GetSubCatLabel(0-i)); } } tempBuf.Append(_T("</select></form>") ); Out.Replace( ed2kbox?_T("[CATBOXED2K]") : _T("[CATBOX]"), tempBuf); CString tempBuff3, tempBuff4; CString tempBuff; CString strCategory; for (int i = 0; i < thePrefs.GetCatCount(); i++) { if (i==preselect) { tempBuff3 = _T("checked.gif"); tempBuff4 = (i==0)?GetResString(IDS_ALL):thePrefs.GetCategory(i)->strTitle; } else tempBuff3 = _T("checked_no.gif"); strCategory = (i==0)?GetResString(IDS_ALL):thePrefs.GetCategory(i)->strTitle; strCategory.Replace(_T("'"),_T("\\'")); tempBuff.AppendFormat(_T("<a href=&quot;/?ses=%s&w=transfer&cat=%d&quot;><div class=menuitems><img class=menuchecked src=%s>%s&nbsp;</div></a>"), sSession, i, tempBuff3, strCategory); } if (extraCats) { tempBuff.Append(_T("<div class=menuitems>&nbsp;------------------------------&nbsp;</div>")); for (int i = 1;i<16;i++) { if ((0-i)==preselect) { tempBuff3= _T("checked.gif"); tempBuff4 = GetSubCatLabel(0-i); } else tempBuff3 = _T("checked_no.gif"); tempBuff.AppendFormat( _T("<a href=&quot;/?ses=%s&w=transfer&cat=%d&quot;><div class=menuitems><img class=menuchecked src=%s>%s&nbsp;</div></a>"), sSession, 0-i, tempBuff3, GetSubCatLabel(0-i)); } } Out.Replace(_T("[CatBox]"), tempBuff); Out.Replace(_T("[Category]"), tempBuff4); tempBuff.Empty(); // For each user category index... for (int i = 0; i <thePrefs.GetCatCount(); i++) { uchar FileHash[16]; CPartFile *found_file = NULL; if (!sFileHash.IsEmpty()) found_file=CGlobalVariable::downloadqueue->GetFileByID(_GetFileHash(sFileHash, FileHash)); // Get the user category index of 'found_file' in 'preselect'. if (found_file) preselect = found_file->GetCategory(); if (i==preselect) { tempBuff3 = _T("checked.gif"); tempBuff4 = (i==0)?GetResString(IDS_ALL):thePrefs.GetCategory(i)->strTitle; } else tempBuff3 = _T("checked_no.gif"); strCategory = (i == 0)? GetResString(IDS_CAT_UNASSIGN) : thePrefs.GetCategory(i)->strTitle; strCategory.Replace(_T("'"),_T("\\'")); tempBuff.AppendFormat(_T("<a href=&quot;/?ses=%s&w=transfer[CatSel]&op=setcat&file=%s&filecat=%d&quot;><div class=menuitems><img class=menuchecked src=%s>%s&nbsp;</div></a>"), sSession, sFileHash, i, tempBuff3, strCategory); } Out.Replace(_T("[SetCatBox]"), tempBuff); } CString CWebServer::GetSubCatLabel(int cat) { switch (cat) { case -1: return _GetPlainResString(IDS_ALLOTHERS); case -2: return _GetPlainResString(IDS_STATUS_NOTCOMPLETED); case -3: return _GetPlainResString(IDS_DL_TRANSFCOMPL); case -4: return _GetPlainResString(IDS_WAITING); case -5: return _GetPlainResString(IDS_DOWNLOADING); case -6: return _GetPlainResString(IDS_ERRORLIKE); case -7: return _GetPlainResString(IDS_PAUSED); case -8: return _GetPlainResString(IDS_SEENCOMPL); case -9: return _GetPlainResString(IDS_VIDEO); case -10: return _GetPlainResString(IDS_AUDIO); case -11: return _GetPlainResString(IDS_SEARCH_ARC); case -12: return _GetPlainResString(IDS_SEARCH_CDIMG); case -13: return _GetPlainResString(IDS_SEARCH_DOC); case -14: return _GetPlainResString(IDS_SEARCH_PICS); case -15: return _GetPlainResString(IDS_SEARCH_PRG); } return _T("?"); } CString CWebServer::_GetRemoteLinkAddedOk(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString Out = _T(""); /*int cat=*/_tstoi(_ParseURL(Data.sURL,_T("cat"))); CString HTTPTemp = _ParseURL(Data.sURL, _T("c")); /*const TCHAR* buf=HTTPTemp;*/ // Comment UI //theApp.emuledlg->SendMessage(WEB_ADDDOWNLOADS, (WPARAM)buf, cat); Out += _T("<status result=\"OK\">"); Out += _T("<description>") + GetResString(IDS_WEB_REMOTE_LINK_ADDED) + _T("</description>"); Out += _T("<filename>") + HTTPTemp + _T("</filename>"); Out += _T("</status>"); return Out; } CString CWebServer::_GetRemoteLinkAddedFailed(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return _T(""); CString Out = _T(""); Out += _T("<status result=\"FAILED\" reason=\"WRONG_PASSWORD\">"); Out += _T("<description>") + GetResString(IDS_WEB_REMOTE_LINK_NOT_ADDED) + _T("</description>"); Out += _T("</status>"); return Out; } void CWebServer::_SetLastUserCat(ThreadData Data, long lSession,int cat){ CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return; _RemoveTimeOuts(Data); // find our session for(int i = 0; i < pThis->m_Params.Sessions.GetSize(); i++) { if(pThis->m_Params.Sessions[i].lSession == lSession && lSession != 0) { // if found, also reset expiration time pThis->m_Params.Sessions[i].startTime = CTime::GetCurrentTime(); pThis->m_Params.Sessions[i].lastcat=cat; return; } } } int CWebServer::_GetLastUserCat(ThreadData Data, long lSession) { CWebServer *pThis = (CWebServer *)Data.pThis; if(pThis == NULL) return 0; _RemoveTimeOuts(Data); // find our session for(int i = 0; i < pThis->m_Params.Sessions.GetSize(); i++) { if(pThis->m_Params.Sessions[i].lSession == lSession && lSession != 0) { // if found, also reset expiration time pThis->m_Params.Sessions[i].startTime = CTime::GetCurrentTime(); return pThis->m_Params.Sessions[i].lastcat; } } return 0; } uchar* CWebServer::_GetFileHash(CString sHash, uchar *FileHash) { strmd4(sHash, FileHash); return FileHash; } void CWebServer::ProcessFileReq(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; if (pThis == NULL) return; CString filename=Data.sURL; CString contenttype; if ( filename.Right(4).MakeLower()==_T(".gif")) contenttype=_T("Content-Type: image/gif\r\n"); else if (filename.Right(4).MakeLower()==_T(".jpg") || filename.Right(5).MakeLower()==_T(".jpeg")) contenttype=_T("Content-Type: image/jpg\r\n"); else if (filename.Right(4).MakeLower()==_T(".bmp")) contenttype=_T("Content-Type: image/bmp\r\n"); else if (filename.Right(4).MakeLower()==_T(".png")) contenttype=_T("Content-Type: image/png\r\n"); //DonQ - additional filetypes else if (filename.Right(4).MakeLower()==_T(".ico")) contenttype=_T("Content-Type: image/x-icon\r\n"); else if (filename.Right(4).MakeLower()==_T(".css")) contenttype=_T("Content-Type: text/css\r\n"); else if (filename.Right(3).MakeLower()==_T(".js")) contenttype=_T("Content-Type: text/javascript\r\n"); contenttype += _T("Last-Modified: ") + pThis->m_Params.sLastModified + _T("\r\n") + _T("ETag: ") + pThis->m_Params.sETag + _T("\r\n"); filename.Replace(_T('/'),_T('\\')); if (filename.GetAt(0)==_T('\\')) filename.Delete(0); filename=thePrefs.GetMuleDirectory(EMULE_WEBSERVERDIR)+filename; CFile file; if(file.Open(filename, CFile::modeRead|CFile::shareDenyWrite|CFile::typeBinary)) { if (thePrefs.GetMaxWebUploadFileSizeMB()==0 || file.GetLength()<=thePrefs.GetMaxWebUploadFileSizeMB()*1024*1024 ) { DWORD filesize=(DWORD)file.GetLength(); USES_CONVERSION; char* buffer=new char[filesize]; DWORD size=file.Read(buffer,filesize); file.Close(); Data.pSocket->SendContent(T2CA(contenttype), buffer, size); delete[] buffer; } else { Data.pSocket->SendReply( "HTTP/1.1 403 Forbidden\r\n" ); } } else { Data.pSocket->SendReply( "HTTP/1.1 404 File not found\r\n" ); } } CString CWebServer::GetWebImageNameForFileType(CString filename) { switch (GetED2KFileTypeID(filename)) { case ED2KFT_AUDIO: return _T("audio"); case ED2KFT_VIDEO: return _T("video"); case ED2KFT_IMAGE: return _T("picture"); case ED2KFT_PROGRAM: return _T("program"); case ED2KFT_DOCUMENT: return _T("document"); case ED2KFT_ARCHIVE: return _T("archive"); case ED2KFT_CDIMAGE: return _T("cdimage"); case ED2KFT_EMULECOLLECTION: return _T("emulecollection"); default: /*ED2KFT_ANY:*/ return _T("other"); } } CString CWebServer::GetClientSummary(CUpDownClient* client) { // name CString buffer= GetResString(IDS_CD_UNAME) + _T(" ") + client->GetUserName() + _T("\n"); // client version buffer+= GetResString(IDS_CD_CSOFT)+ _T(": ") + client->GetClientSoftVer() + _T("\n"); // uploading file buffer+= GetResString(IDS_CD_UPLOADREQ) + _T(" "); CKnownFile* file = CGlobalVariable::sharedfiles->GetFileByID(client->GetUploadFileID() ); ASSERT(file); if (file) { buffer += file->GetFileName(); } buffer+= _T("\n\n"); // transfering time buffer+= GetResString(IDS_UPLOADTIME) + _T(": ") + CastSecondsToHM(client->GetUpStartTimeDelay()/1000) + _T("\n"); // transfered data (up,down,global,session) buffer+= GetResString(IDS_FD_TRANS) + _T(" (") +GetResString(IDS_STATS_SESSION) + _T("):\n"); buffer+= _T(".....") + GetResString(IDS_PW_CON_UPLBL) + _T(": ")+ CastItoXBytes(client->GetTransferredUp()) + _T(" (") + CastItoXBytes(client->GetSessionUp()) + _T(" )\n"); buffer+= _T(".....") + GetResString(IDS_DOWNLOAD) + _T(": ") + CastItoXBytes(client->GetTransferredDown()) + _T(" (") + CastItoXBytes(client->GetSessionDown()) + _T(" )\n"); return buffer; } CString CWebServer::GetClientversionImage(CUpDownClient* client) { switch(client->GetClientSoft()) { case SO_EMULE: return _T("1"); case SO_OLDEMULE: return _T("1"); case SO_EDONKEY: return _T("0"); case SO_EDONKEYHYBRID: return _T("h"); case SO_AMULE: return _T("a"); case SO_SHAREAZA: return _T("s"); case SO_MLDONKEY: return _T("m"); case SO_LPHANT: return _T("l"); case SO_URL: return _T("u"); } return _T("0"); } CString CWebServer::_GetCommentlist(ThreadData Data) { CWebServer *pThis = (CWebServer *)Data.pThis; uchar FileHash[16]; CPartFile* pPartFile=CGlobalVariable::downloadqueue->GetFileByID(_GetFileHash(_ParseURL(Data.sURL, _T("filehash")),FileHash) ); CString Out= pThis->m_Templates.sCommentList; if (!pPartFile) return _T(""); CString commentlines; Out.Replace(_T("[COMMENTS]"), GetResString(IDS_COMMENT) + _T(": ") + pPartFile->GetFileName() ); // prepare commentsinfo-string for (POSITION pos = pPartFile->srclist.GetHeadPosition(); pos != NULL; ) { CUpDownClient* cur_src = pPartFile->srclist.GetNext(pos); if (cur_src->HasFileRating() || !cur_src->GetFileComment().IsEmpty()) { commentlines.AppendFormat( pThis->m_Templates.sCommentListLine, _SpecialChars(cur_src->GetUserName()), _SpecialChars(cur_src->GetClientFilename()), _SpecialChars(cur_src->GetFileComment()), _SpecialChars(GetRateString(cur_src->GetFileRating())) ); } } const CTypedPtrList<CPtrList, Kademlia::CEntry*>& list = pPartFile->getNotes(); for(POSITION pos = list.GetHeadPosition(); pos != NULL; ) { Kademlia::CEntry* entry = list.GetNext(pos); commentlines.AppendFormat( pThis->m_Templates.sCommentListLine, _T(""), _SpecialChars(entry->m_fileName), _SpecialChars(entry->GetStrTagValue(TAG_DESCRIPTION)), _SpecialChars(GetRateString((UINT)entry->GetIntTagValue(TAG_FILERATING)) ) ); } Out.Replace(_T("[COMMENTLINES]"), commentlines ); Out.Replace(_T("[COMMENTS]"), _T("") ); Out.Replace(_T("[USERNAME]"), GetResString(IDS_QL_USERNAME)); Out.Replace(_T("[FILENAME]"), GetResString(IDS_DL_FILENAME)); Out.Replace(_T("[COMMENT]"), GetResString(IDS_COMMENT)); Out.Replace(_T("[RATING]"), GetResString(IDS_QL_RATING)); Out.Replace(_T("[CLOSE]"), GetResString(IDS_CW_CLOSE)); Out.Replace(_T("[CharSet]"), HTTPENCODING ); return Out; }
[ "LanceFong@4a627187-453b-0410-a94d-992500ef832d" ]
[ [ [ 1, 5184 ] ] ]
34f1617c000c998fc83f0bfa2d25bffcc7860f35
c5ecda551cefa7aaa54b787850b55a2d8fd12387
/src/WorkLayer/SourceURL.h
68a1117cf5547ff3debbb52a7c859232c06f4e3f
[]
no_license
firespeed79/easymule
b2520bfc44977c4e0643064bbc7211c0ce30cf66
3f890fa7ed2526c782cfcfabb5aac08c1e70e033
refs/heads/master
2021-05-28T20:52:15.983758
2007-12-05T09:41:56
2007-12-05T09:41:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
464
h
#pragma once class CSourceURL { // Construction public: CSourceURL(LPCTSTR pszURL = NULL); // Attributes public: //CString m_sURL; CString m_sAddress; CString m_sPath; CString m_sLogin; CString m_sPassword; uint16 m_nPort; // Operations public: void Clear(); BOOL ParseFTP(LPCTSTR pszURL); BOOL ParseHTTP(LPCTSTR pszURL); BOOL Resolve(LPCTSTR pszHost, int nPort, SOCKADDR_IN* pHost, BOOL bNames = TRUE) const; };
[ "LanceFong@4a627187-453b-0410-a94d-992500ef832d" ]
[ [ [ 1, 24 ] ] ]
e3095bb4103f70a1a595225cec7497c52be43c27
0b66a94448cb545504692eafa3a32f435cdf92fa
/tags/0.8/cbear.berlios.de/base/const_ref.hpp
2dd4d4624780c490eeb03ec4d9031fe26a2dd733
[ "MIT" ]
permissive
BackupTheBerlios/cbear-svn
e6629dfa5175776fbc41510e2f46ff4ff4280f08
0109296039b505d71dc215a0b256f73b1a60b3af
refs/heads/master
2021-03-12T22:51:43.491728
2007-09-28T01:13:48
2007-09-28T01:13:48
40,608,034
0
0
null
null
null
null
UTF-8
C++
false
false
248
hpp
#ifndef CBEAR_BERLIOS_DE_BASE_CONST_REF_HPP_INCLUDED #define CBEAR_BERLIOS_DE_BASE_CONST_REF_INCLUDED namespace cbear_berlios_de { namespace base { template<class T> const T &const_ref(const T &X) { return X; } } } #endif
[ "sergey_shandar@e6e9985e-9100-0410-869a-e199dc1b6838" ]
[ [ [ 1, 18 ] ] ]
60b3de91fd59364b18a9858adbe88a24637760b1
1c80a726376d6134744d82eec3129456b0ab0cbf
/Project/C++/C++/练习/Visual C++程序设计与应用教程/Li2_1/MainFrm.cpp
b565c211958c952476a8cb4eca82c44d40758447
[]
no_license
dabaopku/project_pku
338a8971586b6c4cdc52bf82cdd301d398ad909f
b97f3f15cdc3f85a9407e6bf35587116b5129334
refs/heads/master
2021-01-19T11:35:53.500533
2010-09-01T03:42:40
2010-09-01T03:42:40
null
0
0
null
null
null
null
GB18030
C++
false
false
1,884
cpp
// MainFrm.cpp : CMainFrame 类的实现 // #include "stdafx.h" #include "Li2_1.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CMainFrame IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) ON_WM_CREATE() END_MESSAGE_MAP() static UINT indicators[] = { ID_SEPARATOR, // 状态行指示器 ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; // CMainFrame 构造/析构 CMainFrame::CMainFrame() { // TODO: 在此添加成员初始化代码 } CMainFrame::~CMainFrame() { } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("未能创建工具栏\n"); return -1; // 未能创建 } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("未能创建状态栏\n"); return -1; // 未能创建 } // TODO: 如果不需要可停靠工具栏,则删除这三行 m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); return 0; } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: 在此处通过修改 // CREATESTRUCT cs 来修改窗口类或样式 return TRUE; } // CMainFrame 诊断 #ifdef _DEBUG void CMainFrame::AssertValid() const { CFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CFrameWnd::Dump(dc); } #endif //_DEBUG // CMainFrame 消息处理程序
[ "[email protected]@592586dc-1302-11df-8689-7786f20063ad" ]
[ [ [ 1, 102 ] ] ]
a0e32eff018923cc0fd59d813ab196dfe1cf7ee7
f25e9e8fd224f81cefd6d900f6ce64ce77abb0ae
/Exercises/OpenGL6/DDEngine/messagePump.h
650b051efc3387cf291913d21ffd5cb1a97cbb72
[]
no_license
giacomof/gameengines2010itu
8407be66d1aff07866d3574a03804f2f5bcdfab1
bc664529a429394fe5743d5a76a3d3bf5395546b
refs/heads/master
2016-09-06T05:02:13.209432
2010-12-12T22:18:19
2010-12-12T22:18:19
35,165,366
0
0
null
null
null
null
UTF-8
C++
false
false
1,113
h
#ifdef __DDEngine # define messagePump_D __declspec(dllexport) #else # define messagePump_D __declspec(dllimport) #endif #ifndef messagePump__H__ #define messagePump__H__ #include "mutexManager.h" #include <SDL.h> #include <string> #include <list> #include <map> using namespace std; class messagePump_D MessagePump { public: // external declaration static list<SDL_Event> * messageList; static unsigned int count; static SDL_mutex * mutex_event; // Singleton Definitions static MessagePump _instance; MessagePump() { &getInstance(); } ~MessagePump() {}; MessagePump(const MessagePump & getInstance()); MessagePump & operator=(MessagePump & getInstance()); static MessagePump & getInstance(); static bool empty(); static void sendMessage(SDL_Event msg); static void sendPriorityMessage(SDL_Event msg); static SDL_Event receiveMessage(); static SDL_Event readMessage(); static SDL_Event receiveLastMessage(); static SDL_Event readLastMessage(); static void deleteMessage(); static void deleteLastMessage(); }; #endif
[ "[email protected]@1a5f623d-5e27-cfcb-749e-01bf3eb0ad9d", "[email protected]@1a5f623d-5e27-cfcb-749e-01bf3eb0ad9d" ]
[ [ [ 1, 6 ], [ 9, 9 ], [ 11, 18 ], [ 20, 21 ], [ 26, 26 ], [ 30, 45 ], [ 47, 49 ] ], [ [ 7, 8 ], [ 10, 10 ], [ 19, 19 ], [ 22, 25 ], [ 27, 29 ], [ 46, 46 ] ] ]
19a8ad8faa8364313f0dee478c2607a2206a35d2
27d5670a7739a866c3ad97a71c0fc9334f6875f2
/CPP/Targets/MapLib/Shared/include/ImageBlender.h
1d5c54810f2b434054f966abd5f5676e7d78a200
[ "BSD-3-Clause" ]
permissive
ravustaja/Wayfinder-S60-Navigator
ef506c418b8c2e6498ece6dcae67e583fb8a4a95
14d1b729b2cea52f726874687e78f17492949585
refs/heads/master
2021-01-16T20:53:37.630909
2010-06-28T09:51:10
2010-06-28T09:51:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,137
h
/* Copyright (c) 1999 - 2010, Vodafone Group Services Ltd 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 Vodafone Group Services Ltd 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. */ #ifndef IMAGE_BLENDER_H #define IMAGE_BLENDER_H #include "config.h" #include <vector> /** * Class that can blend two colors together, creates * a gradient. */ class ImageBlender { public: /** * Function that creates a gradient with a given * number of color steps. * @param originColor The orginal color, the color that should * be the base color of the gradient. * @param blendColor The color ot use for blending the org color * with. * @param height Number of color steps, a high amount of * color steps will result in a smoother gradient * than with a small amount of color steps. * @param minAlpha Defines the startColor, the originColor and the * blendColor will be blended toghether with this alpha * value defining the first color of the gradient. * The alpha value is expressed as a byte (0 - 255). * @param maxAlpha Defines the endColor, the originColor and the * blendColor will be blended toghether with this alpha * value defining the last color of the gradient. * The alpha value is expressed as a byte (0 - 255). * @param result Vector holding all the colors in the gradient when * the blending is done. */ static void blendImage( uint32 originColor, uint32 blendColor, int32 height, std::vector<uint32>& result, uint8 minAlpha = 0, uint8 maxAlpha = 255 ); /** * Blends two colors together using a alpha value. * @param orgColor The original color that should be the * base of the blended color. * @param blendColor The blendColor, defines wich color that * the orgColor should be blended with. * @param alpha The alpha value expressed in a byte (0 -255) * With a high alpha value, the blended color * will look a lot like the blendColor and with * a small alpha value, the blended color will look * a lot like the orgColor. */ static uint32 calcBlendedColor( uint32 orgColor, uint32 blendColor, uint8 alpha ); }; #endif
[ [ [ 1, 73 ] ] ]
8d0c81553d1a4dd2e2675fa824ab30e70cdd8ce0
a84b013cd995870071589cefe0ab060ff3105f35
/webdriver/branches/chrome/chrome/src/cpp/include/breakpad/src/processor/pathname_stripper.h
352edc614b5f35bff7f16b323d253af035d44316
[ "Apache-2.0" ]
permissive
vdt/selenium
137bcad58b7184690b8785859d77da0cd9f745a0
30e5e122b068aadf31bcd010d00a58afd8075217
refs/heads/master
2020-12-27T21:35:06.461381
2009-08-18T15:56:32
2009-08-18T15:56:32
13,650,409
1
0
null
null
null
null
UTF-8
C++
false
false
2,240
h
// Copyright (c) 2006, Google 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 Google Inc. 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. // pathname_stripper.h: Manipulates pathnames into their component parts. // // Author: Mark Mentovai #ifndef PROCESSOR_PATHNAME_STRIPPER_H__ #define PROCESSOR_PATHNAME_STRIPPER_H__ #include <string> namespace google_breakpad { using std::string; class PathnameStripper { public: // Given path, a pathname with components separated by slashes (/) or // backslashes (\), returns the trailing component, without any separator. // If path ends in a separator character, returns an empty string. static string File(const string &path); }; } // namespace google_breakpad #endif // PROCESSOR_PATHNAME_STRIPPER_H__
[ "noel.gordon@07704840-8298-11de-bf8c-fd130f914ac9" ]
[ [ [ 1, 53 ] ] ]
df3e7dcfa9feb55c1de2a4d7f88d4a2c2b3831e3
971b000b9e6c4bf91d28f3723923a678520f5bcf
/PaperSizeScroll/href_gui.cpp
ef32fd5eee25d7c9ad83e7c95491653f6e9414e1
[]
no_license
google-code-export/fop-miniscribus
14ce53d21893ce1821386a94d42485ee0465121f
966a9ca7097268c18e690aa0ea4b24b308475af9
refs/heads/master
2020-12-24T17:08:51.551987
2011-09-02T07:55:05
2011-09-02T07:55:05
32,133,292
2
0
null
null
null
null
UTF-8
C++
false
false
1,729
cpp
#include "href_gui.h" // /* Save file as href_gui.cpp */ /* Class Href_Gui Created on Fri Jun 2 11:13:28 CEST 2006 */ // #include <QCloseEvent> // QPointer<Href_Gui> Href_Gui::_self = 0L; // Href_Gui* Href_Gui::self( QWidget* parent ) { if ( !_self ) _self = new Href_Gui( parent ); return _self; } // Href_Gui::Href_Gui( QWidget* parent ) : QDialog( parent ) { setupUi( this ); hrefconfisuser.clear(); connect(okButton, SIGNAL(clicked()), this, SLOT(Acceptvars())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); connect(otext_href, SIGNAL(currentIndexChanged(int)), this, SLOT(urlChanged(int))); //////QComboBox *otext_href; } void Href_Gui::urlChanged( const int index ) { const int internals = otext_href->itemData(index).toInt(); if (internals == 2) { target_href->setCurrentIndex(5); target_href->setDisabled(true); } else { target_href->setDisabled(false); } } void Href_Gui::Acceptvars() { QString te = text_href->text(); QString url = otext_href->currentText(); QString target = target_href->itemText(target_href->currentIndex()); if (te.size() < 1 or url.size() < 1) { QMessageBox::warning( this, tr( "Error Text!" ),tr("Please set a valid url")); return; } hrefconfisuser.clear(); hrefconfisuser.append(te); hrefconfisuser.append(url); hrefconfisuser.append(target); accept(); } QStringList Href_Gui::GetUserConfig() { return hrefconfisuser; } void Href_Gui::reject() { hrefconfisuser.clear(); close(); } void Href_Gui::closeEvent( QCloseEvent* e ) { hrefconfisuser.clear(); e->accept(); }
[ "ppkciz@9af58faf-7e3e-0410-b956-55d145112073" ]
[ [ [ 1, 74 ] ] ]
abe73b21f454c720f979944a6bb304c28f1ff4ab
1585c7e187eec165138edbc5f1b5f01d3343232f
/LabActive/LabTest/LabTest.cpp
f354758a06026708eaba3e690677a23b850d734e
[]
no_license
a-27m/vssdb
c8885f479a709dd59adbb888267a03fb3b0c3afb
d86944d4d93fd722e9c27cb134256da16842f279
refs/heads/master
2022-08-05T06:50:12.743300
2011-06-23T08:35:44
2011-06-23T08:35:44
82,612,001
1
0
null
2021-03-29T08:05:33
2017-02-20T23:07:03
C#
UTF-8
C++
false
false
2,097
cpp
// LabTest.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "LabTest.h" #include "LabTestDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CLabTestApp BEGIN_MESSAGE_MAP(CLabTestApp, CWinApp) ON_COMMAND(ID_HELP, &CWinApp::OnHelp) END_MESSAGE_MAP() // CLabTestApp construction CLabTestApp::CLabTestApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } // The one and only CLabTestApp object CLabTestApp theApp; // CLabTestApp initialization BOOL CLabTestApp::InitInstance() { // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Local AppWizard-Generated Applications")); CLabTestDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
[ "Axell@bf672a44-3a04-1d4a-850b-c2a239875c8c" ]
[ [ [ 1, 78 ] ] ]
c1f0f3120e3639430fa94e3805510375b8429995
09057f4cce385ad826cf5f61454e85f214e937a8
/vs2008/iactivex/iactivex/iactivexView.h
069dc82cef95c5735b666f9b47b0208656133e2d
[]
no_license
van-smith/OPBM
751f8f71e6823b7f1c95e5002909427910479f90
69ae167a375dfbfa9552b9bfb388f317447dbd9d
refs/heads/master
2016-08-07T10:44:54.348257
2011-07-28T05:28:59
2011-07-28T05:28:59
2,143,608
0
1
null
null
null
null
UTF-8
C++
false
false
1,076
h
// iactivexView.h : interface of the CiactivexView class // #pragma once class CiactivexView : public CView { protected: // create from serialization only CiactivexView(); DECLARE_DYNCREATE(CiactivexView) // Attributes public: CiactivexDoc* GetDocument() const; // Operations public: // Overrides public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); protected: virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); // Implementation public: virtual ~CiactivexView(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: DECLARE_MESSAGE_MAP() }; #ifndef _DEBUG // debug version in iactivexView.cpp inline CiactivexDoc* CiactivexView::GetDocument() const { return reinterpret_cast<CiactivexDoc*>(m_pDocument); } #endif
[ [ [ 1, 49 ] ] ]
1a5c85beefa1adc51ae154c3ba15e09a6ebad9b4
dc4f8d571e2ed32f9489bafb00b420ca278121c6
/mojo_engine/cAdLibMemo.cpp
e374bb687f7d277cd36b43a985b1a7791bfc3429
[]
no_license
mwiemarc/mojoware
a65eaa4ec5f6130425d2a1e489e8bda4f6f88ec0
168a2d3a9f87e6c585bde4a69b97db53f72deb7f
refs/heads/master
2021-01-11T20:11:30.945122
2010-01-25T00:27:47
2010-01-25T00:27:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,152
cpp
/*********************************************************************************************************************** /* /* cAdLibMemo.cpp / mojo_engine /* /* Copyright 2009 Robert Sacks. See end of file for more info. /* /**********************************************************************************************************************/ #include "stdafx.h" using namespace mojo; //====================================================================================================================== // CODE //====================================================================================================================== //---------------------------------------------------------------------------------------------------------------------- // CONSTRUCTOR //---------------------------------------------------------------------------------------------------------------------- cAdLibMemo :: cAdLibMemo ( _eSeverity e, const wchar_t * pHeadFormatString, const wchar_t * pBodyFormatString, va_list pArgs ) { eSeverity = e; // cScribPack * pSB = static_cast<cScribPack *> ( this ); cScribPack::set_ad_lib ( pHeadFormatString, pBodyFormatString, pArgs ); } //---------------------------------------------------------------------------------------------------------------------- // CONSTRUCTOR //---------------------------------------------------------------------------------------------------------------------- cAdLibMemo :: cAdLibMemo ( _eSeverity e, const wchar_t * pHeadFormatString, const wchar_t * pBodyFormatString, ... ) { eSeverity = e; va_list args; va_start ( args, pBodyFormatString ); cScribPack::set_ad_lib( pHeadFormatString, pBodyFormatString, args ); } /*********************************************************************************************************************** /* /* This file is part of Mojo. For more information, see http://mojoware.org. /* /* You may redistribute and/or modify Mojo under the terms of the GNU General Public License, /* version 3, as published by the Free Software Foundation. You should have received a copy of the /* license with mojo. If you did not, go to http://www.gnu.org. /* /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "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 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. /* /***********************************************************************************************************************/
[ [ [ 1, 57 ] ] ]
a79a2f7e06c342a6e87c3234a87b161ec38ec203
8aa65aef3daa1a52966b287ffa33a3155e48cc84
/Source/Math/Matrix.inl
103bd40bdf56e67f191eddcf93e8a92580d22a11
[]
no_license
jitrc/p3d
da2e63ef4c52ccb70023d64316cbd473f3bd77d9
b9943c5ee533ddc3a5afa6b92bad15a864e40e1e
refs/heads/master
2020-04-15T09:09:16.192788
2009-06-29T04:45:02
2009-06-29T04:45:02
37,063,569
1
0
null
null
null
null
UTF-8
C++
false
false
5,995
inl
#pragma once namespace P3D { mathinline Matrix::Matrix() { #ifdef TD_MATH_PARANOIA elements[0] = elements[4] = elements[11] = 1000000.0f; #endif } mathinline Matrix::Matrix(Scalar m00, Scalar m01, Scalar m02, Scalar m10, Scalar m11, Scalar m12, Scalar m20, Scalar m21, Scalar m22) { SetColumns(Vector(m00, m01, m02), Vector(m10, m11, m12), Vector(m20, m21, m22)); } mathinline Vector& Matrix::GetColumn(int x) { return *(Vector*)&elements[4*x]; }; mathinline const Vector& Matrix::GetColumn(int x) const { return *(const Vector*)&elements[4*x]; } mathinline void Matrix::Transpose() { Scalar swap; swap = GetColumn(0)(1); GetColumn(0)(1) = GetColumn(1)(0); GetColumn(1)(0) = swap; swap = GetColumn(0)(2); GetColumn(0)(2) = GetColumn(2)(0); GetColumn(2)(0) = swap; swap = GetColumn(1)(2); GetColumn(1)(2) = GetColumn(2)(1); GetColumn(2)(1) = swap; } mathinline void Matrix::SetRows(const Vector& r0, const Vector& r1, const Vector& r2) { GetColumn(0).Set( r0(0), r1(0), r2(0) ); GetColumn(1).Set( r0(1), r1(1), r2(1) ); GetColumn(2).Set( r0(2), r1(2), r2(2) ); } mathinline void Matrix::SetColumns(const Vector& c0, const Vector& c1, const Vector& c2) { GetColumn(0) = c0; GetColumn(1) = c1; GetColumn(2) = c2; } mathinline void Matrix::SetZero() { GetColumn(0).SetZero(); GetColumn(1).SetZero(); GetColumn(2).SetZero(); } mathinline void Matrix::SetDiagonal(Scalar d0, Scalar d1, Scalar d2) { GetColumn(0).Set(d0, 0, 0); GetColumn(1).Set( 0,d1, 0); GetColumn(2).Set( 0, 0,d2); } mathinline void Matrix::SetIdentity() { SetDiagonal(1, 1, 1); } mathinline void Matrix::SetCrossSkewSymmetric(const Vector& v) { // See http://en.wikipedia.org/wiki/Cross_product#Conversion_to_matrix_multiplication GetColumn(0).Set(0, -v.z, v.y); GetColumn(1).Set(v.z, 0, -v.x); GetColumn(2).Set(-v.y, v.x, 0); } mathinline bool Matrix::Invert(Scalar epsilon) { IncCounter(g_MatrixInverse); Vector r0 = GetColumn(1) ^ GetColumn(2); Vector r1 = GetColumn(2) ^ GetColumn(0); Vector r2 = GetColumn(0) ^ GetColumn(1); Scalar D = GetColumn(0) * r0; // main determinant if (abs(D) < epsilon) return false; Scalar DI = Scalar(1.0f)/D; r0 *= DI; r1 *= DI; r2 *= DI; SetRows(r0, r1, r2); return true; } mathinline void Matrix::operator+=(const Matrix& a) { GetColumn(0) += a.GetColumn(0); GetColumn(1) += a.GetColumn(1); GetColumn(2) += a.GetColumn(2); } mathinline void Matrix::operator-=(const Matrix& a) { GetColumn(0) -= a.GetColumn(0); GetColumn(1) -= a.GetColumn(1); GetColumn(2) -= a.GetColumn(2); } mathinline void Matrix::operator*=(Scalar a) { GetColumn(0) *= a; GetColumn(1) *= a; GetColumn(2) *= a; } mathinline void Matrix::operator*=(const Matrix& a) { IncCounter(g_MatrixMultiply); Matrix& Ma = *this; for (int i = 0; i < 3; i++) { Scalar x = Ma(0,0)*a(0,i) + Ma(0,1)*a(1,i) + Ma(0,2)*a(2,i); Scalar y = Ma(1,0)*a(0,i) + Ma(1,1)*a(1,i) + Ma(1,2)*a(2,i); Scalar z = Ma(2,0)*a(0,i) + Ma(2,1)*a(1,i) + Ma(2,2)*a(2,i); GetColumn(i).Set(x,y,z); } } mathinline void Matrix::SetMultiply(const Matrix& a, const Matrix& b) { IncCounter(g_MatrixMultiply); for (int i = 0; i < 3; i++) { Scalar x = a(0,0)*b(0,i) + a(0,1)*b(1,i) + a(0,2)*b(2,i); Scalar y = a(1,0)*b(0,i) + a(1,1)*b(1,i) + a(1,2)*b(2,i); Scalar z = a(2,0)*b(0,i) + a(2,1)*b(1,i) + a(2,2)*b(2,i); GetColumn(i).Set(x,y,z); } } mathinline void Matrix::SetQuaternion(const Quaternion& q) { // See http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion IncCounter(g_QuaternionToMatrixConversion); Scalar wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2; x2 = q.x + q.x; y2 = q.y + q.y; z2 = q.z + q.z; xx = q.x * x2; xy = q.x * y2; xz = q.x * z2; yy = q.y * y2; yz = q.y * z2; zz = q.z * z2; wx = q.w * x2; wy = q.w * y2; wz = q.w * z2; GetColumn(0).Set(1.0f-(yy+zz), xy-wz, xz+wy); GetColumn(1).Set(xy+wz, 1.0f-(xx+zz), yz-wx); GetColumn(2).Set(xz-wy, yz+wx, 1.0f-(xx+yy)); } mathinline void Matrix::SetAxisAngle(const Vector& axis, Scalar angle) { SetQuaternion(Quaternion(axis, angle)); } mathinline void Matrix::SetEulerAngles(Scalar yaw, Scalar pitch, Scalar roll) { // See http://en.wikipedia.org/wiki/Euler_angles#Table_of_matrices // x y z Scalar c1, s1; sincos(roll, &s1, &c1); Scalar c2, s2; sincos(pitch, &s2, &c2); Scalar c3, s3; sincos(yaw, &s3, &c3); GetColumn(0).Set(c2 * c3, c3 * s1 *s2 - c1 * s3, c1 * c3 * s2 + s1 * s3 ); GetColumn(1).Set(c2 * s3, c1 * c3 + s1 * s2 * s3, c1 * s2 * s3 - c3 * s1); GetColumn(2).Set(-s2, c2 * s1, c1 * c2 ); } mathinline Scalar Matrix::GetDeterminant() const { const Matrix& m = *this; return m(0, 0) * (m(1, 1) * m(2, 2) - m(2, 1) * m(1, 2)) - m(0, 1) * (m(1, 0) * m(2, 2) - m(2, 0) * m(1, 2)) + m(0, 2) * (m(1, 0) * m(2, 1) - m(2, 0) * m(1, 1)); } }
[ "vadun87@6320d0be-1f75-11de-b650-e715bd6d7cf1" ]
[ [ [ 1, 193 ] ] ]
76ded568597b662e9d68879fcce4767b8d33a312
c0edc7294df991d2e422ce972d96e66a99e79d3a
/src/cpm.h
d9064e512420be5919f07acfea0dacc200246156
[]
no_license
mahmudulhaque/CPM_Development
47c1310b521e32f6bd83a357056ae39e0c9781e9
982ef01d3a06013596a50a30d5b782cb01096a72
refs/heads/master
2020-07-22T00:14:30.627911
2011-04-29T16:23:44
2011-04-29T16:23:44
1,681,413
0
0
null
null
null
null
UTF-8
C++
false
false
2,963
h
//------------------------------------------------------------- // File: cpm.h // (part of OMNeT++ simulation of CPMnet) // Author: Weihai Yu //------------------------------------------------------------- #ifndef __CPM_H #define __CPM_H #include "cpmcommon.h" #include "cont.h" #include "environ.h" #include "cpmsite.h" class CPmessageHandler; class ScpAct; class Cpm { public: //unique flow id (fid), scope id (sid) or join id (jid) static long nextid; Cpm ( CPMsite* s, xmlDocPtr cpmdoc = NULL ); ~Cpm (); Cpm* set ( xmlDocPtr newdoc ); Cpm* set ( const char *str ); void dispatch ( CPmessageHandler *cmsgh = NULL ); void leave (); void enact (); void moveOn (); void rollBack (); bool isRollingback () { return rollingback; }; void terminate (); Cpm* applyC (); Cpm* applyBwc (); long getFid () const { return fid; }; long getSid () const { return sid; }; long getBid () const { return bid; }; int getSaddr () const { return saddr; }; static void resetId () { nextid = 0; }; CPMsite* site; xmlDocPtr doc; xmlNodePtr cpmelm, actelm; ActType acttype; Environ* e; Cont* c; Cont* bwc; CPmessageHandler *msgh; //actually was private long msgSize (); private: long fid; long sid; long bid; int saddr; bool return_to_caller; // whether return to the invoker bool rollingback; bool centralized; double svc_failrate; Cpm* setToNull (); Cpm* release (); Cpm* setFid (long newfid); Cpm* setNewSid (); Cpm* setSid (long newsid); Cpm* setBid (long newbid); Cpm* setSaddrWithScp (); Cpm* setSaddr (int newsaddr); Cpm* setRollingback (bool to_rollback); Cpm* setReturn (bool back_to_caller = false); xmlChar* toXstr (); void invalidCpm (); bool isLocal () const; bool isEnd () const { return acttype == NON; }; CPmessageHandler* refreshMsgH (); void forward (int remote_addr, bool leave_guard = true); unsigned int hash (const xmlChar* xstr); unsigned int poolMatchKey (); Cpm* invCpm ( bool just_failed = false ); void createScope ( long newsid ); void stopScope (long esid, int esaddr, long epsid, int epsaddr); Cpm* invReturn (int caller); Cont* createBwc (xmlNodePtr elm); xmlNodePtr makeEos (long psid, int psaddr, xmlNodePtr compensate_elm); xmlNodePtr makeEsf (long psid, int psaddr); xmlNodePtr makeJoin ( long jid, long psid, int psaddr, int count, int bid, const char *heading ); xmlNodePtr makeRollbackFlow ( int matchkey, long jid ); xmlNodePtr makeRollbackFlowBranch ( Cpm *branch_cpm, long jid ); xmlNodePtr makeEoi ( long iid ); xmlNodePtr makeEif ( long iid ); void scpNewSite (int newsite); void scpNewScp ( long psid, int psaddr); void scpStop ( long esid, int esaddr, long epsid, int epsaddr ); void scpRollback (); }; #endif
[ [ [ 1, 58 ], [ 62, 89 ], [ 91, 109 ], [ 111, 116 ] ], [ [ 59, 61 ], [ 90, 90 ], [ 110, 110 ], [ 117, 117 ] ] ]
e4d093db403cb9460def5928b8f36eba7313214a
7a310d01d1a4361fd06b40a74a2afc8ddc23b4d3
/src/option/ProxyDialog.cpp
2302f8f74529b589c56edd6d494dac444bd0ba89
[]
no_license
plus7/DonutG
b6fec6111d25b60f9a9ae5798e0ab21bb2fa28f6
2d204c36f366d6162eaf02f4b2e1b8bc7b403f6b
refs/heads/master
2020-06-01T15:30:31.747022
2010-08-21T18:51:01
2010-08-21T18:51:01
767,753
1
2
null
null
null
null
SHIFT_JIS
C++
false
false
6,469
cpp
/** * @file ProxyDialog.h * @brief donutのオプション : プロキシ */ #include "stdafx.h" #include "ProxyDialog.h" #include "../IniFile.h" #include "../DonutPFunc.h" #if defined USE_ATLDBGMEM #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif using namespace MTL; // Constructor CProxyPropertyPage::CProxyPropertyPage() { m_nRandTimeMin = 5; m_nRandTimeSec = 0; m_nRandChk = 0; m_nLocalChk = 0; m_nUseIE = 1; } // Overrides BOOL CProxyPropertyPage::OnSetActive() { SetModified(TRUE); if (m_editPrx.m_hWnd == NULL) { m_editPrx.Attach( GetDlgItem(IDC_EDIT1) ); } if (m_editNoPrx.m_hWnd == NULL) { m_editNoPrx.Attach( GetDlgItem(IDC_EDIT2) ); } if (m_editPrx.m_hWnd && m_editNoPrx.m_hWnd) { //+++ きっと r13test10のほうが正しいと思われる #if 1 //+++ メモ: r13test10での処理. _SetData(); #else //+++ メモ:undonut+ での処理.... OnApplyでも_GetData()で、_SetDataしてる箇所がない... _GetData(); #endif } return DoDataExchange(FALSE); } BOOL CProxyPropertyPage::OnKillActive() { return DoDataExchange(TRUE); } BOOL CProxyPropertyPage::OnApply() { if ( DoDataExchange(TRUE) ) { _GetData(); return TRUE; } else { return FALSE; } } void CProxyPropertyPage::_SetData() { CString strFile = _GetFilePath( _T("Proxy.ini") ); //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // プロキシ { CIniFileI pr( strFile, _T("PROXY") ); DWORD dwLineCnt = 0; pr.QueryValue( dwLineCnt, _T("MAX") ); m_editPrx.SetSelAll(); for (int ii = 0; ii < (int) dwLineCnt; ++ii) { CString strKey; strKey.Format(_T("%d"), ii); CString strProxy = pr.GetString( strKey ); //*+++ ここをGetStringUWにするかは後で. if ( strProxy.IsEmpty() ) continue; m_editPrx.ReplaceSel( LPCTSTR(strProxy) ); m_editPrx.ReplaceSel( _T("\r\n") ); } } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // ランダム { CIniFileI pr( strFile, _T("RAND") ); DWORD dwRandChk = 0; pr.QueryValue( dwRandChk, STR_ENABLE ); m_nRandChk = dwRandChk; DWORD dwRandTimeMin = 5; pr.QueryValue( dwRandTimeMin, _T("Min") ); m_nRandTimeMin = dwRandTimeMin; DWORD dwRandTimeSec = 0; pr.QueryValue( dwRandTimeSec, _T("Sec") ); m_nRandTimeSec = dwRandTimeSec; } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // 非プロキシ { CIniFileI pr( strFile, _T("NOPROXY") ); DWORD dwLineCnt = 0; pr.QueryValue( dwLineCnt, _T("MAX") ); m_editNoPrx.SetSelAll(); for (int ii = 0; ii < (int) dwLineCnt; ++ii) { CString strKey; strKey.Format(_T("%d"), ii); CString strProxy = pr.GetString( strKey ); //*+++ ここをGetStringUWにするかは後で. if ( strProxy.IsEmpty() ) continue; m_editNoPrx.ReplaceSel( LPCTSTR(strProxy) ); m_editNoPrx.ReplaceSel( _T("\r\n") ); } } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // ローカル { CIniFileI pr( strFile, _T("LOCAL") ); DWORD dwLocalChk = 0; pr.QueryValue( dwLocalChk, STR_ENABLE ); m_nLocalChk = dwLocalChk; } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // ローカル { CIniFileI pr( strFile, _T("USE_IE") ); DWORD dwUseIE = 1; pr.QueryValue( dwUseIE, STR_ENABLE ); m_nUseIE = dwUseIE; } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } void CProxyPropertyPage::_GetData() { CString strFile; strFile = _GetFilePath( _T("Proxy.ini") ); #if 1 //+++ メモ: r13test10に対し undonut+ で増えた処理... #if 1 //+++ 念のためバックアップファイルにする. Misc::MoveToBackupFile(strFile); #else if (GetFileAttributes(strFile) != 0xFFFFFFFF) //Proxy.iniが存在していれば削除 DeleteFile(strFile); #endif #endif //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // プロキシ { CIniFileO pr( strFile, _T("PROXY") ); int nLineCnt = m_editPrx.GetLineCount(); pr.SetValue( (DWORD) nLineCnt, _T("MAX") ); for (int ii = 0; ii < nLineCnt; ++ii) { CString strKey; strKey.Format(_T("%d"), ii); TCHAR cBuff[MAX_PATH]; memset(cBuff, 0, MAX_PATH); int nTextSize = m_editPrx.GetLine(ii, cBuff, MAX_PATH); #if 1 //+++ メモ: r13test10に対し undonut+ で増えた処理. if (cBuff[0] == '\0') break; //何もなかったら終了 #endif cBuff[nTextSize] = '\0'; CString strBuff(cBuff); pr.SetString(strBuff, strKey); } //x pr.Close(); //+++ } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // ランダム { CIniFileO pr( strFile, _T("RAND") ); pr.SetValue( (DWORD) m_nRandChk, STR_ENABLE ); pr.SetValue( (DWORD) m_nRandTimeMin, _T("Min") ); pr.SetValue( (DWORD) m_nRandTimeSec, _T("Sec") ); } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // 非プロキシ { CIniFileO pr( strFile, _T("NOPROXY") ); int nLineCnt = m_editNoPrx.GetLineCount(); pr.SetValue( (DWORD) nLineCnt, _T("MAX") ); for (int ii = 0; ii < nLineCnt; ++ii) { CString strKey; strKey.Format(_T("%d"), ii); TCHAR cBuff[MAX_PATH]; memset(cBuff, 0, MAX_PATH); int nTextSize = m_editNoPrx.GetLine(ii, cBuff, MAX_PATH); #if 1 //+++ メモ: r13test10に対し undonut+ で増えた処理. if (cBuff[0] == _T('\0')) break; //何もなかったら終了 #endif cBuff[nTextSize] = _T('\0'); CString strBuff(cBuff); #if 1 //+++ メモ: undonut+ でコメントアウトされた部分. //strBuff += _T("\n"); #endif pr.SetString(strBuff, strKey); } } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // ローカル { CIniFileO pr( strFile, _T("LOCAL") ); pr.SetValue( (DWORD) m_nLocalChk, STR_ENABLE ); } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // IE { CIniFileO pr( strFile, _T("USE_IE") ); pr.SetValue( (DWORD) m_nUseIE, STR_ENABLE ); } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }
[ [ [ 1, 271 ] ] ]
844420aeae24757376b8ab1fd4a3a103819b3981
2dbbca065b62a24f47aeb7ec5cd7a4fd82083dd4
/OUAN/OUAN/Src/Graphics/RenderComponent/RenderComponentWater.cpp
146f5c25f522209f890e82e26fb163f76ff7edb2
[]
no_license
juanjmostazo/once-upon-a-night
9651dc4dcebef80f0475e2e61865193ad61edaaa
f8d5d3a62952c45093a94c8b073cbb70f8146a53
refs/heads/master
2020-05-28T05:45:17.386664
2010-10-06T12:49:50
2010-10-06T12:49:50
38,101,059
1
1
null
null
null
null
UTF-8
C++
false
false
7,818
cpp
#include "OUAN_Precompiled.h" #include "RenderComponentWater.h" #include "../../Game/GameObject/GameObject.h" #include "../../Game/GameObject/GameObjectOny.h" #include "../../Game/GameWorldManager.h" #include "../../Event/EventDefs.h" #include "../CameraManager/CameraManager.h" #include "../../Game/WorldNameConverter.h" using namespace OUAN; using namespace Ogre; RenderComponentWater::RenderComponentWater(const std::string& type) :RenderComponent(COMPONENT_TYPE_RENDER_ENTITY) { } RenderComponentWater::~RenderComponentWater() { } Ogre::Entity* RenderComponentWater::getEntity() const { return mEntity; } void RenderComponentWater::setEntity(Ogre::Entity* entity,bool existInDreams,bool existInNightmares) { mEntity=entity; Ogre::SubEntity* subEnt; unsigned int i; mDreamsMaterial.clear(); mNightmaresMaterial.clear(); mChangeWorldMaterial.clear(); if(mEntity) { for ( i = 0; i < mEntity->getNumSubEntities(); i++) { // Get the material of this sub entity and build the clone material name subEnt = mEntity->getSubEntity(i); if(subEnt) { mDreamsMaterial.push_back(WorldNameConverter::getDreamsName(subEnt->getMaterialName().c_str())); mNightmaresMaterial.push_back(WorldNameConverter::getNightmaresName(subEnt->getMaterialName().c_str())); mChangeWorldMaterial.push_back(WorldNameConverter::getChangeWorldName(subEnt->getMaterialName().c_str())); mChangeWorldMaterial[i]=setChangeWorldMaterialTransparentTextures(mChangeWorldMaterial[i],existInDreams,existInNightmares); } } } } void RenderComponentWater::setVisible(bool visible) { Ogre::SceneNode * pSceneNode; pSceneNode=getParent()->getPositionalComponent()->getSceneNode(); if(visible) { if(!mEntity->isAttached()) { pSceneNode->attachObject(mEntity); } } else { if(mEntity->isAttached() && mEntity->getParentSceneNode()->getName().compare(pSceneNode->getName())==0) { pSceneNode->detachObject(mEntity->getName()); } } } void RenderComponentWater::initFresnelReflection(CameraManagerPtr pCameraManager,GameWorldManagerPtr pGameWorldManager) { //mCameraManager=pCameraManager; //mGameWorldManager=pGameWorldManager; // // Check prerequisites first //const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities(); // if (!caps->hasCapability(RSC_VERTEX_PROGRAM) || !(caps->hasCapability(RSC_FRAGMENT_PROGRAM))) // { // OGRE_EXCEPT(1, "Your card does not support vertex and fragment programs, so cannot " // " run Once Upon a Night. Sorry!", // "Fresnel::createScene"); // } // else // { // if (!GpuProgramManager::getSingleton().isSyntaxSupported("arbfp1") && // !GpuProgramManager::getSingleton().isSyntaxSupported("ps_2_0") && // !GpuProgramManager::getSingleton().isSyntaxSupported("ps_1_4") // ) // { // OGRE_EXCEPT(1, "Your card does not support advanced fragment programs, " // "so cannot run Once Upon a Night. Sorry!", // "Fresnel::createScene"); // } // } // TexturePtr mTexture = TextureManager::getSingleton().createManual( "Refraction", // ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, // 512, 512, 0, PF_R8G8B8, TU_RENDERTARGET ); // //RenderTexture* rttTex = mRoot->getRenderSystem()->createRenderTexture( "Refraction", 512, 512 ); // RenderTarget *rttTex = mTexture->getBuffer()->getRenderTarget(); // { // Viewport *v = rttTex->addViewport( mCameraManager->getActiveCamera() ); // MaterialPtr mat = MaterialManager::getSingleton().getByName("Examples/FresnelReflectionRefraction"); // mat->getTechnique(0)->getPass(0)->getTextureUnitState(2)->setTextureName("Refraction"); // v->setOverlaysEnabled(false); // } // //mTexture = TextureManager::getSingleton().createManual( "Reflection", // ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, // 512, 512, 0, PF_R8G8B8, TU_RENDERTARGET ); // //rttTex = mRoot->getRenderSystem()->createRenderTexture( "Reflection", 512, 512 ); // rttTex = mTexture->getBuffer()->getRenderTarget(); // { // Viewport *v = rttTex->addViewport( mCameraManager->getActiveCamera() ); // MaterialPtr mat = MaterialManager::getSingleton().getByName("Examples/FresnelReflectionRefraction"); // mat->getTechnique(0)->getPass(0)->getTextureUnitState(1)->setTextureName("Reflection"); // v->setOverlaysEnabled(false); // } //mEntity->setMaterialName("Examples/FresnelReflectionRefraction"); // //mEntity->setVisible(false); // mReflectionPlane.normal = Vector3::UNIT_Y; //mReflectionPlane.d=0; // //MeshManager::getSingleton().createPlane("ReflectPlane", // // ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, // // mReflectionPlane, // // 700,1300,10,10,true,1,3,5,Vector3::UNIT_Z); // //pPlaneEnt = mSceneMgr->createEntity( "plane", "ReflectPlane" ); // //pPlaneEnt->setMaterialName("Examples/FresnelReflectionRefraction"); // //mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt); } void RenderComponentWater::update(double elapsedTime) { RenderComponent::update(elapsedTime); } void RenderComponentWater::postUpdate() { // //// Show plane and objects below the water // mEntity->setVisible(true); // //std::vector<Entity*>::iterator i, iend; // //iend = belowWaterEnts.end(); // //for (i = belowWaterEnts.begin(); i != iend; ++i) // //{ // // (*i)->setVisible(true); // //} //mGameWorldManager->getGameObjectOny()->getRenderComponentWater()->setVisible(true); // mCameraManager->getActiveCamera()->disableReflection(); } void RenderComponentWater::setMaterial(std::vector<std::string> & material) { Ogre::SubEntity* subEnt; Ogre::MaterialPtr original_material; unsigned int i; for ( i = 0; i < mEntity->getNumSubEntities(); i++) { // Get the material of this sub entity and build the clone material name subEnt = mEntity->getSubEntity(i); original_material = subEnt->getMaterial(); // Get/Create the clone material if (Ogre::MaterialManager::getSingleton().resourceExists(material[i])) { subEnt->setMaterial(Ogre::MaterialManager::getSingleton().getByName(material[i])); } else { Logger::getInstance()->log("[RenderComponentWater] material "+material[i]+" does not exist."); } } } void RenderComponentWater::setChangeWorldMaterials() { setMaterial(mChangeWorldMaterial); } void RenderComponentWater::setDreamsMaterials() { setMaterial(mDreamsMaterial); } void RenderComponentWater::setNightmaresMaterials() { setMaterial(mNightmaresMaterial); } void RenderComponentWater::setChangeWorldFactor(double factor) { Ogre::Technique * technique; Ogre::Pass * pass; Ogre::GpuProgramParametersSharedPtr params; unsigned int i; for ( i = 0; i < mChangeWorldMaterial.size(); i++) { Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName(mChangeWorldMaterial[i]); if(material.get()) { technique= material->getTechnique(0); if(technique) { if(technique->getNumPasses()>0) { pass=technique->getPass(0); if(pass->hasFragmentProgram()) { params=pass->getFragmentProgramParameters(); if(params.get()) { params->setNamedConstant("mix_factor",Ogre::Real(factor)); } } } } } } } TRenderComponentWaterParameters::TRenderComponentWaterParameters() : TRenderComponentParameters() { } TRenderComponentWaterParameters::~TRenderComponentWaterParameters() { }
[ "ithiliel@1610d384-d83c-11de-a027-019ae363d039", "wyern1@1610d384-d83c-11de-a027-019ae363d039" ]
[ [ [ 1, 2 ] ], [ [ 3, 249 ] ] ]
fd32c407af97da39729da22e3c23ffb0da9b6f3c
de98f880e307627d5ce93dcad1397bd4813751dd
/3libs/ut/include/PROGRESS.h
e6766d6f44a9935827170c3a97976f1584816901
[]
no_license
weimingtom/sls
7d44391bc0c6ae66f83ddcb6381db9ae97ee0dd8
d0d1de9c05ecf8bb6e4eda8a260c7a2f711615dd
refs/heads/master
2021-01-10T22:20:55.638757
2011-03-19T06:23:49
2011-03-19T06:23:49
44,464,621
2
0
null
null
null
null
WINDOWS-1252
C++
false
false
3,628
h
// ========================================================================== // Class Specification : COXDiffProgress // ========================================================================== // Header file : progress.h // Version: 9.3 // This software along with its related components, documentation and files ("The Libraries") // is © 1994-2007 The Code Project (1612916 Ontario Limited) and use of The Libraries is // governed by a software license agreement ("Agreement"). Copies of the Agreement are // available at The Code Project (www.codeproject.com), as part of the package you downloaded // to obtain this file, or directly from our office. For a copy of the license governing // this software, you may contact us at [email protected], or by calling 416-849-8900. // ////////////////////////////////////////////////////////////////////////// // Properties: // NO Abstract class (does not have any objects) // YES Derived from CObject // NO Is a Cwnd. // NO Two stage creation (constructor & Create()) // NO Has a message map // NO Needs a resource (template) // NO Persistent objects (saveable on disk) // NO Uses exceptions // ////////////////////////////////////////////////////////////////////////// // Desciption : // This class encapsulates a progress bar that will be used // when calculating the binary differences // You can derive from this class and use and own implementation // Remark: // *** // Prerequisites (necessary conditions): // *** ///////////////////////////////////////////////////////////////////////////// #ifndef __PROGRESS_H__ #define __PROGRESS_H__ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 #include "OXDllExt.h" class OX_CLASS_DECL COXDiffProgress : public CObject { DECLARE_DYNAMIC(COXDiffProgress) // Data members ------------------------------------------------------------- public: protected: LONG m_MinVal; LONG m_MaxVal; LONG m_CurPos; private: // Member functions --------------------------------------------------------- public: COXDiffProgress(); // --- In : // --- Out : // --- Returns : // --- Effect : Contructor of object virtual void Init(LONG minVal, LONG maxVal, LPCTSTR pszMessage); // --- In : minVal : Minimum value // maxVal : Maximum value // pszMessage : Message text to show // --- Out : // --- Returns : // --- Effect : Initializes the progress bar virtual BOOL Adjust(LONG curVal); // --- In : curVal : The new current value // representing the progress // --- Out : // --- Returns : Whether the action may continue (TRUE) // returning FALSE will abort the action in progress // --- Effect : Adjust the progress bar virtual void Abort(LPCTSTR pszMessage); // --- In : pszMessage : The abort message // --- Out : // --- Returns : // --- Effect : This function shows a message to the user and // aborts the program // This function should never return virtual void Close(); // --- In : // --- Out : // --- Returns : // --- Effect : Closes the progress bar #ifdef _DEBUG virtual void Dump(CDumpContext&) const; virtual void AssertValid() const; #endif //_DEBUG virtual ~COXDiffProgress(); // --- In : // --- Out : // --- Returns : // --- Effect : Destructor of object protected: private: }; #endif // __PROGRESS_H__ // ==========================================================================
[ [ [ 1, 124 ] ] ]
6cad23c848220880512ad7250b8c772bc56d2b44
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/mw/classicui/uifw/apps/S60_SDK3.0/bctestappfrm/src/bctestaknapplication.cpp
8ece5fe115a4e31f50a91ca315f889f38f261f3d
[]
no_license
SymbianSource/oss.FCL.sftools.ana.compatanamdw
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
1169475bbf82ebb763de36686d144336fcf9d93b
refs/heads/master
2020-12-24T12:29:44.646072
2010-11-11T14:03:20
2010-11-11T14:03:20
72,994,432
0
0
null
null
null
null
UTF-8
C++
false
false
4,475
cpp
/* * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ #include <aknserverapp.h> #include <aknapp.h> #include <eikenv.h> #include <eikappui.h> #include "bctestaknapplication.h" #include "bctestappfrm.hrh" #include "streamlogger.h" // ---------------------------------------------------------------------------- // ctor, do nothing. // ---------------------------------------------------------------------------- // CBCTestAknApplication::CBCTestAknApplication() { } // ---------------------------------------------------------------------------- // dtor, do nothing. // ---------------------------------------------------------------------------- // CBCTestAknApplication::~CBCTestAknApplication() { } // ---------------------------------------------------------------------------- // symbian 2nd phase ctor. // ---------------------------------------------------------------------------- // void CBCTestAknApplication::ConstructL() { BuildScriptL(); } // ---------------------------------------------------------------------------- // symbian NewL. // ---------------------------------------------------------------------------- // CBCTestAknApplication* CBCTestAknApplication::NewL() { CBCTestAknApplication* self = new ( ELeave ) CBCTestAknApplication(); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); return self; } // ---------------------------------------------------------------------------- // override the CBCTestCase::RunL, only response to the related command ID. // ---------------------------------------------------------------------------- // void CBCTestAknApplication::RunL(int aCmd) { if(aCmd != EBCTestCmdApplication) return; SetupL(); TestL(); TearDownL(); } // ---------------------------------------------------------------------------- // build the test scripts for this test case. // ---------------------------------------------------------------------------- // void CBCTestAknApplication::BuildScriptL() { const TInt scripts[] = { DELAY(1), // delay between commands is 1*0.1 seconds = 0.1 seconds LeftCBA, //REP(Down, n), LeftCBA }; AddTestScriptL(scripts, sizeof(scripts)/sizeof(TInt)); } void CBCTestAknApplication::TestIniFileL(CAknApplication* aApp, RFs& aFs) { // In fact OpenIniFileLC do nothing with clean up stack, but leave with // not supported error. aApp->OpenIniFileLC(aFs); } // ---------------------------------------------------------------------------- // test the volume setting page creation api. // ---------------------------------------------------------------------------- // void CBCTestAknApplication::TestL() { CAknApplication* app = static_cast<CAknApplication*>(CEikonEnv::Static()->EikAppUi()->Application()); //app->PreDocConstructL(); //TO DO: need a release, but dono //AssertTrueL(ETrue, _L("CAknApplication::PreDocConstructL() invoked.")); RFs& fs = CEikonEnv::Static()->FsSession(); TRAPD( err, TestIniFileL(app, fs)); if(err == KErrNotSupported){ AssertTrueL(ETrue, _L("CAknApplication::OpenIniFileLC () isn't supported in S60")); } CApaAppServer* server = NULL; app->NewAppServerL(server); CleanupStack::PushL(server); AssertNotNullL(server, _L("CAknApplication::NewAppServerL() invoked.")); CleanupStack::PopAndDestroy(server); //server } // ---------------------------------------------------------------------------- // prepare for the test. // ---------------------------------------------------------------------------- // void CBCTestAknApplication::SetupL() { } // ---------------------------------------------------------------------------- // do release jobs. // ---------------------------------------------------------------------------- // void CBCTestAknApplication::TearDownL() { } //end of file
[ "none@none" ]
[ [ [ 1, 138 ] ] ]
8c0672145dc106de8c3ffc12e97f905635b79a9f
ac559231a41a5833220a1319456073365f13d484
/src/old/server-jaus/jaus/core/transport/judp.h
798d6e2b6517b6d3660f2f2b49987863b642edcf
[]
no_license
mtboswell/mtboswell-auvc2
6521002ca12f9f7e1ec5df781ed03419129b8f56
02bb0dd47936967a7b9fa7d091398812f441c1dc
refs/heads/master
2020-04-01T23:02:15.282160
2011-07-17T16:48:34
2011-07-17T16:48:34
32,832,956
0
0
null
null
null
null
UTF-8
C++
false
false
8,108
h
//////////////////////////////////////////////////////////////////////////////////// /// /// \file judp.h /// \brief Contains the definition for the JUDP Transport Service for JAUS++. /// /// <br>Author(s): Daniel Barber /// <br>Created: 17 October 2009 /// <br>Copyright (c) 2009 /// <br>Applied Cognition and Training in Immersive Virtual Environments /// <br>(ACTIVE) Laboratory /// <br>Institute for Simulation and Training (IST) /// <br>University of Central Florida (UCF) /// <br>All rights reserved. /// <br>Email: [email protected] /// <br>Web: http://active.ist.ucf.edu /// /// 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 ACTIVE LAB, IST, UCF, 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 ACTIVE LAB''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 UCF 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. /// //////////////////////////////////////////////////////////////////////////////////// #ifndef __JAUS_CORE_TRANSPORT_UDP__H #define __JAUS_CORE_TRANSPORT_UDP__H #include "jaus/core/transport/transport.h" #include <cxutils/networking/udpclient.h> #include <cxutils/networking/udpsharedserver.h> namespace JAUS { //////////////////////////////////////////////////////////////////////////////////// /// /// \class JUDP /// \brief Transport is an interface class for sending/receiving UDP packets. /// This interface coforms to the SAE-JAUS AS5669 Standard. /// //////////////////////////////////////////////////////////////////////////////////// class JAUS_CORE_DLL JUDP : public Transport, public CxUtils::UdpSharedServer::Callback { public: const static unsigned short Port = 3794; ///< JAUS UDP/TCP Port Number == "jaus". const static unsigned int OverheadSizeBytes = 61;///< JUDP Overhead in bytes. const static Byte Version = 0x02; ///< JUDP Header Version. JUDP(); ~JUDP(); // Sets the delay time in ms for UDP polling loop. virtual void SetPacketPollingDelayMs(const unsigned int delayTimeMs = 0); // Load settings from a file. virtual bool LoadSettings(const std::string& filename); // Initializes the transport with a given ID for a component. virtual bool Initialize(const Address& componentID); // Returns true if transport has been initialized. virtual bool IsInitialized() const; // Shutsdown the transport service. virtual void Shutdown(); // Gets the list of connections available. virtual Address::List GetConnections() const; // Returns true if connection is present. virtual bool HaveConnection(const Address& id) const; // Send a serialized message. virtual bool SendPacket(const Packet& packet, const Header& header) const; // Serialize the JAUS message (add transport headers, serialize payload, etc.) virtual bool SerializeMessage(const Message* message, Packet::List& stream, Header::List& streamHeaders, const UShort startingSequenceNumber) const; // Get a copy of the transport header. virtual Packet GetTransportHeader() const { return mTransportHeader; } // Gets a list of all manually created connections. virtual Address::List GetManualConnections() const ; // Sets the maximum packet size. void SetMaxPacketSize(const unsigned int maxSizeBytes = 1500); // Sets how long to wait until a connection is considered invalid. void SetDisconnectTimeMs(const unsigned int timeMs); // Sets the default Time-to-Live (TTL) for multicast. void SetTTL(const unsigned char ttl = 16); // Sets the mutlicast group IP address. void SetMulticastIP(const CxUtils::IP4Address& multicastIP); // Use broadcast instead of multicast. void EnableBroadcasting(const bool enabled); // Gets the mutlicast group IP address. CxUtils::IP4Address GetMulticastIP() const { return mMulticastIP; } // Sets the host interface IP address to connect on. void SetInterfaceIP(const CxUtils::IP4Address& networkIP = CxUtils::IP4Address()); // Adds a connection to a specific IP address. bool AddConnection(const CxUtils::IP4Address& networkIP, const Address& jausID, const unsigned short port = Port); virtual bool CloseConnection(const Address& jausID); // Method to listen/discover broadcasting subsystem on the network. static bool ListenForSubsystems(Address::Set& discovered, const unsigned int waitTimeMs = 5000, const CxUtils::IP4Address& multicastIP = "239.255.0.1"); private: static void ReceiveThread(void* args); virtual void CheckServiceStatus(const unsigned int timeSinceLastCheckMs); virtual void ProcessUDP(const Packet& packet, const CxUtils::IP4Address& ipAddress, const unsigned short sourcePort); Time::Stamp mDisconnectTimeMs; ///< How long to wait in ms before a connection is closed. unsigned int mMaxPayloadSize; ///< Maximum payload size. unsigned char mTimeToLive; ///< Time to Live TTL for UDP. CxUtils::IP4Address mHostIP; ///< Host IP Address to use. CxUtils::IP4Address mMulticastIP; ///< IP Address for local multicast group. bool mUseBroadcastingFlag; ///< If true, broadcasting is enabled. Mutex mClientsMutex; ///< Mutex for thread protection of client data. Thread mRecvThread; ///< Thread for receiving UDP data. Thread mSecondaryThread; ///< Secondary thread for receiving UDP data. unsigned int mDelayTimeMs; ///< Polling delay time in ms. CxUtils::UdpClient mMulticast; ///< Local UDP Mutlicast Socket. std::map<Address, Time::Stamp> mUpdateTimes; ///< Times when data was received from a JAUS Component. std::map<Address, CxUtils::UdpClient*> mClients; ///< Unicast UDP Sockets to JAUS Components. std::map<Address, bool> mPermanentConnections; ///< Permanent connections added manually. Packet mTransportHeader; ///< JUDP Transport Header. }; } #endif /* End of File */
[ [ [ 1, 138 ] ] ]
d78404913f9bd1024eb0432c11207332bd069e61
0b55a33f4df7593378f58b60faff6bac01ec27f3
/Konstruct/Client/Dimensions/PlayerClass.cpp
4ce4cca972411b1746bcd2f53a33ea925558ede9
[]
no_license
RonOHara-GG/dimgame
8d149ffac1b1176432a3cae4643ba2d07011dd8e
bbde89435683244133dca9743d652dabb9edf1a4
refs/heads/master
2021-01-10T21:05:40.480392
2010-09-01T20:46:40
2010-09-01T20:46:40
32,113,739
1
0
null
null
null
null
UTF-8
C++
false
false
3,934
cpp
#include "StdAfx.h" #include "PlayerClass.h" #include "SpineCrank.h" Skill** PlayerClass::m_paBrawlerSkills = (Skill**)calloc(NUMBER_OF_BRAWLER_SKILLS, sizeof(Skill*)); Skill** PlayerClass::m_paSwordsmanSkills = (Skill**)calloc(NUMBER_OF_SWORDSMAN_SKILLS, sizeof(Skill*)); Skill** PlayerClass::m_paArcherSkills = (Skill**)calloc(NUMBER_OF_ARCHER_SKILLS, sizeof(Skill*)); Skill** PlayerClass::m_paMarksmanSkills = (Skill**)calloc(NUMBER_OF_MARKSMAN_SKILLS, sizeof(Skill*)); Skill** PlayerClass::m_paRocketeerSkills = (Skill**)calloc(NUMBER_OF_ROCKETEER_SKILLS, sizeof(Skill*)); Skill** PlayerClass::m_paMedicSkills = (Skill**)calloc(NUMBER_OF_MEDIC_SKILLS, sizeof(Skill*)); Skill** PlayerClass::m_paPriestSkills = (Skill**)calloc(NUMBER_OF_PRIEST_SKILLS, sizeof(Skill*)); Skill** PlayerClass::m_paOccultistSkills = (Skill**)calloc(NUMBER_OF_OCCULTIST_SKILLS, sizeof(Skill*)); PlayerClass::PlayerClass(ePlayerClass eClass, float fExpPercent) { switch(eClass) { case eCL_Brawler: { m_iNumSkills = NUMBER_OF_BRAWLER_SKILLS; m_paSkills = m_paBrawlerSkills; strcpy(m_szName, "Brawler"); break; } case eCL_Archer: { m_iNumSkills = NUMBER_OF_ARCHER_SKILLS; m_paSkills = m_paArcherSkills; strcpy(m_szName, "Archer"); break; } case eCL_Medic: { m_iNumSkills = NUMBER_OF_MEDIC_SKILLS; m_paSkills = m_paMedicSkills; strcpy(m_szName, "Medic"); break; } case eCL_Marksman: { m_iNumSkills = NUMBER_OF_MARKSMAN_SKILLS; m_paSkills = m_paMarksmanSkills; strcpy(m_szName, "Marksman"); break; } case eCL_Rocketeer: { m_iNumSkills = NUMBER_OF_ROCKETEER_SKILLS; m_paSkills = m_paRocketeerSkills; strcpy(m_szName, "Rocketeer"); break; } case eCL_Occultist: { m_iNumSkills = NUMBER_OF_OCCULTIST_SKILLS; m_paSkills = m_paOccultistSkills; strcpy(m_szName, "Occultist"); break; } case eCL_Priest: { m_iNumSkills = NUMBER_OF_PRIEST_SKILLS; m_paSkills = m_paPriestSkills; strcpy(m_szName, "Priest"); break; } case eCL_Swordsman: { m_iNumSkills = NUMBER_OF_SWORDSMAN_SKILLS; m_paSkills = m_paSwordsmanSkills; strcpy_s(m_szName, "Swordsman"); break; } } m_eClass = eClass; m_fExpSplit = fExpPercent; ClassInit(); //Skill we are testing /*Skill* pSkill = new SpineCrank(); m_paSkills[0] = pSkill; m_paSkills[1] = 0;*/ } PlayerClass::~PlayerClass(void) { } void PlayerClass::UpdateSkillTimers(float fDeltaTime) { for (int i = 0; i < m_iNumSkills; i++) { if(m_paSkills[i]) m_paSkills[i]->UpdateTimers(fDeltaTime); else break; } } void PlayerClass::ClassInit() { m_iLevel = 1; m_fCurrentExp = 0.0f; m_fNeededExp = 1000.0f; } bool PlayerClass::GainExp(int iExp) { m_fCurrentExp += iExp * m_fExpSplit; if(m_fCurrentExp >= m_fNeededExp) { m_fCurrentExp -= m_fNeededExp; LevelUp(); return true; } return false; } Skill* PlayerClass::GetSkill(int iIndex) { return m_paSkills[iIndex]; } Skill* PlayerClass::GetSkill(ePlayerClass ePlayerClass, int iIndex) { switch(ePlayerClass) { case eCL_Brawler: { return m_paBrawlerSkills[iIndex]; } case eCL_Archer: { return m_paArcherSkills[iIndex]; } case eCL_Medic: { return m_paMedicSkills[iIndex]; } case eCL_Marksman: { return m_paMarksmanSkills[iIndex]; } case eCL_Rocketeer: { return m_paRocketeerSkills[iIndex]; } case eCL_Occultist: { return m_paOccultistSkills[iIndex]; } case eCL_Priest: { return m_paPriestSkills[iIndex]; } case eCL_Swordsman: { return m_paSwordsmanSkills[iIndex]; } } return 0; } bool PlayerClass::LoadSkills() { return false; }
[ "bflassing@0c57dbdb-4d19-7b8c-568b-3fe73d88484e" ]
[ [ [ 1, 184 ] ] ]
41d8e68be130c521939a78798167798e717cb0d1
335783c9e5837a1b626073d1288b492f9f6b057f
/source/fbxcmd/daolib/Common/text.h
4133a47003c47d413d4c229a005eee38e8febbc1
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause" ]
permissive
code-google-com/fbx4eclipse
110766ee9760029d5017536847e9f3dc09e6ebd2
cc494db4261d7d636f8c4d0313db3953b781e295
refs/heads/master
2016-09-08T01:55:57.195874
2009-12-03T20:35:48
2009-12-03T20:35:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,252
h
#pragma once #include <stdarg.h> #include "utility.h" template <typename T> inline T AlignWord(T val) { T m = (val%4) ? 1 : 0; return (val/4 + m) * 4; } #pragma region Text struct TextHelper { static CHAR* _Copy(CHAR* dst, const CHAR* src, size_t len) { return strncpy(dst, src, len); } static WCHAR* _Copy(WCHAR* dst, const WCHAR* src, size_t len) { return wcsncpy(dst, src, len); } static CHAR* _Copy(CHAR* dst, const WCHAR* src, size_t len) { size_t slen = wcslen(src) + 1; len = min(slen, len); wcstombs(dst, src, len); return dst; } static WCHAR* _Copy(WCHAR* dst, const CHAR* src, size_t len) { size_t slen = strlen(src) + 1; len = min(slen, len); mbstowcs(dst, src, len); return dst; } static size_t _Size(const CHAR* src) { return src ? strlen(src) : 0; } static size_t _Size(const WCHAR* src) { return src ? wcslen(src) : 0; } static CHAR* _Concat(CHAR* dst, const CHAR* src, size_t len) { CHAR *p = strncpy(dst+_Size(dst), src, len); p[len] = 0; return p; } static WCHAR* _Concat(WCHAR* dst, const WCHAR* src, size_t len) { WCHAR *p = wcsncpy(dst+_Size(dst), src, len);p[len] = 0; return p; } static CHAR* _Concat(CHAR* dst, const WCHAR* src, size_t len) { size_t slen = wcslen(src) + 1; len = min(slen, len); CHAR* p = dst+_Size(dst); wcstombs(p, src, len); p[len] = 0; return dst; } static WCHAR* _Concat(WCHAR* dst, const CHAR* src, size_t len) { size_t slen = strlen(src) + 1; len = min(slen, len); WCHAR *p = dst+_Size(dst); mbstowcs(p, src, len); p[len] = 0; return dst; } static int _Compare(const CHAR* src, const CHAR *dst, bool ignoreCase = false) { return ignoreCase ? stricmp(src, dst) : strcmp(src, dst); } static int _Compare(const WCHAR* src, const WCHAR *dst, bool ignoreCase = false) { return ignoreCase ? wcsicmp(src, dst) : wcscmp(src, dst); } }; #pragma endregion #pragma region Text ///////////////////////////////////// // Text template<class T> class TextBase : TextHelper { private: public: TextBase() : s(0), n(0) { } TextBase(const CHAR *string) : s(0), n(0) { assign(string); } TextBase(const CHAR *string, int len) : s(0), n(0) { assign(string, len); } TextBase(const WCHAR *string) : s(0), n(0) { assign(string); } TextBase(const WCHAR *string, int len) : s(0), n(0) { assign(string, len); } TextBase( const TextBase& other ) : s(0), n(0) { assign(other.s); } TextBase & operator=( const TextBase& other ) { assign(other.s); return *this; } TextBase & operator=( const CHAR * string ) { assign( string ); return *this; } TextBase & operator=( const WCHAR * string ) { assign( string ); return *this; } void assign( const CHAR * string ) { size_t len = string ? strlen(string) + 1 : 0; assign(string, len); } void assign( const WCHAR * string ) { size_t len = string ? wcslen(string) + 1: 0; assign(string, len); } void assign( const CHAR * string, size_t len ) { if (len == 0) { clear(); } else { reserve(len); _Copy(s, string, len); } } void assign( const WCHAR * string, size_t len ) { if (len == 0) { clear(); } else { reserve(len); _Copy(s, string, len); } } void append( const CHAR * string ) { size_t slen = (string ? strlen(string) + 1 : 0); size_t len = slen + size(); if (len == 0) { clear(); } else if (slen != 0) { reserve(len); _Concat(s, string, slen); } } void append( const WCHAR * string ) { size_t slen = (string ? wcslen(string) + 1 : 0); size_t len = slen + size(); if (len == 0) { clear(); } else if (slen != 0) { reserve(len); _Concat(s, string, slen); } } void append( CHAR c ) { size_t len = 1 + size(); if (len == 0) { clear(); } else { reserve(len); T *p = s + len - 1; *p++ = c; *p = 0; } } void append( WCHAR c ) { size_t len = 1 + size(); if (len == 0) { clear(); } else { reserve(len); T *p = s + len - 1; *p++ = c; *p = 0; } } void append( const CHAR * string, size_t len ) { size_t slen = min(len, (string ? strlen(string) + 1 : 0)); size_t vlen = slen + size(); if (vlen == 0) { clear(); } else if (slen != 0) { reserve(vlen); _Concat(s, string, slen); } } void append( const WCHAR * string, size_t len ) { size_t slen = min(len, (string ? wcslen(string) + 1 : 0)); size_t vlen = slen + size(); if (vlen == 0) { clear(); } else if (slen != 0) { reserve(vlen); _Concat(s, string, slen); } } void reserve( size_t len ) { if (len >= n) { T *olds = s; size_t oldn = n; size_t a = AlignWord(oldn * 3 / 2), b = AlignWord(len+1); n = max(a, b); s = (T*)calloc(n, sizeof(T)); if (olds) { _Copy(s, olds, oldn); free(olds); } } } void Format(const CHAR *format, ...) { if (s) *s = 0; va_list args; va_start(args, format); AppendFormatV(format, args); va_end(args); } void Format(const WCHAR *format, ...) { if (s) *s = 0; va_list args; va_start(args, format); AppendFormatV(format, args); va_end(args); } void AppendFormat(const CHAR *format, ...) { va_list args; va_start(args, format); AppendFormatV(format, args); va_end(args); } void AppendFormat(const WCHAR *format, ...) { va_list args; va_start(args, format); AppendFormatV(format, args); va_end(args); } void AppendFormatV(const CHAR *format, va_list args) { CHAR buffer[512]; int nChars = _vsnprintf(buffer, _countof(buffer), format, args); if (nChars != -1) { append(buffer, nChars); } else { size_t Size = _vscprintf(format, args); size_t Len = Length(); Resize(Len + Size); #ifdef _UNICODE CHAR *buf = (CHAR *)_alloca((Size+1)*sizeof(CHAR)); nChars = _vsnprintf(buf, Size+1, format, args); mbstowcs(data()+Len, buf, Size+1); #else nChars = _vsnprintf(data()+Len, capacity(), format, args); #endif } } void AppendFormatV(const WCHAR *format, va_list args) { WCHAR buffer[512]; int nChars = _vsnwprintf(buffer, _countof(buffer), format, args); if (nChars != -1) { append(buffer, nChars); } else { size_t Size = _vsctprintf(format, args); size_t Len = Length(); Resize(Len + Size); #ifdef _UNICODE nChars = _vsnwprintf(data()+Len, capacity(), format, args); #else WCHAR *buf = (WCHAR *)_alloca((Size+1)*sizeof(WCHAR)); nChars = _vsnwprintf(buf, Size+1, format, args); wcstombs(data()+Len, buf, Size+1); #endif } } void Resize( size_t len ) { reserve(len); } void remove( size_t off, size_t len = 1 ) { if ( !isNull() ) { size_t n = Length(); if ( off < n ) { size_t l = min(len, n-off); if (l > 0) { memmove(s+off, s+off+l, sizeof(T) * (n-off-l+1)); } } } } void clear() { free(s); s = NULL; n = 0; } TextBase Substr(size_t off, size_t len) { if (isNull()) return TextBase(); size_t l = Length(); if ( off < l ) return TextBase(); l = min(len, l-off); return TextBase(s+off, l); } void swap(TextBase& other) { size_t on = other.n; other.n = n; n = on; T *os = other.s; other.s = s; s = os; } size_t size() const { return _Size(s); } size_t Length() const { return size(); } size_t capacity() const { return n; } bool isNull() const { return (n == 0) || (s == NULL) || (s[0] == 0); } operator LPTSTR() { return s; } operator LPCTSTR() const { return s; } T* data() { return s; } const T *c_str() const { return s; } TextBase& operator+=( CHAR c ) { append(c); return *this; } TextBase& operator+=( LPCSTR s ) { append(s); return *this; } TextBase& operator+=( WCHAR c ) { append(c); return *this; } TextBase& operator+=( LPCWSTR s ) { append(s); return *this; } TextBase& operator+=( const TextBase& t ) { append(t); return *this; } T& operator[](int idx) { return s[idx]; } T operator[](int idx) const { return s[idx]; } void toUpper() { for (size_t i=0; i<n; ++i) s[i] = toupper(s[i]); } void toLower() { for (size_t i=0; i<n; ++i) s[i] = tolower(s[i]); } void toMixed() { bool nextUpper = true; for (size_t i=0; i<n; ++i) { T val = s[i]; if (isalpha(val)) { if (nextUpper) { s[i] = toupper(s[i]); nextUpper = false; } else { s[i] = tolower(s[i]); } } else { nextUpper = true; } } } void removeChar(T value) { for (size_t i=0; i<n; ) { if (s[i] == value) { remove(i); } else { ++i; } } } void Trim() { while(!isNull() && _istspace(s[0])) remove(0, 1); int len = Length()-1; while (len >= 0 && _istspace(s[len])) remove(len--, 1); } int Compare(const T* value, bool ignoreCase = false) const { return _Compare(s, value, ignoreCase); } private: T *s; size_t n; }; #pragma endregion typedef TextBase<TCHAR> Text; typedef TextBase<CHAR> CText; typedef TextBase<WCHAR> WText; #ifdef _UTILITY_ _STD_BEGIN template <> inline void swap<CText>(CText& lhs, CText& rhs) { lhs.swap(rhs); } template <> inline void swap<WText>(WText& lhs, WText& rhs) { lhs.swap(rhs); } _STD_END #endif #pragma region FixedString ///////////////////////////////////// // FixedString template<class T, size_t size, int padding='\0'> class FixedString : TextHelper { public: FixedString() { memset(v_, padding, size*sizeof(T)); v_[size] = 0; } FixedString(const T *string) { assign(string); } FixedString( const FixedString& other ) { memcpy(v_, other.v_, (size+1)*sizeof(T)); } FixedString & operator=( const FixedString& other ) { memcpy(v_, other.v_, (size+1)*sizeof(T)); return *this; } FixedString & operator=( const T * string ) { assign( string ); return *this; } void assign( const char * string ) { size_t len = string ? strlen(string) : 0; // assert(len <= size); len = min(len, size); _Copy(v_, string, len); memset(v_+len, padding, (size-len)*sizeof(T)); v_[size] = 0; } void assign( const wchar_t * string ) { size_t len = string ? wcslen(string) : 0; // assert(len <= size); len = min(len, size); _Copy(v_, string, len); memset(v_+len, padding, (size-len)*sizeof(T)); v_[size] = 0; } void clear() { memset(v_, padding, size*sizeof(T)); v_[size] = 0; } operator T*() { return v_; } operator const T*() const { return v_; } T* data() { return v_; } const T *c_str() const { return v_; } size_t max_size() const { return size; } int Compare(const T* value, bool ignoreCase = false) const { return _Compare(v_, value, ignoreCase); } private: T v_[size+1]; //! Very important that this is only data for this class. }; #if 0 template<size_t fixedsize, int padding> inline bool operator==( FixedString<fixedsize, padding>& lhs, const TCHAR *rhs) { return (_tcsncmp(lhs.data(), rhs, fixedsize) == 0) ? true : false; } template<size_t fixedsize, int padding> inline bool operator==( const TCHAR *lhs, FixedString<fixedsize, padding>& rhs) { return (_tcsncmp(lhs, rhs.data(), fixedsize) == 0) ? true : false; } template<size_t fixedsize, int padding> inline bool operator==( FixedString<fixedsize, padding>& lhs, FixedString<fixedsize, padding>& rhs) { return (_tcsncmp(lhs.data(), rhs.data(), fixedsize) == 0) ? true : false; } template<size_t fixedsize, int padding> inline bool operator!=( FixedString<fixedsize, padding>& lhs, const TCHAR *rhs) { return (_tcsncmp(lhs.data(), rhs, fixedsize) == 0) ? false : true ; } template<size_t fixedsize, int padding> inline bool operator!=( const TCHAR *lhs, FixedString<fixedsize, padding>& rhs) { return (_tcsncmp(lhs, rhs.data(), fixedsize) == 0) ? false : true; } template<size_t fixedsize, int padding> inline bool operator!=( FixedString<fixedsize, padding>& lhs, FixedString<fixedsize, padding>& rhs) { return (_tcsncmp(lhs.data(), rhs.data(), fixedsize) == 0) ? false : true; } #endif #pragma endregion #pragma region Helpers // sprintf for Text without having to worry about buffer size. extern Text FormatText(const TCHAR* format,...); extern Text& Trim(Text&p); // Enumeration support typedef struct EnumLookupType { int value; const TCHAR *name; } EnumLookupType; extern Text EnumToString(int value, const EnumLookupType *table); extern int StringToEnum(Text value, const EnumLookupType *table); extern Text FlagsToString(int value, const EnumLookupType *table); extern int StringToFlags(Text value, const EnumLookupType *table); typedef std::basic_string<TCHAR, std::char_traits<TCHAR>, std::allocator<TCHAR> > _tstring; // sprintf for std::string without having to worry about buffer size. extern std::string FormatStringA(const CHAR* format,...); extern std::wstring FormatStringW(const WCHAR* format,...); extern _tstring FormatString(const char* format,...); extern _tstring FormatString(const WCHAR* format,...); #pragma endregion
[ "tazpn314@ccf8930c-dfc1-11de-9043-17b7bd24f792" ]
[ [ [ 1, 556 ] ] ]
043b5339aaba58020f38da85d231b58a72c405fd
3eae8bea68fd2eb7965cca5afca717b86700adb5
/Engine/Project/Core/GnSystem/Source/GnDebugAllocator.cpp
5b610095aecbefd69c5b931cf66f31fe0bb92689
[]
no_license
mujige77/WebGame
c0a218ee7d23609076859e634e10e29c92bb595b
73d36f9d8bfbeaa944c851e8a1cfa5408ce1d3dd
refs/heads/master
2021-01-01T15:51:20.045414
2011-10-03T01:02:59
2011-10-03T01:02:59
455,950
3
1
null
null
null
null
UTF-8
C++
false
false
3,758
cpp
#include "GnSystemPCH.h" #include "GnDebugAllocator.h" #ifdef GN_MEMORY_DEBUGGER GnDebugAllocator::GnDebugAllocator(GnAllocator* actualAllocator, bool writeToLog, gtuint initialSize, gtuint growBy, bool alwaysValidateAll,bool checkArrayOverruns) : mActualAlloctor(actualAllocator) { } GnDebugAllocator::~GnDebugAllocator(void) { GnExternalDelete mActualAlloctor; } void* GnDebugAllocator::Allocate(gsize& sizeInBytes, gsize& alignment, GnMemoryEventType eventType, bool provideAccurateSizeOnDeallocate, const gchar* pcFile, int iLine, const gchar* allocateFunction) { //gsize stSizeOriginal = sizeInBytes; //float fTime = GnGetCurrentTimeInSec(); //if( mCheckArrayOverruns ) //{ // sizeInBytes = PadForArrayOverrun(alignment, sizeInBytes); //} //fTime = GnGetCurrentTimeInSec() - fTime; void* memory = mActualAlloctor->Allocate(sizeInBytes, alignment, eventType, provideAccurateSizeOnDeallocate, pcFile, iLine, allocateFunction); //#if WIN32 GnAllocUnit unit; unit.mpMeomry = memory; unit.mAllocSize = sizeInBytes; GnStrcpy( unit.maFileName, pcFile, sizeof( unit.maFileName ) ); unit.mFileLine = iLine; GnStrcpy( unit.maFunctionName, allocateFunction, sizeof( unit.maFunctionName ) ); mpAllocList.insert(std::make_pair(memory, unit)); //#endif // return memory; } void GnDebugAllocator::Deallocate(void* pvMemory, GnMemoryEventType eEventType, gsize stSizeInBytes) { //#if WIN32 mpAllocList.erase(pvMemory); //#endif // mActualAlloctor->Deallocate(pvMemory, eEventType, stSizeInBytes); } void* GnDebugAllocator::Reallocate(void* pvMemory, gsize& stSizeInBytes, gsize& stAlignment, GnMemoryEventType eEventType, bool bProvideAccurateSizeOnDeallocate, gsize stSizeCurrent, const gchar* pcFile, int iLine, const gchar* pcFunction) { return mActualAlloctor->Reallocate(pvMemory, stSizeInBytes, stAlignment, eEventType, bProvideAccurateSizeOnDeallocate, stSizeCurrent, pcFile, iLine, pcFunction); } bool GnDebugAllocator::TrackAllocate(const void* const pvMemory, gsize stSizeInBytes, GnMemoryEventType eEventType, const gchar* pcFile, int iLine, const gchar* pcFunction) { return true; } bool GnDebugAllocator::TrackDeallocate(const void* const pvMemory, GnMemoryEventType eEventType) { return true; } bool GnDebugAllocator::SetMarker(const char* pcMarkerType, const char* pcClassifier, const char* pcString) { return true; } void GnDebugAllocator::Initialize() { } void GnDebugAllocator::Shutdown() { //#ifdef WIN32 std::map<void*, GnAllocUnit>::iterator iter = mpAllocList.begin(); while(iter != mpAllocList.end()) { GnAllocUnit item = iter->second; GnLogA( "Memory Leak %d : Size = %d, %s %s %d\n" , item.mpMeomry, item.mAllocSize, item.maFileName, item.maFunctionName, item.mFileLine ); ++iter; } //#endif // WIN32 } bool GnDebugAllocator::VerifyAddress(const void* pvMemory) { return false; } gsize GnDebugAllocator::PadForArrayOverrun(gsize stAlignment, gsize stSizeOriginal) { return stSizeOriginal + 2 * stAlignment; } void GnDebugAllocator::AllocateAssert(const gchar* allocateFunction, gsize ID, gsize size) { //// If you hit this NIMEMASSERT, you requested a breakpoint on a specific //// function name. //GnAssert(strcmp(ms_pcBreakOnFunctionName, pcFunction) != 0); //// If you hit this NIMEMASSERT, you requested a breakpoint on a specific //// allocation ID. //GnAssert(ms_stBreakOnAllocID != m_stCurrentAllocID); //// If you hit this NIMEMASSERT, you requested a breakpoint on a specific //// allocation request size. //GnAssert(ms_stBreakOnSizeRequested != stSizeOriginal); } #endif // #ifdef GN_MEMORY_DEBUGGER
[ [ [ 1, 126 ] ] ]
4edb57fe0b61d4680b74f29d8288f056030298b8
c1a2953285f2a6ac7d903059b7ea6480a7e2228e
/deitel/ch13/Fig13_06/BasePlusCommissionEmployee.h
8758d6b0c4885903261c25c9b147373bcfb6f093
[]
no_license
tecmilenio/computacion2
728ac47299c1a4066b6140cebc9668bf1121053a
a1387e0f7f11c767574fcba608d94e5d61b7f36c
refs/heads/master
2016-09-06T19:17:29.842053
2008-09-28T04:27:56
2008-09-28T04:27:56
50,540
4
3
null
null
null
null
UTF-8
C++
false
false
1,937
h
// Fig. 13.3: BasePlusCommissionEmployee.h // BasePlusCommissionEmployee class derived from class // CommissionEmployee. #ifndef BASEPLUS_H #define BASEPLUS_H #include <string> // C++ standard string class using std::string; #include "CommissionEmployee.h" // CommissionEmployee class declaration class BasePlusCommissionEmployee : public CommissionEmployee { public: BasePlusCommissionEmployee( const string &, const string &, const string &, double = 0.0, double = 0.0, double = 0.0 ); void setBaseSalary( double ); // set base salary double getBaseSalary() const; // return base salary double earnings() const; // calculate earnings void print() const; // print BasePlusCommissionEmployee object private: double baseSalary; // base salary }; // end class BasePlusCommissionEmployee #endif /************************************************************************** * (C) Copyright 1992-2008 by Deitel & Associates, Inc. and * * Pearson Education, Inc. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * **************************************************************************/
[ [ [ 1, 43 ] ] ]
6bfcd07f94f9fba690da4aadc18b46dbdea1586f
f2d877d3cd6d3cf57b212930801df4fe97226702
/Sintatico.h
084373cb11605c04f1059d0d6b48da2dd55c6994
[]
no_license
lucasjcastro/uelcompmepa-renato
39eacf1841d0d25a92803a2c6e2139bf02f79f61
6cbd4b501e4ec4b511e4fb8dff497f70a00344c1
refs/heads/master
2021-01-10T07:37:40.275497
2007-07-14T00:16:52
2007-07-14T00:16:52
46,513,265
0
0
null
null
null
null
UTF-8
C++
false
false
1,238
h
#ifndef Sintatico_h_ #define Sintatico_h_ #include "Atomo.h" #include "TabelaHash.h" #include "ArvoreDerivacao.h" #include "NoHash_ParForm.h" #include <queue> #include <list> #include <string> class Sintatico{ public: Sintatico(atomo *); ~Sintatico(); void anasin(); private: atomo a; std::queue<atomo> fila; TabelaHash hash; ArvoreDerivacao arvore; void gera_fila(atomo *); bool programa(); bool bloco(); bool bloco_var(); bool bloco_procedure(); bool bloco_function(); bool bloco_begin(); bool tipo(char *); bool param_formais(list<NoHash_ParForm*> &); bool comando(); bool comando_id(); bool comando_atrib(); bool comando_begin(); bool comando_if(); bool comando_while(); bool comando_read(); bool comando_write(); bool expressao(); bool expressao_simples(); bool fator(); bool termo(); bool erro(char *); }; #endif
[ "renatoes@2e6dfe6f-b034-0410-ba66-8ba39d4a960b" ]
[ [ [ 1, 45 ] ] ]
4b1a1d2ddac87bc6a7f0bc7a77fc57e1bc392299
1e01b697191a910a872e95ddfce27a91cebc57dd
/GrfQuantifyExecution.h
e2065250c44f300b8825f76333f3b3dfd63c1131
[]
no_license
canercandan/codeworker
7c9871076af481e98be42bf487a9ec1256040d08
a68851958b1beef3d40114fd1ceb655f587c49ad
refs/heads/master
2020-05-31T22:53:56.492569
2011-01-29T19:12:59
2011-01-29T19:12:59
1,306,254
7
5
null
null
null
null
IBM852
C++
false
false
3,733
h
/* "CodeWorker": a scripting language for parsing and generating text. Copyright (C) 1996-1997, 1999-2002 CÚdric Lemaire This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA To contact the author: [email protected] */ #ifndef _GrfQuantifyExecution_h_ #define _GrfQuantifyExecution_h_ #pragma warning (disable : 4786) #include <string> #include <list> #include <map> #include "GrfExecutionContext.h" namespace CodeWorker { class BNFClauseCall; class DtaQuantifyFunction { public: std::string _sName; const char* _sFile; int _iLocation; unsigned int _iCounter; long _iTimeInMillis; public: bool operator < (const DtaQuantifyFunction& function) const; bool operator > (const DtaQuantifyFunction& function) const; bool operator ==(const DtaQuantifyFunction& function) const; bool operator !=(const DtaQuantifyFunction& function) const; }; class GrfQuantifyExecution : public GrfExecutionContext { private: std::map<std::string, int> _listOfPredefinedFunctions; std::map<std::string, std::map<std::string, DtaQuantifyFunction> > _listOfUserFunctions; std::map<std::string, std::map<int, int> > _coveredLines; ExprScriptExpression* _pFilename; unsigned int _iCoveredCode; unsigned int _iTotalCode; public: GrfQuantifyExecution(GrfBlock* pParent) : GrfExecutionContext(pParent), _pFilename(NULL) {} virtual ~GrfQuantifyExecution(); inline void setFilename(ExprScriptExpression* pFilename) { _pFilename = pFilename; } virtual void handleBeforeExecutionCBK(GrfCommand* pCommand, DtaScriptVariable& /*visibility*/); virtual void handleAfterExecutionCBK(GrfCommand* /*pCommand*/, DtaScriptVariable& /*visibility*/); virtual void handleAfterExceptionCBK(GrfCommand* /*pCommand*/, DtaScriptVariable& /*visibility*/, UtlException& /*exception*/); virtual void handleStartingFunction(GrfFunction* pFunction); virtual void handleEndingFunction(GrfFunction* pFunction); virtual void handleStartingBNFClause(BNFClauseCall* pBNFClause); virtual void handleEndingBNFClause(BNFClauseCall* pBNFClause); virtual void handleBeforeScriptExecutionCBK(GrfCommand* /*pCommand*/, DtaScriptVariable& /*visibility*/); virtual void handleAfterScriptExecutionCBK(GrfCommand* pCommand, DtaScriptVariable& /*visibility*/); protected: virtual SEQUENCE_INTERRUPTION_LIST openSession(DtaScriptVariable& visibility); private: static GrfQuantifyExecution* getCurrentQuantify() { return (GrfQuantifyExecution*) GrfCommand::getCurrentExecutionContext(); } static void recoverData(GrfCommand* pCommand); void registerCode(GrfCommand* pCommand); void registerUserFunction(GrfFunction* pFunction); void registerPredefinedFunction(GrfCommand* pCommand); void displayResults(DtaScriptVariable& visibility); void generateHTMLFile(const char* sFilename, DtaScriptVariable& visibility); inline unsigned int getCoveredCode() const { return _iCoveredCode; } inline unsigned int getTotalCode() const { return _iTotalCode; } }; } #endif
[ "cedric.p.r.lemaire@28b3f5f3-d42e-7560-b87f-5f53cf622bc4" ]
[ [ [ 1, 95 ] ] ]
16ffa93bf6a00efcbebf54a2a0db2a84dc45ee45
fac8de123987842827a68da1b580f1361926ab67
/inc/physics/Physics/Dynamics/World/Listener/hkpWorldPostSimulationListener.h
67d09e2e4436153021177e75446c9621d40e5883
[]
no_license
blockspacer/transporter-game
23496e1651b3c19f6727712a5652f8e49c45c076
083ae2ee48fcab2c7d8a68670a71be4d09954428
refs/heads/master
2021-05-31T04:06:07.101459
2009-02-19T20:59:59
2009-02-19T20:59:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,861
h
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent.This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2008 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ #ifndef HK_DYNAMICS2_WORLD_POST_SIMULATION_LISTENER_H #define HK_DYNAMICS2_WORLD_POST_SIMULATION_LISTENER_H class hkpWorld; class hkpEntity; class hkStepInfo; /// Derive from this class to receive callbacks after all entities have been simulated class hkpWorldPostSimulationListener { public: virtual ~hkpWorldPostSimulationListener() {} /// Called at the end of the hkpWorld::simulate call. virtual void postSimulationCallback( hkpWorld* world ) = 0; /// Called when an inactive/fixed entity is moved in the hkpWorld. virtual void inactiveEntityMovedCallback( hkpEntity* entity ) {} }; #endif // HK_DYNAMICS2_WORLD_POST_SIMULATION_LISTENER_H /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20080529) * * Confidential Information of Havok. (C) Copyright 1999-2008 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at * www.havok.com/tryhavok * */
[ "uraymeiviar@bb790a93-564d-0410-8b31-212e73dc95e4" ]
[ [ [ 1, 48 ] ] ]
f3b7dcf185fda2442bc9db1214165d970ed44a7d
7dd2dbb15df45024e4c3f555da6d9ca6fc2c4d8b
/vacp/utilities.h
b318cca3bdb49106a3bdad58d17c8caf3a54b337
[]
no_license
wangscript/maelstrom-editor
c9f761e1f9e5f4e64d7e37834a7a63e04f57ae31
5bfab31bf444f44b9f8209f4deaed8715c305426
refs/heads/master
2021-01-10T01:37:00.619456
2011-11-21T23:17:08
2011-11-21T23:17:08
50,160,495
0
0
null
null
null
null
UTF-8
C++
false
false
319
h
#ifndef UTILITIES_H #define UTILITIES_H class Utilities { public: static quint32 calc_str_hash(const char *str) { quint32 hash = 5381; quint32 c; while ((c = *str++)) hash = ((hash << 5) + hash) + c; return hash; } }; #endif // UTILITIES_H
[ [ [ 1, 19 ] ] ]
301eb4401899d54e15656aa8e6534d3c87520e87
4f02bfedbe7b9f6104c2090e64a8b479c28f27b8
/source/sprite.h
7e9024a3600955b3f0934367ca836991994df943
[]
no_license
sanzaru/benny-the-game
172972fe8b3bce38790975c1f1312cebb8fa9437
555dac8078ee0983af5cb045c3ce2327231a414b
refs/heads/master
2021-01-01T05:47:07.616266
2010-04-20T20:53:00
2010-04-20T20:53:00
37,158,009
0
0
null
null
null
null
UTF-8
C++
false
false
1,921
h
/******************************************************************************************** Benny - The game Author: Martin Albrecht <[email protected]> Date: Something like 2004/2005... maybe? ;) Website: http://code.javacofee.de DEPENDENCIES: ------------- - SDL library with SDL_TTF, SDL_MIXER, SDL_TIMER and SDL_IMAGE see http://www.libsdl.org/ for more information. LICENSE: -------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ********************************************************************************************/ #ifndef __SPRITE_H__ #define __SPRITE_H__ #include "general.h" /* Class for sprite */ class Sprite{ public: SDL_Surface *sprImg; int Health; Sprite(SDL_Surface *new_image, int x, int y); void SetImage(SDL_Surface *new_image); void SetPos(int x, int y); void Move(int move_x, int move_y); SDL_Rect *GetRect(void); void Draw(SDL_Surface *target); SDL_Surface* GetImage(); protected: SDL_Rect rect; SDL_Surface *image; }; /* Function prototypes */ int spr_collision(Sprite *S1, Sprite *S2); #endif
[ "iWuerstchen@6ac12481-4ef6-6f72-47ac-43285762d7e7" ]
[ [ [ 1, 56 ] ] ]
d1aae591ec8752afd64c546789ae573bb81e6674
f4d39655394aebbb524146cc7a61f93505289ce7
/pollard/crack.h
c0e1decd37906cfc7380ea4b0353ecca81477c9f
[]
no_license
pjacosta/ECDLP-Pollard
b9ded826e7f9d07791a6b8a5e4b8e7bd6259266a
d0a4ebf0dc241cf0fc108a639c4c4e52b89ffba9
refs/heads/master
2023-03-19T14:59:15.270344
2010-04-20T23:39:07
2010-04-20T23:39:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,413
h
#ifndef _CRACK_H #define _CRACK_H #include "../ecc/epoint.h" #include "../ecc/bint.h" /* Need some classes */ class ecurve; class epoint; class bint; typedef struct { bint p; // factor itself bint sol; // part of Pollig-Hellman algorithm - solution of ECDLP for this prime-power subgroup int k; // factors power } pofactor; namespace crackRoutines { void op_err(int err); bint chinese_remainder_theorem(const pofactor *factors, int n, const bint &N); pofactor *calculate_point_order_factorization(const epoint &point, int &factor_count); } class crack { public: /* Constructors */ crack(const ecurve &curve); crack(const ecurve &curve, const epoint &G, const epoint &xG); /* Setter methods */ void set_G(const epoint &G); void set_xG(const epoint &xG); /* Accessor methods */ const epoint &get_G(void); const epoint &get_xG(void); /* Helper methods */ bool is_running(void); /* Control methods */ bool solve(bint &result, bool verbose, char *offset, double &work_time); /* Solution methods */ static bool pollard(const epoint &P, const epoint &Q, const bint &order, bint &result, int &iterations, double &work_time); static bool bruteforce(const epoint &P, const epoint &Q, const bint &order, bint &result, int &iterations, double &work_time); private: bool running; const ecurve *curve; epoint G, xG; }; #endif
[ "grizenko.a@211633f8-0eb2-11df-8d37-15e3504968c6" ]
[ [ [ 1, 58 ] ] ]
c4650d8e98cd1f6fa3cec299280511cbdea4538a
b14d5833a79518a40d302e5eb40ed5da193cf1b2
/cpp/extern/xercesc++/2.6.0/src/xercesc/util/IOException.hpp
532b7b423ccde6d7d6d3fcbb3e35ef7015ffdbb0
[ "Apache-2.0" ]
permissive
andyburke/bitflood
dcb3fb62dad7fa5e20cf9f1d58aaa94be30e82bf
fca6c0b635d07da4e6c7fbfa032921c827a981d6
refs/heads/master
2016-09-10T02:14:35.564530
2011-11-17T09:51:49
2011-11-17T09:51:49
2,794,411
1
0
null
null
null
null
UTF-8
C++
false
false
982
hpp
/* * Copyright 1999-2000,2004 The Apache Software Foundation. * * 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. */ /* * $Id: IOException.hpp,v 1.3 2004/09/08 13:56:22 peiyongz Exp $ */ #if !defined(IOEXCEPTION_HPP) #define IOEXCEPTION_HPP #include <xercesc/util/XercesDefs.hpp> #include <xercesc/util/XMLException.hpp> XERCES_CPP_NAMESPACE_BEGIN MakeXMLException(IOException, XMLUTIL_EXPORT) XERCES_CPP_NAMESPACE_END #endif
[ [ [ 1, 34 ] ] ]
2230245bce5fc3e5ec74c4c9e975f0bea191144d
fb8a3d68c676c977b9b6d3389debd785c2f25634
/Input/Include/Devices/Keyboard.hpp
1b927fd0d480c4edd612966a01b2959bdbfd2f52
[]
no_license
skevy/CSC-350-Assignment2
ef1a1e5fae8c9b9ab4ca2b97390974751ad1dedb
98811d2cbbc221af9cc9aa601a990e7969920f7e
refs/heads/master
2021-01-01T20:35:26.246966
2011-02-17T01:57:03
2011-02-17T01:57:03
1,376,632
0
0
null
null
null
null
UTF-8
C++
false
false
11,590
hpp
//***************************************************************************// // Keyboard Class Interface // // Created Sept 13, 2006 // By: Jeremy M Miller // // Copyright (c) 2006 Jeremy M Miller. All rights reserved. // This source code module, and all information, data, and algorithms // associated with it, are part of Habu technology (tm). // PROPRIETARY AND CONFIDENTIAL //***************************************************************************// #ifndef HABU_INPUT_KEYBOARD_HPP #define HABU_INPUT_KEYBOARD_HPP //***************************************************************************// #include "HabuInput.hpp" #include "Devices\Device.hpp" //***************************************************************************// //***************************************************************************// // This enum simply maskes that we are using DirectInput keys enum HabuInputKey { HIK_ESCAPE = DIK_ESCAPE, HIK_1 = DIK_1, HIK_2 = DIK_2, HIK_3 = DIK_3, HIK_4 = DIK_4, HIK_5 = DIK_5, HIK_6 = DIK_6, HIK_7 = DIK_7, HIK_8 = DIK_8, HIK_9 = DIK_9, HIK_0 = DIK_0, HIK_MINUS = DIK_MINUS, /* - on main keyboard */ HIK_EQUALS = DIK_EQUALS, HIK_BACK = DIK_BACK, /* backspace */ HIK_TAB = DIK_TAB, HIK_Q = DIK_Q, HIK_W = DIK_W, HIK_E = DIK_E, HIK_R = DIK_R, HIK_T = DIK_T, HIK_Y = DIK_Y, HIK_U = DIK_U, HIK_I = DIK_I, HIK_O = DIK_O, HIK_P = DIK_P, HIK_LBRACKET = DIK_LBRACKET, HIK_RBRACKET = DIK_RBRACKET, HIK_RETURN = DIK_RETURN, /* Enter on main keyboard */ HIK_LCONTROL = DIK_LCONTROL, HIK_A = DIK_A, HIK_S = DIK_S, HIK_D = DIK_D, HIK_F = DIK_F, HIK_G = DIK_G, HIK_H = DIK_H, HIK_J = DIK_J, HIK_K = DIK_K, HIK_L = DIK_L, HIK_SEMICOLON = DIK_SEMICOLON, HIK_APOSTROPHE = DIK_APOSTROPHE, HIK_GRAVE = DIK_GRAVE, /* accent grave */ HIK_LSHIFT = DIK_LSHIFT, HIK_BACKSLASH = DIK_BACKSLASH, HIK_Z = DIK_Z, HIK_X = DIK_X, HIK_C = DIK_C, HIK_V = DIK_V, HIK_B = DIK_B, HIK_N = DIK_N, HIK_M = DIK_M, HIK_COMMA = DIK_COMMA, HIK_PERIOD = DIK_PERIOD, /* . on main keyboard */ HIK_SLASH = DIK_SLASH, /* / on main keyboard */ HIK_RSHIFT = DIK_RSHIFT, HIK_MULTIPLY = DIK_MULTIPLY, /* * on numeric keypad */ HIK_LMENU = DIK_LMENU, /* left Alt */ HIK_SPACE = DIK_SPACE, HIK_CAPITAL = DIK_CAPITAL, HIK_F1 = DIK_F1, HIK_F2 = DIK_F2, HIK_F3 = DIK_F3, HIK_F4 = DIK_F4, HIK_F5 = DIK_F5, HIK_F6 = DIK_F6, HIK_F7 = DIK_F7, HIK_F8 = DIK_F8, HIK_F9 = DIK_F9, HIK_F10 = DIK_F10, HIK_NUMLOCK = DIK_NUMLOCK, HIK_SCROLL = DIK_SCROLL, /* Scroll Lock */ HIK_NUMPAD7 = DIK_NUMPAD7, HIK_NUMPAD8 = DIK_NUMPAD8, HIK_NUMPAD9 = DIK_NUMPAD9, HIK_SUBTRACT = DIK_SUBTRACT, /* - on numeric keypad */ HIK_NUMPAD4 = DIK_NUMPAD4, HIK_NUMPAD5 = DIK_NUMPAD5, HIK_NUMPAD6 = DIK_NUMPAD6, HIK_ADD = DIK_ADD, /* + on numeric keypad */ HIK_NUMPAD1 = DIK_NUMPAD1, HIK_NUMPAD2 = DIK_NUMPAD2, HIK_NUMPAD3 = DIK_NUMPAD3, HIK_NUMPAD0 = DIK_NUMPAD0, HIK_DECIMAL = DIK_DECIMAL, /* . on numeric keypad */ HIK_OEM_102 = DIK_OEM_102, /* <> or \| on RT 102-key keyboard (Non-U.S.) */ HIK_F11 = DIK_F11, HIK_F12 = DIK_F12, HIK_F13 = DIK_F13, /* (NEC PC98) */ HIK_F14 = DIK_F14, /* (NEC PC98) */ HIK_F15 = DIK_F15, /* (NEC PC98) */ HIK_KANA = DIK_KANA, /* (Japanese keyboard) */ HIK_ABNT_C1 = DIK_ABNT_C1, /* /? on Brazilian keyboard */ HIK_CONVERT = DIK_CONVERT, /* (Japanese keyboard) */ HIK_NOCONVERT = DIK_NOCONVERT, /* (Japanese keyboard) */ HIK_YEN = DIK_YEN, /* (Japanese keyboard) */ HIK_ABNT_C2 = DIK_ABNT_C2, /* Numpad . on Brazilian keyboard */ HIK_NUMPADEQUALS = DIK_NUMPADEQUALS, /* = on numeric keypad (NEC PC98) */ HIK_PREVTRACK = DIK_PREVTRACK, /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ HIK_AT = DIK_AT, /* (NEC PC98) */ HIK_COLON = DIK_COLON, /* (NEC PC98) */ HIK_UNDERLINE = DIK_UNDERLINE, /* (NEC PC98) */ HIK_KANJI = DIK_KANJI, /* (Japanese keyboard) */ HIK_STOP = DIK_STOP, /* (NEC PC98) */ HIK_AX = DIK_AX, /* (Japan AX) */ HIK_UNLABELED = DIK_UNLABELED, /* (J3100) */ HIK_NEXTTRACK = DIK_NEXTTRACK, /* Next Track */ HIK_NUMPADENTER = DIK_NUMPADENTER, /* Enter on numeric keypad */ HIK_RCONTROL = DIK_RCONTROL, HIK_MUTE = DIK_MUTE, /* Mute */ HIK_CALCULATOR = DIK_CALCULATOR, /* Calculator */ HIK_PLAYPAUSE = DIK_PLAYPAUSE, /* Play / Pause */ HIK_MEDIASTOP = DIK_MEDIASTOP, /* Media Stop */ HIK_VOLUMEDOWN = DIK_VOLUMEDOWN, /* Volume - */ HIK_VOLUMEUP = DIK_VOLUMEUP, /* Volume + */ HIK_WEBHOME = DIK_WEBHOME, /* Web home */ HIK_NUMPADCOMMA = DIK_NUMPADCOMMA, /* , on numeric keypad (NEC PC98) */ HIK_DIVIDE = DIK_DIVIDE, /* / on numeric keypad */ HIK_SYSRQ = DIK_SYSRQ, HIK_RMENU = DIK_RMENU, /* right Alt */ HIK_PAUSE = DIK_PAUSE, /* Pause */ HIK_HOME = DIK_HOME, /* Home on arrow keypad */ HIK_UP = DIK_UP, /* UpArrow on arrow keypad */ HIK_PRIOR = DIK_PRIOR, /* PgUp on arrow keypad */ HIK_LEFT = DIK_LEFT, /* LeftArrow on arrow keypad */ HIK_RIGHT = DIK_RIGHT, /* RightArrow on arrow keypad */ HIK_END = DIK_END, /* End on arrow keypad */ HIK_DOWN = DIK_DOWN, /* DownArrow on arrow keypad */ HIK_NEXT = DIK_NEXT, /* PgDn on arrow keypad */ HIK_INSERT = DIK_INSERT, /* Insert on arrow keypad */ HIK_DELETE = DIK_DELETE, /* Delete on arrow keypad */ HIK_LWIN = DIK_LWIN, /* Left Windows key */ HIK_RWIN = DIK_RWIN, /* Right Windows key */ HIK_APPS = DIK_APPS, /* AppMenu key */ HIK_POWER = DIK_POWER, /* System Power */ HIK_SLEEP = DIK_SLEEP, /* System Sleep */ HIK_WAKE = DIK_WAKE, /* System Wake */ HIK_WEBSEARCH = DIK_WEBSEARCH, /* Web Search */ HIK_WEBFAVORITES = DIK_WEBFAVORITES, /* Web Favorites */ HIK_WEBREFRESH = DIK_WEBREFRESH, /* Web Refresh */ HIK_WEBSTOP = DIK_WEBSTOP, /* Web Stop */ HIK_WEBFORWARD = DIK_WEBFORWARD, /* Web Forward */ HIK_WEBBACK = DIK_WEBBACK, /* Web Back */ HIK_MYCOMPUTER = DIK_MYCOMPUTER, /* My Computer */ HIK_MAIL = DIK_MAIL, /* Mail */ HIK_MEDIASELECT = DIK_MEDIASELECT, /* Media Select */ }; // End of enum HabuInputKey //***************************************************************************// //***************************************************************************// namespace HabuTech { //*************************************************************************// // This class reads the state of keys on the machines keyboard class Keyboard : public Device { private: //***********************************************************************// //-----------------------------------------------------------------------// // This member is the pointer to DirectInput's keybaord interface device IDirectInputDevice8* mpKeyBoard; // This member array holds the state of the keys for the last time this // classes Poll method was called char mcaKeyBoardState[256]; //-----------------------------------------------------------------------// //***********************************************************************// public: //***********************************************************************// //-----------------------------------------------------------------------// // Constructor Keyboard(); // Desturctor // Note this destructor is not virtual. Do not derive from this class. ~Keyboard(); //-----------------------------------------------------------------------// //-----------------------------------------------------------------------// // The below method uses a pointer from a the directinput interface to // create and initialze communication with the keyboard using directinput. // This method also sets cooperation level for the window. This method // is required by the Device base class. // Parameter 1: An establised pointer to a directinput interface. // Parameter 2: A valid window handle so we know when the windows is infocus // and therefore know if we should capture the state of the device. // Return Value: If the method was unable to setup directinput for the mouse // this method will return false. Otherwise it will return true. // We assume that we can always use the mouse windows calls. bool Initialize(IDirectInput8* pDirectInput, HWND hMainWindow); // The below method will uninitialize and release the keyboard from directinput. // This method is required by the Device base class. // Return Value: This method will return true if the release and uninitialization // was sucessful. Otherwise it will return false. bool Uninitialize(); //-----------------------------------------------------------------------// //-----------------------------------------------------------------------// // This method will return true if the a specified key was held down when // the keyboard was last polled. // Parameter 1: The key the method will check. // Return Value: The methid will return true if the key specifed in parameter // 1 is pressed. Otherwise it will return false. bool KeyDown(enum HabuInputKey eKey) const { return ((this->mcaKeyBoardState[eKey] & 0x80) != 0); } //-----------------------------------------------------------------------// //-----------------------------------------------------------------------// // This is method is required to poll the mouse and should be called once per // program loop. This method is required by the Device base class. void Poll(); //-----------------------------------------------------------------------// }; // End of class Keyboard : public Device //*************************************************************************// } // End of namespace HabuTech //***************************************************************************// #endif HABU_INPUT_KEYBOARD_HPP
[ [ [ 1, 240 ] ] ]
65bc168b436811ed71dd62e7e1b63a2f08c61936
8b4f7e8e746b8592a2289337a2013d7cf7d04c44
/ControlPoint.cpp
3ff760530dbabde0bc01b4b9a6f644c602d3b0ba
[]
no_license
seansu4you87/osclaser
8f0aac69dc9d803f097df34a9938fbabe25fde14
dcd3bcb898db4957209c9c04115b2375aea7ab35
refs/heads/master
2021-01-01T16:55:14.318564
2010-02-18T03:52:17
2010-02-18T03:52:17
32,344,063
0
0
null
null
null
null
UTF-8
C++
false
false
357
cpp
//ControlPoint.cpp #include "stdafx.h" #include "ControlPoint.h" ControlPoint::ControlPoint(float x, float y) { this->setCoords(x, y); pt.z = 0; pt.f = 0; } void ControlPoint::setColor(float r, float g, float b) { pt.r = r; pt.g = g; pt.b = b; } void ControlPoint::setCoords(float x, float y) { pt.x = x; pt.y = 1.0 - y; }
[ "codeb87@ba1854fa-1114-11df-8588-0bb593d8ec56" ]
[ [ [ 1, 24 ] ] ]
be15b9437e22ab86e5318c79828a301641e0127e
b505ef7eb1a6c58ebcb73267eaa1bad60efb1cb2
/source/storage/fileio/filereadmemory.h
1771c360f6543517a3e7e9994f680f24b8aec4d4
[]
no_license
roxygen/maid2
230319e05d6d6e2f345eda4c4d9d430fae574422
455b6b57c4e08f3678948827d074385dbc6c3f58
refs/heads/master
2021-01-23T17:19:44.876818
2010-07-02T02:43:45
2010-07-02T02:43:45
38,671,921
0
0
null
null
null
null
UTF-8
C++
false
false
1,079
h
/*! @file @brief メモリ上においてあるデータをファイルとして扱うクラス */ #ifndef maid2_storage_fileio_filereadmemory_h #define maid2_storage_fileio_filereadmemory_h #include"../../config/define.h" #include"../../config/typedef.h" #include"ifileread.h" #include<boost/smart_ptr.hpp> namespace Maid { class FileReadMemory : public IFileRead { public: FileReadMemory( const boost::shared_array<unt08>& pBegin, size_t Size ); FileReadMemory( const void* pBegin, size_t Size ); virtual ~FileReadMemory(); virtual OPENRESULT Open(); virtual void Close(); virtual bool IsOpen() const; virtual size_t Read ( void* pData, size_t Size ); virtual size_t GetSize() const; virtual size_t GetPosition()const; virtual void Seek( IFileRead::POSITION Pos, int Size); private: boost::shared_array<unt08> m_pShared; const size_t m_Size; const unt08* m_pBegin; size_t m_Position; bool m_IsOpen; }; } #endif
[ [ [ 1, 47 ] ] ]
333b7d8014bf0b462b073be9a96eb9b0107df5b4
5e755d27b668f647bb29218987a03c9eaa6a6d0b
/CADBiS_winservice/BillingService/BalloonMess.h
1f4fa1e12c8a1d230b82e1990c63567a775323f2
[]
no_license
xtps1987225/cadbis
0672ae5b00fd04fa7ce0722190110ab1466a04ac
ffd2f41d87df438d6276b748129dca4dc49d2055
refs/heads/master
2021-01-20T02:17:18.865466
2008-07-23T09:32:21
2008-07-23T09:32:21
33,819,572
0
0
null
null
null
null
UTF-8
C++
false
false
998
h
#pragma once #include "resource.h" #include "stdafx.h" // CBalloonMess dialog struct CSettings { COLORREF m_transcolor; size_t m_transcoeff; COLORREF m_textcolor; COLORREF m_bordercolor; COLORREF m_fillcolor; size_t m_delay; size_t m_showdelay; size_t m_enddelay; std::string m_caption; std::string m_subcapt; }; class CBalloonMess : public CDialog { DECLARE_DYNAMIC(CBalloonMess) public: CBalloonMess(CWnd* pParent = NULL); // standard constructor virtual ~CBalloonMess(); // Dialog Data enum { IDD = IDD_BALLOONMESS }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support DECLARE_MESSAGE_MAP() public: CString m_strMessage; INT_PTR DoModal(CString str); public: afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); public: afx_msg void OnBnClickedBexit(); private: CSettings m_set; afx_msg void OnTimer(UINT_PTR nIDEvent); void LoadSettings(std::string FileName = "lanservice.ini"); };
[ "smecsia@254517df-764a-0410-b743-7361b4a10c92" ]
[ [ [ 1, 48 ] ] ]
0f8d8b12f8857a8992d440b6802c81667999a597
8103a6a032f7b3ec42bbf7a4ad1423e220e769e0
/Prominence/World.cpp
bc51360e87716fe1f56e4a91ffab1758430874f0
[]
no_license
wgoddard/2d-opengl-engine
0400bb36c2852ce4f5619f8b5526ba612fda780c
765b422277a309b3d4356df2e58ee8db30d91914
refs/heads/master
2016-08-08T14:28:07.909649
2010-06-17T19:13:12
2010-06-17T19:13:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,307
cpp
#include "World.h" namespace Prominence { World::World(ResourceManager & resourceManager, Logger & logger, Renderer & renderer) : m_Logger(logger), m_Renderer(renderer), m_ResourceManager(resourceManager) { m_LevelIndex = 0; m_WorldFile = ""; m_CurrentLevel = new Level(m_ResourceManager, m_Renderer); } World::~World(void) { delete m_CurrentLevel; } void World::NextLevel() { Level * nextLevel = new Level(m_ResourceManager, m_Renderer); m_Renderer.ClearStaticFrames(); if (nextLevel->LoadXML(m_Logger, m_WorldFile, m_LevelIndex + 1) ) { delete m_CurrentLevel; m_CurrentLevel = nextLevel; m_Logger.Outputf(P_INFO, WORLD, "Successfully advanced levels.\n"); } else { m_Logger.Outputf(P_WARNING, WORLD, "Failed to advance levels.\n"); delete nextLevel; } } void World::Update(Uint32 dt) { m_CurrentLevel->Update(dt); } void World::Render() { m_CurrentLevel->Render(); } //Quad World::GetBody() //{ // Quad q = {0}; // b2Vec2 pos = body->GetPosition(); // // q.z = 0.5f; // q.v[0].x = pos.x; q.v[0].y = pos.y; // q.v[1].x = pos.x + 50; q.v[1].y = pos.y; // q.v[2].x = pos.x + 50; q.v[2].y = pos.y + 50; // q.v[3].x = pos.x; q.v[3].y = pos.y + 50; // // return q; //} b2Body * World::CreateBody(b2PolygonDef * polyDef, float x, float y) { return m_CurrentLevel->CreateBody(polyDef, x, y); } Entity * World::CreateEntity(Sprite * sprite, float x, float y) { //b2Body * body = CreateBody(sprite->GetPolyDef(), x, y); Entity * e = new Entity(*sprite, x, y); m_CurrentLevel->AddEntity(e); return e; } AnimatedEntity * World::CreateAnimatedEntity(AnimatedSprite * sprite, float x, float y) { AnimatedEntity * e = new AnimatedEntity(*sprite, x, y); m_CurrentLevel->AddEntity(e); return e; } Actor * World::CreateActor(AnimatedSprite * sprite, float x, float y) { b2Body * body = m_CurrentLevel->CreateBody(sprite->GetPolyDef(), x, y); Actor * e = new Actor(*sprite, *body); m_CurrentLevel->AddEntity(e); return e; } IsoActor * World::CreateIsoActor(AnimatedSprite * sprite, float x, float y) { b2Body * body = m_CurrentLevel->CreateBody(sprite->GetPolyDef(), x, y); IsoActor * e = new IsoActor(*sprite, *body); m_CurrentLevel->AddEntity(e); return e; } PlayerCharacter * World::CreatePlayerCharacter(AnimatedSprite * sprite, float x, float y, InputDevice * d, Class cclass)//, CharacterClass &cclass) { b2Body * body = m_CurrentLevel->CreateBody(sprite->GetPolyDef(), x, y); //InputDevice * d = new KeyboardA(); PlayerCharacter *pc = NULL; switch (cclass) { case Rocktard: pc = new RockTard(*sprite, *body, *d);//, cclass); break; case Voodoo: pc = new PlayerCharacter(*sprite, *body, *d);//, cclass); break; }; m_CurrentLevel->AddEntity(pc); return pc; //return new PlayerCharacter(*sprite, *body, *d); } Monster * World::CreateMonster(AnimatedSprite * sprite, float x, float y) { b2Body * body = m_CurrentLevel->CreateBody(sprite->GetPolyDef(), x, y); //InputDevice * d = new KeyboardA(); Monster * m = new Monster(*sprite, *body);//, cclass); m_CurrentLevel->AddEntity(m); return m; } }
[ "William@18b72257-4ce5-c346-ae33-905a28f88ba6" ]
[ [ [ 1, 129 ] ] ]
6333cde722f01c520704f63776f25c145deb4f05
619941b532c6d2987c0f4e92b73549c6c945c7e5
/Source/Nuclex/Support/String.cpp
7a559e3e997cc8e8491f923b9941e15af858f7de
[]
no_license
dzw/stellarengine
2b70ddefc2827be4f44ec6082201c955788a8a16
2a0a7db2e43c7c3519e79afa56db247f9708bc26
refs/heads/master
2016-09-01T21:12:36.888921
2008-12-12T12:40:37
2008-12-12T12:40:37
36,939,169
0
0
null
null
null
null
UTF-8
C++
false
false
13,593
cpp
//  // // # # ### # # -= Nuclex Library =-  // // ## # # # ## ## String.cpp - Nuclex string class  // // ### # # ###  // // # ### # ### Nuclex string class, extends std::string with a  // // # ## # # ## ## few additional methods  // // # # ### # # R1 (C)2002-2004 Markus Ewald -> License.txt  // //  // #include "Nuclex/Support/String.h" #include "Nuclex/Support/Exception.h" #include "Nuclex/Storage/Stream.h" #include <vector> #include <locale> using namespace Nuclex; using namespace Nuclex::Support; using namespace std; namespace { // The CRC32 table const unsigned_32 CRC32Table[256] = { 0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005, 0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, 0x2B4BCB61, 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD, 0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9, 0x5F15ADAC, 0x5BD4B01B, 0x569796C2, 0x52568B75, 0x6A1936C8, 0x6ED82B7F, 0x639B0DA6, 0x675A1011, 0x791D4014, 0x7DDC5DA3, 0x709F7B7A, 0x745E66CD, 0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039, 0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5, 0xBE2B5B58, 0xBAEA46EF, 0xB7A96036, 0xB3687D81, 0xAD2F2D84, 0xA9EE3033, 0xA4AD16EA, 0xA06C0B5D, 0xD4326D90, 0xD0F37027, 0xDDB056FE, 0xD9714B49, 0xC7361B4C, 0xC3F706FB, 0xCEB42022, 0xCA753D95, 0xF23A8028, 0xF6FB9D9F, 0xFBB8BB46, 0xFF79A6F1, 0xE13EF6F4, 0xE5FFEB43, 0xE8BCCD9A, 0xEC7DD02D, 0x34867077, 0x30476DC0, 0x3D044B19, 0x39C556AE, 0x278206AB, 0x23431B1C, 0x2E003DC5, 0x2AC12072, 0x128E9DCF, 0x164F8078, 0x1B0CA6A1, 0x1FCDBB16, 0x018AEB13, 0x054BF6A4, 0x0808D07D, 0x0CC9CDCA, 0x7897AB07, 0x7C56B6B0, 0x71159069, 0x75D48DDE, 0x6B93DDDB, 0x6F52C06C, 0x6211E6B5, 0x66D0FB02, 0x5E9F46BF, 0x5A5E5B08, 0x571D7DD1, 0x53DC6066, 0x4D9B3063, 0x495A2DD4, 0x44190B0D, 0x40D816BA, 0xACA5C697, 0xA864DB20, 0xA527FDF9, 0xA1E6E04E, 0xBFA1B04B, 0xBB60ADFC, 0xB6238B25, 0xB2E29692, 0x8AAD2B2F, 0x8E6C3698, 0x832F1041, 0x87EE0DF6, 0x99A95DF3, 0x9D684044, 0x902B669D, 0x94EA7B2A, 0xE0B41DE7, 0xE4750050, 0xE9362689, 0xEDF73B3E, 0xF3B06B3B, 0xF771768C, 0xFA325055, 0xFEF34DE2, 0xC6BCF05F, 0xC27DEDE8, 0xCF3ECB31, 0xCBFFD686, 0xD5B88683, 0xD1799B34, 0xDC3ABDED, 0xD8FBA05A, 0x690CE0EE, 0x6DCDFD59, 0x608EDB80, 0x644FC637, 0x7A089632, 0x7EC98B85, 0x738AAD5C, 0x774BB0EB, 0x4F040D56, 0x4BC510E1, 0x46863638, 0x42472B8F, 0x5C007B8A, 0x58C1663D, 0x558240E4, 0x51435D53, 0x251D3B9E, 0x21DC2629, 0x2C9F00F0, 0x285E1D47, 0x36194D42, 0x32D850F5, 0x3F9B762C, 0x3B5A6B9B, 0x0315D626, 0x07D4CB91, 0x0A97ED48, 0x0E56F0FF, 0x1011A0FA, 0x14D0BD4D, 0x19939B94, 0x1D528623, 0xF12F560E, 0xF5EE4BB9, 0xF8AD6D60, 0xFC6C70D7, 0xE22B20D2, 0xE6EA3D65, 0xEBA91BBC, 0xEF68060B, 0xD727BBB6, 0xD3E6A601, 0xDEA580D8, 0xDA649D6F, 0xC423CD6A, 0xC0E2D0DD, 0xCDA1F604, 0xC960EBB3, 0xBD3E8D7E, 0xB9FF90C9, 0xB4BCB610, 0xB07DABA7, 0xAE3AFBA2, 0xAAFBE615, 0xA7B8C0CC, 0xA379DD7B, 0x9B3660C6, 0x9FF77D71, 0x92B45BA8, 0x9675461F, 0x8832161A, 0x8CF30BAD, 0x81B02D74, 0x857130C3, 0x5D8A9099, 0x594B8D2E, 0x5408ABF7, 0x50C9B640, 0x4E8EE645, 0x4A4FFBF2, 0x470CDD2B, 0x43CDC09C, 0x7B827D21, 0x7F436096, 0x7200464F, 0x76C15BF8, 0x68860BFD, 0x6C47164A, 0x61043093, 0x65C52D24, 0x119B4BE9, 0x155A565E, 0x18197087, 0x1CD86D30, 0x029F3D35, 0x065E2082, 0x0B1D065B, 0x0FDC1BEC, 0x3793A651, 0x3352BBE6, 0x3E119D3F, 0x3AD08088, 0x2497D08D, 0x2056CD3A, 0x2D15EBE3, 0x29D4F654, 0xC5A92679, 0xC1683BCE, 0xCC2B1D17, 0xC8EA00A0, 0xD6AD50A5, 0xD26C4D12, 0xDF2F6BCB, 0xDBEE767C, 0xE3A1CBC1, 0xE760D676, 0xEA23F0AF, 0xEEE2ED18, 0xF0A5BD1D, 0xF464A0AA, 0xF9278673, 0xFDE69BC4, 0x89B8FD09, 0x8D79E0BE, 0x803AC667, 0x84FBDBD0, 0x9ABC8BD5, 0x9E7D9662, 0x933EB0BB, 0x97FFAD0C, 0xAFB010B1, 0xAB710D06, 0xA6322BDF, 0xA2F33668, 0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4 }; // ####################################################################### // // # Nuclex::checkWildcardMatch() # // // ####################################################################### // /// Ascii wildcard match function /** Compares a string to a wildcard @param pszString String to compare to the wildcard @param pszWildcard Wildcard specification to compare with @return True if the string matches the wildcard specification */ inline bool checkWildcardMatch(const char *pszString, const char *pszWildcard) { if(!pszString) return false; for(; '*' ^ *pszWildcard; ++pszWildcard, ++pszString) { if(!*pszString) return (!*pszWildcard); if(::toupper(*pszString) ^ ::toupper(*pszWildcard) && '?' ^ *pszWildcard) return false; } while('*' == pszWildcard[1]) pszWildcard++; do { if(checkWildcardMatch(pszString, pszWildcard + 1)) return true; } while(*pszString++); return false; } // ####################################################################### // // # Nuclex::checkWildcardMatch() # // // ####################################################################### // /// Unicode wildcard match function /** Compares a string to a wildcard @param pszString String to compare to the wildcard @param pszWildcard Wildcard specification to compare with @return True if the string matches the wildcard specification */ inline bool checkWildcardMatch(const wchar_t *pszString, const wchar_t *pszWildcard) { if(!pszString) return false; for(; L'*' ^ *pszWildcard; ++pszWildcard, ++pszString) { if(!*pszString) return (!*pszWildcard); if(::toupper(*pszString) ^ ::toupper(*pszWildcard) && L'?' ^ *pszWildcard) return false; } while(L'*' == pszWildcard[1]) pszWildcard++; do { if(checkWildcardMatch(pszString, pszWildcard + 1)) return true; } while(*pszString++); return false; } } // ####################################################################### // // # Nuclex::Support::unicodeFromAscii() # // // ####################################################################### // /** Performs a string conversion from ascii to unicode @param sAscii Ascii string to be converted to unicode @return An unicode string which is equivalent to the ascii string */ wstring Nuclex::Support::unicodeFromAscii(const std::string &sAscii) { std::vector<wchar_t> Unicode(sAscii.length()); const char *pszNext; wchar_t *pwszNext; mbstate_t state; int res = use_facet<codecvt<wchar_t, char, mbstate_t> >(locale("C")).in( state, sAscii.c_str(), &sAscii.c_str()[sAscii.length()], pszNext, &Unicode[0], &Unicode[0] + sAscii.length(), pwszNext ); if(res == codecvt_base::error) throw UnexpectedException("Nuclex::Support::unicodeFromAscii()", "Conversion failed"); return std::wstring(&Unicode[0], pwszNext - &Unicode[0]); } // ####################################################################### // // # Nuclex::Support::asciiFromUnicode() # // // ####################################################################### // /** Performs a string conversion from unicode to ascii @param sUnicode Unicode string to be converted to ascii @return An ascii string which is equivalent to the unicode string */ string Nuclex::Support::asciiFromUnicode(const std::wstring &sUnicode) { std::vector<char> Ascii(sUnicode.length()); char *pszNext; const wchar_t *pwszNext; mbstate_t state; int res = use_facet<codecvt<wchar_t, char, mbstate_t> >(locale("C")).out( state, sUnicode.c_str(), &sUnicode.c_str()[sUnicode.length()], pwszNext, &Ascii[0], &Ascii[0] + sUnicode.length(), pszNext ); if(res == codecvt_base::error) throw UnexpectedException("Nuclex::Support::asciiFromUnicode()", "Conversion failed"); return std::string(&Ascii[0], pszNext - &Ascii[0]); } // ####################################################################### // // # Nuclex::Support::wildcardMatch() # // // ####################################################################### // bool wildcardMatch(const string &sString, const string &sWildcard) { return checkWildcardMatch(sString.c_str(), sWildcard.c_str()); } // ####################################################################### // // # Nuclex::Support::wildcardMatch() # // // ####################################################################### // bool wildcardMatch(const wstring &sString, const wstring &sWildcard) { return checkWildcardMatch(sString.c_str(), sWildcard.c_str()); } // ####################################################################### // // # Nuclex::Support::stringFromStream() # // // ####################################################################### // /** Reads the entire contents of a stream into a string @param spStream Stream to be read @return A string containing the entire stream contents */ string Nuclex::Support::stringFromStream(const shared_ptr<Storage::Stream> &spStream) { std::vector<char> Chars(spStream->getSize()); spStream->seekTo(0); spStream->readData(&Chars[0], spStream->getSize()); return string(&Chars[0], spStream->getSize()); } // ####################################################################### // // # Nuclex::Support::getCRC32() # // // ####################################################################### // /** Calculates a simple hashing value from the string @return CRC32 of the string */ unsigned_32 getCRC32(const void *pData, size_t Length) { const unsigned_8 *pcData = reinterpret_cast<const unsigned_8 *>(pData); unsigned_32 nAccum = 0; for(size_t nJ = 0; nJ < Length; nJ++) { unsigned_32 nI = (nAccum >> 24) ^ pcData[nJ] & 0xFF; nAccum = (nAccum << 8) ^ CRC32Table[nI]; } return nAccum; } #if 0 // ####################################################################### // // # Nuclex::Support::stringFromLong() # // // ####################################################################### // /** Converts an integer into a string @param nValue Integer value to convert @param nBase Numeric base for the conversion @return The string representation of the integer */ string Nuclex::Support::stringFromLong(long nValue, size_t nBase) { char pszValue[64]; ::itoa(nValue, pszValue, nBase); return pszValue; // Implicitely constructs a string } // ####################################################################### // // # Nuclex::Support::stringFromFloat() # // // ####################################################################### // /** Converts a float into a string @param fValue Float value to convert @param nDecimals Number of decimal places to return @return The string representation of the double */ string Nuclex::Support::stringFromFloat(float fValue, size_t nDecimals) { return stringFromDouble(fValue, nDecimals); } // ####################################################################### // // # Nuclex::Support::stringFromDouble() # // // ####################################################################### // /** Converts a double into a string @param dValue Double value to convert @param nDecimals Number of decimal places to return @return The string representation of the double */ string Nuclex::Support::stringFromDouble(double dValue, size_t nDecimals) { int nDec, nSign; string sTemp = _fcvt(dValue, nDecimals, &nDec, &nSign); if(nDec <= 0) { sTemp = string(1 - nDec, '0') + sTemp; nDec = 1; } if(nDecimals > 0) return (nSign ? string("-") : string()) + (sTemp.substr(0, nDec) + "." + sTemp.substr(nDec)).c_str(); else return (nSign ? string("-") : string()) + sTemp.substr(0, nDec); } // ####################################################################### // // # Nuclex::Support::stringFromPointer() # // // ####################################################################### // /** Converts a pointer into a string @param pPointer Pointer to convert @return The string representation of the pointer */ string Nuclex::Support::stringFromPointer(const void *pPointer) { char pszTemp[16] = { '0', '0', '0', '0', '0', '0', '0', '0' }; ::itoa(reinterpret_cast<int>(pPointer), &pszTemp[7], 16); return &pszTemp[11 - ::strlen(&pszTemp[7])]; // Implicitely constructs a string } #endif /* CRC32Table() { unsigned_32 nI, nJ, nAccum; for(nI = 0; nI < 256; nI++) { nAccum = (nI << 24); for(nJ = 0; nJ < 8; nJ++) { if(nAccum & 0x80000000L) nAccum = (nAccum << 1) ^ 0x04C11DB7L; else nAccum <<= 1; } data[nI] = nAccum; } } */
[ [ [ 1, 325 ] ] ]
4f2b48b4b2ea00e63679b62cd04fde7269c00c3d
4fac8e482c7fb1cec9d2a7be618757a22ec12816
/libraries/Menu/SubMenuItem.h
9283e1e2243248a9fea494104ecacc85832ad0e6
[]
no_license
robomotic/RobotUGV
5d32ada2b6114f99b3323b09b7a20758c872caaa
2fb067b535d0a41473dcba0903339d6d85628a5a
refs/heads/master
2021-01-01T16:05:34.134641
2011-06-28T09:15:16
2011-06-28T09:15:16
1,965,337
1
1
null
null
null
null
UTF-8
C++
false
false
1,277
h
/* || || @file SubMenuItem.h || @version 1.0 || @author Alexander Brevig || @contact [email protected] || || @description || | Provide an easy way of making submenuitems || # || || @license || | This library is free software; you can redistribute it and/or || | modify it under the terms of the GNU Lesser General Public || | License as published by the Free Software Foundation; version || | 2.1 of the License. || | || | This library 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 || | Lesser General Public License for more details. || | || | You should have received a copy of the GNU Lesser General Public || | License along with this library; if not, write to the Free Software || | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA || # || */ #ifndef SUBMENUITEM_H #define SUBMENUITEM_H #include "interfaces/MenuItemInterface.h" class SubMenuItem : public MenuItemInterface{ public: SubMenuItem(); virtual MenuItemInterface* use(); }; #endif /* || @changelog || | 1.0 2009-04-22 - Alexander Brevig : Initial Release || # */
[ "robomotic@robomotic-lap.(none)" ]
[ [ [ 1, 47 ] ] ]
c759e595bfeedafcc1a1f9de17887b39a08104af
81b7033dd0d0203290795b51513a4014b084d39d
/hash/fcs.h
612f663dd48eee85855fe23e642f2799a1425fd7
[]
no_license
starcid/lua-binding-libraries
d27f5c2fccfeae2d667fdb60c86c3244d9ddc065
e33c85f773d88d3b31b026464066264820e4c302
refs/heads/master
2016-08-04T19:57:05.839477
2010-11-15T12:02:08
2010-11-15T12:02:08
35,589,712
0
0
null
null
null
null
UTF-8
C++
false
false
6,945
h
#ifndef HASH_FCS_H_ #define HASH_FCS_H_ // FCS-16 algorithm implemented as described in RFC 1331 #define FCSINIT16 0xFFFF #define FCSINIT32 0xFFFFFFFF // Fast 16 bit FCS lookup table const unsigned short fcs16tab[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 }; const unsigned long fcs32tab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; class CFCS16 { unsigned short m_context; public: enum { nDigestLength = 2}; int Init() { m_context = FCSINIT16; return 0; } int Update(unsigned char * pData, unsigned long ulLen) { unsigned int i = 0; for(i = 0; i < ulLen; i++) m_context = (m_context >> 8) ^ fcs16tab[(m_context ^ pData[i]) & 0xFF]; return 0; } int Final(unsigned char * pszOut) { m_context = ~(m_context); pszOut[0] = (unsigned char)((m_context & 0xFF00 )>> 8); pszOut[1] = (unsigned char)((m_context & 0xFF )); return 0; } }; class CFCS32 { unsigned long m_context; public: enum { nDigestLength = 4}; int Init() { m_context = FCSINIT32; return 0; } int Update(unsigned char * pData, unsigned long ulLen) { unsigned int i = 0; for(i = 0; i < ulLen; i++) m_context = (m_context >> 8) ^ fcs32tab[(m_context ^ pData[i]) & 0xFF]; return 0; } int Final(unsigned char * pszOut) { m_context = ~(m_context); pszOut[0] = (unsigned char)((m_context & 0xFF000000 )>> 24); pszOut[1] = (unsigned char)((m_context & 0xFF0000 )>> 16); pszOut[2] = (unsigned char)((m_context & 0xFF00 )>> 8); pszOut[3] = (unsigned char)((m_context & 0xFF )); return 0; } }; #endif
[ "missdeer@959521e0-e54e-11de-9298-fbd6a473cdd1" ]
[ [ [ 1, 174 ] ] ]
a6476d703c5994d449f6903cddf4197bb6309d4d
011359e589f99ae5fe8271962d447165e9ff7768
/src/burn/neogeo/neo_sprite.cpp
3d516f27805f1a89e3c3e05c6c9dd73f7add1d05
[]
no_license
PS3emulators/fba-next-slim
4c753375fd68863c53830bb367c61737393f9777
d082dea48c378bddd5e2a686fe8c19beb06db8e1
refs/heads/master
2021-01-17T23:05:29.479865
2011-12-01T18:16:02
2011-12-01T18:16:02
2,899,840
1
0
null
null
null
null
UTF-8
C++
false
false
3,144
cpp
#include "neogeo.h" int nNeoScreenWidth = 320; unsigned char* NeoSpriteROM; unsigned char* NeoZoomROM; unsigned char* NeoTileAttrib = NULL; unsigned int nNeoTileMask; int nNeoMaxTile; int nSliceStart, nSliceEnd, nSliceSize; static unsigned int* pTileData; static unsigned int* pTilePalette; static unsigned short* pBank; static int nBankSize; static int nBankXPos, nBankYPos; static int nBankXZoom, nBankYZoom; static int nNeoSpriteFrame04, nNeoSpriteFrame08; static int nLastBPP = -1; typedef void (*RenderBankFunction)(); static RenderBankFunction* RenderBank; // Include the tile rendering functions #include "../../generated/neo_sprite_func.h" int NeoRenderSprites() { #if USE_BPP_RENDERING == 16 RenderBank = RenderBankNormal[0]; #else if (nLastBPP != nBurnBpp ) { nLastBPP = nBurnBpp; RenderBank = RenderBankNormal[nBurnBpp - 2]; } #endif #ifndef NO_LAYER_ENABLE_TOGGLE if (!(nBurnLayer & 1)) { return 0; } #endif unsigned short BankAttrib01, BankAttrib02, BankAttrib03; nNeoSpriteFrame04 = nNeoSpriteFrame & 3; nNeoSpriteFrame08 = nNeoSpriteFrame & 7; for (int nBank = 1; nBank < 0x17D; nBank++) { BankAttrib01 = *((unsigned short*)(NeoGraphicsRAM + 0x010000 + (nBank << 1))); BankAttrib02 = *((unsigned short*)(NeoGraphicsRAM + 0x010400 + (nBank << 1))); BankAttrib03 = *((unsigned short*)(NeoGraphicsRAM + 0x010800 + (nBank << 1))); pBank = (unsigned short*)(NeoGraphicsRAM + (nBank << 7)); if (BankAttrib02 & 0x40) { nBankXPos += nBankXZoom + 1; } else { nBankYPos = (0x0200 - (BankAttrib02 >> 7)) & 0x01FF; nBankXPos = (BankAttrib03 >> 7); if (nNeoScreenWidth == 304) { nBankXPos -= 8; } nBankYZoom = BankAttrib01 & 0xFF; nBankSize = (BankAttrib02 & 0x3F); if (nBankSize > 0x20) { nBankSize = 0x20; } // if (nBankSize /* > 0x10 */ && nSliceStart == 0x10) bprintf(PRINT_NORMAL, _T("bank: %04X, x: %04X, y: %04X, zoom: %02X, size: %02X.\n"), nBank, nBankXPos, nBankYPos, nBankYZoom, nBankSize); } if (nBankSize) { nBankXZoom = (BankAttrib01 >> 8) & 0x0F; if (nBankXPos >= 0x01E0) { nBankXPos -= 0x200; } if (nBankXPos >= 0 && nBankXPos < (nNeoScreenWidth - nBankXZoom - 1)) { RenderBank[nBankXZoom](); } else { if (nBankXPos >= -nBankXZoom && nBankXPos < nNeoScreenWidth) { RenderBank[nBankXZoom + 16](); } } } } // bprintf(PRINT_NORMAL, _T("\n")); return 0; } int NeoInitSprites() { // Create a table that indicates if a tile is transparent NeoTileAttrib = (unsigned char*)malloc(nNeoTileMask + 1); for (int i = 0; i < nNeoMaxTile; i++) { bool bTransparent = true; for (int j = i << 7; j < (i + 1) << 7; j++) { if (NeoSpriteROM[j]) { bTransparent = false; break; } } if (bTransparent) { NeoTileAttrib[i] = 1; } else { NeoTileAttrib[i] = 0; } } for (unsigned int i = nNeoMaxTile; i < nNeoTileMask + 1; i++) { NeoTileAttrib[i] = 1; } return 0; } void NeoExitSprites() { free(NeoTileAttrib); }
[ [ [ 1, 136 ] ] ]
73b690683c6c02844fd19b3dc7190083440753d4
3856c39683bdecc34190b30c6ad7d93f50dce728
/LastProject/Source/StateMachine.h
a191eae3135a7576fccffde52d435fb0a2aa306a
[]
no_license
yoonhada/nlinelast
7ddcc28f0b60897271e4d869f92368b22a80dd48
5df3b6cec296ce09e35ff0ccd166a6937ddb2157
refs/heads/master
2021-01-20T09:07:11.577111
2011-12-21T22:12:36
2011-12-21T22:12:36
34,231,967
0
0
null
null
null
null
UHC
C++
false
false
2,219
h
#ifndef _STATEMACHINE_H_ #define _STATEMACHINE_H_ #include "State.h" template<class entity_type> class StateMachine { private: entity_type* m_pOwner; // 이 인스턴스를 소유하는 에이전트 State<entity_type>* m_pPreviousState; // 이전 상태 State<entity_type>* m_pCurrentState; // 현재 상태 State<entity_type>* m_pGlobalState; // 이 상태는 FSM이 갱신될 때마다 호출된다. public: StateMachine( entity_type* pOwner ) : m_pOwner( pOwner ), m_pPreviousState( NULL ), m_pCurrentState( NULL ), m_pGlobalState( NULL ) {} virtual ~StateMachine(){} VOID Update() const { if( m_pGlobalState ) m_pGlobalState->Execute( m_pOwner ); if( m_pCurrentState ) m_pCurrentState->Execute( m_pOwner ); } VOID ChangeState( State<entity_type>* pNewState ) { // 현재 상태를 저장해 둔다. m_pPreviousState = m_pCurrentState; // 현재 상태 Exit if( m_pCurrentState ) { m_pCurrentState->Exit( m_pOwner ); } // 새로운 상태를 현재 상태로 m_pCurrentState = pNewState; // 새로운 상태로 Enter if ( pNewState ) { m_pCurrentState->Enter( m_pOwner ); } } VOID RevertToPreviousState() { ChangeState( m_pPreviousState ); } BOOL isInState( const State<entity_type>& state ) const { if( typeid( &m_pCurrentState ) == typeid( state ) ) { return TRUE; } return FALSE; } std::string GetNameOfCurrentState() const { std::string s( typeid(*m_pCurrentState).name() ); // 문자열 앞의 'class' 를 제거한다. if( s.size() > 5 ) { s.erase( 0, 6 ); } return s; } // Set VOID SetPreviousState( State<entity_type>* state ) { m_pPreviousState = state; } VOID SetCurrentState( State<entity_type>* state ) { m_pCurrentState = state; } VOID SetGlobalState( State<entity_type>* state ) { m_pGlobalState = state; } // Get State<entity_type>* GetPreviousState() const { return m_pPreviousState; } State<entity_type>* GetCurrentState() const { return m_pCurrentState; } State<entity_type>* GetGlobalState() const { return m_pGlobalState; } }; #endif
[ "[email protected]@d02aaf57-2019-c8cd-d06c-d029ef2af4e0", "[email protected]@d02aaf57-2019-c8cd-d06c-d029ef2af4e0", "[email protected]@d02aaf57-2019-c8cd-d06c-d029ef2af4e0" ]
[ [ [ 1, 39 ], [ 44, 48 ], [ 53, 100 ] ], [ [ 40, 43 ] ], [ [ 49, 52 ] ] ]
8ba19fdd0d4a9c3a4144d874ce39698698fc17e5
2725cbc61c571e59846fabf309ea331631b00295
/popup.h
b2427e833c6ce533e352f4fd61b24b5381d8f684
[]
no_license
bunny1985/detoks
40c21dee66f479625698b5acb8024d4d969c8f38
55fd4b154117d328c8962850a39246f542a02513
refs/heads/master
2018-12-28T09:31:33.763688
2010-07-16T05:48:44
2010-07-16T05:48:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
515
h
#ifndef POPUP_H #define POPUP_H #include <QWidget> #include <QDesktopWidget> #include <QRect> #include <QTimer> namespace Ui { class popup; } class popup : public QWidget { Q_OBJECT public: popup(QWidget *parent = 0); void execute(QString msg); ~popup(); protected: void changeEvent(QEvent *e); private: Ui::popup *ui; QTimer *timer; double op; bool showed; bool opened; private slots: void tick(); }; #endif // POPUP_H
[ [ [ 1, 36 ] ] ]
fc674500e05c94f96b5d35d85e73d1021a4db80f
6ee200c9dba87a5d622c2bd525b50680e92b8dab
/Autumn/Core/Console/Console.cpp
7a9f978d477685f7bcbc8e5c646c1c5747492798
[]
no_license
Ishoa/bizon
4dbcbbe94d1b380f213115251e1caac5e3139f4d
d7820563ab6831d19e973a9ded259d9649e20e27
refs/heads/master
2016-09-05T11:44:00.831438
2010-03-10T23:14:22
2010-03-10T23:14:22
32,632,823
0
0
null
null
null
null
UTF-8
C++
false
false
3,222
cpp
#define _CRT_SECURE_NO_DEPRECATE #include "stdafx.h" #include "Console.h" int CConsole::m_NbInstance = 0; HANDLE CConsole::m_hConsole = NULL; CConsole::CConsole() { m_NbInstance++; if(m_NbInstance == 1) { AllocConsole(); SetConsoleTitle("Debug Console"); SetScreenBufferSize(80, 100); SetCursorPosition(0, 0); m_hConsole = GetStdHandle(STD_OUTPUT_HANDLE); } } CConsole::~CConsole() { m_NbInstance--; if(m_NbInstance == 0) { FreeConsole(); CloseHandle(m_hConsole); m_hConsole = NULL; } } void CConsole::Printf(const char *szfmt, ...) { char s[300]; va_list argptr; int cnt; va_start(argptr, szfmt); cnt = vsprintf_s(s, szfmt, argptr); va_end(argptr); DWORD cCharsWritten; if(m_hConsole) { WriteConsole(m_hConsole, s, (DWORD)strlen(s), &cCharsWritten, NULL); } } void CConsole::SetScreenBufferSize(short X, short Y) { if(m_hConsole) { COORD co = {X, Y }; SetConsoleScreenBufferSize(m_hConsole, co); } } void CConsole::SetCursorPosition(short X, short Y) { if(m_hConsole) { COORD co = {X, Y }; SetConsoleCursorPosition(m_hConsole,co); } } int CConsole::GetNbInstance() { return m_NbInstance; } CConsole& CConsole::operator << (int i) { char s[50]; sprintf_s(s, "%d", i); DWORD cCharsWritten; if(m_hConsole) { WriteConsole(m_hConsole, s, (DWORD)strlen(s), &cCharsWritten, NULL); } return *this; } CConsole& CConsole::operator << (unsigned int u) { char s[50]; sprintf_s(s, "%d", u); DWORD cCharsWritten; if(m_hConsole) { WriteConsole(m_hConsole, s, (DWORD)strlen(s), &cCharsWritten, NULL); } return *this; } CConsole& CConsole::operator << (unsigned long u) { char s[50]; sprintf_s(s, "%d", u); DWORD cCharsWritten; if(m_hConsole) { WriteConsole(m_hConsole, s, (DWORD)strlen(s), &cCharsWritten, NULL); } return *this; } CConsole& CConsole::operator << (double f) { char s[50]; sprintf_s(s, "%f", f); DWORD cCharsWritten; if(m_hConsole) { WriteConsole(m_hConsole, s, (DWORD)strlen(s), &cCharsWritten, NULL); } return *this; } CConsole& CConsole::operator << (char* s) { DWORD cCharsWritten; if(m_hConsole) { WriteConsole(m_hConsole, s, (DWORD)strlen(s), &cCharsWritten, NULL); } return *this; } CConsole& CConsole::operator << (const char* s) { DWORD cCharsWritten; if(m_hConsole) { WriteConsole(m_hConsole, s, (DWORD)strlen(s), &cCharsWritten, NULL); } return *this; } CConsole& CConsole::operator << (char c) { char s[5]; sprintf_s(s, "%c", c); DWORD cCharsWritten; if(m_hConsole) { WriteConsole(m_hConsole, s, (DWORD)strlen(s), &cCharsWritten, NULL); } return *this; } CConsole& CConsole::operator << (RECT rc) { *this << endl; *this << "RECT.left = " << rc.left << endl; *this << "RECT.top = " << rc.top << endl; *this << "RECT.right = " << rc.right << endl; *this << "RECT.bottom = " << rc.bottom << endl; *this << endl; return *this; }
[ "edouard.roge@ab19582e-f48f-11de-8f43-4547254af6c6" ]
[ [ [ 1, 166 ] ] ]
de05f9d8a06bdfd6df6c9846b2c1ba9f04bd41b1
729f72df96cd6f816d3a100b8b1346c98ba72457
/source/FlourToolCupcake.h
5c007ac667027fea1ca11261ea1be880a737cef6
[]
no_license
yhzhu/flour
e2459c10a05bbb8e03fa2b18b61116825f91f36b
10424d1ec6490cf8a07705beb6507201c36dcfbc
refs/heads/master
2021-01-18T03:13:40.892264
2010-04-11T17:11:17
2010-04-11T17:11:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,929
h
/** File: FlourToolVersion.h Created on: 06-Sept-09 Author: Robin Southern "betajaen" Copyright (c) 2009 Robin Southern 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. */ #ifndef FLOUR_TOOL_CUPCAKE_H #define FLOUR_TOOL_CUPCAKE_H #include "FlourTool.h" #include "FlourOpenGL.h" class FlourCupcake : public FlourTool, public OpenGL { public: enum Errors { ERROR_NoFile, ERROR_NoMeshData, ERROR_UnrecongisedFileformat }; FlourCupcake(); ~FlourCupcake(); void process(); void onPreFrame(); void onPostFrame(); void onKeyEvent(char key); void onMouseDragEvent(int ButtonID, int deltaX, int deltaY); void onMouseButtonEvent(int ButtonID, int x, int y); protected: float mYaw, mPitch, mDistance; }; #endif
[ [ [ 1, 66 ] ] ]
f1f85cc615280e18b5c520491376224ccfa012d7
b240ccb537657eb72a3ac7634c99e3b8733e454c
/code/api/api_v001rc/networkcommunication/tcpSocket/include/mailclient.h
96c021cceab17b455b20b2423dc5caacb4580e7e
[]
no_license
Jmos/ftofsharing
96c2c77deab4c15da0ec42b14e0c17f5adfeb485
8969c3b33a2173c36f3a282b946b92656d77ad81
refs/heads/master
2021-01-22T23:16:04.198478
2011-06-04T18:46:00
2011-06-04T18:46:00
34,392,347
0
0
null
null
null
null
UTF-8
C++
false
false
3,823
h
#ifndef _MAILCLIENT_H_ #define _MAILCLIENT_H_ //----------------------------------------------------------------- #include <QString> #include <QList> #include "tcpsocket.h" //----------------------------------------------------------------- /** * @ingroup api * * @brief Abstract class for a basic mail-client. * @author Saxl Georg * @version 1.0 * @date \a started: 18.11.2010 \n * \a completed: 03.12.2010 * * This abstract class comprises functions and properties for a basic mail-client.\n * Inherited by CSmtpClient, CPop3Client.\n * * @par Version 1.1 (05.12.2010) * \arg SSL supported * *******************************************************************************/ class CMailClient { public: /** * This struct declares the data structure of an email. */ struct REMail { QString From; ///< sender-address QString To; ///< receiver-address QString Subject; ///< subject of the mail QList<QString> Body; ///< body of the mail }; /** * This enum defines errors while sending/receiving emails. */ enum EEMailErrorCode { NOERROR, ///< No Error occurred. INVALIDHOSTNAME, ///< The commited hostname was invalid. UNAVAILABLEHOST, ///< The commited host is unavailable. INVALIDUSERNAME, ///< The commited username was invalid. INVALIDPASSWORD, ///< The commited password was invalid. NORESPONSEFROMSERVER, ///< The host doesnot respond. UNKNOWNSERVERERROR, ///< A unknown error occurred on the server. SENDINGERROR, ///< An error occurred while sending. MAILINDEXOUTOFBOUNDS, ///< The commited Mailindex is out of bounds. LOSTCONNECTION, ///< An unexpected disconnection occurred. AUTHENTICATIONERROR, ///< Authentication failed. INVALIDTOADDRESS, ///< The receiver-address is invalid. INVALIDFROMADDRESS, ///< The sender-address is invalid. INVALIDMAIL ///< The commited mail-struct is invalid. }; /** * This enum defines the protocol type */ enum EProtocolType { ProtocolPOP3, ///< to use the protocol POP3 ProtocolSMTP ///< to use the protocol SMTP }; CMailClient(EProtocolType iProtocol, CTcpSocket::EConnectionType iConnectionType); CMailClient(EProtocolType iProtocol, CTcpSocket::EConnectionType iConnectionType, QString iHostName); CMailClient(EProtocolType iProtocol, CTcpSocket::EConnectionType iConnectionType, QString iHostName, QString iUserName, QString iPassWord); ~CMailClient(); int GetServerPort(); void SetServerPort(int iServerPort); int GetMaxServerTimeOut(); void SetMaxServerTimeOut(int iMaxServerTimeOut); CTcpSocket::EConnectionType GetConnectionType(); void SetConnectionType(CTcpSocket::EConnectionType iConnectionType); EEMailErrorCode GetLastErrorCode(); protected: CTcpSocket *cTcpSocket; QString cHostName; QString cUserName; QString cPassWord; EEMailErrorCode cLastError; EProtocolType cProtocol; int cMaxServerTimeOut; int cServerPort; CTcpSocket::EConnectionType cConnectionType; void Initialise(EProtocolType iProtocol, CTcpSocket::EConnectionType iConnectionType); bool CheckParams(QString iHostName, QString iUserName, QString iPassWord); virtual bool ServerLogIn(QString iHostName, QString iUserName, QString iPassWord)= 0; ///< abstract function for login }; //----------------------------------------------------------------- //----------------------------------------------------------------- #endif
[ "georgsaxl@ed7a1941-e62f-a9da-ef21-68f2f9546975" ]
[ [ [ 1, 110 ] ] ]
add1389bc2e45dae3add1bffdbdb9b1d3890caf2
f29ec520791e5d2a265ee6fc25f9cebb58838968
/BigNumbers/Big Numbers - NAO FUNCIONA.cpp
dac6d733772f580f01e146ea4556f7feb18b38d3
[]
no_license
jonashartmann/menoso3alg
fc89ac05f6f01af6cb00a1c55968990b52ecce45
5c4b3afda0b6fbf72c3d016f3c7ad4f0bbcc1782
refs/heads/master
2020-04-08T07:37:33.293356
2009-03-31T02:30:48
2009-03-31T02:30:48
32,696,684
0
0
null
null
null
null
ISO-8859-1
C++
false
false
4,155
cpp
#include <iostream> #include <algorithm> #include <iterator> #include <string> using namespace std; struct bignum { bool neg; string number; bignum(long long x = 0) : number("") { neg = x<0; if(neg) x = -x; while(x) { number += char(x%10+'0'); x /= 10; } } bignum(const string &s) { for(int i = s.size()-1; i > 0; --i) number += s[i]; neg = s[0] == '-'; if(!neg) number += s[0]; } bignum &clean() { int b = number.find_last_not_of("0"); number = number.substr(0, b); // zero nao eh negativo if(number.empty()) neg = false; return *this; } bool operator!() const { return number.empty(); } operator bool() const { return !number.empty(); } char operator[](int i) const { return number[i]; } char &operator[](int i) { return number[i]; } inline int size() const { return number.size(); } }; ostream &operator<<(ostream &o, const bignum &x) { if(!x) return o << 0; if(x.neg) o << '-'; for(int i = x.size()-1; i >=0; --i) o << x.number[i]; return o; } bool operator<(const bignum& x, const bignum& y) { if(x.neg != y.neg) return x.neg; if(x.size() != y.size()) return x.neg == (x.size() > y.size()); for(int i = x.size()-1; i >= 0; --i) { if(x[i] != y[i]) { return x.neg != (x[i] < y[i]); } } return false; } bool operator==(const bignum& x, const bignum& y) { return (x.neg == y.neg)&&(x.number == y.number); } // variacoes dos operadores de comparação bool operator!=(const bignum &x, const bignum &y) { return !(x == y); } bool operator>(const bignum &x, const bignum &y) { return y < x; } bool operator<=(const bignum &x, const bignum &y) { return !(y < x); } bool operator>=(const bignum &x, const bignum &y) { return !(x < y); } // assume que tem sinais iguais bignum &add(bignum &x, const bignum &y) { int tam = max(x.size(), y.size()); for(int i = 0; i < tam; ++i) x.number += '0'; int carry = 0; for(int i = 0; i < x.size(); ++i) { int s = x[i]-'0' + (i < y.size()? y[i]-'0' : 0) + carry; x[i] = (s%10)+'0'; carry = s > 9; } if(carry) x.number += '1'; return x; } // assume que tem sinais iguais bignum &sub(bignum &x, const bignum &y) { bignum z; if(x > y) z = y; else { z = x; x = y; // n eh usado na subtracao x.neg = !x.neg; } int borrow = 0; for(int i = 0; i < x.size(); ++i) { int s = (x[i]-'0') - borrow - ((i < z.size())? (z[i]-'0') : 0); x[i] = ((s + 20)%10) + '0'; borrow = s < 0; } return x; } bignum& operator+=(bignum& x, const bignum& y) { if(!y) return x; if(!x) return x = y; if(x.neg != y.neg) return sub(x, y).clean(); return add(x, y).clean(); } bignum& operator-=(bignum& x, const bignum& y) { if(!y) return x; if(!x) return x = -y; if(x.neg != y.neg) return add(x, y).clean(); return sub(x, y).clean(); } bignum& operator*=(bignum& x, const bignum& y) { bignum r; for(int i = 0; i < y.size(); ++i) { for(int j = 0; j < y[i]; ++j) { add(r, x); x.number = '1'+x.number; } } r.neg = x.neg != y.neg; x = r; return x.clean(); } // FAZER bignum& operator/=(bignum& x, const bignum& y) { bignum temp; //temp.resize(x.size); temp.neg = x.neg != y.neg; bignum row; bignum ty = y; ty.neg = false; for (int i=x.size()-1; i>=0; --i) { //row <<= 1; row[0] = x[i]; row.clean(); while (ty <= row) { ++temp[i]; sub(row, ty).clean(); } } return (x = temp).clean(); } bignum operator+(const bignum& a, const bignum& b) { bignum c = a; return c += b; } bignum operator-(const bignum& a, const bignum& b) { bignum c = a; return c -= b; } bignum operator*(const bignum& a, const bignum& b) { bignum c = a; return c *= b; } bignum operator/(const bignum& a, const bignum& b) { bignum c = a; return c /= b; } int main() { string a, b; while(cin >> a >> b) { bignum a1(a), b1(b); cout << "soma: " << a1+b1 << endl; cout << "sub: " << a1-b1 << endl; cout << "mult: " << a1*b1 << endl; } return 0; }
[ "jonasharty@39649dc1-f352-0410-822d-0b1548283ca8", "rosaliaschneider@39649dc1-f352-0410-822d-0b1548283ca8" ]
[ [ [ 1, 7 ], [ 9, 9 ], [ 44, 44 ], [ 46, 46 ], [ 48, 48 ], [ 52, 55 ], [ 65, 68 ], [ 70, 71 ], [ 77, 77 ], [ 80, 80 ], [ 92, 93 ], [ 96, 96 ], [ 114, 115 ], [ 117, 117 ], [ 120, 120 ], [ 124, 124 ], [ 129, 129 ], [ 133, 135 ], [ 146, 147 ], [ 149, 150 ], [ 170, 173 ], [ 176, 179 ], [ 182, 185 ], [ 188, 191 ], [ 194, 197 ], [ 207, 207 ] ], [ [ 8, 8 ], [ 10, 43 ], [ 45, 45 ], [ 47, 47 ], [ 49, 51 ], [ 56, 64 ], [ 69, 69 ], [ 72, 76 ], [ 78, 79 ], [ 81, 91 ], [ 94, 95 ], [ 97, 113 ], [ 116, 116 ], [ 118, 119 ], [ 121, 123 ], [ 125, 128 ], [ 130, 132 ], [ 136, 145 ], [ 148, 148 ], [ 151, 169 ], [ 174, 175 ], [ 180, 181 ], [ 186, 187 ], [ 192, 193 ], [ 198, 206 ] ] ]
70a9260935aa619fef2bbafed52a64691ecfc461
5fb9b06a4bf002fc851502717a020362b7d9d042
/developertools/GumpEditor-0.32/DiagramPropertySheet.h
d7480e2aa8bdc0609a8a9de149b8f57c68648459
[]
no_license
bravesoftdz/iris-svn
8f30b28773cf55ecf8951b982370854536d78870
c03438fcf59d9c788f6cb66b6cb9cf7235fbcbd4
refs/heads/master
2021-12-05T18:32:54.525624
2006-08-21T13:10:54
2006-08-21T13:10:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
508
h
#pragma once // CDiagramPropertySheet class CDiagramPropertySheet : public CPropertySheet { DECLARE_DYNAMIC(CDiagramPropertySheet) public: CDiagramPropertySheet(); virtual ~CDiagramPropertySheet(); protected: DECLARE_MESSAGE_MAP() public: virtual BOOL OnInitDialog(); void SetValues(); void ApplyValues(); void ResetValues(); CButton m_btnApply; CButton m_btnReset; afx_msg void OnApply(); afx_msg void OnReset(); virtual BOOL PreTranslateMessage(MSG* pMsg); };
[ "sience@a725d9c3-d2eb-0310-b856-fa980ef11a19" ]
[ [ [ 1, 27 ] ] ]
80e568cbcaa199ae41cef76248a7c4e1de770a2d
6a925ad6f969afc636a340b1820feb8983fc049b
/librtsp/librtsp/inc/rtspCommon.h
117ab1e7d42a67c9a9dd1a6fcf09befec903c393
[]
no_license
dulton/librtsp
c1ac298daecd8f8008f7ab1c2ffa915bdbb710ad
8ab300dc678dc05085f6926f016b32746c28aec3
refs/heads/master
2021-05-29T14:59:37.037583
2010-05-30T04:07:28
2010-05-30T04:07:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,910
h
/*!@file @brief Copyright (c) 2009 HUST ITEC VoIP Lab. All rights reserved. @author Wentao Tang @date 2009.3.21 @version 1.0 */ #pragma once #include <string> #include <map> #include <iostream> #include <vector> using std::cout; using std::cerr; using std::endl; using std::string; using std::map; using std::vector; // defines #define MAX_BUF_SIZE 1024 #define MAX_PACKET_SIZE ((1024 * 64) - 1) #define MILLION 1000000 #define RTSP_OK 0 //!< typedefs namespace RTSP { typedef enum _eRTSP_STATE { RTSP_INIT, RTSP_READY, RTSP_PLAYING, RTSP_RECORD, RTSP_NONE, }RTSP_STATE; typedef struct _sRTSPVERSION { int major; int minor; }RTSPVERSION; typedef enum _ePACKETTYPE { REQUEST_PKT, RESPONSE_PKT, NONE_PKT, }PACKETTYPE; const string SP = " "; const string CRLF = "\r\n"; const string MEDIATYPE_AUDIO = "audio"; const string MEDIATYPE_VIDEO = "video"; }; namespace RTSP { // Methods namespace Method { const string OPTIONS = "OPTIONS"; const string DESCRIBE = "DESCRIBE"; const string ANNOUNCE = "ANNOUNCE"; const string SETUP = "SETUP"; const string PLAY = "PLAY"; const string PAUSE = "PAUSE"; const string TEARDOWN = "TEARDOWN"; const string GET_PAPAMETER = "GET_PAPAMETER"; const string SET_PAPAMETER = "SET_PAPAMETER"; const string REDIRECT = "REDIRECT"; const string RECORD = "RECORD"; const string UNPPORTED = "UNSPPORTED"; } // Header Field namespace HeaderField { const string Accept = "Accept"; const string Accept_Encoding = "Accept-Encoding"; const string Accept_Language = "Accept-Language"; const string Allow = "Allow"; const string Authorization = "Authorization"; const string Bandwidth = "Bandwidth"; const string Blocksize = "Blocksize"; const string Cache_Control = "Cache-Control"; const string Conference = "Conference"; const string Connection = "Connection"; const string Content_Base = "Content-Base"; const string Content_Encoding = "Content-Encoding"; const string Content_Language = "Content-Language"; const string Content_Length = "Content-Length"; const string Content_Location = "Content-Location"; const string Content_Type = "Content-Type"; const string CSeq = "CSeq"; const string Date = "Date"; const string Expires = "Expires"; const string From = "From"; const string Host = "Host"; const string If_Match = "If-Match"; const string If_Modified_Since = "If-Modified-Since"; const string Last_Modified = "Last-Modified"; const string Location = "Location"; const string Proxy_Authenticate = "Proxy-Authenticate"; const string Proxy_Require = "Proxy-Require"; const string Public = "Public"; const string Range = "Range"; const string Referer = "Referer"; const string Retry_After = "Retry-After"; const string Require = "Require"; const string RTP_Info = "RTP-Info"; const string Scale = "Scale"; const string Speed = "Speed"; const string Server = "Server"; const string Session = "Session"; const string Timestamp = "Timestamp"; const string Transport = "Transport"; const string Unsupported = "Unsupported"; const string User_Agent = "User-Agent"; const string Vary = "Vary"; const string Via = "Via"; const string WWW_Authenticate = "WWW-Authenticate"; } typedef struct _sSTATUS_CODE_MAP { string code; string reason; }STATUS_CODE_MAP; }; static RTSP::STATUS_CODE_MAP codeAndReason[] = { {"100", "Continue"}, {"200", "OK"}, {"201", "Created"}, {"250", "Low on Storage Space"}, {"300", "Multiple Choices"}, {"301", "Moved Permanently"}, {"302", "Moved Temporarily"}, {"303", "See Other"}, {"304", "Not Modified"}, {"305", "Use Proxy"}, {"400", "Bad Request"}, {"401", "Unauthorized"}, {"402", "Payment Required"}, {"403", "Forbidden"}, {"404", "Not Found"}, {"405", "Method Not Allowed"}, {"406", "Not Acceptable"}, {"407", "Proxy Authentication Required"}, {"408", "Request Time-out"}, {"410", "Gone"}, {"411", "Length Required"}, {"412", "Precondition Failed"}, {"413", "Request Entity Too Large"}, {"414", "Request-URI Too Large"}, {"415", "Unsupported Media Type"}, {"451", "Parameter Not Understood"}, {"452", "Conference Not Found"}, {"453", "Not Enough Bandwidth"}, {"454", "Session Not Found"}, {"455", "Method Not Valid in This State"}, {"456", "Header Field Not Valid for Resource"}, {"457", "Invalid Range"}, {"458", "Parameter Is Read-Only"}, {"459", "Aggregate operation not allowed"}, {"460", "Only aggregate operation allowed"}, {"461", "Unsupported transport"}, {"462", "Destination unreachable"}, {"500", "Internal Server Error"}, {"501", "Not Implemented"}, {"000", "END"} }; #ifdef _DEBUG //#define #else #define NDEBUG #endif
[ "TangWentaoHust@95ff1050-1aa1-11de-b6aa-3535bc3264a2" ]
[ [ [ 1, 184 ] ] ]
80bd123cd886eeae0202e7aee634e3f211d783a8
d826e0dcc5b51f57101f2579d65ce8e010f084ec
/pre/FSKETCHCreate2DArc3Points.h
b0eea22a729b21cdd68c676a192d220de602b16c
[]
no_license
crazyhedgehog/macro-parametric
308d9253b96978537a26ade55c9c235e0442d2c4
9c98d25e148f894b45f69094a4031b8ad938bcc9
refs/heads/master
2020-05-18T06:01:30.426388
2009-06-26T15:00:02
2009-06-26T15:00:02
38,305,994
0
0
null
null
null
null
UTF-8
C++
false
false
1,182
h
#pragma once #include "Feature.h" class Part; class FSketch; class FSKETCHCreate2DArc3Points : public Feature { public: FSKETCHCreate2DArc3Points(Part * part, tag_t fTag, FSketch * pFSketch); virtual ~FSKETCHCreate2DArc3Points(void); void SetCntPnt(const Point3D & cP) {_cP=cP;} void SetRadius(const double r) {_dR = r;} void SetStaAng(const double sA) {_dStaAng = sA;} void SetEndAng(const double eA) {_dEndAng = eA;} void SetStaPnt(const Point3D& sP) {_sP=sP;} void SetEndPnt(const Point3D& eP) {_eP=eP;} void SetPickPnt(); // under Construction FSketch * GetFSketch() {return _pFSketch;} void GetCntPnt(Point3D & cP) {cP=_cP;} double GetRadius() const {return _dR;} double GetStaAng() const {return _dStaAng;} double GetEndAng() const {return _dEndAng;} void GetStaPnt(Point3D & sP) {sP=_sP;} void GetEndPnt(Point3D & eP) {eP=_eP;} void GetPickPnt(Point3D & pP) {pP=_pP;} virtual void GetUGInfo(); virtual void ToTransCAD(); private: static int _2DArc3PntsCnt; Point3D _cP; double _dR; double _dStaAng; double _dEndAng; Point3D _sP; Point3D _eP; Point3D _pP; FSketch * _pFSketch; };
[ "surplusz@2d8c97fe-2f4b-11de-8e0c-53a27eea117e" ]
[ [ [ 1, 50 ] ] ]
5be5d06451a981eee47ff6a87664ad8a378da00a
8fcf3f01e46f8933b356f763c61938ab11061a38
/Interface/sources/Data/ItemData.cpp
2fac3e56c08298e9e70b10759b3f97a2b3d12511
[]
no_license
jonesbusy/parser-effex
9facab7e0ff865d226460a729f6cb1584e8798da
c8c00e7f9cf360c0f70d86d1929ad5b44c5521be
refs/heads/master
2021-01-01T16:50:16.254785
2011-02-26T22:27:05
2011-02-26T22:27:05
33,957,768
0
0
null
null
null
null
UTF-8
C++
false
false
377
cpp
#include "Data/ItemData.h" ItemData::ItemData(const QString& name, const QString& domain, double value) : name(name), domain(domain), value(value) { } const QString& ItemData::getName() const { return this->name; } const QString& ItemData::getDomain() const { return this->domain; } double ItemData::getValue() const { return this->value; }
[ "jonesbusy@fa255007-c97c-c9ae-ff28-e9f0558300b6" ]
[ [ [ 1, 20 ] ] ]
c66eccd4b64ef7c15dcf3d88ead43d8996c0b57f
2a47a0a9749be9adae403d99f6392f9d412fca53
/OpenGL/Logo/3DLOGO_fly.cpp
2bc52ac9c0e7758e576de4c29e90f647b8075f34
[]
no_license
waseemilahi/waseem
153bed6788475a88d234d75a323049a9d8ec47fe
0bb2bddcc8758477f0ad5db85bfc927db2ae07af
refs/heads/master
2020-03-30T14:59:17.066002
2008-11-22T01:21:04
2008-11-22T01:21:04
32,640,847
0
0
null
null
null
null
UTF-8
C++
false
false
16,146
cpp
/* * wilahi_3DLOGO_fly.cpp * * draws the initials of my first, middle and last names that fly. */ #include <Windows.h> #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> /* Screen window parameters */ int windType; GLint windW, windH; /* camera parameters */ struct camera { float ex, ey, ez; /* eye position */ float ux, uy, uz; /* u axis */ float vx, vy, vz; /* v axis */ float nx, ny, nz; /* n axis */ } myCamera; GLdouble spin_angle = 0.0; GLdouble spin_increment = 3; GLboolean animate = FALSE; /* camera functions */ void init_camera (float ex, float ey, float ez, // eye or camera coordinates (origin of view) float ux, float uy, float uz, // u axis (points to right of origin) float vx, float vy, float vz, // v axis (points up from origin) float nx, float ny, float nz) // n axis (points opposite of view direction) { myCamera.ex = ex; myCamera.ey = ey; myCamera.ez = ez; myCamera.ux = ux; myCamera.uy = uy; myCamera.uz = uz; myCamera.vx = vx; myCamera.vy = vy; myCamera.vz = vz; myCamera.nx = nx; myCamera.ny = ny; myCamera.nz = nz; } void setModelViewMatrix(struct camera C) { float m[16]; m[0] = C.ux; m[1] = C.vx; m[2] = C.nx; m[3] = 0; m[4] = C.uy; m[5] = C.vy; m[6] = C.ny; m[7] = 0; m[8] = C.uz; m[9] = C.vz; m[10] = C.nz; m[11] = 0; m[12] = -((C.ex * C.ux) + (C.ey * C.uy) + (C.ez * C.uz)); m[13] = -((C.ex * C.vx) + (C.ey * C.vy) + (C.ez * C.vz)); m[14] = -((C.ex * C.nx) + (C.ey * C.ny) + (C.ez * C.nz)); m[15] = 1; glMatrixMode (GL_MODELVIEW); glLoadMatrixf (m); } void slide_camera (float dx, float dy, float dz) { myCamera.ex += (dx * myCamera.ux) + (dy * myCamera.vx) + (dz * myCamera.nx); myCamera.ey += (dx * myCamera.uy) + (dy * myCamera.vy) + (dz * myCamera.ny); myCamera.ez += (dx * myCamera.uz) + (dy * myCamera.vz) + (dz * myCamera.nz); } void roll_camera (double angle) { angle=0.0174532925*angle; myCamera.ux=myCamera.ux*cos(angle)-myCamera.vx*sin(angle); myCamera.uy=myCamera.uy*cos(angle)-myCamera.vy*sin(angle); myCamera.uz=myCamera.uz*cos(angle)-myCamera.vz*sin(angle); myCamera.vx=myCamera.vx*cos(angle)+myCamera.ux*sin(angle); myCamera.vy=myCamera.vy*cos(angle)+myCamera.uy*sin(angle); myCamera.vz=myCamera.vz*cos(angle)+myCamera.uz*sin(angle); glutPostRedisplay(); } void pitch_camera (double angle) { angle=0.0174532925*angle; myCamera.vx=myCamera.vx*cos(angle)-myCamera.nx*sin(angle); myCamera.vy=myCamera.vy*cos(angle)-myCamera.ny*sin(angle); myCamera.vz=myCamera.vz*cos(angle)-myCamera.nz*sin(angle); myCamera.nx=myCamera.nx*cos(angle)+myCamera.vx*sin(angle); myCamera.ny=myCamera.ny*cos(angle)+myCamera.vy*sin(angle); myCamera.nz=myCamera.nz*cos(angle)+myCamera.vz*sin(angle); glutPostRedisplay(); } void yaw_camera (double angle) { angle=0.0174532925*angle; myCamera.ux=myCamera.ux*cos(angle)+myCamera.nx*sin(angle); myCamera.uy=myCamera.uy*cos(angle)+myCamera.ny*sin(angle); myCamera.uz=myCamera.uz*cos(angle)+myCamera.nz*sin(angle); myCamera.nx=myCamera.nx*cos(angle)-myCamera.ux*sin(angle); myCamera.ny=myCamera.ny*cos(angle)-myCamera.uy*sin(angle); myCamera.nz=myCamera.nz*cos(angle)-myCamera.uz*sin(angle); glutPostRedisplay(); } /* FILL IN THIS FUNCTION TO INCREMENTALLY CHANGE POSITION / ORIENTATION / SIZE OF LOGO */ /* Hint: change global rotation or position value(s) by a small amount, then use the value(s) as parameters in the Draw function */ void fly (void) { spin_angle+=spin_increment; glutPostRedisplay(); /* update of the display */ } GLuint letterI; // display list speeds up rendering GLuint letterW; // display list speeds up rendering GLuint letterK; // display list speeds up rendering /* draw the letter I in a display list called letterI */ void drawI (void) { #define NPOINTS 8 #define NPOLYGONS 6 /* define all the points on the letter */ GLdouble point[NPOINTS][3] = { {4.5, 0.0, 1.2}, {5.5, 0.0, 1.2}, {5.5, 6.0, 1.2}, {4.5, 6.0, 1.2}, {4.5, 0.0, 0.0}, {5.5, 0.0, 0.0}, {5.5, 6.0, 0.0}, {4.5, 6.0, 0.0}}; /* each polygonal face references 4 points */ int polygon[NPOLYGONS][4] = { {0, 1, 2, 3}, /* front face */ {4, 7, 6, 5}, /* back face */ {0, 3, 7, 4}, /* side faces */ {1, 5, 6, 2}, {2, 6, 7, 3}, {4, 5, 1, 0}}; /* color array defines a different color for each face */ GLdouble color[NPOLYGONS][3] = { {0.3, 0.5, 0.2}, /* front face */ {0.3, 0.5, 0.2}, /* back face */ {0.4, 0.4, 0.4}, /* side faces */ {0.6, 0.6, 0.6}, {0.8, 0.8, 0.8}, {0.9, 0.9, 0.9}}; int face, pt; /* Setup display list */ letterI = glGenLists(1); glNewList (letterI, GL_COMPILE); /* Draw the letter */ for (face = 0; face < NPOLYGONS; face++) { glColor3dv(color[face]); /* set the color of the face */ glBegin(GL_POLYGON); for (pt = 0; pt < 4; pt++) /* draw all points on the face */ glVertex3dv (point[polygon[face][pt]]); glEnd(); } /* Finish the display list */ glEndList(); } /* draw the letter K in a display list called letterk */ void drawK (void) { #define NPOINTSK 22 #define NPOLYGONSK 19 /* define all the points on the letter */ GLdouble point[NPOINTSK][3] = { {-1.0, 0.0, 1.0}, { 0.0, 0.0, 1.0}, { 0.0, 6.0, 1.0}, {-1.0, 6.0, 1.0}, {-1.0, 0.0, 0.0}, { 0.0, 0.0, 0.0}, { 0.0, 6.0, 0.0}, {-1.0, 6.0, 0.0}, { 0.5, 3.0, 1.0}, {-0.35,3.5, 1.0}, {2.0, 6.0, 1.0}, {3.2, 6.0, 1.0}, {3.2, 0.0, 1.0}, {2.0, 0.0, 1.0}, {-0.5,2.0, 1.0}, {0.0, 3.0, 0.0}, {-0.4,3.5, 0.0}, {2.0, 5.9, 0.0}, {3.0, 5.9, 0.0}, {2.8, 0.0, 0.0}, {2.0, 0.0, 0.0}, {-0.5,2.5, 0.0}}; /* each polygonal face references 4 points */ int polygon[NPOLYGONSK][4] = { {0, 1, 2, 3}, /* front face */ {11, 10, 9, 8}, {8, 14, 13, 12}, {8, 9, 14, 14}, {4, 7, 6, 5}, /* back face */ {16,17,18,15}, {15,19,20,21}, {16, 15, 21,21}, {0, 3, 7, 4}, /* side faces */ {1, 5, 6, 2}, {21, 14, 2, 6}, {6, 7, 3, 2}, {4, 5, 1, 0}, {18, 17, 10, 11}, {12, 13, 20, 19}, {10, 17, 16, 9}, {11, 8, 15, 18}, {19, 15, 8, 12}, {13, 14, 21, 20}}; /* color array defines a different color for each face */ GLdouble color[NPOLYGONSK][3] = { {0.3, 0.5, 0.2}, /* front face */ {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, /* back face */ {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.4, 0.6, 0.3}, /* side faces */ {0.6, 0.6, 0.6}, {0.8, 0.8, 0.8}, {0.8, 0.8, 0.8}, {0.9, 0.9, 0.9}, {0.7, 0.8, 0.9}, {0.6, 0.7, 0.8}, {0.2, 0.4, 0.6}, {0.4, 0.1, 0.7}, {0.4, 0.4, 0.4}, {0.5, 0.5, 0.5}}; int face, pt; /* Setup display list */ letterK = glGenLists(1); glNewList (letterK, GL_COMPILE); /* Draw the letter */ for (face = 0; face < NPOLYGONSK; face++) { glColor3dv(color[face]); /* set the color of the face */ glBegin(GL_POLYGON); for (pt = 0; pt < 4; pt++) /* draw all points on the face */ glVertex3dv (point[polygon[face][pt]]); glEnd(); } /* Finish the display list */ glEndList(); } /* draw the letter W in a display list called W */ void drawW (void) { #define NPOINTSW 32 #define NPOLYGONS1 16 #define NPOLYGONS2 13 /* define all the points on the letter */ GLdouble point[NPOINTSW][3] = { {-7.9, 6.0, 1.2}, {-7.3, 0.0, 1.2}, {-5.7, 0.0, 1.2}, {-4.3, 0.0, 1.2}, {-2.7, 0.0, 1.2}, {-2.1, 6.0, 1.2}, {-3.1, 6.0, 1.2}, {-4.3, 6.0, 1.2}, {-5.7, 6.0, 1.2}, {-6.9, 6.0, 1.0}, {-6.0,0.0, 1.0}, {-3.7,0.0, 1.0}, {-5.0,4.0, 1.0}, {-5.0, 6.0, 1.0}, {-6.7, 0.0, 1.0}, {-3.0, 0.0, 1.0}, {-7.9, 6.0, 0.0},/*reverse side starts here*/ {-7.3, 0.0, 0.0}, {-5.7, 0.0, 0.0}, {-4.3, 0.0, 0.0}, {-2.7, 0.0, 0.0}, {-2.1, 6.0, 0.0}, {-3.1, 6.0, 0.0}, {-4.3, 6.0, 0.0}, {-5.7, 6.0, 0.0}, {-6.9, 6.0, 0.0}, {-6.4,1.5, 0.0}, {-3.7,1.5, 0.0}, {-5.0, 3.0, 0.0}, {-5.0, 6.0, 0.0}, {-6.7, 0.0, 0.0}, {-3.4, 0.0, 0.0}}; /* each polygonal face references 4 points */ int polygon1[NPOLYGONS1][4] = { {9, 0, 1, 14}, /* front faces */ {9, 14, 14, 10}, {13, 8, 12, 12}, {8, 14, 2, 12}, {7,13, 12, 3}, {7, 3, 15, 11}, {6,11, 15, 4}, {5, 6, 4, 4}, {16, 25, 26, 30}, /* back faces */ {16, 30, 17, 17}, {30, 24, 29, 28}, {30, 28, 18, 18}, {29, 23, 31, 19}, {29, 19, 28, 28}, {31, 27, 22, 21}, {21, 20, 31, 31}}; /* color array defines a different color for each face */ GLdouble color1[NPOLYGONS1][3] = { {0.3, 0.5, 0.2}, /* front faces */ {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, /* back faces */ {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}, {0.3, 0.5, 0.2}}; /*Side faces: where each polygon refrences to 4 points.*/ int polygon2[NPOLYGONS2][4] = { {0, 16, 17, 1}, {25, 9, 10, 26}, {8, 24, 26, 10}, {23, 7, 11, 27}, {6, 22, 27, 11}, {21, 5, 4, 20}, {25, 16, 0, 9}, {21, 22, 6, 5}, {2, 1, 17, 18}, {4, 3, 19, 20}, {28, 12, 2, 18}, {12, 28, 19, 3}, {23, 24, 8, 7}}; /* color array defines a different color for each face */ GLdouble color2[NPOLYGONS2][3] = { {0.3, 0.3, 0.3}, /* side faces */ {0.3, 0.7, 0.7}, {0.4, 0.4, 0.4}, {0.4, 0.5, 0.7}, {0.5, 0.5, 0.5}, {0.5, 0.6, 0.7}, {0.6, 0.5, 0.6}, {0.6, 0.8, 0.9}, {0.7, 0.7, 0.7}, {0.7, 0.9, 1.0}, {0.9, 0.6, 0.9}, {0.8, 1.0, 0.3}, {0.9, 0.9, 0.9}}; int face, pt; /* Setup display list */ letterW = glGenLists(1); glNewList (letterW, GL_COMPILE); /* Draw the letter */ for (face = 0; face < NPOLYGONS1; face++) { glColor3dv(color1[face]); /* set the color of the face */ glBegin(GL_POLYGON); for (pt = 0; pt < 4; pt++) /* draw all points on the face */ glVertex3dv (point[polygon1[face][pt]]); glEnd(); } for (face = 0; face < NPOLYGONS2; face++) { glColor3dv(color2[face]); /* set the color of the face */ glBegin(GL_POLYGON); for (pt = 0; pt < 4; pt++) /* draw all points on the face */ glVertex3dv (point[polygon2[face][pt]]); glEnd(); } /* Finish the display list */ glEndList(); } /* Setup OpenGL state machine */ static void Init(void) { /* Set background color */ glClearColor(0.0, 0.0, 0.0, 0.0); /* Enable depth buffer */ glEnable(GL_DEPTH_TEST); /* Enable back-face culling */ glCullFace(GL_BACK); glEnable(GL_CULL_FACE); /* Set polygon attributes */ glPolygonMode (GL_FRONT, GL_FILL); /* Set shading & lighting values*/ glShadeModel (GL_FLAT); } /* Window size has changed: adjust viewport and perspective transformations */ static void Reshape(int width, int height) { float aspect; windW = (GLint)width; windH = (GLint)height; aspect = (float)windW / (float)windH; /* Viewport fills the entire window */ glViewport(0, 0, width, height); /* Use orthographic projection to set visibility boundaries relative to viewing coordinates */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective (70.0, aspect, 0.001, 110.0); /* fovy, aspect, near, far */ /* Return to modelview mode */ glMatrixMode(GL_MODELVIEW); } static void Key2(int key,int x,int y) { switch (key) { case GLUT_KEY_LEFT: /* decrease angle about Y axis */ yaw_camera(-5.0); break; case GLUT_KEY_RIGHT: /* increase angle about Y axis */ yaw_camera(5.0); break; case GLUT_KEY_UP: /* decrease angle about X axis */ pitch_camera(-5.0); break; case GLUT_KEY_DOWN: /* increase angle about X axis */ pitch_camera(5.0); break; default: return; } glutPostRedisplay(); /* force update of the display */ } static void Key(unsigned char key, int x, int y) { switch (key) { case 27: /* ESC to quit */ exit(1); case 'r': case 'R': slide_camera (1.0, 0.0, 0.0); /* move camera right */ break; case 'l': case 'L': slide_camera (-1.0, 0.0, 0.0); /* move camera left */ break; case 'u': case 'U': slide_camera (0.0, 1.0, 0.0); /* move camera up */ break; case 'd': case 'D': slide_camera (0.0, -1.0, 0.0); /* move camera down */ break; case 'b': case 'B': slide_camera (0.0, 0.0, 1.0); /* move camera back */ break; case 'f': case 'F': slide_camera (0.0, 0.0, -1.0); /* move camera forward */ break; case 'a': case 'A': if (animate) glutIdleFunc(NULL); else glutIdleFunc(fly); animate = !animate; break; case '+': spin_increment+=0.05; break; case '-': if(spin_increment>=0.05) spin_increment-=0.05; break; case 'w': /* decrease angle about Z axis */ case 'W': roll_camera(-5.0); break; case 'q': /* increase angle about Z axis */ case 'Q': roll_camera(5.0); break; default: return; } glutPostRedisplay(); /* force update of the display */ } /* Set modeling and viewing transformations, then draw the letter polygons */ static void Draw(void) { //int face, pt; /* clear the screen AND the depth buffer */ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* Set the viewing transformation(s) */ glLoadIdentity(); setModelViewMatrix (myCamera); /* Load transformation for camera view */ /* Transform the letters to the correct position (using global values set by "fly") */ glTranslated(20,0,-10); glRotated(spin_angle,0,1,0); glTranslated(-20,0,10); glTranslated(-10,0,0); glRotated(spin_angle,0,1,0); glTranslated(10,0,0); /* Draw the letters */ glCallList(letterW); glCallList(letterK); glCallList(letterI); glFlush(); /* force all changes to be applied to buffer */ glutSwapBuffers(); /* display what you just drew */ } int main() { /* Setup the window that logo will appear in */ windW = 950; windH = 950; glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH); /* Window uses depth buffer, full color, and double buffering */ windType = GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE; glutInitDisplayMode((GLenum)windType); if (glutCreateWindow("Flying Logo") == GL_FALSE) { exit(1); } Init(); drawW();/*Create display list letterW */ drawK();/*Create display list letterK */ drawI(); /* Create display list letterI */ /* Initially center camera on world system, & step back 8 */ init_camera (26.0, 2.0, 55.0, // camera position in world coordinates 1.0, 0.0, 0.0, // u vector (points to the right) 0.0, 1.0, 0.0, // v vector (points up) 0.0, 0.0, 1.0); // n vector (points opposite to line-of-sight) glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutSpecialFunc(Key2); glutDisplayFunc(Draw); glutMainLoop(); return 0; }
[ "waseemilahi@b30cb682-9650-11dd-b20a-03c46e462ecf" ]
[ [ [ 1, 712 ] ] ]
2a43628fbb12a4cd5d23b20fafe1320761d893a1
fb8a3d68c676c977b9b6d3389debd785c2f25634
/Graphics/Library/Include/Graphics.hpp
e97eb1cbebdeb91f3d253a187bb7a58360854935
[]
no_license
skevy/CSC-350-Assignment2
ef1a1e5fae8c9b9ab4ca2b97390974751ad1dedb
98811d2cbbc221af9cc9aa601a990e7969920f7e
refs/heads/master
2021-01-01T20:35:26.246966
2011-02-17T01:57:03
2011-02-17T01:57:03
1,376,632
0
0
null
null
null
null
UTF-8
C++
false
false
4,105
hpp
#ifndef VICTOR_GRAPHICS_HPP #define VICTOR_GRAPHICS_HPP //***************************************************************************// #define DEFAULT_WINDOW_WIDTH 800 #define DEFAULT_WINDOW_HEIGHT 600 //***************************************************************************// //***************************************************************************// // System Includes #include <assert.h> #include <vector> #include <string> //***************************************************************************// // Platform Includes #include <windows.h> //***************************************************************************// #include "Scenes\Scene.hpp" //***************************************************************************// namespace Victor { //*************************************************************************// class Graphics { private: //***********************************************************************// Scene *scene; //-----------------------------------------------------------------------// static HDC smhDeviceContext; static HGLRC smhRenderingContext; static HWND smhWindow; static HINSTANCE smhInstance; //-----------------------------------------------------------------------// //-----------------------------------------------------------------------// unsigned long mulWindowWidth; unsigned long mulWindowHeight; //-----------------------------------------------------------------------// //-----------------------------------------------------------------------// // This member is used to store the index to the current adapter being used. unsigned long mulAdapter; //-----------------------------------------------------------------------// //***********************************************************************// public: //***********************************************************************// //-----------------------------------------------------------------------// Graphics(bool bWindowed, string filename); ~Graphics(); //-----------------------------------------------------------------------// //-----------------------------------------------------------------------// unsigned long GetNumberOfAdapters(); //-----------------------------------------------------------------------// //-----------------------------------------------------------------------// long Initialize(HWND hWindow, unsigned long ulWidth = DEFAULT_WINDOW_WIDTH, unsigned long ulHeight = DEFAULT_WINDOW_HEIGHT); static long Uninitialize(); //-----------------------------------------------------------------------// //-----------------------------------------------------------------------// void WindowDimensions(unsigned long ulWidth, unsigned long ulHeight); unsigned long WindowWidth() const; unsigned long WindowHeight() const; void NearClipPlane(float fNear); float NearClipPlane() const; void FarClipPlane(float fFar); float FarClipPlane() const; void FieldOfVeiw(float fDegrees); float FieldOfView() const; //-----------------------------------------------------------------------// //-----------------------------------------------------------------------// void SetBackBufferSize(unsigned long ulWidth, unsigned long ulHeight); //-----------------------------------------------------------------------// //-----------------------------------------------------------------------// Scene* getActiveScene(); int Render(float fDT); void SwapBuffer(); //-----------------------------------------------------------------------// //***********************************************************************// }; //*************************************************************************// } //***************************************************************************// #endif VICTOR_GRAPHICS_HPP
[ [ [ 1, 102 ] ] ]
2e3785851c8aa0c21ad4c4b175a904fe9f7535e7
c5534a6df16a89e0ae8f53bcd49a6417e8d44409
/trunk/Dependencies/Xerces/include/xercesc/util/regx/RangeTokenMap.cpp
a7d1c00715fecabcdfb321665433bd1f92e67652
[]
no_license
svn2github/ngene
b2cddacf7ec035aa681d5b8989feab3383dac012
61850134a354816161859fe86c2907c8e73dc113
refs/heads/master
2023-09-03T12:34:18.944872
2011-07-27T19:26:04
2011-07-27T19:26:04
78,163,390
2
0
null
null
null
null
UTF-8
C++
false
false
11,161
cpp
/* * Copyright 2001,2004 The Apache Software Foundation. * * 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. */ /* * $Id: RangeTokenMap.cpp 191691 2005-06-21 17:28:38Z cargilld $ */ // --------------------------------------------------------------------------- // Includes // --------------------------------------------------------------------------- #include <xercesc/util/regx/RangeTokenMap.hpp> #include <xercesc/util/regx/RangeToken.hpp> #include <xercesc/util/regx/RegxDefs.hpp> #include <xercesc/util/regx/TokenFactory.hpp> #include <xercesc/util/regx/XMLRangeFactory.hpp> #include <xercesc/util/regx/ASCIIRangeFactory.hpp> #include <xercesc/util/regx/UnicodeRangeFactory.hpp> #include <xercesc/util/regx/BlockRangeFactory.hpp> #include <xercesc/util/PlatformUtils.hpp> #include <xercesc/util/XMLExceptMsgs.hpp> #include <xercesc/util/XMLRegisterCleanup.hpp> #include <xercesc/util/StringPool.hpp> #include <xercesc/util/XMLInitializer.hpp> #include <xercesc/util/OutOfMemoryException.hpp> XERCES_CPP_NAMESPACE_BEGIN // --------------------------------------------------------------------------- // Local static data // --------------------------------------------------------------------------- static XMLMutex* sRangeTokMapMutex = 0; static XMLRegisterCleanup rangeTokMapRegistryCleanup; static XMLRegisterCleanup rangeTokMapInstanceCleanup; // --------------------------------------------------------------------------- // Local, static functions // --------------------------------------------------------------------------- static void reinitRangeTokMapMutex() { delete sRangeTokMapMutex; sRangeTokMapMutex = 0; } static XMLMutex& getRangeTokMapMutex() { if (!sRangeTokMapMutex) { XMLMutexLock lock(XMLPlatformUtils::fgAtomicMutex); // If we got here first, then register it and set the registered flag if (!sRangeTokMapMutex) { sRangeTokMapMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager); rangeTokMapRegistryCleanup.registerCleanup(reinitRangeTokMapMutex); } } return *sRangeTokMapMutex; } // --------------------------------------------------------------------------- // Static member data initialization // --------------------------------------------------------------------------- RangeTokenMap* RangeTokenMap::fInstance = 0; void XMLInitializer::initializeRangeTokenMap() { RangeTokenMap::fInstance = new RangeTokenMap(XMLPlatformUtils::fgMemoryManager); if (RangeTokenMap::fInstance) { rangeTokMapInstanceCleanup.registerCleanup(RangeTokenMap::reinitInstance); RangeTokenMap::fInstance->buildTokenRanges(); } } // --------------------------------------------------------------------------- // RangeTokenElemMap: Constructors and Destructor // --------------------------------------------------------------------------- RangeTokenElemMap::RangeTokenElemMap(unsigned int categoryId) : fCategoryId(categoryId) , fRange(0) , fNRange(0) { } RangeTokenElemMap::~RangeTokenElemMap() { } // --------------------------------------------------------------------------- // RangeTokenMap: Constructors and Destructor // --------------------------------------------------------------------------- typedef JanitorMemFunCall<RangeTokenMap> CleanupType; RangeTokenMap::RangeTokenMap(MemoryManager* manager) : fTokenRegistry(0) , fRangeMap(0) , fCategories(0) , fTokenFactory(0) , fMutex(manager) { CleanupType cleanup(this, &RangeTokenMap::cleanUp); try { fTokenRegistry = new (manager) RefHashTableOf<RangeTokenElemMap>(109, manager); fRangeMap = new (manager) RefHashTableOf<RangeFactory>(29, manager); fCategories = new (manager) XMLStringPool(109, manager); fTokenFactory = new (manager) TokenFactory(manager); initializeRegistry(); } catch(const OutOfMemoryException&) { cleanup.release(); throw; } cleanup.release(); } RangeTokenMap::~RangeTokenMap() { cleanUp(); } // --------------------------------------------------------------------------- // RangeTokenMap: Getter methods // --------------------------------------------------------------------------- RangeToken* RangeTokenMap::getRange(const XMLCh* const keyword, const bool complement) { if (!fTokenRegistry->containsKey(keyword)) return 0; RangeTokenElemMap* elemMap = fTokenRegistry->get(keyword); RangeToken* rangeTok = elemMap->getRangeToken(complement); if (!rangeTok) { XMLMutexLock lockInit(&fMutex); // make sure that it was not created while we were locked rangeTok = elemMap->getRangeToken(complement); if (!rangeTok) { unsigned int categId = elemMap->getCategoryId(); const XMLCh* categName = fCategories->getValueForId(categId); RangeFactory* rangeFactory = fRangeMap->get(categName); if (rangeFactory) { rangeFactory->buildRanges(this); rangeTok = elemMap->getRangeToken(complement); // see if we are complementing an existing range if (!rangeTok && complement) { rangeTok = elemMap->getRangeToken(); if (rangeTok) { rangeTok = (RangeToken*) RangeToken::complementRanges(rangeTok, fTokenFactory, fTokenRegistry->getMemoryManager()); elemMap->setRangeToken(rangeTok , complement); } } } } } return rangeTok; } // --------------------------------------------------------------------------- // RangeTokenMap: Putter methods // --------------------------------------------------------------------------- void RangeTokenMap::addCategory(const XMLCh* const categoryName) { fCategories->addOrFind(categoryName); } void RangeTokenMap::addRangeMap(const XMLCh* const categoryName, RangeFactory* const rangeFactory) { fRangeMap->put((void*)categoryName, rangeFactory); } void RangeTokenMap::addKeywordMap(const XMLCh* const keyword, const XMLCh* const categoryName) { unsigned int categId = fCategories->getId(categoryName); if (categId == 0) { ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Regex_InvalidCategoryName, categoryName, fTokenRegistry->getMemoryManager()); } if (fTokenRegistry->containsKey(keyword)) { RangeTokenElemMap* elemMap = fTokenRegistry->get(keyword); if (elemMap->getCategoryId() != categId) elemMap->setCategoryId(categId); return; } fTokenRegistry->put((void*) keyword, new RangeTokenElemMap(categId)); } // --------------------------------------------------------------------------- // RangeTokenMap: Setter methods // --------------------------------------------------------------------------- void RangeTokenMap::setRangeToken(const XMLCh* const keyword, RangeToken* const tok,const bool complement) { if (fTokenRegistry->containsKey(keyword)) { fTokenRegistry->get(keyword)->setRangeToken(tok, complement); } else { ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Regex_KeywordNotFound, keyword, fTokenRegistry->getMemoryManager()); } } // --------------------------------------------------------------------------- // RangeTokenMap: Initialization methods // --------------------------------------------------------------------------- void RangeTokenMap::initializeRegistry() { // Add categories fCategories->addOrFind(fgXMLCategory); fCategories->addOrFind(fgASCIICategory); fCategories->addOrFind(fgUnicodeCategory); fCategories->addOrFind(fgBlockCategory); // Add xml range factory RangeFactory* rangeFact = new XMLRangeFactory(); fRangeMap->put((void*)fgXMLCategory, rangeFact); rangeFact->initializeKeywordMap(this); // Add ascii range factory rangeFact = new ASCIIRangeFactory(); fRangeMap->put((void*)fgASCIICategory, rangeFact); rangeFact->initializeKeywordMap(this); // Add unicode range factory rangeFact = new UnicodeRangeFactory(); fRangeMap->put((void*)fgUnicodeCategory, rangeFact); rangeFact->initializeKeywordMap(this); // Add block range factory rangeFact = new BlockRangeFactory(); fRangeMap->put((void*)fgBlockCategory, rangeFact); rangeFact->initializeKeywordMap(this); } void RangeTokenMap::buildTokenRanges() { // Build ranges */ RangeFactory* rangeFactory = fRangeMap->get(fgXMLCategory); rangeFactory->buildRanges(this); rangeFactory = fRangeMap->get(fgASCIICategory); rangeFactory->buildRanges(this); rangeFactory = fRangeMap->get(fgUnicodeCategory); rangeFactory->buildRanges(this); rangeFactory = fRangeMap->get(fgBlockCategory); rangeFactory->buildRanges(this); } // --------------------------------------------------------------------------- // RangeTokenMap: Instance methods // --------------------------------------------------------------------------- RangeTokenMap* RangeTokenMap::instance() { if (!fInstance) { XMLMutexLock lock(&getRangeTokMapMutex()); if (!fInstance) { fInstance = new RangeTokenMap(XMLPlatformUtils::fgMemoryManager); rangeTokMapInstanceCleanup.registerCleanup(RangeTokenMap::reinitInstance); } } return (fInstance); } // --------------------------------------------------------------------------- // RangeTokenMap: helper methods // --------------------------------------------------------------------------- void RangeTokenMap::cleanUp() { delete fTokenRegistry; fTokenRegistry = 0; delete fRangeMap; fRangeMap = 0; delete fCategories; fCategories = 0; delete fTokenFactory; fTokenFactory = 0; } // ----------------------------------------------------------------------- // Notification that lazy data has been deleted // ----------------------------------------------------------------------- void RangeTokenMap::reinitInstance() { delete fInstance; fInstance = 0; } XERCES_CPP_NAMESPACE_END /** * End of file RangeTokenMap.cpp */
[ "Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57" ]
[ [ [ 1, 339 ] ] ]
75fbf710b3ae27f09e5d3801f0aa726ea9f8872e
2a0a607b23961936b9bda50ba7ebcf1dbd181fc5
/src/unittest/old/CoordinateTransformTest.h
01b94506981178ee1d9de1c8b3bfd455145326f5
[]
no_license
egparedes/tinysg
ba7ab579e0cc42fb5c6ffaaaf29a31603506331f
1d6a8f49f29c753cc02722e2262127fd377849f2
refs/heads/master
2021-01-10T12:31:08.437564
2010-06-10T21:01:03
2010-06-10T21:01:03
47,564,405
0
0
null
null
null
null
UTF-8
C++
false
false
753
h
/* * CoordinateTransformTest.h * * Created on: Aug 12, 2008 * Author: yamokosk */ #ifndef COORDINATETRANSFORMTEST_H_ #define COORDINATETRANSFORMTEST_H_ // Logging #include <log4cxx/logger.h> // CppUnit #include <cppunit/extensions/HelperMacros.h> // Class to test #include <CoordinateTransform.h> class CoordinateTransformTest: public CPPUNIT_NS::TestFixture { static log4cxx::LoggerPtr logger; CPPUNIT_TEST_SUITE(CoordinateTransformTest); CPPUNIT_TEST(testUpdateCachedTransform); CPPUNIT_TEST_SUITE_END(); private: // Member variables here public: void setUp(); void tearDown(); protected: // Unittest declarations void testUpdateCachedTransform(); }; #endif /* COORDINATETRANSFORMTEST_H_ */
[ [ [ 1, 35 ] ] ]
29f04f977bf7e5490cb1a0f22cbbbc2882491db5
ee054a19fa820fb1e4440e3d31930ffe7726ae60
/cppsrc/include/geom2d.hpp
4a8b8f58220f9fb354b79b712fa0e3814b6c4dc5
[]
no_license
cmbruns/opencmbcv
e45dbade61010d6e08c9fb597d97538bc15a7a1a
9725fce3ddce1ab24b347475ec81e4ea001b8c91
refs/heads/master
2020-05-30T12:14:02.503305
2010-07-25T22:32:22
2010-07-25T22:32:22
32,115,060
0
0
null
null
null
null
UTF-8
C++
false
false
9,202
hpp
#ifndef CMBCV_GEOM2D_HPP_ #define CMBCV_GEOM2D_HPP_ #include <cassert> #include <iostream> // These classes are intended to be wrapped using boost.python, // with an efficient C++ API and a nearly syntactically identical python API namespace cmbcv { // "floats" in python are C++ doubles. So use double. typedef double real_t; // vec_t<int> class defines indexing, equality, and printing for use // by other classes. // But reuse will be by containment, rather than inheritance. template<unsigned int DIM> class vec_t { public: typedef real_t value_type; typedef value_type* iterator; typedef value_type const * const_iterator; protected: value_type data[DIM]; public: unsigned int size() const {return DIM;} const value_type& operator[](int ix) const { assert(ix >= 0); assert(ix < DIM); return data[ix]; } value_type& operator[](int ix) { assert(ix >= 0); assert(ix < DIM); return data[ix]; } bool operator!=(const vec_t& rhs) const { const vec_t& lhs = *this; // There exist tricks to force the compiler to unroll these loops, // but that's probably overkill at this point. // (see SimTK Vec.h Impl:: namespace) for (unsigned int ix(0); ix < size(); ++ix) if (lhs[ix] != rhs[ix]) return true; return false; } bool operator==(const vec_t& rhs) const { const vec_t& lhs = *this; return !(lhs != rhs); } std::ostream& print(std::ostream& os) const { const vec_t& v = *this; os << "~["; for (unsigned int ix(0); ix < size(); ++ix) { if (ix > 0) os << ", "; os << v[ix]; } os << "]"; return os; } // begin and end methods help with boost python indexing const_iterator begin() const {return &data[0];} iterator begin() {return &data[0];} const_iterator end() const {return &data[DIM];} iterator end() {return &data[DIM];} }; class vec2_t { public: typedef vec_t<2> vector_type; typedef vector_type::value_type value_type; typedef vector_type::iterator iterator; typedef vector_type::const_iterator const_iterator; // Use union to permit specifying content by members x, y union { vector_type vec; struct { value_type x, y; }; }; vec2_t(value_type x, value_type y) : x(x), y(y) {} unsigned int size() const {return vec.size();} value_type& operator[](int ix) {return vec[ix];} const value_type& operator[](int ix) const {return vec[ix];} bool operator!=(const vec2_t& rhs) const { return this->vec != rhs.vec; } bool operator==(const vec2_t& rhs) const { return this->vec == rhs.vec; } std::ostream& print(std::ostream& os) const { return vec.print(os); } // begin and end methods help with boost python indexing const_iterator begin() const {return vec.begin();} iterator begin() {return vec.begin();} const_iterator end() const {return vec.end();} iterator end() {return vec.end();} }; class vec3_t { public: typedef vec_t<3> vector_type; typedef vector_type::value_type value_type; typedef vector_type::iterator iterator; typedef vector_type::const_iterator const_iterator; // Use union to permit specifying content by members x, y, z union { vector_type vec; struct { value_type x, y, z; }; }; vec3_t(value_type x, value_type y, value_type z) : x(x), y(y), z(z) {} unsigned int size() const {return vec.size();} value_type& operator[](int ix) {return vec[ix];} const value_type& operator[](int ix) const {return vec[ix];} bool operator!=(const vec3_t& rhs) const { return this->vec != rhs.vec; } bool operator==(const vec3_t& rhs) const { return this->vec == rhs.vec; } std::ostream& print(std::ostream& os) const { return vec.print(os); } vec3_t cross(const vec3_t& rhs) const { const vec3_t& lhs = *this; return vec3_t( lhs[1]*rhs[2] - lhs[2]*rhs[1], lhs[2]*rhs[0] - lhs[0]*rhs[2], lhs[0]*rhs[1] - lhs[1]*rhs[0]); } }; // forward declaration class line2_t; // define homogeneous_point2_t before point2_t to ease making conversion // homogeneous_point2_t => point2_t explicit (expensive), but // point2_t => homogeneous_point2_t implicit (cheap) class homogeneous_point2_t { public: typedef vec_t<3> vector_type; typedef vector_type::value_type value_type; typedef vector_type::iterator iterator; typedef vector_type::const_iterator const_iterator; // Use union to permit specifying content by members x, y, w union { vector_type vec; struct { value_type x, y, w; }; }; homogeneous_point2_t(value_type x, value_type y, value_type w = 1.0) : x(x), y(y), w(w) {} /// Returns the line joining two points line2_t line(const homogeneous_point2_t& rhs) const; unsigned int size() const {return asVec3().size();} value_type& operator[](int ix) {return asVec3()[ix];} const value_type& operator[](int ix) const {return asVec3()[ix];} bool operator!=(const homogeneous_point2_t& rhs) const { return asVec3() != rhs.asVec3(); } bool operator==(const homogeneous_point2_t& rhs) const { return asVec3() == rhs.asVec3(); } std::ostream& print(std::ostream& os) const { return asVec3().print(os); } // interconversion with vec3 to ease use of cross product for intersection // Q: Is this constructor more expensive than a reinterpret cast? // A: Probably not when called as the return value in a method. explicit homogeneous_point2_t(const vec3_t& vec3) : x(vec3.x), y(vec3.y), w(vec3.z) {} protected: const vec3_t& asVec3() const { return reinterpret_cast<const vec3_t&>(*this); } vec3_t& asVec3() { return reinterpret_cast<vec3_t&>(*this); } }; // point2_t describes pixel coordinates in an image. // point2_t represents a column vector. class point2_t : public vec2_t { public: point2_t(value_type x, value_type y) : vec2_t(x,y) {} // point2 => homogeneous_point2 is cheap; // the reverse is not. explicit point2_t(const homogeneous_point2_t& hp) : vec2_t(hp.x/hp.w, hp.y/hp.w) {} // implicit conversion to homogeneous_point2_t is cheap operator homogeneous_point2_t() const { return homogeneous_point2_t(x, y, 1.0); } }; class line2_t { public: typedef vec_t<3> vector_type; typedef vector_type::value_type value_type; typedef vector_type::iterator iterator; typedef vector_type::const_iterator const_iterator; union { vector_type vec; // equation of the line ax + by + c = 0 struct { value_type a, b, c; }; }; line2_t(value_type a, value_type b, value_type c) : a(a), b(b), c(c) {} value_type& operator[](int ix) {return asVec3()[ix];} const value_type& operator[](int ix) const {return asVec3()[ix];} /// Compute the point of intersection of two lines homogeneous_point2_t intersection(const line2_t& rhs) const { const line2_t& lhs = *this; // abuse vec3 cross product to get answer vec3_t v = lhs.asVec3().cross(rhs.asVec3()); return homogeneous_point2_t(v); } // interconversion with vec3 to ease use of cross product for intersection // Q: Is this constructor more expensive than a reinterpret cast? // A: Probably not when called as the return value in a method. explicit line2_t(const vec3_t& vec3) : a(vec3.x), b(vec3.y), c(vec3.z) {} protected: const vec3_t& asVec3() const { return reinterpret_cast<const vec3_t&>(*this); } vec3_t& asVec3() { return reinterpret_cast<vec3_t&>(*this); } }; std::ostream& operator<<(std::ostream& os, const cmbcv::point2_t& p); } // namespace cmbcv #endif // CMBCV_GEOM2D_HPP_
[ "Christopher.Bruns@1f01f6ea-e675-d132-ccb2-4cd361804335" ]
[ [ [ 1, 286 ] ] ]
1ab8e1efe740ade5d1c228f359893e1ade3ce5a0
9c62af23e0a1faea5aaa8dd328ba1d82688823a5
/rl/tags/v0-1/engine/rules/include/Combat.h
f604632fefbafe261067ed4a5cd51983d580ae2d
[ "ClArtistic", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
jacmoe/dsa-hl-svn
55b05b6f28b0b8b216eac7b0f9eedf650d116f85
97798e1f54df9d5785fb206c7165cd011c611560
refs/heads/master
2021-04-22T12:07:43.389214
2009-11-27T22:01:03
2009-11-27T22:01:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,361
h
/* This source file is part of Rastullahs Lockenpracht. * Copyright (C) 2003-2005 Team Pantheon. http://www.team-pantheon.de * * This program is free software; you can redistribute it and/or modify * it under the terms of the Clarified Artistic 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 * Clarified Artistic License for more details. * * You should have received a copy of the Clarified Artistic License * along with this program; if not you can get it here * http://www.jpaulmorrison.com/fbp/artistic2.htm. */ #ifndef __Combat_H__ #define __Combat_H__ #include "RulesPrerequisites.h" #include <stack> #include <vector> #include "EventSource.h" #include "EventCaster.h" #include "CombatEvents.h" #include "GameTask.h" namespace rl { enum MoveType { MT_NO_WALK, MT_WALK, MT_RUN, MT_WALK_IN_PA_PHASE, MT_WALK_IN_AT_PHASE, MT_WALK_IN_AT_PA_PHASE, MT_RUN_IN_AT_PA_PHASE }; class Creature; class CombatAction; class CombatActionAttack; class CombatActionMove; class CombatActionParee; class CombatTest; /** * Verwaltungsklasse fuer einen Kampf */ class _RlRulesExport Combat : public EventSource, public GameTask { friend class CombatTest; public: static const int ACTION_TIME_OVER = 0; Combat(int slowMotionFactor = 1.0); ~Combat(); /** * Laesst eine Creature am Kampf teilnehmen * * @param creature die Kreatur * @param group die Partei, in der die Kreatur kaempft */ void add(Creature* creature, int group); /** * Gibt alle Mitglieder einer Kampfpartei zurueck * @param group die Partei * @param eine Vector mit allen Mitgliedern der Partei */ std::vector<Creature*> getGroupMembers(int group); /** * Gibt die Partei zurueck, der ein Wesen in diesem Kampf angehoert */ int getGroupOf(Creature* creature); Creature* getAttackeTarget(Creature* creature); void setAttackeTarget(Creature* creature, Creature* target); Creature* getParadeTarget(Creature* creature); void setParadeTarget(Creature* creature, Creature* target); void setNextAction(Creature* creature, CombatAction* action, int eventId = -1); void setNextReaction(Creature* creature, CombatAction* action, int eventId = -1); Ogre::Real getMaxMoveDistance(MoveType action); void doAttacke(Creature* creature); bool isInAttackDistance(Creature* attacker, Creature* target); Creature* getNext(); Creature* getNext(int group); bool isActionPhaseDone(Creature* actor); void addCombatEventListener(CombatEventListener* listener); void removeCombatEventListener(CombatEventListener* listener); void run(Ogre::Real elapsedTime); void start(); private: static const int INI_START = 99999999; static const int NO_INI = -9999999; /** * Speichert alle Daten, die eine Kreatur in diesem Kampf hat */ class Participant { public: Participant(Creature* creature, int group, int no); //Wesen und Gruppe Creature* creature; int group; int id; //DSA-Daten int initiative; int pareesLeft; //Naechste Vorhaben Creature* attackeTarget; Creature* paradeTarget; CombatAction* nextAction; CombatAction* nextReaction; CombatAction* nextKRAction; CombatAction* nextKRReaction; }; typedef std::map<Creature*, Participant*> CombatMap; class CombatEvt { public: CombatEvt(int ini, int iniIdx, bool isAction, Participant* part, CombatAction* action); int ini; int iniIdx; int id; bool isAction; Participant* part; CombatAction* action; static int sId; }; typedef std::pair<int, long> CombatTime; // INI, vergangene Zeit in dieser INI-Phase typedef std::map<CombatTime, CombatEvt*> CombatEventList; CombatEventList mEventList; Participant* getParticipant(Creature* creature); void initialize(Participant* creature); void initializeKampfrunde(); int mCurrentInitiative; int mKampfrunde; Ogre::Real mCurrentIniTime; Ogre::Real mCurrentEventStart; Ogre::Real mTimeInKampfrunde; std::vector<CombatEvt*> mEventStack; CombatMap mParticipants; int mSlowMotionFactor; bool mIsSlowMotion; Ogre::Real mTimeOfAction; bool mStarted; std::map<int, EventCaster<CombatEvent> > mEventCasters; CombatEventList::const_iterator findNextCombatEvent(const CombatEventList& eventList); bool processEvent(CombatEvt* evt); void sendStartEvent(CombatEvt* evt); void sendStopEvent(CombatEvt* evt); bool processAttack(Participant* part, CombatActionAttack* attack); bool processMove(Participant* part, CombatActionMove* move); bool processParee(Participant* part, CombatActionParee* paree, CombatActionAttack* attack); CombatEvt* getLastEvent(); CombatEvt* getSecondLastEvent(); bool canDefend(Participant* defender, Participant* attacker); void executeAttacke(Participant* attacker, Participant* defender); int getAttackeModifier(Participant* attacker); int getParadeModifier(Participant* defender); void popEventStack(); }; } #endif //__Combat_H__
[ "blakharaz@4c79e8ff-cfd4-0310-af45-a38c79f83013" ]
[ [ [ 1, 203 ] ] ]