blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
5
146
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
16
author_lines
sequencelengths
1
16
2a84ecebf71e01fef083f2c61335dd8787c0a9dc
9426ad6e612863451ad7aac2ad8c8dd100a37a98
/ULLib/include/ULStatusBarCtrl.h
792453bbc657d161b4ae43e0b7a9c51b9c711a1e
[]
no_license
piroxiljin/ullib
61f7bd176c6088d42fd5aa38a4ba5d4825becd35
7072af667b6d91a3afd2f64310c6e1f3f6a055b1
refs/heads/master
2020-12-28T19:46:57.920199
2010-02-17T01:43:44
2010-02-17T01:43:44
57,068,293
0
0
null
2016-04-25T19:05:41
2016-04-25T19:05:41
null
WINDOWS-1251
C++
false
false
1,736
h
///\file ULStatusBarCtrl.h ///\brief Заголовочный файл класса статусбара размещенного на плавающей панельке(12.10.2007) #pragma once #ifndef __UL_ULSTATUSBARCTRL_H__ #define __UL_ULSTATUSBARCTRL_H__ #include "ULWndCtrl.h" #include "ULStatusBar.h" namespace ULWnds { namespace ULWndCtrls { ///\class CULStatusBarCtrl ///\brief Класс статусбара размещенного на плавающей панельке(12.10.2007) class CULStatusBarCtrl: public CULWndCtrl { protected: ///\brief Непосредственно сам статубар ULBars::CULStatusBar m_StatusBar; public: ///\brief Конструктор CULStatusBarCtrl(void); ///\brief Конструктор копирования CULStatusBarCtrl(CULStatusBarCtrl&); ///\brief Деструктор virtual ~CULStatusBarCtrl(void); ///\brief оператор копирования void operator=(CULStatusBarCtrl&); ///\brief Функция возвращает ссылку на статубар inline ULBars::CULStatusBar& GetStatusBar(){return m_StatusBar;}; ///\brief Функция создания статусбарконтрола ///\param hParentWnd - хендл родителя(носителя) ///\param nStatusID - ID статусбара ///\param fGrip - разметка на статусбаре для изменения размеров BOOL CreateStatusBar(HWND hParentWnd,short nStatusID,BOOL fGrip=TRUE); protected: ///\brief Обработчик WM_SIZE virtual LRESULT OnSize(WPARAM nType,LPARAM size); }; } } #endif //__UL_ULSTATUSBARCTRL_H__
[ "UncleLab@a8b69a72-a546-0410-9fb4-5106a01aa11f" ]
[ [ [ 1, 42 ] ] ]
b4e1ed7293aadfee796e885c8849da09913d34be
9433cf978aa6b010903c134d77c74719f22efdeb
/src/svl/Mat.cpp
7ad818ded478cf117e5f7ab58ec65a95a5986625
[]
no_license
brandonagr/gpstracktime
4666575cb913db2c9b3b8aa6b40a3ba1a3defb2f
842bfd9698ec48debb6756a9acb2f40fd6041f9c
refs/heads/master
2021-01-20T07:10:58.579764
2008-09-24T05:44:56
2008-09-24T05:44:56
32,090,265
0
0
null
null
null
null
UTF-8
C++
false
false
14,309
cpp
/* File: Mat.cpp Function: Implements Mat.h Author(s): Andrew Willmott Copyright: (c) 1995-2001, Andrew Willmott */ #include "svl/Mat.h" #include <cctype> #include <cstring> #include <cstdarg> #include <iomanip> // --- Mat Constructors & Destructors ----------------------------------------- Mat::Mat(Int rows, Int cols, ZeroOrOne k) : rows(rows), cols(cols) { Assert(rows > 0 && cols > 0, "(Mat) illegal matrix size"); data = new Real[rows * cols]; MakeDiag(k); } Mat::Mat(Int rows, Int cols, Block k) : rows(rows), cols(cols) { Assert(rows > 0 && cols > 0, "(Mat) illegal matrix size"); data = new Real[rows * cols]; MakeBlock(k); } Mat::Mat(Int rows, Int cols, double elt0, ...) : rows(rows), cols(cols) // The double is hardwired here because it is the only type that will work // with var args and C++ real numbers. { Assert(rows > 0 && cols > 0, "(Mat) illegal matrix size"); va_list ap; Int i, j; data = new Real[rows * cols]; va_start(ap, elt0); SetReal(data[0], elt0); for (i = 1; i < cols; i++) SetReal(Elt(0, i), va_arg(ap, double)); for (i = 1; i < rows; i++) for (j = 0; j < cols; j++) SetReal(Elt(i, j), va_arg(ap, double)); va_end(ap); } Mat::Mat(const Mat &m) : cols(m.cols) { Assert(m.data != 0, "(Mat) Can't construct from null matrix"); rows = m.Rows(); UInt elts = rows * cols; data = new Real[elts]; #ifdef VL_USE_MEMCPY memcpy(data, m.data, elts * sizeof(Real)); #else for (UInt i = 0; i < elts; i++) data[i] = m.data[i]; #endif } Mat::Mat(const Mat2 &m) : data(m.Ref()), rows(2 | VL_REF_FLAG), cols(2) { } Mat::Mat(const Mat3 &m) : data(m.Ref()), rows(3 | VL_REF_FLAG), cols(3) { } Mat::Mat(const Mat4 &m) : data(m.Ref()), rows(4 | VL_REF_FLAG), cols(4) { } // --- Mat Assignment Operators ----------------------------------------------- Mat &Mat::operator = (const Mat &m) { if (!IsRef()) SetSize(m.Rows(), m.Cols()); else Assert(Rows() == m.Rows(), "(Mat::=) Matrix rows don't match"); for (Int i = 0; i < Rows(); i++) SELF[i] = m[i]; return(SELF); } Mat &Mat::operator = (const Mat2 &m) { if (!IsRef()) SetSize(m.Rows(), m.Cols()); else Assert(Rows() == m.Rows(), "(Mat::=) Matrix rows don't match"); for (Int i = 0; i < Rows(); i++) SELF[i] = m[i]; return(SELF); } Mat &Mat::operator = (const Mat3 &m) { if (!IsRef()) SetSize(m.Rows(), m.Cols()); else Assert(Rows() == m.Rows(), "(Mat::=) Matrix rows don't match"); for (Int i = 0; i < Rows(); i++) SELF[i] = m[i]; return(SELF); } Mat &Mat::operator = (const Mat4 &m) { if (!IsRef()) SetSize(m.Rows(), m.Cols()); else Assert(Rows() == m.Rows(), "(Mat::=) Matrix rows don't match"); for (Int i = 0; i < Rows(); i++) SELF[i] = m[i]; return(SELF); } Void Mat::SetSize(Int nrows, Int ncols) { UInt elts = nrows * ncols; Assert(nrows > 0 && ncols > 0, "(Mat::SetSize) Illegal matrix size."); UInt oldElts = Rows() * Cols(); if (IsRef()) { // Abort! We don't allow this operation on references. _Error("(Mat::SetSize) Trying to resize a matrix reference"); } rows = nrows; cols = ncols; // Don't reallocate if we already have enough storage if (elts <= oldElts) return; // Otherwise, delete old storage and reallocate delete[] data; data = 0; data = new Real[elts]; // may throw an exception } Void Mat::SetSize(const Mat &m) { SetSize(m.Rows(), m.Cols()); } Void Mat::MakeZero() { #ifdef VL_USE_MEMCPY memset(data, 0, sizeof(Real) * Rows() * Cols()); #else Int i; for (i = 0; i < Rows(); i++) SELF[i] = vl_zero; #endif } Void Mat::MakeDiag(Real k) { Int i, j; for (i = 0; i < Rows(); i++) for (j = 0; j < Cols(); j++) if (i == j) Elt(i,j) = k; else Elt(i,j) = vl_zero; } Void Mat::MakeDiag() { Int i, j; for (i = 0; i < Rows(); i++) for (j = 0; j < Cols(); j++) Elt(i,j) = (i == j) ? vl_one : vl_zero; } Void Mat::MakeBlock(Real k) { Int i; for (i = 0; i < Rows(); i++) SELF[i].MakeBlock(k); } Void Mat::MakeBlock() { Int i, j; for (i = 0; i < Rows(); i++) for (j = 0; j < Cols(); j++) Elt(i,j) = vl_one; } // --- Mat Assignment Operators ----------------------------------------------- Mat &Mat::operator += (const Mat &m) { Assert(Rows() == m.Rows(), "(Mat::+=) matrix rows don't match"); Int i; for (i = 0; i < Rows(); i++) SELF[i] += m[i]; return(SELF); } Mat &Mat::operator -= (const Mat &m) { Assert(Rows() == m.Rows(), "(Mat::-=) matrix rows don't match"); Int i; for (i = 0; i < Rows(); i++) SELF[i] -= m[i]; return(SELF); } Mat &Mat::operator *= (const Mat &m) { Assert(Cols() == m.Cols(), "(Mat::*=) matrix columns don't match"); Int i; for (i = 0; i < Rows(); i++) SELF[i] = SELF[i] * m; return(SELF); } Mat &Mat::operator *= (Real s) { Int i; for (i = 0; i < Rows(); i++) SELF[i] *= s; return(SELF); } Mat &Mat::operator /= (Real s) { Int i; for (i = 0; i < Rows(); i++) SELF[i] /= s; return(SELF); } // --- Mat Comparison Operators ----------------------------------------------- Bool operator == (const Mat &m, const Mat &n) { Assert(n.Rows() == m.Rows(), "(Mat::==) matrix rows don't match"); Int i; for (i = 0; i < m.Rows(); i++) if (m[i] != n[i]) return(0); return(1); } Bool operator != (const Mat &m, const Mat &n) { Assert(n.Rows() == m.Rows(), "(Mat::!=) matrix rows don't match"); Int i; for (i = 0; i < m.Rows(); i++) if (m[i] != n[i]) return(1); return(0); } // --- Mat Arithmetic Operators ----------------------------------------------- Mat operator + (const Mat &m, const Mat &n) { Assert(n.Rows() == m.Rows(), "(Mat::+) matrix rows don't match"); Mat result(m.Rows(), m.Cols()); Int i; for (i = 0; i < m.Rows(); i++) result[i] = m[i] + n[i]; return(result); } Mat operator - (const Mat &m, const Mat &n) { Assert(n.Rows() == m.Rows(), "(Mat::-) matrix rows don't match"); Mat result(m.Rows(), m.Cols()); Int i; for (i = 0; i < m.Rows(); i++) result[i] = m[i] - n[i]; return(result); } Mat operator - (const Mat &m) { Mat result(m.Rows(), m.Cols()); Int i; for (i = 0; i < m.Rows(); i++) result[i] = -m[i]; return(result); } Mat operator * (const Mat &m, const Mat &n) { Assert(m.Cols() == n.Rows(), "(Mat::*m) matrix cols don't match"); Mat result(m.Rows(), n.Cols()); Int i; for (i = 0; i < m.Rows(); i++) result[i] = m[i] * n; return(result); } Vec operator * (const Mat &m, const Vec &v) { Assert(m.Cols() == v.Elts(), "(Mat::*v) matrix and vector sizes don't match"); Int i; Vec result(m.Rows()); for (i = 0; i < m.Rows(); i++) result[i] = dot(v, m[i]); return(result); } Mat operator * (const Mat &m, Real s) { Int i; Mat result(m.Rows(), m.Cols()); for (i = 0; i < m.Rows(); i++) result[i] = m[i] * s; return(result); } Mat operator / (const Mat &m, Real s) { Int i; Mat result(m.Rows(), m.Cols()); for (i = 0; i < m.Rows(); i++) result[i] = m[i] / s; return(result); } // --- Mat Mat-Vec Functions -------------------------------------------------- Vec operator * (const Vec &v, const Mat &m) // v * m { Assert(v.Elts() == m.Rows(), "(Mat::v*m) vector/matrix sizes don't match"); Vec result(m.Cols(), vl_zero); Int i; for (i = 0; i < m.Rows(); i++) result += m[i] * v[i]; return(result); } // --- Mat Special Functions -------------------------------------------------- Mat trans(const Mat &m) { Int i,j; Mat result(m.Cols(), m.Rows()); for (i = 0; i < m.Rows(); i++) for (j = 0; j < m.Cols(); j++) result.Elt(j,i) = m.Elt(i,j); return(result); } Real trace(const Mat &m) { Int i; Real result = vl_0; for (i = 0; i < m.Rows(); i++) result += m.Elt(i,i); return(result); } Mat &Mat::Clamp(Real fuzz) // clamps all values of the matrix with a magnitude // smaller than fuzz to zero. { Int i; for (i = 0; i < Rows(); i++) SELF[i].Clamp(fuzz); return(SELF); } Mat &Mat::Clamp() { return(Clamp(1e-7)); } Mat clamped(const Mat &m, Real fuzz) // clamps all values of the matrix with a magnitude // smaller than fuzz to zero. { Mat result(m); return(result.Clamp(fuzz)); } Mat clamped(const Mat &m) { return(clamped(m, 1e-7)); } Mat oprod(const Vec &a, const Vec &b) // returns outerproduct of a and b: a * trans(b) { Mat result; Int i; result.SetSize(a.Elts(), b.Elts()); for (i = 0; i < a.Elts(); i++) result[i] = a[i] * b; return(result); } // --- Mat Input & Output ----------------------------------------------------- ostream &operator << (ostream &s, const Mat &m) { Int i, w = s.width(); s << '['; for (i = 0; i < m.Rows() - 1; i++) s << setw(w) << m[i] << endl; s << setw(w) << m[i] << ']' << endl; return(s); } inline Void CopyPartialMat(const Mat &m, Mat &n, Int numRows) { for (Int i = 0; i < numRows; i++) n[i] = m[i]; } istream &operator >> (istream &s, Mat &m) { Int size = 1; Char c; Mat inMat; // Expected format: [row0 row1 row2 ...] while (isspace(s.peek())) // chomp white space s.get(c); if (s.peek() == '[') { Vec row; s.get(c); s >> row; inMat.SetSize(2 * row.Elts(), row.Elts()); inMat[0] = row; while (isspace(s.peek())) // chomp white space s.get(c); while (s.peek() != ']') // resize if needed { if (size == inMat.Rows()) { Mat holdMat(inMat); inMat.SetSize(size * 2, inMat.Cols()); CopyPartialMat(holdMat, inMat, size); } s >> row; // read a row inMat[size++] = row; if (!s) { _Warning("Couldn't read matrix row"); return(s); } while (isspace(s.peek())) // chomp white space s.get(c); } s.get(c); } else { s.clear(ios::failbit); _Warning("Error: Expected '[' while reading matrix"); return(s); } m.SetSize(size, inMat.Cols()); CopyPartialMat(inMat, m, size); return(s); } // --- Matrix Inversion ------------------------------------------------------- #if !defined(CL_CHECKING) && !defined(VL_CHECKING) // we #define away pAssertEps if it is not used, to avoid // compiler warnings. #define pAssertEps #endif Mat inv(const Mat &m, Real *determinant, Real pAssertEps) // matrix inversion using Gaussian pivoting { Assert(m.IsSquare(), "(inv) Matrix not square"); Int i, j, k; Int n = m.Rows(); Real t, pivot, det; Real max; Mat A(m); Mat B(n, n, vl_I); // ---------- Forward elimination ---------- ------------------------------ det = vl_1; for (i = 0; i < n; i++) // Eliminate in column i, below diag { max = -1.0; for (k = i; k < n; k++) // Find a pivot for column i if (len(A[k][i]) > max) { max = len(A[k][i]); j = k; } Assert(max > pAssertEps, "(inv) Matrix not invertible"); if (j != i) // Swap rows i and j { for (k = i; k < n; k++) Swap(A.Elt(i, k), A.Elt(j, k)); for (k = 0; k < n; k++) Swap(B.Elt(i, k), B.Elt(j, k)); det = -det; } pivot = A.Elt(i, i); Assert(abs(pivot) > pAssertEps, "(inv) Matrix not invertible"); det *= pivot; for (k = i + 1; k < n; k++) // Only do elements to the right of the pivot A.Elt(i, k) /= pivot; for (k = 0; k < n; k++) B.Elt(i, k) /= pivot; // We know that A(i, i) will be set to 1, so don't bother to do it for (j = i + 1; j < n; j++) { // Eliminate in rows below i t = A.Elt(j, i); // We're gonna zero this guy for (k = i + 1; k < n; k++) // Subtract scaled row i from row j A.Elt(j, k) -= A.Elt(i, k) * t; // (Ignore k <= i, we know they're 0) for (k = 0; k < n; k++) B.Elt(j, k) -= B.Elt(i, k) * t; } } // ---------- Backward elimination ---------- ----------------------------- for (i = n - 1; i > 0; i--) // Eliminate in column i, above diag { for (j = 0; j < i; j++) // Eliminate in rows above i { t = A.Elt(j, i); // We're gonna zero this guy for (k = 0; k < n; k++) // Subtract scaled row i from row j B.Elt(j, k) -= B.Elt(i, k) * t; } } if (determinant) *determinant = det; return(B); }
[ "BrandonAGr@0fd8bb18-9850-0410-888e-21b4c4172e3e" ]
[ [ [ 1, 659 ] ] ]
8df27bf54eed898842d76b4d55d46a93a7ec6810
668dc83d4bc041d522e35b0c783c3e073fcc0bd2
/fbide-rw/sdk/typemanager.cpp
7e4e4c33f15c56e1b9869427122befa42d4d5fb2
[]
no_license
albeva/fbide-old-svn
4add934982ce1ce95960c9b3859aeaf22477f10b
bde1e72e7e182fabc89452738f7655e3307296f4
refs/heads/master
2021-01-13T10:22:25.921182
2009-11-19T16:50:48
2009-11-19T16:50:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,167
cpp
/* * This file is part of FBIde project * * FBIde 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. * * FBIde 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 FBIde. If not, see <http://www.gnu.org/licenses/>. * * Author: Albert Varaksin <[email protected]> * Copyright (C) The FBIde development team */ #include "wx_pch.h" #include <wx/textfile.h> #include "manager.h" #include "typemanager.h" using namespace fb; /** * Manager class implementation */ struct TheTypeManager : TypeManager { // create TheTypeManager () {} // destroy ~TheTypeManager () {} }; // Implement Manager IMPLEMENT_MANAGER(TypeManager, TheTypeManager)
[ "vongodric@957c6b5c-1c3a-0410-895f-c76cfc11fbc7" ]
[ [ [ 1, 47 ] ] ]
ca47830e3446012cd8c35fb4140f006594e89045
3ac8c943b13d943fbd3b92787e40aa5519460a32
/Source/IPC/Semaphore.cpp
902ca06f146c6ecf022dfd6531720f5a1c7010ff
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
locosoft1986/Microkernel-1
8069bd2be390d6d8ad10f73e8a944112a764a401
c9dfeec4581d4dd8b1e9020adb3778ad78b3e525
refs/heads/master
2021-01-24T04:54:08.589308
2010-09-23T19:38:01
2010-09-23T19:38:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,142
cpp
#include <IPC/Semaphore.h> Semaphore::Semaphore(unsigned int atom) { atomic = atom; } Semaphore::~Semaphore() { } Semaphore &Semaphore::operator =(const Semaphore &x) { atomic = x.atomic; return *this; } unsigned int Semaphore::operator +=(unsigned int x) { return __sync_add_and_fetch(&atomic, x); } unsigned int Semaphore::operator -=(unsigned int x) { return __sync_sub_and_fetch(&atomic, x); } unsigned int Semaphore::operator |=(unsigned int x) { return __sync_or_and_fetch(&atomic, x); } unsigned int Semaphore::operator &=(unsigned int x) { return __sync_and_and_fetch(&atomic, x); } unsigned int Semaphore::operator ^=(unsigned int x) { return __sync_xor_and_fetch(&atomic, x); } bool Semaphore::operator ==(const Semaphore &x) { return (x.atomic == this->atomic); } bool Semaphore::operator !=(const Semaphore &x) { return !(*this == x); } Semaphore::operator unsigned int () const { return atomic; } bool Semaphore::CompareAndSwap(unsigned int oldValue, unsigned int newValue) { return __sync_bool_compare_and_swap(&atomic, oldValue, newValue); }
[ [ [ 1, 61 ] ] ]
76221190c6e654274828dfa498f7cf2ccf1cc509
1ae2f659bb2e80698684074c48920d05cd6bc05a
/src/tad03OK.cpp
992645a89587ef74daf108f75127a26d6b6a4a53
[]
no_license
AntonioManuelGarcia/ped-loris
f1a479de890ee274f081618cf505bd5a377e3dbf
4d9847c9d280e1141d1cf6dbe6825970d1109bad
refs/heads/master
2016-09-01T11:07:04.989259
2011-06-11T17:33:25
2011-06-11T17:33:25
36,604,917
0
0
null
null
null
null
UTF-8
C++
false
false
733
cpp
//Constructor copia y NElementos #include "thashcalendario.h" int main() { THASHCalendario a,b(4); TCalendario c1(1,1,2011,(const char *)"Fecha1"); TCalendario c2(2,1,2011,(const char *)"Fecha2"); TCalendario c3(3,1,2011,(const char *)"Fecha3"); TCalendario c4(4,1,2011,(const char *)"Fecha4"); TCalendario c5(5,1,2011,(const char *)"Fecha5"); b.Insertar(c1); b.Insertar(c2); b.Insertar(c3); b.Insertar(c4); b.Insertar(c5); cout << "NElementos : " << b.NElementos() << endl; THASHCalendario c(b); if (c.Insertar(c5)) cout <<"Elemento insertado"<<endl; else cout <<"Elemento no insertado"<<endl; cout << "NElementos : " << c.NElementos() << endl; return 0; }
[ "arkariang@f1768c50-85fa-8e18-060e-33f9a243e389", "Arkariang@f1768c50-85fa-8e18-060e-33f9a243e389" ]
[ [ [ 1, 2 ], [ 4, 4 ], [ 6, 25 ], [ 28, 28 ] ], [ [ 3, 3 ], [ 5, 5 ], [ 26, 27 ], [ 29, 29 ] ] ]
d97aa36e36fb812d4f7e70d1d6e32c9d5b85a952
3d0021b222ddd65b36e61207a8382e841d13e3df
/adpcm.cpp
d6f3f0672247e4dfbbfcf3a6b9cefed8f550a0a5
[]
no_license
default0/zeldablackmagic
1273f5793c4d5bbb594b6da07cf70b52de499392
f12078b4c3b22d80077e485657538398e8db3b0f
refs/heads/master
2021-01-10T11:54:31.897192
2010-02-10T19:23:04
2010-02-10T19:23:04
51,330,005
0
0
null
null
null
null
UTF-8
C++
false
false
1,127
cpp
/* #include "common.h" #include "adpcm.h" // <pSXAuthor> you use the decoder class like: // <pSXAuthor> adpcm::decoder d; // <pSXAuthor> signed short buffer[...number of pcm bytes....]; // <pSXAuthor> packet *p=... pointer to start of adpcm data ...; // <pSXAuthor> signed short *ptr=buffer; while ((p->flags&flag_end)==0) ptr=d.decode_packet(p++,ptr); // // // const int adpcm::filter_coef[5][2]= { { 0,0 }, { 60,0 }, { 115,-52 }, { 98,-55 }, { 122,-60 }, }; // // // signed short *adpcm::decoder::decode_packet(adpcm::packet *ap, signed short *dp) { int shift=ap->info&0xf, filter=ap->info>>4, f0=filter_coef[filter][0], f1=filter_coef[filter][1]; for (int i=0; i<14; i++) { unsigned char b=ap->data[i]; short bl=(b&0xf)<<12, bh=(b>>4)<<12; bl=(bl>>shift)+(((l0*f0)+(l1*f1)+32)>>6); if (bl<-32768) bl=-32768; else if (bl>32767) bl=32767; *dp++=bl; l1=l0; l0=bl; bh=(bh>>shift)+(((l0*f0)+(l1*f1)+32)>>6); if (bh<-32768) bh=-32768; else if (bh>32767) bh=32767; *dp++=bh; l1=l0; l0=bh; } return dp; } */
[ "MathOnNapkins@99ff0a3e-ee68-11de-8de6-035db03795fd" ]
[ [ [ 1, 57 ] ] ]
2bb1b0a26f5b7e43d245e081a5e643a91ab923f2
729fbfae883f0f1a7330f62255656b5ed3d51ee6
/decode/src/testApp.h
f878b81fa9c0aeb740d482cdb18a004a18270e80
[]
no_license
jjzhang166/CreatorsProjectDev
76d3481f9c6d290485718b96d8e06c1df2676ceb
bf0250731d22a42d7b9b6821aff98fcd663d68c1
refs/heads/master
2021-12-02T03:12:33.528110
2010-09-02T23:33:55
2010-09-02T23:33:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,857
h
/* model (ofxStructuredLight) good view (vbo based rendering) only call decode() once per 3d frame unless told to update() controller (ofxControlPanel) implement connections to m+v -- maybe import/export just in xml now, decode in control panel? implement importer + exporter wrappers eventually add file dialog... for now specify via xml */ #pragma once #include "ofMain.h" #include "ofxEasyCam.h" #include "ofxStructuredLight.h" #include "ofxAutoControlPanel.h" #include "ofxQtVideoSaver.h" #include <fstream> class testApp : public ofBaseApp { public: ~testApp(); void setup(); void update(); void draw(); void keyPressed(int key); void drawCloud(); void drawMesh(); void getBounds(ofxPoint3f& min, ofxPoint3f& max); void boxOutline(ofxPoint3f min, ofxPoint3f max); void drawAxes(float size); void nextFrame(); void jumpTo(unsigned frame); void setupInput(); ofxEasyCam camera; ThreePhaseDecoder* threePhase; string inputDir; simpleFileLister inputList; ofxDirList imageList; ofVideoPlayer movieInput; bool usingDirectory; unsigned totalImages; ofxAutoControlPanel panel; vector<string> styles, exportFormats; bool hidden; float lastDepthScale, lastDepthSkew; float lastFilterMin, lastFilterMax; int lastRangeThreshold, lastOrientation; float lastGamma; float lastJumpTo; int lastCameraRate, lastCameraOffset; bool lastPhasePersistence; /// visualizations bool redraw; ofImage rangeIm; ofImage phaseWrapped; ofImage phaseUnwrapped; ofImage depthIm; ofImage unwrapOrderIm; ofImage phaseWrappedPlot; ofImage sourceImagesPlot; int sequenceFrame; ofxQtVideoSaver movieOutput; ofImage screenCapture; static const unsigned char scol[8][3]; /// expects a 0-1.0 float ofColor makeColor(float f); };
[ [ [ 1, 85 ] ] ]
1b258c3a13e33f9d18ac7bee22a057bb4da103c0
188058ec6dbe8b1a74bf584ecfa7843be560d2e5
/GodDK/lang/Character.cxx
780d2a123d076f725504cd9427ed4848655c0bd9
[]
no_license
mason105/red5cpp
636e82c660942e2b39c4bfebc63175c8539f7df0
fcf1152cb0a31560af397f24a46b8402e854536e
refs/heads/master
2021-01-10T07:21:31.412996
2007-08-23T06:29:17
2007-08-23T06:29:17
36,223,621
0
0
null
null
null
null
UTF-8
C++
false
false
1,600
cxx
#ifdef HAVE_CONFIG_H # include "config.h" #endif #include "lang/Character.h" using namespace goddk::lang; const jchar Character::MIN_VALUE = (jchar) 0; const jchar Character::MAX_VALUE = (jchar) 0xFFFF; const jchar Character::MIN_HIGH_SURROGATE = (jchar) 0xD800; const jchar Character::MAX_HIGH_SURROGATE = (jchar) 0xDBFF; const jchar Character::MIN_LOW_SURROGATE = (jchar) 0xDC00; const jchar Character::MAX_LOW_SURROGATE = (jchar) 0xDFFF; const jchar Character::MIN_SURROGATE = MIN_HIGH_SURROGATE; const jchar Character::MAX_SURROGATE = MAX_LOW_SURROGATE; const jint Character::MIN_SUPPLEMENTARY_CODE_POINT = 0x10000; const jint Character::MIN_CODE_POINT = 0; const jint Character::MAX_CODE_POINT = 0x10FFFF; const jint Character::MIN_RADIX = 2; const jint Character::MAX_RADIX = 36; String Character::toString(jchar c) throw () { return String(&c, 0, 1); } bool Character::isHighSurrogate(jchar c) throw () { return c >= MIN_HIGH_SURROGATE && c <= MAX_HIGH_SURROGATE; } bool Character::isLowSurrogate(jchar c) throw () { return c >= MIN_LOW_SURROGATE && c <= MAX_LOW_SURROGATE; } Character::Character(jchar value) throw () : _val(value) { } jint Character::hashCode() const throw () { return _val; } jint Character::compareTo(const Character& c) const throw () { if (_val == c._val) return 0; else if (_val < c._val) return -1; else return 1; } string Character::toString() const throw () { String str(_val); const char* tmp = str.ByteData(); string result(tmp); delete tmp; return result; }
[ "soaris@46205fef-a337-0410-8429-7db05d171fc8" ]
[ [ [ 1, 70 ] ] ]
c7c4e969415250005bc65a7ffd463e4bd277d385
b5ad65ebe6a1148716115e1faab31b5f0de1b493
/src/NodeViewer/PropertiesWnd.cpp
a1c26ebeb662070bb167c621d9ae8e9f70491ad1
[]
no_license
gasbank/aran
4360e3536185dcc0b364d8de84b34ae3a5f0855c
01908cd36612379ade220cc09783bc7366c80961
refs/heads/master
2021-05-01T01:16:19.815088
2011-03-01T05:21:38
2011-03-01T05:21:38
1,051,010
1
0
null
null
null
null
UTF-8
C++
false
false
28,199
cpp
#include "NodeViewerPCH.h" #include "PropertiesWnd.h" #include "Resource.h" #include "MainFrm.h" #include "NodeViewer.h" #include "MaterialListProperty.h" ////////////////////////////////////////////////////////////////////////// #include "ArnNode.h" #include "ArnXformable.h" #include "ArnContainer.h" #include "ArnMesh.h" #include "ArnSkeleton.h" #include "ArnHierarchy.h" #include "ArnLight.h" #include "ArnCamera.h" #include "ArnAnim.h" #include "ArnBone.h" #include "ArnMaterial.h" #include "ArnLight.h" #include "ArnIpo.h" #include "ArnMath.h" #include "Animation.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ///////////////////////////////////////////////////////////////////////////// // CResourceViewBar CPropertiesWnd::CPropertiesWnd() { } CPropertiesWnd::~CPropertiesWnd() { } BEGIN_MESSAGE_MAP(CPropertiesWnd, CDockablePane) ON_WM_CREATE() ON_WM_SIZE() ON_COMMAND(ID_EXPAND_ALL, OnExpandAllProperties) ON_UPDATE_COMMAND_UI(ID_EXPAND_ALL, OnUpdateExpandAllProperties) ON_COMMAND(ID_SORTPROPERTIES, OnSortProperties) ON_UPDATE_COMMAND_UI(ID_SORTPROPERTIES, OnUpdateSortProperties) ON_COMMAND(ID_PROPERTIES1, OnProperties1) ON_UPDATE_COMMAND_UI(ID_PROPERTIES1, OnUpdateProperties1) ON_COMMAND(ID_PROPERTIES2, OnProperties2) ON_UPDATE_COMMAND_UI(ID_PROPERTIES2, OnUpdateProperties2) ON_WM_SETFOCUS() ON_WM_SETTINGCHANGE() END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CResourceViewBar message handlers void CPropertiesWnd::AdjustLayout() { if (GetSafeHwnd() == NULL) { return; } CRect rectClient,rectCombo; GetClientRect(rectClient); m_wndObjectCombo.GetWindowRect(&rectCombo); int cyCmb = rectCombo.Size().cy; int cyTlb = m_wndToolBar.CalcFixedLayout(FALSE, TRUE).cy; m_wndObjectCombo.SetWindowPos(NULL, rectClient.left, rectClient.top, rectClient.Width(), 200, SWP_NOACTIVATE | SWP_NOZORDER); m_wndToolBar.SetWindowPos(NULL, rectClient.left, rectClient.top + cyCmb, rectClient.Width(), cyTlb, SWP_NOACTIVATE | SWP_NOZORDER); m_wndPropList.SetWindowPos(NULL, rectClient.left, rectClient.top + cyCmb + cyTlb, rectClient.Width(), rectClient.Height() -(cyCmb+cyTlb), SWP_NOACTIVATE | SWP_NOZORDER); } int CPropertiesWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDockablePane::OnCreate(lpCreateStruct) == -1) return -1; CRect rectDummy; rectDummy.SetRectEmpty(); // Create combo: const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_BORDER | CBS_SORT | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; if (!m_wndObjectCombo.Create(dwViewStyle, rectDummy, this, 1)) { TRACE0("Failed to create Properties Combo \n"); return -1; // fail to create } m_wndObjectCombo.AddString(_T("Application")); m_wndObjectCombo.AddString(_T("Properties Window")); m_wndObjectCombo.SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); m_wndObjectCombo.SetCurSel(0); if (!m_wndPropList.Create(WS_VISIBLE | WS_CHILD, rectDummy, this, 2)) { TRACE0("Failed to create Properties Grid \n"); return -1; // fail to create } InitPropList(); m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_PROPERTIES); m_wndToolBar.LoadToolBar(IDR_PROPERTIES, 0, 0, TRUE /* Is locked */); m_wndToolBar.CleanUpLockedImages(); m_wndToolBar.LoadBitmap(theApp.m_bHiColorIcons ? IDB_PROPERTIES_HC : IDR_PROPERTIES, 0, 0, TRUE /* Locked */); m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY); m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT)); m_wndToolBar.SetOwner(this); // All commands will be routed via this control , not via the parent frame: m_wndToolBar.SetRouteCommandsViaFrame(FALSE); AdjustLayout(); return 0; } void CPropertiesWnd::OnSize(UINT nType, int cx, int cy) { CDockablePane::OnSize(nType, cx, cy); AdjustLayout(); } void CPropertiesWnd::OnExpandAllProperties() { m_wndPropList.ExpandAll(); } void CPropertiesWnd::OnUpdateExpandAllProperties(CCmdUI* pCmdUI) { } void CPropertiesWnd::OnSortProperties() { m_wndPropList.SetAlphabeticMode(!m_wndPropList.IsAlphabeticMode()); } void CPropertiesWnd::OnUpdateSortProperties(CCmdUI* pCmdUI) { pCmdUI->SetCheck(m_wndPropList.IsAlphabeticMode()); } void CPropertiesWnd::OnProperties1() { // TODO: Add your command handler code here } void CPropertiesWnd::OnUpdateProperties1(CCmdUI* /*pCmdUI*/) { // TODO: Add your command update UI handler code here } void CPropertiesWnd::OnProperties2() { // TODO: Add your command handler code here } void CPropertiesWnd::OnUpdateProperties2(CCmdUI* /*pCmdUI*/) { // TODO: Add your command update UI handler code here } void CPropertiesWnd::InitPropList() { SetPropListFont(); m_wndPropList.EnableHeaderCtrl(FALSE); m_wndPropList.EnableDescriptionArea(); m_wndPropList.SetVSDotNetLook(); m_wndPropList.MarkModifiedProperties(); ////////////////////////////////////////////////////////////////////////// m_nodeBaseGroup = new CMFCPropertyGridProperty(_T("NodeBase")); CMFCPropertyGridProperty* pPropNDT = new CMFCPropertyGridProperty(_T("NODE_DATA_TYPE"), (_variant_t) _T("NDT_RT_CONTAINER"), _T("ARN Node data type enum"), PROP_BASE_NDT); pPropNDT->AddOption(_T("NDT_RT_CONTAINER")); pPropNDT->AddOption(_T("NDT_RT_MESH")); pPropNDT->AddOption(_T("NDT_RT_CAMERA")); pPropNDT->AddOption(_T("NDT_RT_LIGHT")); pPropNDT->AddOption(_T("NDT_RT_ANIM")); pPropNDT->AddOption(_T("NDT_RT_MATERIAL")); pPropNDT->AddOption(_T("NDT_RT_HIERARCHY")); pPropNDT->AddOption(_T("NDT_RT_SKELETON")); pPropNDT->AddOption(_T("NDT_RT_BONE")); pPropNDT->AllowEdit(FALSE); //pPropNDT->Enable(FALSE); m_nodeBaseGroup->AddSubItem(pPropNDT); m_nodeBaseGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Name"), (_variant_t) _T("Node Name"), _T("Node unique name"), PROP_BASE_NAME)); m_nodeBaseGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Parent"), (_variant_t) _T("Parent Name"), _T("Current node's parent name"), PROP_BASE_PARENT)); CMFCPropertyGridProperty* pProp = 0; m_wndPropList.AddProperty(m_nodeBaseGroup); ////////////////////////////////////////////////////////////////////// m_movableGroup = new CMFCPropertyGridProperty(_T("Movable")); CMFCPropertyGridProperty* localXformProp = new CMFCPropertyGridProperty(_T("Local Transform")); m_movableGroup->AddSubItem(localXformProp); pProp = new CMFCPropertyGridProperty(_T("Rotation (Deg)"), (_variant_t) _T("(0, 0, 0)"), _T("Local rotation in Euler form (Unit: Degrees)"), PROP_MOV_LX_ROT); localXformProp->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty(_T("Rotation (Quat)"), (_variant_t) _T("(0, 0, 0)"), _T("Local rotation in Euler form (Unit: Degrees)"), PROP_MOV_LX_QUAT); localXformProp->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Scaling"), (_variant_t) _T("(0, 0, 0)"), _T("Local scaling"), PROP_MOV_LX_SCALING); localXformProp->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Translation"), (_variant_t) _T("(0, 0, 0)"), _T("Local translation"), PROP_MOV_LX_TRANS); localXformProp->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("IPO"), (_variant_t) _T("IPO linked to the node"), _T("IPO linked to the node"), PROP_MOV_IPO); m_movableGroup->AddSubItem(pProp); m_wndPropList.AddProperty(m_movableGroup); ////////////////////////////////////////////////////////////////////// m_cameraGroup = new CMFCPropertyGridProperty(_T("Camera")); pProp = new CMFCPropertyGridProperty( _T("Target Position"), (_variant_t) _T("(0, 0, 0)"), _T("Camera target position"), PROP_CAM_TARGETPOS); m_cameraGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Up Vector"), (_variant_t) _T("(0, 0, 0)"), _T("Camera up vector"), PROP_CAM_UPVEC); m_cameraGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("LookAt Vector"), (_variant_t) _T("(0, 0, 0)"), _T("Camera look at vector"), PROP_CAM_LOOKATVEC); m_cameraGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Far Clip"), (_variant_t) 0.0f, _T("Camera far clip"), PROP_CAM_FARCLIP); m_cameraGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Near Clip"), (_variant_t) 0.0f, _T("Camera near clip"), PROP_CAM_NEARCLIP); m_cameraGroup->AddSubItem(pProp); m_wndPropList.AddProperty(m_cameraGroup); m_cameraGroup->Show(FALSE); ////////////////////////////////////////////////////////////////////////// m_animGroup = new CMFCPropertyGridProperty(_T("Animation")); pProp = new CMFCPropertyGridProperty( _T("Key Count"), (_variant_t)(unsigned int) 0, _T("Animation RST key-frame count"), PROP_ANIM_KEYCOUNT); m_animGroup->AddSubItem(pProp); m_wndPropList.AddProperty(m_animGroup); m_animGroup->Show(FALSE); ////////////////////////////////////////////////////////////////////////// m_meshGroup = new CMFCPropertyGridProperty(_T("Mesh")); pProp = new CMFCPropertyGridProperty( _T("Vertex Count"), (_variant_t)(unsigned int) 0, _T("Mesh vertex count"), PROP_MESH_VERTCOUNT); m_meshGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Face Count"), (_variant_t)(unsigned int) 0, _T("Mesh face count"), PROP_MESH_FACECOUNT); m_meshGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Material Count"), (_variant_t)(unsigned int) 0, _T("Mesh material count"), PROP_MESH_MATERIALCOUNT); m_meshGroup->AddSubItem(pProp); pProp = new CMaterialListProperty( _T("Material Name List"), (_variant_t) _T("MatNames"), _T("Material name list"), PROP_MESH_MATERIALNAMELIST); m_meshGroup->AddSubItem(pProp); pProp = new CMaterialListProperty( _T("Armature"), (_variant_t) _T(""), _T("Armature(Skeleton) node linked to this mesh"), PROP_MESH_ARMATURENAME); m_meshGroup->AddSubItem(pProp); m_wndPropList.AddProperty(m_meshGroup); m_meshGroup->Show(FALSE); ////////////////////////////////////////////////////////////////////////// m_hierarchyGroup = new CMFCPropertyGridProperty(_T("Hierarchy")); CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("First sub-level")); m_hierarchyGroup->AddSubItem(pGroup41); CMFCPropertyGridProperty* pGroup411 = new CMFCPropertyGridProperty(_T("Second sub-level")); pGroup41->AddSubItem(pGroup411); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 1"), (_variant_t) _T("Value 1"), _T("This is a description"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 2"), (_variant_t) _T("Value 2"), _T("This is a description"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 3"), (_variant_t) _T("Value 3"), _T("This is a description"))); //hierarchyGroup->Expand(FALSE); m_wndPropList.AddProperty(m_hierarchyGroup); m_hierarchyGroup->Show(FALSE); ////////////////////////////////////////////////////////////////////////// m_skelGroup = new CMFCPropertyGridProperty(_T("Skeleton")); pProp = new CMFCPropertyGridProperty( _T("Max Weights Per Vertex"), (_variant_t)(unsigned int) 0, _T("Mesh vertex count"), PROP_SKEL_MAXWEIGHTSPERVERT); m_skelGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Bone Count"), (_variant_t)(unsigned int) 0, _T("Mesh vertex count"), PROP_SKEL_BONECOUNT); m_skelGroup->AddSubItem(pProp); m_wndPropList.AddProperty(m_skelGroup); m_skelGroup->Show(FALSE); ////////////////////////////////////////////////////////////////////////// m_boneGroup = new CMFCPropertyGridProperty(_T("Bone")); CMFCPropertyGridProperty* boneOffsetMatrix = new CMFCPropertyGridProperty(_T("Offset Matrix")); m_boneGroup->AddSubItem(boneOffsetMatrix); pProp = new CMFCPropertyGridProperty(_T("Rotation (Deg)"), (_variant_t) _T("(0, 0, 0)"), _T("Rotation in Euler form (Unit: Degrees)"), PROP_BONE_OFF_ROT); boneOffsetMatrix->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty(_T("Rotation (Quat)"), (_variant_t) _T("(0, 0, 0, 0)"), _T("Rotation in Euler form (Unit: Degrees)"), PROP_BONE_OFF_QUAT); boneOffsetMatrix->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Scaling"), (_variant_t) _T("(0, 0, 0)"), _T("Scaling"), PROP_BONE_OFF_SCALING); boneOffsetMatrix->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Translation"), (_variant_t) _T("(0, 0, 0)"), _T("Translation"), PROP_BONE_OFF_TRANS); boneOffsetMatrix->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Inf Vertex Count"), (_variant_t)(unsigned int) 0, _T("The influenced vertex count by this bone"), PROP_BONE_INFVERTCOUNT); m_boneGroup->AddSubItem(pProp); m_wndPropList.AddProperty(m_boneGroup); m_boneGroup->Show(FALSE); ////////////////////////////////////////////////////////////////////////// CMFCPropertyGridColorProperty* pColorProp; m_materialGroup = new CMFCPropertyGridProperty(_T("Material")); pProp = new CMFCPropertyGridProperty( _T("Count"), (_variant_t)(unsigned int) 0, _T("Material count embedded in this node"), PROP_MAT_COUNT); m_materialGroup->AddSubItem(pProp); CMFCPropertyGridProperty* d3dMaterial9 = new CMFCPropertyGridProperty(_T("D3DMATERIAL9")); m_materialGroup->AddSubItem(d3dMaterial9); pColorProp = new CMFCPropertyGridColorProperty(_T("Diffuse"), RGB(0, 0, 0), NULL, _T("Diffuse color RGBA"), PROP_MAT_DIFFUSE); d3dMaterial9->AddSubItem(pColorProp); pColorProp = new CMFCPropertyGridColorProperty(_T("Ambient"), RGB(0, 0, 0), NULL, _T("Ambient color RGB"), PROP_MAT_AMBIENT); d3dMaterial9->AddSubItem(pColorProp); pColorProp = new CMFCPropertyGridColorProperty(_T("Specular"), RGB(0, 0, 0), NULL, _T("Specular 'shininess'"), PROP_MAT_SPECULAR); d3dMaterial9->AddSubItem(pColorProp); pColorProp = new CMFCPropertyGridColorProperty(_T("Emissive"), RGB(0, 0, 0), NULL, _T("Emissive color RGB"), PROP_MAT_EMISSIVE); d3dMaterial9->AddSubItem(pColorProp); pProp = new CMFCPropertyGridProperty( _T("Power"), (_variant_t)0.0f, _T("Sharpness if specular highlight"), PROP_MAT_POWER); d3dMaterial9->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Texture Images"), (_variant_t) _T("TexImgs"), _T("Texture images"), PROP_MAT_TEXIMGS); m_materialGroup->AddSubItem(pProp); m_wndPropList.AddProperty(m_materialGroup); m_materialGroup->Show(FALSE); ////////////////////////////////////////////////////////////////////////// m_lightGroup = new CMFCPropertyGridProperty(_T("Light")); CMFCPropertyGridProperty* d3dLight9 = new CMFCPropertyGridProperty(_T("D3DLIGHT9")); m_lightGroup->AddSubItem(d3dLight9); pProp = new CMFCPropertyGridProperty( _T("Type"), _T("Point"), _T("Light type"), PROP_LIGHT_TYPE); pProp->AddOption(_T("Point")); pProp->AddOption(_T("Spot")); pProp->AddOption(_T("Directional")); pProp->AllowEdit(FALSE); d3dLight9->AddSubItem(pProp); pColorProp = new CMFCPropertyGridColorProperty(_T("Diffuse"), RGB(0, 0, 0), NULL, _T("Diffuse color of light"), PROP_LIGHT_DIFFUSE); d3dLight9->AddSubItem(pColorProp); pColorProp = new CMFCPropertyGridColorProperty(_T("Specular"), RGB(0, 0, 0), NULL, _T("Specular color of light"), PROP_LIGHT_SPECULAR); d3dLight9->AddSubItem(pColorProp); pColorProp = new CMFCPropertyGridColorProperty(_T("Ambient"), RGB(0, 0, 0), NULL, _T("Ambient color of light"), PROP_LIGHT_AMBIENT); d3dLight9->AddSubItem(pColorProp); pProp = new CMFCPropertyGridProperty( _T("Position"), _T("(0, 0, 0)"), _T("Position in world(local) space"), PROP_LIGHT_POS); d3dLight9->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Direction"), _T("(0, 0, 0)"), _T("Direction in world(local) space"), PROP_LIGHT_DIR); d3dLight9->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Range"), (_variant_t)0.0f, _T("Cutoff range"), PROP_LIGHT_RANGE); d3dLight9->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Falloff"), (_variant_t)0.0f, _T("Falloff"), PROP_LIGHT_FALLOFF); d3dLight9->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Attenuation0"), (_variant_t)0.0f, _T("Constant attenuation"), PROP_LIGHT_ATT0); d3dLight9->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Attenuation1"), (_variant_t)0.0f, _T("Linear attenuation"), PROP_LIGHT_ATT1); d3dLight9->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Attenuation2"), (_variant_t)0.0f, _T("Quadratic attenuation"), PROP_LIGHT_ATT2); d3dLight9->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Theta"), (_variant_t)0.0f, _T("Inner angle of spotlight cone"), PROP_LIGHT_THETA); d3dLight9->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Phi"), (_variant_t)0.0f, _T("Outer angle of spotlight cone"), PROP_LIGHT_PHI); d3dLight9->AddSubItem(pProp); m_wndPropList.AddProperty(m_lightGroup); m_lightGroup->Show(FALSE); ////////////////////////////////////////////////////////////////////////// m_ipoGroup = new CMFCPropertyGridProperty(_T("IPO")); pProp = new CMFCPropertyGridProperty(_T("IPO Count"), (_variant_t) (unsigned int)0, _T("IPOs embedded in this node"), PROP_IPO_COUNT); m_ipoGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty(_T("Curve Count"), (_variant_t) (unsigned int)0, _T("Curves included in the IPO (valid only if IPO count is 1)"), PROP_IPO_CURVECOUNT); m_ipoGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty(_T("Curve Names"), (_variant_t) _T("Names..."), _T("Curve names included in the IPO (valid only if IPO count is 1)"), PROP_IPO_CURVENAMES); m_ipoGroup->AddSubItem(pProp); m_wndPropList.AddProperty(m_ipoGroup); m_ipoGroup->Show(FALSE); } void CPropertiesWnd::OnSetFocus(CWnd* pOldWnd) { CDockablePane::OnSetFocus(pOldWnd); m_wndPropList.SetFocus(); } void CPropertiesWnd::OnSettingChange(UINT uFlags, LPCTSTR lpszSection) { CDockablePane::OnSettingChange(uFlags, lpszSection); SetPropListFont(); } void CPropertiesWnd::SetPropListFont() { ::DeleteObject(m_fntPropList.Detach()); LOGFONT lf; afxGlobalData.fontRegular.GetLogFont(&lf); NONCLIENTMETRICS info; info.cbSize = sizeof(info); afxGlobalData.GetNonClientMetrics(info); lf.lfHeight = info.lfMenuFont.lfHeight; lf.lfWeight = info.lfMenuFont.lfWeight; lf.lfItalic = info.lfMenuFont.lfItalic; m_fntPropList.CreateFontIndirect(&lf); m_wndPropList.SetFont(&m_fntPropList); } ////////////////////////////////////////////////////////////////////////// void CPropertiesWnd::updateNodeProp( ArnNode* node ) { CString ndtVal; hideAllPropGroup(); switch (node->getType()) { case NDT_RT_MESH: ndtVal = _T("NDT_RT_MESH"); m_movableGroup->Show(TRUE); m_meshGroup->Show(TRUE); updateNodeProp(static_cast<ArnXformable*>(node)); updateNodeProp(static_cast<ArnMesh*>(node)); break; case NDT_RT_ANIM: ndtVal = _T("NDT_RT_ANIM"); m_animGroup->Show(TRUE); updateNodeProp(static_cast<ArnAnim*>(node)); break; case NDT_RT_SKELETON: ndtVal = _T("NDT_RT_SKELETON"); m_skelGroup->Show(TRUE); updateNodeProp(static_cast<ArnSkeleton*>(node)); break; case NDT_RT_BONE: ndtVal = _T("NDT_RT_BONE"); m_boneGroup->Show(TRUE); updateNodeProp(static_cast<ArnBone*>(node)); break; case NDT_RT_CAMERA: ndtVal = _T("NDT_RT_CAMERA"); m_movableGroup->Show(TRUE); m_cameraGroup->Show(TRUE); updateNodeProp(static_cast<ArnXformable*>(node)); updateNodeProp(static_cast<ArnCamera*>(node)); break; case NDT_RT_HIERARCHY: ndtVal = _T("NDT_RT_HIERARCHY"); m_hierarchyGroup->Show(TRUE); updateNodeProp(static_cast<ArnHierarchy*>(node)); break; case NDT_RT_LIGHT: ndtVal = _T("NDT_RT_LIGHT"); m_movableGroup->Show(TRUE); m_lightGroup->Show(TRUE); updateNodeProp(static_cast<ArnXformable*>(node)); updateNodeProp(static_cast<ArnLight*>(node)); break; case NDT_RT_MATERIAL: ndtVal = _T("NDT_RT_MATERIAL"); m_materialGroup->Show(TRUE); updateNodeProp(static_cast<ArnMaterial*>(node)); break; case NDT_RT_IPO: ndtVal = _T("NDT_RT_IPO"); m_ipoGroup->Show(TRUE); updateNodeProp(static_cast<ArnIpo*>(node)); // Bezier interpolation testing writePrecomputedCurvesToFile(static_cast<ArnIpo*>(node)); break; default: ndtVal = _T("NDT_RT_CONTAINER"); break; } propEnumSetValue(PROP_BASE_NDT, ndtVal); propEnumSetValue(PROP_BASE_NAME, node->getName()); propEnumSetValue(PROP_BASE_PARENT, node->getParentName()); } void CPropertiesWnd::updateNodeProp( ArnMesh* node ) { const MeshData& md = node->getMeshData(); CString str, substr; propEnumSetValue(PROP_MESH_VERTCOUNT, md.vertexCount); propEnumSetValue(PROP_MESH_FACECOUNT, md.faceCount); propEnumSetValue(PROP_MESH_MATERIALCOUNT, md.materialCount); unsigned int i; for (i = 0; i < md.materialCount; ++i) { substr.Format(_T("%s"), CString(md.matNameList[i].c_str())); str += (i!=0)?_T(","):_T(""); str += substr; } propEnumSetValue(PROP_MESH_MATERIALNAMELIST, str); propEnumSetValue(PROP_MESH_ARMATURENAME, md.armatureName); } void CPropertiesWnd::updateNodeProp( ArnCamera* node ) { CString str; const ARN_NDD_CAMERA_CHUNK& cameraData = node->getCameraData(); propEnumSetValue(PROP_CAM_FARCLIP, cameraData.farClip); propEnumSetValue(PROP_CAM_NEARCLIP, cameraData.nearClip); propEnumSetValue(PROP_CAM_TARGETPOS, cameraData.targetPos); propEnumSetValue(PROP_CAM_UPVEC, cameraData.upVector); propEnumSetValue(PROP_CAM_LOOKATVEC, cameraData.lookAtVector); } void CPropertiesWnd::updateNodeProp( ArnAnim* node ) { propEnumSetValue(PROP_ANIM_KEYCOUNT, node->getKeyCount()); } void CPropertiesWnd::updateNodeProp( ArnSkeleton* node ) { const SkeletonData& sd = node->getSkeletonData(); propEnumSetValue(PROP_SKEL_MAXWEIGHTSPERVERT, sd.maxWeightsPerVertex); propEnumSetValue(PROP_SKEL_BONECOUNT, sd.bonesCount); } void CPropertiesWnd::updateNodeProp( ArnBone* node ) { const D3DXMATRIX& offsetMat = node->getBoneData().offsetMatrix; D3DXVECTOR3 vecScaling, vecTranslation; D3DXQUATERNION quat; D3DXMatrixDecompose(&vecScaling, &quat, &vecTranslation, &offsetMat); D3DXVECTOR3 euler = ArnMath::QuatToEuler(&quat); euler = ArnMath::Vec3RadToDeg(&euler); propEnumSetValue(PROP_BONE_OFF_ROT, euler); propEnumSetValue(PROP_BONE_OFF_QUAT, quat); propEnumSetValue(PROP_BONE_OFF_SCALING, vecScaling); propEnumSetValue(PROP_BONE_OFF_TRANS, vecTranslation); propEnumSetValue(PROP_BONE_INFVERTCOUNT, node->getBoneData().infVertexCount); } void CPropertiesWnd::updateNodeProp( ArnHierarchy* node ) { // TODO: not implemented yet } void CPropertiesWnd::updateNodeProp( ArnMaterial* node ) { CString str, substr; const D3DMATERIAL9& mat = node->getD3DMaterialData(); propEnumSetValue(PROP_MAT_COUNT, node->getMaterialCount()); propEnumSetValue(PROP_MAT_DIFFUSE, mat.Diffuse); propEnumSetValue(PROP_MAT_AMBIENT, mat.Ambient); propEnumSetValue(PROP_MAT_SPECULAR, mat.Specular); propEnumSetValue(PROP_MAT_EMISSIVE, mat.Emissive); propEnumSetValue(PROP_MAT_POWER, mat.Power); unsigned int i; for (i = 0; i < node->getTexImgCount(); ++i) { substr = node->getTexImgName(i).c_str(); str += (i!=0)?_T(","):_T(""); str += substr; } propEnumSetValue(PROP_MAT_TEXIMGS, str); } void CPropertiesWnd::updateNodeProp( ArnLight* node ) { CString str; const D3DLIGHT9& light = node->getD3DLightData(); switch (node->getD3DLightData().Type) { case D3DLIGHT_POINT: str = "Point"; break; case D3DLIGHT_SPOT: str = "Spot"; break; case D3DLIGHT_DIRECTIONAL: str = "Directional"; break; } propEnumSetValue(PROP_LIGHT_TYPE, str); propEnumSetValue(PROP_LIGHT_DIFFUSE, light.Diffuse); propEnumSetValue(PROP_LIGHT_SPECULAR, light.Specular); propEnumSetValue(PROP_LIGHT_AMBIENT, light.Ambient); propEnumSetValue(PROP_LIGHT_POS, light.Position); propEnumSetValue(PROP_LIGHT_DIR, light.Direction); propEnumSetValue(PROP_LIGHT_RANGE, light.Range); propEnumSetValue(PROP_LIGHT_FALLOFF, light.Falloff); propEnumSetValue(PROP_LIGHT_ATT0, light.Attenuation0); propEnumSetValue(PROP_LIGHT_ATT1, light.Attenuation1); propEnumSetValue(PROP_LIGHT_ATT2, light.Attenuation2); } void CPropertiesWnd::updateNodeProp( ArnIpo* node ) { CString str, substr; unsigned int curveCount = node->getCurveCount(); propEnumSetValue(PROP_IPO_COUNT, node->getIpoCount()); propEnumSetValue(PROP_IPO_CURVECOUNT, curveCount); unsigned int i; for (i = 0; i < curveCount; ++i) { const CurveData& cd = node->getCurveData(i); substr.Format(_T("%s(%d)"), CString(cd.nameStr.c_str()), cd.points.size()); str += (i!=0)?_T(","):_T(""); str += substr; } propEnumSetValue(PROP_IPO_CURVENAMES, str); } void CPropertiesWnd::updateNodeProp( ArnXformable* node ) { const D3DXMATRIX& localXform = node->getFinalLocalXform(); D3DXVECTOR3 vecScaling, vecTranslation; D3DXQUATERNION quat; D3DXMatrixDecompose(&vecScaling, &quat, &vecTranslation, &localXform); D3DXVECTOR3 euler = ArnMath::QuatToEuler(&quat); euler = ArnMath::Vec3RadToDeg(&euler); propEnumSetValue(PROP_MOV_LX_ROT, euler); propEnumSetValue(PROP_MOV_LX_QUAT, quat); propEnumSetValue(PROP_MOV_LX_SCALING, vecScaling); propEnumSetValue(PROP_MOV_LX_TRANS, vecTranslation); propEnumSetValue(PROP_MOV_IPO, node->getIpoName()); } void CPropertiesWnd::hideAllPropGroup() { //nodeBaseGroup->Show(FALSE); /* NodeBase group is always shown */ m_movableGroup->Show(FALSE); m_cameraGroup->Show(FALSE); m_animGroup->Show(FALSE); m_meshGroup->Show(FALSE); m_hierarchyGroup->Show(FALSE); m_skelGroup->Show(FALSE); m_boneGroup->Show(FALSE); m_materialGroup->Show(FALSE); m_lightGroup->Show(FALSE); m_ipoGroup->Show(FALSE); } // Prop SetValue() helper methods void CPropertiesWnd::propEnumSetValue(PROP_ENUM pe, const POINT3FLOAT& p3f) { CString str; str.Format(_T("(%.2f %.2f %.2f)"), p3f.x, p3f.y, p3f.z); m_wndPropList.FindItemByData(pe)->SetValue(str); } void CPropertiesWnd::propEnumSetValue(PROP_ENUM pe, float f) { m_wndPropList.FindItemByData(pe)->SetValue((_variant_t)f); } void CPropertiesWnd::propEnumSetValue( PROP_ENUM pe, unsigned int ui ) { m_wndPropList.FindItemByData(pe)->SetValue((_variant_t)ui); } void CPropertiesWnd::propEnumSetValue( PROP_ENUM pe, CString& cstr ) { m_wndPropList.FindItemByData(pe)->SetValue(cstr); } void CPropertiesWnd::propEnumSetValue( PROP_ENUM pe, const D3DVECTOR& d3dVec ) { CString str; str.Format(_T("(%.2f %.2f %.2f)"), d3dVec.x, d3dVec.y, d3dVec.z); m_wndPropList.FindItemByData(pe)->SetValue(str); } void CPropertiesWnd::propEnumSetValue( PROP_ENUM pe, const D3DCOLORVALUE& d3dColVal ) { CMFCPropertyGridColorProperty* colorProp = (CMFCPropertyGridColorProperty*)m_wndPropList.FindItemByData(pe); colorProp->SetColor((COLORREF)ArnMath::Float4ColorToDword(&d3dColVal)); } void CPropertiesWnd::propEnumSetValue( PROP_ENUM pe, const D3DXQUATERNION& quat ) { CString str; str.Format(_T("(%.2f %.2f %.2f; %.2f)"), quat.x, quat.y, quat.z, quat.w); m_wndPropList.FindItemByData(pe)->SetValue(str); } void CPropertiesWnd::propEnumSetValue( PROP_ENUM pe, const STRING& arnStr ) { m_wndPropList.FindItemByData(pe)->SetValue(CString(arnStr.c_str())); } void CPropertiesWnd::writePrecomputedCurvesToFile( ArnIpo* node ) { const float timeStep = 0.1f; unsigned int curveCount = node->getCurveCount(); unsigned int i, j; CString fileName; fileName = _T("c:\\"); fileName += node->getName(); fileName += _T(".txt"); std::ofstream file(fileName); for (i = 0; i < curveCount; ++i) { const CurveData& cd = node->getCurveData(i); file << cd.nameStr << std::endl; for (j = 0; j < 1000; j++) file << Animation::EvalCurveInterp(&cd, timeStep * j) << std::endl; } file.close(); }
[ [ [ 1, 764 ] ] ]
9c909bfb34de3f32da76a9c2671b793b41a928e9
2982a765bb21c5396587c86ecef8ca5eb100811f
/util/wm5/LibCore/Assert/Wm5Assert.h
4ed90d6848b8e952aba09ac5a664fc2b522f5839
[]
no_license
evanw/cs224final
1a68c6be4cf66a82c991c145bcf140d96af847aa
af2af32732535f2f58bf49ecb4615c80f141ea5b
refs/heads/master
2023-05-30T19:48:26.968407
2011-05-10T16:21:37
2011-05-10T16:21:37
1,653,696
27
9
null
null
null
null
UTF-8
C++
false
false
1,604
h
// Geometric Tools, LLC // Copyright (c) 1998-2010 // Distributed under the Boost Software License, Version 1.0. // http://www.boost.org/LICENSE_1_0.txt // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt // // File Version: 5.0.1 (2010/10/01) #ifndef WM5ASSERT_H #define WM5ASSERT_H #include "Wm5CoreLIB.h" #ifdef WM5_USE_ASSERT //---------------------------------------------------------------------------- // Use WM5 asserts with file/line tracking. //---------------------------------------------------------------------------- namespace Wm5 { class WM5_CORE_ITEM Assert { public: // Construction and destruction. Assert (bool condition, const char* file, int line, const char* format, ...); ~Assert (); private: enum { MAX_MESSAGE_BYTES = 1024 }; static const char* msDebugPrompt; static const size_t msDebugPromptLength; static const char* msMessagePrefix; #ifdef WM5_USE_ASSERT_WRITE_TO_MESSAGE_BOX static const char* msMessageBoxTitle; #endif }; } #define assertion(condition, format, ...) \ Wm5::Assert(condition, __FILE__, __LINE__, format, __VA_ARGS__) //---------------------------------------------------------------------------- #else //---------------------------------------------------------------------------- // Use standard asserts. //---------------------------------------------------------------------------- #define assertion(condition, format, ...) assert(condition) //---------------------------------------------------------------------------- #endif #endif
[ [ [ 1, 54 ] ] ]
2866ea7fa01397a0a81f7932180cc561d54598cf
8a47aa7c36fa2b9ea76cf2ef9fea8207d40a71a2
/devilheart/project_pin/devilheart/taint_source.cpp
abfc0bb3cc607debf04d5e62dba4d4a193ce4e20
[]
no_license
iidx/devilheart
4eae52d7201149347d3f93fdf0202e2520313bf3
13a28efa9f9a37a133b52301642c7ebc264697d5
refs/heads/master
2021-01-10T10:17:58.686621
2010-03-16T03:16:18
2010-03-16T03:16:18
46,808,731
0
0
null
null
null
null
UTF-8
C++
false
false
6,814
cpp
/******************************************************************* Title:TaintSource.cpp Function:to find the taintsource in program and record the in memory Description: Define some data structors to record the state of memory in size of 4G at most. Version: 1.1 Date and author: 2009.07.24 ethenjean *******************************************************************/ #include "taint_source.h" #include "decoder.h" /*the flag of tainted source*/ int flag=0; /*record the size of file*/ ADDRINT sizeH; ADDRINT sizeL; /*record the base address of file mapping to memory*/ ADDRINT baseaddr; CreateFileWData CFWdata[50]; CreateFileMappingWData CFMWdata[50]; MapViewOfFileData MVFdata[50]; /* ===================================================================== */ /* Commandline Switches */ /* ===================================================================== */ KNOB<string> KnobOutputFile(KNOB_MODE_WRITEONCE, "pintool", "o", "malloctrace.out", "specify trace file name"); /* ===================================================================== */ INT32 Usage() { cerr << "This tool produces a trace of calls to malloc.\n" "\n"; cerr << KNOB_BASE::StringKnobSummary(); cerr << endl; return -1; } /****************************************************************** Title:FindObjectByName Function:get the file name from the args Input: wchar_t name: the source path of file opened Output: ******************************************************************/ VOID FindObjectByName(wchar_t *name) { //store the file file name string NameStr=""; //store the source point wchar_t* name0=name; //read the content from the args name for(;*name!='\0';name++) { NameStr+=*name; } //store the source point name=name0; //compare with the defined file name if(NameStr.find(FILE_NAME)!=string::npos) { int i; //find the first place not used for(i=0;CFWdata[i].sign !=0;i++) ; //set the handle value to -2 so we sign it CFWdata[i].CFWHandle = -2; CFWdata[i].sign = 1; CFWdata[i+1].sign = 0; } } /****************************************************************** Title:SetCFWReturnValue Function:store the infomation from the function createfilew Input: ADDRINT fileHandle:the file handle returned from createfilew Output: ******************************************************************/ VOID SetCFWReturnValue(ADDRINT fileHandle) { //store the return value of function createfilew if(fileHandle) { int i; for(i=0;CFWdata[i].sign != 0;i++) { if(CFWdata[i].CFWHandle==-2) { CFWdata[i].CFWHandle =fileHandle; } } } } /****************************************************************** Title:FindMatchingCFMW Function:find if args of CreateFileMapping match with the return value of CreateFileW Input: ADDRINT hfile:the file handle from args of CreateFIleMapping ADDRINT offsethigh:the size of file high bit value ADDRINT offsetlow: the size of file low bit value Output: ******************************************************************/ VOID FindMatchingCFMW(ADDRINT hfile,ADDRINT offsethigh,ADDRINT offsetlow) { int i; for(i=0;CFWdata[i].sign !=0;i++) { if(CFWdata[i].CFWHandle == hfile ) { int j; for(j=0;CFMWdata[j].sign!=0;j++) ; CFMWdata[j].sign=1; CFMWdata[j+1].sign = 0; CFMWdata[j].Filedata = &CFWdata[i]; CFMWdata[j].sizeHigh = offsethigh; CFMWdata[j].sizeLow = offsetlow; CFMWdata[j].CFMWHandle = -2; } } } /****************************************************************** Title:SetCFMWReturnValue Function:set the return value from CreateFileMappingW Input: UINT32 mappingHandle: the file handle from the args of CreateFileMappingW Output: ******************************************************************/ VOID SetCFMWReturnValue(UINT32 mappingHandle) { //find each the handle value is -2 andl set the handle value int i; for(i=0;CFMWdata[i].sign!=0;i++) { if(CFMWdata[i].CFMWHandle == -2) { CFMWdata[i].CFMWHandle = mappingHandle; } } } /****************************************************************** Title:FindMachingMVF Function:find the matched handle of data stored in CFMWdata Input: ADDRINT mappingHandle:the return value of function MapViewOfFile Output: ******************************************************************/ VOID FindMachingMVF(ADDRINT mappingHandle) { int i; for(i=0;CFMWdata[i].sign!=0;i++) { int j; if(CFMWdata[i].CFMWHandle == mappingHandle) { for(j=0;MVFdata[j].sign!=0;j++) ; MVFdata[j].FileMappingdata = &CFMWdata[i]; MVFdata[j].sign=1; MVFdata[j+1].sign = 0; MVFdata[j].MVFReturnHandle = -2; } } } /****************************************************************** Title:SetMappingBase Function:set the matched MVFdata and set value to base Input: ADDRINT base:the base place of file mapping in memory Output: ******************************************************************/ VOID SetMappingBase(ADDRINT base) { int i; for(i=0;MVFdata[i].sign!=0;i++) { if(MVFdata[i].MVFReturnHandle==-2){ MVFdata[i].MVFReturnHandle=base; flag=1; //fprintf(output,"****************************************************\n"); //fprintf(output,"Before the application\n"); //memManager->printState(output); } } } /****************************************************************** Title:getAddr Function:return the place of file mappint in memory Input: Output:MVFReturnHandle ******************************************************************/ ADDRINT getAddr() { return MVFdata[0].MVFReturnHandle; } /****************************************************************** Title:getSizeH Function:return the high bit of size of file Input: Output:sizeHigh ******************************************************************/ ADDRINT getSizeH() { return MVFdata[0].FileMappingdata->sizeHigh; } /****************************************************************** Title:getSizeL Function:return the low bit of size of file Input: Output:sizeLow ******************************************************************/ ADDRINT getSizeL() { return MVFdata[0].FileMappingdata->sizeLow; }
[ "ethenjean@86a7f5e6-5eca-11de-8a4b-256bef446c6c", "hsqfire@86a7f5e6-5eca-11de-8a4b-256bef446c6c" ]
[ [ [ 1, 10 ], [ 13, 13 ], [ 16, 16 ], [ 27, 57 ], [ 59, 191 ], [ 193, 195 ], [ 197, 198 ], [ 203, 203 ], [ 205, 238 ] ], [ [ 11, 12 ], [ 14, 15 ], [ 17, 26 ], [ 58, 58 ], [ 192, 192 ], [ 196, 196 ], [ 199, 202 ], [ 204, 204 ] ] ]
b699ba16dbac846420821e7a75ef87964ccc8dde
fd3f2268460656e395652b11ae1a5b358bfe0a59
/ResizableLib/ResizableLayout.cpp
8d47e4d4682cc22f8cf9929122722521418c016a
[ "Artistic-1.0" ]
permissive
mikezhoubill/emule-gifc
e1cc6ff8b1bb63197bcfc7e67c57cfce0538ff60
46979cf32a313ad6d58603b275ec0b2150562166
refs/heads/master
2021-01-10T20:37:07.581465
2011-08-13T13:58:37
2011-08-13T13:58:37
32,465,033
4
2
null
null
null
null
UTF-8
C++
false
false
14,910
cpp
// ResizableLayout.cpp: implementation of the CResizableLayout class. // ///////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2000-2002 by Paolo Messina // (http://www.geocities.com/ppescher - [email protected]) // // The contents of this file are subject to the Artistic License (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.opensource.org/licenses/artistic-license.html // // If you find this code useful, credits would be nice! // ///////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "ResizableLayout.h" #include "ResizableMsgSupport.inl" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// // In August 2002 Platform SDK, some guy at MS thought it was time to // add the missing symbol BS_TYPEMASK, but forgot its original meaning // and so now he's telling us not to use that symbol because its // value is likely to change in the future SDK releases, including all // the BS_* style bits in the mask, not just the button's type as the // symbol's name suggests. So now we're forced to use another symbol! #define _BS_TYPEMASK 0x0000000FL void CResizableLayout::AddAnchor(HWND hWnd, CSize sizeTypeTL, CSize sizeTypeBR) { CWnd* pParent = GetResizableWnd(); // child window must be valid ASSERT(::IsWindow(hWnd)); // must be child of parent window // ASSERT(::IsChild(pParent->GetSafeHwnd(), hWnd)); // top-left anchor must be valid ASSERT(sizeTypeTL != NOANCHOR); // get control's window class CString sClassName; GetClassName(hWnd, sClassName.GetBufferSetLength(MAX_PATH), MAX_PATH); sClassName.ReleaseBuffer(); // get parent window's rect CRect rectParent; GetTotalClientRect(&rectParent); // and child control's rect CRect rectChild; ::GetWindowRect(hWnd, &rectChild); ::MapWindowPoints(NULL, pParent->m_hWnd, (LPPOINT)&rectChild, 2); // adjust position, if client area has been scrolled rectChild.OffsetRect(-rectParent.TopLeft()); // go calculate margins CSize sizeMarginTL, sizeMarginBR; if (sizeTypeBR == NOANCHOR) sizeTypeBR = sizeTypeTL; // calculate margin for the top-left corner sizeMarginTL.cx = rectChild.left - rectParent.Width() * sizeTypeTL.cx / 100; sizeMarginTL.cy = rectChild.top - rectParent.Height() * sizeTypeTL.cy / 100; // calculate margin for the bottom-right corner sizeMarginBR.cx = rectChild.right - rectParent.Width() * sizeTypeBR.cx / 100; sizeMarginBR.cy = rectChild.bottom - rectParent.Height() * sizeTypeBR.cy / 100; // prepare the structure LayoutInfo layout(hWnd, sizeTypeTL, sizeMarginTL, sizeTypeBR, sizeMarginBR, sClassName); // initialize resize properties (overridable) InitResizeProperties(layout); // must not be already there! // (this is probably due to a duplicate call to AddAnchor) POSITION pos; ASSERT(!m_mapLayout.Lookup(hWnd, pos)); // add to the list and the map pos = m_listLayout.AddTail(layout); m_mapLayout.SetAt(hWnd, pos); } void CResizableLayout::AddAnchorCallback(UINT nCallbackID) { // one callback control cannot rely upon another callback control's // size and/or position (they're updated all together at the end) // it can however use a non-callback control, which is updated before // add to the list LayoutInfo layout; layout.nCallbackID = nCallbackID; m_listLayoutCB.AddTail(layout); } BOOL CResizableLayout::ArrangeLayoutCallback(CResizableLayout::LayoutInfo& /*layout*/) { ASSERT(FALSE); // must be overridden, if callback is used return FALSE; // no output data } void CResizableLayout::ArrangeLayout() { // common vars UINT uFlags; LayoutInfo layout; CRect rectParent, rectChild; GetTotalClientRect(&rectParent); // get parent window's rect int count = m_listLayout.GetCount(); int countCB = m_listLayoutCB.GetCount(); // reposition child windows HDWP hdwp = ::BeginDeferWindowPos(count + countCB); POSITION pos = m_listLayout.GetHeadPosition(); while (pos != NULL) { // get layout info layout = m_listLayout.GetNext(pos); // calculate new child's position, size and flags for SetWindowPos CalcNewChildPosition(layout, rectParent, rectChild, uFlags); // only if size or position changed if ((uFlags & (SWP_NOMOVE|SWP_NOSIZE)) != (SWP_NOMOVE|SWP_NOSIZE)) { hdwp = ::DeferWindowPos(hdwp, layout.hWnd, NULL, rectChild.left, rectChild.top, rectChild.Width(), rectChild.Height(), uFlags); } } // for callback items you may use GetAnchorPosition to know the // new position and size of a non-callback item after resizing pos = m_listLayoutCB.GetHeadPosition(); while (pos != NULL) { // get layout info layout = m_listLayoutCB.GetNext(pos); // request layout data if (!ArrangeLayoutCallback(layout)) continue; // calculate new child's position, size and flags for SetWindowPos CalcNewChildPosition(layout, rectParent, rectChild, uFlags); // only if size or position changed if ((uFlags & (SWP_NOMOVE|SWP_NOSIZE)) != (SWP_NOMOVE|SWP_NOSIZE)) { hdwp = ::DeferWindowPos(hdwp, layout.hWnd, NULL, rectChild.left, rectChild.top, rectChild.Width(), rectChild.Height(), uFlags); } } // finally move all the windows at once ::EndDeferWindowPos(hdwp); } void CResizableLayout::ClipChildWindow(const CResizableLayout::LayoutInfo& layout, CRgn* pRegion) { // obtain window position CRect rect; ::GetWindowRect(layout.hWnd, &rect); ::MapWindowPoints(NULL, GetResizableWnd()->m_hWnd, (LPPOINT)&rect, 2); // use window region if any CRgn rgn; rgn.CreateRectRgn(0,0,0,0); switch (::GetWindowRgn(layout.hWnd, rgn)) { case COMPLEXREGION: case SIMPLEREGION: rgn.OffsetRgn(rect.TopLeft()); break; default: rgn.SetRectRgn(&rect); } // get the clipping property BOOL bClipping = layout.properties.bAskClipping ? LikesClipping(layout) : layout.properties.bCachedLikesClipping; // modify region accordingly if (bClipping) pRegion->CombineRgn(pRegion, &rgn, RGN_DIFF); else pRegion->CombineRgn(pRegion, &rgn, RGN_OR); } void CResizableLayout::GetClippingRegion(CRgn* pRegion) { CWnd* pWnd = GetResizableWnd(); // System's default clipping area is screen's size, // not enough for max track size, for example: // if screen is 1024 x 768 and resizing border is 4 pixels, // maximized size is 1024+4*2=1032 x 768+4*2=776, // but max track size is 4 pixels bigger 1036 x 780 (don't ask me why!) // So, if you resize the window to maximum size, the last 4 pixels // are clipped out by the default clipping region, that gets created // as soon as you call clipping functions (my guess). // reset clipping region to the whole client area CRect rect; pWnd->GetClientRect(&rect); pRegion->CreateRectRgnIndirect(&rect); // clip only anchored controls LayoutInfo layout; POSITION pos = m_listLayout.GetHeadPosition(); while (pos != NULL) { // get layout info layout = m_listLayout.GetNext(pos); if (::IsWindowVisible(layout.hWnd)) ClipChildWindow(layout, pRegion); } pos = m_listLayoutCB.GetHeadPosition(); while (pos != NULL) { // get layout info layout = m_listLayoutCB.GetNext(pos); // request data if (!ArrangeLayoutCallback(layout)) continue; if (::IsWindowVisible(layout.hWnd)) ClipChildWindow(layout, pRegion); } // fix for RTL layouts (1 pixel of horz offset) if (pWnd->GetExStyle() & WS_EX_LAYOUTRTL) pRegion->OffsetRgn(-1,0); } void CResizableLayout::EraseBackground(CDC* pDC) { HWND hWnd = GetResizableWnd()->GetSafeHwnd(); // retrieve the background brush HBRUSH hBrush = NULL; // is this a dialog box? // (using class atom is quickier than using the class name) ATOM atomWndClass = (ATOM)::GetClassLong(hWnd, GCW_ATOM); if (atomWndClass == (ATOM)0x8002) { // send a message to the dialog box hBrush = (HBRUSH)::SendMessage(hWnd, WM_CTLCOLORDLG, (WPARAM)pDC->GetSafeHdc(), (LPARAM)hWnd); } else { // take the background brush from the window's class hBrush = (HBRUSH)::GetClassLong(hWnd, GCL_HBRBACKGROUND); } // fill the clipped background CRgn rgn; GetClippingRegion(&rgn); ::FillRgn(pDC->GetSafeHdc(), rgn, hBrush); } // support legacy code (will disappear in future versions) void CResizableLayout::ClipChildren(CDC* pDC) { CRgn rgn; GetClippingRegion(&rgn); // the clipping region is in device units rgn.OffsetRgn(-pDC->GetWindowOrg()); pDC->SelectClipRgn(&rgn); } void CResizableLayout::GetTotalClientRect(LPRECT lpRect) { GetResizableWnd()->GetClientRect(lpRect); } BOOL CResizableLayout::NeedsRefresh(const CResizableLayout::LayoutInfo& layout, const CRect& rectOld, const CRect& rectNew) { if (layout.bMsgSupport) { REFRESHPROPERTY refresh; refresh.rcOld = rectOld; refresh.rcNew = rectNew; if (Send_NeedsRefresh(layout.hWnd, &refresh)) return refresh.bNeedsRefresh; } int nDiffWidth = (rectNew.Width() - rectOld.Width()); int nDiffHeight = (rectNew.Height() - rectOld.Height()); // is the same size? if (nDiffWidth == 0 && nDiffHeight == 0) return FALSE; // optimistic, no need to refresh BOOL bRefresh = FALSE; // window classes that need refresh when resized if (layout.sWndClass == WC_STATIC) { DWORD style = ::GetWindowLong(layout.hWnd, GWL_STYLE); switch (style & SS_TYPEMASK) { case SS_LEFT: case SS_CENTER: case SS_RIGHT: // word-wrapped text bRefresh = bRefresh || (nDiffWidth != 0); // vertically centered text if (style & SS_CENTERIMAGE) bRefresh = bRefresh || (nDiffHeight != 0); break; case SS_LEFTNOWORDWRAP: // text with ellipsis if (style & SS_ELLIPSISMASK) bRefresh = bRefresh || (nDiffWidth != 0); // vertically centered text if (style & SS_CENTERIMAGE) bRefresh = bRefresh || (nDiffHeight != 0); break; case SS_ENHMETAFILE: case SS_BITMAP: case SS_ICON: // images case SS_BLACKFRAME: case SS_GRAYFRAME: case SS_WHITEFRAME: case SS_ETCHEDFRAME: // and frames bRefresh = TRUE; break; } } // window classes that don't redraw client area correctly // when the hor scroll pos changes due to a resizing BOOL bHScroll = FALSE; if (layout.sWndClass == WC_LISTBOX) bHScroll = TRUE; // fix for horizontally scrollable windows if (bHScroll && (nDiffWidth > 0)) { // get max scroll position SCROLLINFO info; info.cbSize = sizeof(SCROLLINFO); info.fMask = SIF_PAGE | SIF_POS | SIF_RANGE; if (::GetScrollInfo(layout.hWnd, SB_HORZ, &info)) { // subtract the page size info.nMax -= __max(info.nPage-1,0); } // resizing will cause the text to scroll on the right // because the scrollbar is going beyond the right limit if ((info.nMax > 0) && (info.nPos + nDiffWidth > info.nMax)) { // needs repainting, due to horiz scrolling bRefresh = TRUE; } } return bRefresh; } BOOL CResizableLayout::LikesClipping(const CResizableLayout::LayoutInfo& layout) { if (layout.bMsgSupport) { CLIPPINGPROPERTY clipping; if (Send_LikesClipping(layout.hWnd, &clipping)) return clipping.bLikesClipping; } DWORD style = ::GetWindowLong(layout.hWnd, GWL_STYLE); // skip windows that wants background repainted if (layout.sWndClass == TOOLBARCLASSNAME && (style & TBSTYLE_TRANSPARENT)) return FALSE; else if (layout.sWndClass == WC_BUTTON) { CRect rect; switch (style & _BS_TYPEMASK) { case BS_GROUPBOX: return FALSE; case BS_OWNERDRAW: // ownerdraw buttons must return correct hittest code // to notify their transparency to the system and this library ::GetWindowRect(layout.hWnd, &rect); if ( HTTRANSPARENT == ::SendMessage(layout.hWnd, WM_NCHITTEST, 0, MAKELPARAM(rect.left, rect.top)) ) return FALSE; break; } return TRUE; } else if (layout.sWndClass == WC_STATIC) { switch (style & SS_TYPEMASK) { case SS_LEFT: case SS_CENTER: case SS_RIGHT: case SS_SIMPLE: case SS_LEFTNOWORDWRAP: // text case SS_BLACKRECT: case SS_GRAYRECT: case SS_WHITERECT: // filled rects case SS_ETCHEDHORZ: case SS_ETCHEDVERT: // etched lines case SS_BITMAP: // bitmaps return TRUE; break; case SS_ICON: case SS_ENHMETAFILE: if (style & SS_CENTERIMAGE) return FALSE; return TRUE; break; default: return FALSE; } } // assume the others like clipping return TRUE; } void CResizableLayout::CalcNewChildPosition(const CResizableLayout::LayoutInfo& layout, const CRect &rectParent, CRect &rectChild, UINT& uFlags) { CWnd* pParent = GetResizableWnd(); ::GetWindowRect(layout.hWnd, &rectChild); ::MapWindowPoints(NULL, pParent->m_hWnd, (LPPOINT)&rectChild, 2); CRect rectNew; // calculate new top-left corner rectNew.left = layout.sizeMarginTL.cx + rectParent.Width() * layout.sizeTypeTL.cx / 100; rectNew.top = layout.sizeMarginTL.cy + rectParent.Height() * layout.sizeTypeTL.cy / 100; // calculate new bottom-right corner rectNew.right = layout.sizeMarginBR.cx + rectParent.Width() * layout.sizeTypeBR.cx / 100; rectNew.bottom = layout.sizeMarginBR.cy + rectParent.Height() * layout.sizeTypeBR.cy / 100; // adjust position, if client area has been scrolled rectNew.OffsetRect(rectParent.TopLeft()); // get the refresh property BOOL bRefresh = layout.properties.bAskRefresh ? NeedsRefresh(layout, rectChild, rectNew) : layout.properties.bCachedNeedsRefresh; // set flags uFlags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION; if (bRefresh) uFlags |= SWP_NOCOPYBITS; if (rectNew.TopLeft() == rectChild.TopLeft()) uFlags |= SWP_NOMOVE; if (rectNew.Size() == rectChild.Size()) uFlags |= SWP_NOSIZE; // update rect rectChild = rectNew; } void CResizableLayout::InitResizeProperties(CResizableLayout::LayoutInfo &layout) { // check if custom window supports this library // (properties must be correctly set by the window) layout.bMsgSupport = Send_QueryProperties(layout.hWnd, &layout.properties); // default properties if (!layout.bMsgSupport) { // clipping property is assumed as static layout.properties.bAskClipping = FALSE; layout.properties.bCachedLikesClipping = LikesClipping(layout); // refresh property is assumed as dynamic layout.properties.bAskRefresh = TRUE; } }
[ "Mike.Ken.S@dd569cc8-ff36-11de-bbca-1111db1fd05b" ]
[ [ [ 1, 517 ] ] ]
fcf5c0a3f82b704b3266ded483a7d5d8eae8d7cd
74e7667ad65cbdaa869c6e384fdd8dc7e94aca34
/MicroFrameworkPK_v4_1/BuildOutput/public/debug/Client/stubs/spot_net_security_native_Microsoft_SPOT_Net_Security_SslNative.h
0767fe1527105eabf5fcfb4f2a0f65bd3dcbed2c
[ "BSD-3-Clause", "OpenSSL", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
gezidan/NETMF-LPC
5093ab223eb9d7f42396344ea316cbe50a2f784b
db1880a03108db6c7f611e6de6dbc45ce9b9adce
refs/heads/master
2021-01-18T10:59:42.467549
2011-06-28T08:11:24
2011-06-28T08:11:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,534
h
//----------------------------------------------------------------------------- // // ** WARNING! ** // This file was generated automatically by a tool. // Re-running the tool will overwrite this file. // You should copy this file to a custom location // before adding any customization in the copy to // prevent loss of your changes when the tool is // re-run. // //----------------------------------------------------------------------------- #ifndef _SPOT_NET_SECURITY_NATIVE_MICROSOFT_SPOT_NET_SECURITY_SSLNATIVE_H_ #define _SPOT_NET_SECURITY_NATIVE_MICROSOFT_SPOT_NET_SECURITY_SSLNATIVE_H_ namespace Microsoft { namespace SPOT { namespace Net { namespace Security { struct SslNative { // Helper Functions to access fields of managed object // Declaration of stubs. These functions are implemented by Interop code developers static INT32 SecureServerInit( INT32 param0, INT32 param1, UNSUPPORTED_TYPE param2, double param3, HRESULT &hr ); static INT32 SecureClientInit( INT32 param0, INT32 param1, UNSUPPORTED_TYPE param2, double param3, HRESULT &hr ); static void UpdateCertificates( INT32 param0, UNSUPPORTED_TYPE param1, double param2, HRESULT &hr ); static void SecureAccept( INT32 param0, UNSUPPORTED_TYPE param1, HRESULT &hr ); static void SecureConnect( INT32 param0, LPCSTR param1, UNSUPPORTED_TYPE param2, HRESULT &hr ); static INT32 SecureRead( UNSUPPORTED_TYPE param0, CLR_RT_TypedArray_UINT8 param1, INT32 param2, INT32 param3, INT32 param4, HRESULT &hr ); static INT32 SecureWrite( UNSUPPORTED_TYPE param0, CLR_RT_TypedArray_UINT8 param1, INT32 param2, INT32 param3, INT32 param4, HRESULT &hr ); static INT32 SecureCloseSocket( UNSUPPORTED_TYPE param0, HRESULT &hr ); static INT32 ExitSecureContext( INT32 param0, HRESULT &hr ); static void ParseCertificate( CLR_RT_TypedArray_UINT8 param0, LPCSTR param1, LPCSTR * param2, LPCSTR * param3, UNSUPPORTED_TYPE * param4, float param5, HRESULT &hr ); static INT32 DataAvailable( UNSUPPORTED_TYPE param0, HRESULT &hr ); }; } } } } #endif //_SPOT_NET_SECURITY_NATIVE_MICROSOFT_SPOT_NET_SECURITY_SSLNATIVE_H_
[ [ [ 1, 45 ] ] ]
10e39a77fa7c53af86147640175ae4495869210f
10c14a95421b63a71c7c99adf73e305608c391bf
/gui/core/qmap.h
9dbcd377cb9da51e36797e5b0487e870fb7ffbd2
[]
no_license
eaglezzb/wtlcontrols
73fccea541c6ef1f6db5600f5f7349f5c5236daa
61b7fce28df1efe4a1d90c0678ec863b1fd7c81c
refs/heads/master
2021-01-22T13:47:19.456110
2009-05-19T10:58:42
2009-05-19T10:58:42
33,811,815
0
0
null
null
null
null
UTF-8
C++
false
false
32,404
h
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information ([email protected]) ** ** This file is part of the QtCore module 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$ ** ****************************************************************************/ #ifndef QMAP_H #define QMAP_H // #include <QtCore/qatomic.h> // #include <QtCore/qiterator.h> // #include <QtCore/qlist.h> #include "core/qatomic.h" #include "core/qiterator.h" #include "core/qlist.h" #ifndef QT_NO_STL #include <map> #endif #include <new> #undef QT_MAP_DEBUG QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Gui) struct Q_GUI_EXPORT QMapData { struct Node { Node *backward; Node *forward[1]; }; enum { LastLevel = 11, Sparseness = 3 }; QMapData *backward; QMapData *forward[QMapData::LastLevel + 1]; QBasicAtomicInt ref; int topLevel; int size; uint randomBits; uint insertInOrder : 1; uint sharable : 1; static QMapData *createData(); void continueFreeData(int offset); Node *node_create(Node *update[], int offset); void node_delete(Node *update[], int offset, Node *node); #ifdef QT_QMAP_DEBUG uint adjust_ptr(Node *node); void dump(); #endif static QMapData shared_null; }; /* QMap uses qMapLessThanKey() to compare keys. The default implementation uses operator<(). For pointer types, qMapLessThanKey() casts the pointers to integers before it compares them, because operator<() is undefined on pointers that come from different memory blocks. (In practice, this is only a problem when running a program such as BoundsChecker.) */ template <class Key> inline bool qMapLessThanKey(const Key &key1, const Key &key2) { return key1 < key2; } #ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION template <class Ptr> inline bool qMapLessThanKey(Ptr *key1, Ptr *key2) { Q_ASSERT(sizeof(quintptr) == sizeof(Ptr *)); return quintptr(key1) < quintptr(key2); } template <class Ptr> inline bool qMapLessThanKey(const Ptr *key1, const Ptr *key2) { Q_ASSERT(sizeof(quintptr) == sizeof(const Ptr *)); return quintptr(key1) < quintptr(key2); } #endif // QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION template <class Key, class T> struct QMapNode { Key key; T value; QMapData::Node *backward; QMapData::Node *forward[1]; }; template <class Key, class T> struct QMapPayloadNode { Key key; T value; QMapData::Node *backward; }; template <class Key, class T> class QMap { typedef QMapNode<Key, T> Node; typedef QMapPayloadNode<Key, T> PayloadNode; union { QMapData *d; QMapData::Node *e; }; static inline int payload() { return sizeof(PayloadNode) - sizeof(QMapData::Node *); } static inline Node *concrete(QMapData::Node *node) { return reinterpret_cast<Node *>(reinterpret_cast<char *>(node) - payload()); } public: inline QMap() : d(&QMapData::shared_null) { d->ref.ref(); } inline QMap(const QMap<Key, T> &other) : d(other.d) { d->ref.ref(); if (!d->sharable) detach(); } inline ~QMap() { if (!d) return; if (!d->ref.deref()) freeData(d); } QMap<Key, T> &operator=(const QMap<Key, T> &other); #ifndef QT_NO_STL explicit QMap(const typename std::map<Key, T> &other); std::map<Key, T> toStdMap() const; #endif bool operator==(const QMap<Key, T> &other) const; inline bool operator!=(const QMap<Key, T> &other) const { return !(*this == other); } inline int size() const { return d->size; } inline bool isEmpty() const { return d->size == 0; } inline void detach() { if (d->ref != 1) detach_helper(); } inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } inline void setInsertInOrder(bool ordered) { d->insertInOrder = ordered; } void clear(); int remove(const Key &key); T take(const Key &key); bool contains(const Key &key) const; const Key key(const T &value) const; const Key key(const T &value, const Key &defaultKey) const; const T value(const Key &key) const; const T value(const Key &key, const T &defaultValue) const; T &operator[](const Key &key); const T operator[](const Key &key) const; QList<Key> uniqueKeys() const; QList<Key> keys() const; QList<Key> keys(const T &value) const; QList<T> values() const; QList<T> values(const Key &key) const; int count(const Key &key) const; class const_iterator; class iterator { friend class const_iterator; QMapData::Node *i; public: typedef std::bidirectional_iterator_tag iterator_category; typedef ptrdiff_t difference_type; typedef T value_type; typedef T *pointer; typedef T &reference; // ### Qt 5: get rid of 'operator Node *' inline operator QMapData::Node *() const { return i; } inline iterator() : i(0) { } inline iterator(QMapData::Node *node) : i(node) { } inline const Key &key() const { return concrete(i)->key; } inline T &value() const { return concrete(i)->value; } #ifdef QT3_SUPPORT inline QT3_SUPPORT T &data() const { return concrete(i)->value; } #endif inline T &operator*() const { return concrete(i)->value; } inline T *operator->() const { return &concrete(i)->value; } inline bool operator==(const iterator &o) const { return i == o.i; } inline bool operator!=(const iterator &o) const { return i != o.i; } inline iterator &operator++() { i = i->forward[0]; return *this; } inline iterator operator++(int) { iterator r = *this; i = i->forward[0]; return r; } inline iterator &operator--() { i = i->backward; return *this; } inline iterator operator--(int) { iterator r = *this; i = i->backward; return r; } inline iterator operator+(int j) const { iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; } inline iterator operator-(int j) const { return operator+(-j); } inline iterator &operator+=(int j) { return *this = *this + j; } inline iterator &operator-=(int j) { return *this = *this - j; } // ### Qt 5: not sure this is necessary anymore #ifdef QT_STRICT_ITERATORS private: #else public: #endif inline bool operator==(const const_iterator &o) const { return i == o.i; } inline bool operator!=(const const_iterator &o) const { return i != o.i; } private: // ### Qt 5: remove inline operator bool() const { return false; } }; friend class iterator; class const_iterator { friend class iterator; QMapData::Node *i; public: typedef std::bidirectional_iterator_tag iterator_category; typedef ptrdiff_t difference_type; typedef T value_type; typedef const T *pointer; typedef const T &reference; // ### Qt 5: get rid of 'operator Node *' inline operator QMapData::Node *() const { return i; } inline const_iterator() : i(0) { } inline const_iterator(QMapData::Node *node) : i(node) { } #ifdef QT_STRICT_ITERATORS explicit inline const_iterator(const iterator &o) #else inline const_iterator(const iterator &o) #endif { i = o.i; } inline const Key &key() const { return concrete(i)->key; } inline const T &value() const { return concrete(i)->value; } #ifdef QT3_SUPPORT inline QT3_SUPPORT const T &data() const { return concrete(i)->value; } #endif inline const T &operator*() const { return concrete(i)->value; } inline const T *operator->() const { return &concrete(i)->value; } inline bool operator==(const const_iterator &o) const { return i == o.i; } inline bool operator!=(const const_iterator &o) const { return i != o.i; } inline const_iterator &operator++() { i = i->forward[0]; return *this; } inline const_iterator operator++(int) { const_iterator r = *this; i = i->forward[0]; return r; } inline const_iterator &operator--() { i = i->backward; return *this; } inline const_iterator operator--(int) { const_iterator r = *this; i = i->backward; return r; } inline const_iterator operator+(int j) const { const_iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; } inline const_iterator operator-(int j) const { return operator+(-j); } inline const_iterator &operator+=(int j) { return *this = *this + j; } inline const_iterator &operator-=(int j) { return *this = *this - j; } // ### Qt 5: not sure this is necessary anymore #ifdef QT_STRICT_ITERATORS private: inline bool operator==(const iterator &o) { return operator==(const_iterator(o)); } inline bool operator!=(const iterator &o) { return operator!=(const_iterator(o)); } #endif private: // ### Qt 5: remove inline operator bool() const { return false; } }; friend class const_iterator; // STL style inline iterator begin() { detach(); return iterator(e->forward[0]); } inline const_iterator begin() const { return const_iterator(e->forward[0]); } inline const_iterator constBegin() const { return const_iterator(e->forward[0]); } inline iterator end() { detach(); return iterator(e); } inline const_iterator end() const { return const_iterator(e); } inline const_iterator constEnd() const { return const_iterator(e); } iterator erase(iterator it); #ifdef QT3_SUPPORT inline QT3_SUPPORT iterator remove(iterator it) { return erase(it); } inline QT3_SUPPORT void erase(const Key &aKey) { remove(aKey); } #endif // more Qt typedef iterator Iterator; typedef const_iterator ConstIterator; inline int count() const { return d->size; } iterator find(const Key &key); const_iterator find(const Key &key) const; const_iterator constFind(const Key &key) const; iterator lowerBound(const Key &key); const_iterator lowerBound(const Key &key) const; iterator upperBound(const Key &key); const_iterator upperBound(const Key &key) const; iterator insert(const Key &key, const T &value); #ifdef QT3_SUPPORT QT3_SUPPORT iterator insert(const Key &key, const T &value, bool overwrite); #endif iterator insertMulti(const Key &key, const T &value); #ifdef QT3_SUPPORT inline QT3_SUPPORT iterator replace(const Key &aKey, const T &aValue) { return insert(aKey, aValue); } #endif QMap<Key, T> &unite(const QMap<Key, T> &other); // STL compatibility typedef Key key_type; typedef T mapped_type; typedef ptrdiff_t difference_type; typedef int size_type; inline bool empty() const { return isEmpty(); } #ifdef QT_QMAP_DEBUG inline void dump() const { d->dump(); } #endif private: void detach_helper(); void freeData(QMapData *d); QMapData::Node *findNode(const Key &key) const; QMapData::Node *mutableFindNode(QMapData::Node *update[], const Key &key) const; QMapData::Node *node_create(QMapData *d, QMapData::Node *update[], const Key &key, const T &value); }; template <class Key, class T> Q_INLINE_TEMPLATE QMap<Key, T> &QMap<Key, T>::operator=(const QMap<Key, T> &other) { if (d != other.d) { other.d->ref.ref(); if (!d->ref.deref()) freeData(d); d = other.d; if (!d->sharable) detach_helper(); } return *this; } template <class Key, class T> Q_INLINE_TEMPLATE void QMap<Key, T>::clear() { *this = QMap<Key, T>(); } template <class Key, class T> Q_INLINE_TEMPLATE typename QMapData::Node * QMap<Key, T>::node_create(QMapData *adt, QMapData::Node *aupdate[], const Key &akey, const T &avalue) { QMapData::Node *abstractNode = adt->node_create(aupdate, payload()); Node *concreteNode = concrete(abstractNode); new (&concreteNode->key) Key(akey); new (&concreteNode->value) T(avalue); return abstractNode; } template <class Key, class T> Q_INLINE_TEMPLATE QMapData::Node *QMap<Key, T>::findNode(const Key &akey) const { QMapData::Node *cur = e; QMapData::Node *next = e; for (int i = d->topLevel; i >= 0; i--) { while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey)) cur = next; } if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) { return next; } else { return e; } } template <class Key, class T> Q_INLINE_TEMPLATE const T QMap<Key, T>::value(const Key &akey) const { QMapData::Node *node; if (d->size == 0 || (node = findNode(akey)) == e) { return T(); } else { return concrete(node)->value; } } template <class Key, class T> Q_INLINE_TEMPLATE const T QMap<Key, T>::value(const Key &akey, const T &adefaultValue) const { QMapData::Node *node; if (d->size == 0 || (node = findNode(akey)) == e) { return adefaultValue; } else { return concrete(node)->value; } } template <class Key, class T> Q_INLINE_TEMPLATE const T QMap<Key, T>::operator[](const Key &akey) const { return value(akey); } template <class Key, class T> Q_INLINE_TEMPLATE T &QMap<Key, T>::operator[](const Key &akey) { detach(); QMapData::Node *update[QMapData::LastLevel + 1]; QMapData::Node *node = mutableFindNode(update, akey); if (node == e) node = node_create(d, update, akey, T()); return concrete(node)->value; } template <class Key, class T> Q_INLINE_TEMPLATE int QMap<Key, T>::count(const Key &akey) const { int cnt = 0; QMapData::Node *node = findNode(akey); if (node != e) { do { ++cnt; node = node->forward[0]; } while (node != e && !qMapLessThanKey<Key>(akey, concrete(node)->key)); } return cnt; } template <class Key, class T> Q_INLINE_TEMPLATE bool QMap<Key, T>::contains(const Key &akey) const { return findNode(akey) != e; } template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insert(const Key &akey, const T &avalue) { detach(); QMapData::Node *update[QMapData::LastLevel + 1]; QMapData::Node *node = mutableFindNode(update, akey); if (node == e) { node = node_create(d, update, akey, avalue); } else { concrete(node)->value = avalue; } return iterator(node); } #ifdef QT3_SUPPORT template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insert(const Key &akey, const T &avalue, bool aoverwrite) { detach(); QMapData::Node *update[QMapData::LastLevel + 1]; QMapData::Node *node = mutableFindNode(update, akey); if (node == e) { node = node_create(d, update, akey, avalue); } else { if (aoverwrite) concrete(node)->value = avalue; } return iterator(node); } #endif template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const Key &akey, const T &avalue) { detach(); QMapData::Node *update[QMapData::LastLevel + 1]; mutableFindNode(update, akey); return iterator(node_create(d, update, akey, avalue)); } template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::find(const Key &akey) const { return const_iterator(findNode(akey)); } template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::constFind(const Key &akey) const { return const_iterator(findNode(akey)); } template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::find(const Key &akey) { detach(); return iterator(findNode(akey)); } template <class Key, class T> Q_INLINE_TEMPLATE QMap<Key, T> &QMap<Key, T>::unite(const QMap<Key, T> &other) { QMap<Key, T> copy(other); const_iterator it = copy.constEnd(); const const_iterator b = copy.constBegin(); while (it != b) { --it; insertMulti(it.key(), it.value()); } return *this; } template <class Key, class T> Q_OUTOFLINE_TEMPLATE void QMap<Key, T>::freeData(QMapData *x) { if (QTypeInfo<Key>::isComplex || QTypeInfo<T>::isComplex) { QMapData::Node *y = reinterpret_cast<QMapData::Node *>(x); QMapData::Node *cur = y; QMapData::Node *next = cur->forward[0]; while (next != y) { cur = next; next = cur->forward[0]; #if defined(_MSC_VER) && (_MSC_VER >= 1300) #pragma warning(disable:4189) #endif Node *concreteNode = concrete(cur); concreteNode->key.~Key(); concreteNode->value.~T(); #if defined(_MSC_VER) && (_MSC_VER >= 1300) #pragma warning(default:4189) #endif } } x->continueFreeData(payload()); } template <class Key, class T> Q_OUTOFLINE_TEMPLATE int QMap<Key, T>::remove(const Key &akey) { detach(); QMapData::Node *update[QMapData::LastLevel + 1]; QMapData::Node *cur = e; QMapData::Node *next = e; int oldSize = d->size; for (int i = d->topLevel; i >= 0; i--) { while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey)) cur = next; update[i] = cur; } if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) { bool deleteNext = true; do { cur = next; next = cur->forward[0]; deleteNext = (next != e && !qMapLessThanKey<Key>(concrete(cur)->key, concrete(next)->key)); concrete(cur)->key.~Key(); concrete(cur)->value.~T(); d->node_delete(update, payload(), cur); } while (deleteNext); } return oldSize - d->size; } template <class Key, class T> Q_OUTOFLINE_TEMPLATE T QMap<Key, T>::take(const Key &akey) { detach(); QMapData::Node *update[QMapData::LastLevel + 1]; QMapData::Node *cur = e; QMapData::Node *next = e; for (int i = d->topLevel; i >= 0; i--) { while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey)) cur = next; update[i] = cur; } if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) { T t = concrete(next)->value; concrete(next)->key.~Key(); concrete(next)->value.~T(); d->node_delete(update, payload(), next); return t; } return T(); } template <class Key, class T> Q_OUTOFLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::erase(iterator it) { QMapData::Node *update[QMapData::LastLevel + 1]; QMapData::Node *cur = e; QMapData::Node *next = e; if (it == iterator(e)) return it; for (int i = d->topLevel; i >= 0; i--) { while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, it.key())) cur = next; update[i] = cur; } while (next != e) { cur = next; next = cur->forward[0]; if (cur == it) { concrete(cur)->key.~Key(); concrete(cur)->value.~T(); d->node_delete(update, payload(), cur); return iterator(next); } for (int i = 0; i <= d->topLevel; ++i) { if (update[i]->forward[i] != cur) break; update[i] = cur; } } return end(); } template <class Key, class T> Q_OUTOFLINE_TEMPLATE void QMap<Key, T>::detach_helper() { union { QMapData *d; QMapData::Node *e; } x; x.d = QMapData::createData(); if (d->size) { x.d->insertInOrder = true; QMapData::Node *update[QMapData::LastLevel + 1]; QMapData::Node *cur = e->forward[0]; update[0] = x.e; while (cur != e) { Node *concreteNode = concrete(cur); node_create(x.d, update, concreteNode->key, concreteNode->value); cur = cur->forward[0]; } x.d->insertInOrder = false; } if (!d->ref.deref()) freeData(d); d = x.d; } template <class Key, class T> Q_OUTOFLINE_TEMPLATE QMapData::Node *QMap<Key, T>::mutableFindNode(QMapData::Node *aupdate[], const Key &akey) const { QMapData::Node *cur = e; QMapData::Node *next = e; for (int i = d->topLevel; i >= 0; i--) { while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey)) cur = next; aupdate[i] = cur; } if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) { return next; } else { return e; } } template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::uniqueKeys() const { QList<Key> res; const_iterator i = begin(); if (i != end()) { for (;;) { const Key &aKey = i.key(); res.append(aKey); do { if (++i == end()) goto break_out_of_outer_loop; } while (!(aKey < i.key())); // loop while (key == i.key()) } } break_out_of_outer_loop: return res; } template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::keys() const { QList<Key> res; const_iterator i = begin(); while (i != end()) { res.append(i.key()); ++i; } return res; } template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::keys(const T &avalue) const { QList<Key> res; const_iterator i = begin(); while (i != end()) { if (i.value() == avalue) res.append(i.key()); ++i; } return res; } template <class Key, class T> Q_OUTOFLINE_TEMPLATE const Key QMap<Key, T>::key(const T &avalue) const { return key(avalue, Key()); } template <class Key, class T> Q_OUTOFLINE_TEMPLATE const Key QMap<Key, T>::key(const T &avalue, const Key &defaultKey) const { const_iterator i = begin(); while (i != end()) { if (i.value() == avalue) return i.key(); ++i; } return defaultKey; } template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<T> QMap<Key, T>::values() const { QList<T> res; const_iterator i = begin(); while (i != end()) { res.append(i.value()); ++i; } return res; } template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<T> QMap<Key, T>::values(const Key &akey) const { QList<T> res; QMapData::Node *node = findNode(akey); if (node != e) { do { res.append(concrete(node)->value); node = node->forward[0]; } while (node != e && !qMapLessThanKey<Key>(akey, concrete(node)->key)); } return res; } template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::lowerBound(const Key &akey) const { QMapData::Node *update[QMapData::LastLevel + 1]; mutableFindNode(update, akey); return const_iterator(update[0]->forward[0]); } template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::lowerBound(const Key &akey) { detach(); return static_cast<QMapData::Node *>(const_cast<const QMap *>(this)->lowerBound(akey)); } template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::upperBound(const Key &akey) const { QMapData::Node *update[QMapData::LastLevel + 1]; mutableFindNode(update, akey); QMapData::Node *node = update[0]->forward[0]; while (node != e && !qMapLessThanKey<Key>(akey, concrete(node)->key)) node = node->forward[0]; return const_iterator(node); } template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::upperBound(const Key &akey) { detach(); return static_cast<QMapData::Node *>(const_cast<const QMap *>(this)->upperBound(akey)); } template <class Key, class T> Q_OUTOFLINE_TEMPLATE bool QMap<Key, T>::operator==(const QMap<Key, T> &other) const { if (size() != other.size()) return false; if (d == other.d) return true; const_iterator it1 = begin(); const_iterator it2 = other.begin(); while (it1 != end()) { if (!(it1.value() == it2.value()) || qMapLessThanKey(it1.key(), it2.key()) || qMapLessThanKey(it2.key(), it1.key())) return false; ++it2; ++it1; } return true; } #ifndef QT_NO_STL template <class Key, class T> Q_OUTOFLINE_TEMPLATE QMap<Key, T>::QMap(const std::map<Key, T> &other) { d = QMapData::createData(); d->insertInOrder = true; typename std::map<Key,T>::const_iterator it = other.end(); while (it != other.begin()) { --it; insert((*it).first, (*it).second); } d->insertInOrder = false; } template <class Key, class T> Q_OUTOFLINE_TEMPLATE std::map<Key, T> QMap<Key, T>::toStdMap() const { std::map<Key, T> map; const_iterator it = end(); while (it != begin()) { --it; map.insert(std::pair<Key, T>(it.key(), it.value())); } return map; } #endif // QT_NO_STL template <class Key, class T> class QMultiMap : public QMap<Key, T> { public: QMultiMap() {} QMultiMap(const QMap<Key, T> &other) : QMap<Key, T>(other) {} inline typename QMap<Key, T>::iterator replace(const Key &key, const T &value) { return QMap<Key, T>::insert(key, value); } inline typename QMap<Key, T>::iterator insert(const Key &key, const T &value) { return QMap<Key, T>::insertMulti(key, value); } inline QMultiMap &operator+=(const QMultiMap &other) { unite(other); return *this; } inline QMultiMap operator+(const QMultiMap &other) const { QMultiMap result = *this; result += other; return result; } #ifndef Q_NO_USING_KEYWORD using QMap<Key, T>::contains; using QMap<Key, T>::remove; using QMap<Key, T>::count; using QMap<Key, T>::find; using QMap<Key, T>::constFind; #else inline bool contains(const Key &key) const { return QMap<Key, T>::contains(key); } inline int remove(const Key &key) { return QMap<Key, T>::remove(key); } inline int count(const Key &key) const { return QMap<Key, T>::count(key); } inline int count() const { return QMap<Key, T>::count(); } inline typename QMap<Key, T>::iterator find(const Key &key) { return QMap<Key, T>::find(key); } inline typename QMap<Key, T>::const_iterator find(const Key &key) const { return QMap<Key, T>::find(key); } inline typename QMap<Key, T>::const_iterator constFind(const Key &key) const { return QMap<Key, T>::constFind(key); } #endif bool contains(const Key &key, const T &value) const; int remove(const Key &key, const T &value); int count(const Key &key, const T &value) const; typename QMap<Key, T>::iterator find(const Key &key, const T &value) { typename QMap<Key, T>::iterator i(find(key)); typename QMap<Key, T>::iterator end(this->end()); while (i != end && !qMapLessThanKey<Key>(key, i.key())) { if (i.value() == value) return i; ++i; } return end; } typename QMap<Key, T>::const_iterator find(const Key &key, const T &value) const { typename QMap<Key, T>::const_iterator i(constFind(key)); typename QMap<Key, T>::const_iterator end(QMap<Key, T>::constEnd()); while (i != end && !qMapLessThanKey<Key>(key, i.key())) { if (i.value() == value) return i; ++i; } return end; } typename QMap<Key, T>::const_iterator constFind(const Key &key, const T &value) const { return find(key, value); } private: T &operator[](const Key &key); const T operator[](const Key &key) const; }; template <class Key, class T> Q_INLINE_TEMPLATE bool QMultiMap<Key, T>::contains(const Key &key, const T &value) const { return constFind(key, value) != QMap<Key, T>::constEnd(); } template <class Key, class T> Q_INLINE_TEMPLATE int QMultiMap<Key, T>::remove(const Key &key, const T &value) { int n = 0; typename QMap<Key, T>::iterator i(find(key)); typename QMap<Key, T>::const_iterator end(QMap<Key, T>::constEnd()); while (i != end && !qMapLessThanKey<Key>(key, i.key())) { if (i.value() == value) { i = erase(i); ++n; } else { ++i; } } return n; } template <class Key, class T> Q_INLINE_TEMPLATE int QMultiMap<Key, T>::count(const Key &key, const T &value) const { int n = 0; typename QMap<Key, T>::const_iterator i(constFind(key)); typename QMap<Key, T>::const_iterator end(QMap<Key, T>::constEnd()); while (i != end && !qMapLessThanKey<Key>(key, i.key())) { if (i.value() == value) ++n; ++i; } return n; } Q_DECLARE_ASSOCIATIVE_ITERATOR(Map) Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Map) QT_END_NAMESPACE QT_END_HEADER #endif // QMAP_H
[ "zhangyinquan@0feb242a-2539-11de-a0d7-251e5865a1c7" ]
[ [ [ 1, 1029 ] ] ]
f99af53771c9c66fe713463b61ae2e05f302b7a3
ebba8dfe112e93bad2be3551629d632ee4681de9
/apps/examples/serialExample/src/testApp.cpp
d00f5d793d241d7deccb1fe363f010f859a1037d
[]
no_license
lucasdupin/28blobs
8499a4c249b5ac4c7731313e0d418dc051610de4
5a6dd8a9b084468a38f5045a2367a1dbf6d21609
refs/heads/master
2016-08-03T12:27:08.348430
2009-06-20T04:39:03
2009-06-20T04:39:03
219,034
2
0
null
null
null
null
UTF-8
C++
false
false
3,081
cpp
#include "testApp.h" //-------------------------------------------------------------- void testApp::setup(){ ofSetVerticalSync(true); bSendSerialMessage = false; ofBackground(255,255,255); serial.enumerateDevices(); //----------------------------------- note: serial.setup("/dev/tty.usbserial-A4001JEC", 9600); // < this should be set // to whatever com port // your serial device is // connected to. // (ie, COM4 on a pc, dev/tty.... on a mac) // arduino users check in arduino app.... //----------------------------------- font.loadFont("DIN.otf",64); nTimesRead = 0; nBytesRead = 0; readTime = 0; memset(bytesReadString, 0, 4); } //-------------------------------------------------------------- void testApp::update(){ if (bSendSerialMessage){ // (1) write the letter "a" to serial: serial.writeByte('a'); // (2) read // now we try to read 3 bytes // since we might not get them all the time 3 - but sometimes 0, 6, or something else, // we will try to read three bytes, as much as we can // otherwise, we may have a "lag" if we don't read fast enough // or just read three every time. now, we will be sure to // read as much as we can in groups of three... nTimesRead = 0; nBytesRead = 0; int nRead = 0; // a temp variable to keep count per read unsigned char bytesReturned[3]; memset(bytesReadString, 0, 4); memset(bytesReturned, 0, 3); while( (nRead = serial.readBytes( bytesReturned, 3)) > 0){ nTimesRead++; nBytesRead = nRead; }; memcpy(bytesReadString, bytesReturned, 3); bSendSerialMessage = false; readTime = ofGetElapsedTimef(); } } //-------------------------------------------------------------- void testApp::draw(){ char tempStr[1024]; sprintf(tempStr, "click to test serial:\nnBytes read %i\nnTimes read %i\nread: %s\n(at time %0.3f)", nBytesRead, nTimesRead, bytesReadString, readTime); if (nBytesRead > 0 && ((ofGetElapsedTimef() - readTime) < 0.5f)){ ofSetColor(0x000000); } else { ofSetColor(0xdddddd); } font.drawString(tempStr, 50,100); } //-------------------------------------------------------------- void testApp::keyPressed (int key){ } //-------------------------------------------------------------- void testApp::keyReleased(int key){ } //-------------------------------------------------------------- void testApp::mouseMoved(int x, int y ){ } //-------------------------------------------------------------- void testApp::mouseDragged(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::mousePressed(int x, int y, int button){ bSendSerialMessage = true; } //-------------------------------------------------------------- void testApp::mouseReleased(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::windowResized(int w, int h){ }
[ [ [ 1, 118 ] ] ]
460874d02200252842796cbf8cb544c5cbf81119
9b3df03cb7e134123cf6c4564590619662389d35
/RayTracer.h
1fd83b48dc6441be031844587cff93750c79e4a1
[]
no_license
CauanCabral/Computacao_Grafica
a32aeff2745f40144a263c16483f53db7375c0ba
d8673aed304573415455d6a61ab31b68420b6766
refs/heads/master
2016-09-05T16:48:36.944139
2010-12-09T19:32:05
2010-12-09T19:32:05
null
0
0
null
null
null
null
ISO-8859-10
C++
false
false
2,450
h
#ifndef __RayTracer_h #define __RayTracer_h //[]------------------------------------------------------------------------[] //| | //| GVSG Foundation Classes | //| Version 1.0 | //| | //| CopyrightŪ 2007-2009, Paulo Aristarco Pagliosa | //| All Rights Reserved. | //| | //[]------------------------------------------------------------------------[] // // OVERVIEW: RayTracer.h // ======== // Class definition for simple ray tracer. #ifndef __Image_h #include "Image.h" #endif #ifndef __Renderer_h #include "Renderer.h" #endif namespace Graphics { // begin namespace Graphics ////////////////////////////////////////////////////////// // // RayTracer: simple ray tracer class // ========= class RayTracer: public Renderer { public: // Constructor RayTracer(Scene&, Camera* = 0); int getMaxRecursionLevel() const; REAL getMinWeight() const; void setMaxRecursionLevel(int); void setMinWeight(REAL); void render(); virtual void renderImage(Image&); protected: Ray pixelRay; int maxRecursionLevel; REAL minWeight; virtual void scan(Image&); virtual void setPixelRay(REAL, REAL); virtual REAL trace(const Ray&, Color&, int, REAL); virtual bool intersect(const Ray&, IntersectInfo&, REAL); virtual bool notShadow(const Ray&, IntersectInfo&, REAL, Color&); virtual Color shoot(REAL, REAL); virtual Color shade(const Ray&, IntersectInfo&, int, REAL); virtual Color background() const; }; // RayTracer ////////////////////////////////////////////////////////// // // RayTracer inline implementation // ========= inline REAL RayTracer::getMinWeight() const { return minWeight; } inline void RayTracer::setMinWeight(REAL minWeight) { this->minWeight = minWeight; } inline int RayTracer::getMaxRecursionLevel() const { return maxRecursionLevel; } inline void RayTracer::setMaxRecursionLevel(int maxRecursionLevel) { this->maxRecursionLevel = maxRecursionLevel; } } // end namespace Graphics #endif // __RayTracer_h
[ [ [ 1, 96 ] ] ]
dfe4ef8fddd99a51548ca0b88d11152add7a288d
36fea6c98ecabcd5e932f2b7854b3282cdb571ee
/dialogsearch.cpp
f832a7f9ed75e25546e3285fe4182b6edd2e054d
[]
no_license
doomfrawen/visualcommand
976adaae69303d8b4ffc228106a1db9504e4a4e4
f7bc1d590444ff6811f84232f5c6480449228e19
refs/heads/master
2016-09-06T17:40:57.775379
2009-07-28T22:48:23
2009-07-28T22:48:23
32,345,504
0
0
null
null
null
null
UTF-8
C++
false
false
479
cpp
#include "dialogsearch.h" #include "ui_dialogsearch.h" DialogSearch::DialogSearch(QWidget *parent) : QDialog(parent), m_ui(new Ui::DialogSearch) { m_ui->setupUi(this); } DialogSearch::~DialogSearch() { delete m_ui; } void DialogSearch::changeEvent(QEvent *e) { QDialog::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: m_ui->retranslateUi(this); break; default: break; } }
[ "flouger@13a168e0-7ae3-11de-a146-1f7e517e55b8" ]
[ [ [ 1, 26 ] ] ]
35567b21e58d06f81d48573e04f5d70a6e2c045d
cb1c6c586d769f919ed982e9364d92cf0aa956fe
/examples/TRTRenderTest/GridRaycaster.h
ba7562de782b98ef96f7fd83d15f8e0df70cc1aa
[]
no_license
jrk/tinyrt
86fd6e274d56346652edbf50f0dfccd2700940a6
760589e368a981f321e5f483f6d7e152d2cf0ea6
refs/heads/master
2016-09-01T18:24:22.129615
2010-01-07T15:19:44
2010-01-07T15:19:44
462,454
3
0
null
null
null
null
UTF-8
C++
false
false
1,606
h
//===================================================================================================================== // // GridRaycaster.h // // Part of the TinyRT Raytracing Library. // Author: Joshua Barczak // // Copyright 2008 Joshua Barczak. All rights reserved. // See Doc/LICENSE.txt for terms and conditions. // //===================================================================================================================== #ifndef _TRT_GRIDRAYCASTER_H_ #define _TRT_GRIDRAYCASTER_H_ #include "TestRaycaster.h" //===================================================================================================================== /// \ingroup TinyRTTest /// \brief //===================================================================================================================== class GridRaycaster : public TestRaycaster { public: GridRaycaster( TestMesh* pMesh ); virtual ~GridRaycaster(); virtual void RaycastFirstHit( TinyRT::Ray& rRay, TinyRT::TriangleRayHit& rHitInfo ) ; virtual float ComputeCost( float fISectCost ) const ; inline const UniformGrid<TestMesh>* GetGrid() const { return m_pGrid; }; private: UniformGrid<TestMesh>* m_pGrid; //typedef NullMailbox MailboxType; typedef DirectMapMailbox<uint32,16> MailboxType; //typedef FifoMailbox<uint32,8> MailboxType; //typedef SimdFifoMailbox<8> MailboxType; //FifoMailbox<uint32,8> m_mb; //DirectMapMailbox<uint32,8> m_mb; //SimdFifoMailbox<8> m_mb; }; #endif // _TRT_GRIDRAYCASTER_H_
[ "jbarcz1@6ce04321-59f9-4392-9e3f-c0843787e809" ]
[ [ [ 1, 52 ] ] ]
3449f94161d7ad04772ea7851fcb3a00c18192ef
cd61c8405fae2fa91760ef796a5f7963fa7dbd37
/Sauron/Vision/VerticalLineConvolutionOperator.cpp
794efb402236380d9bef2858b0835d0da43df330
[]
no_license
rafaelhdr/tccsauron
b61ec89bc9266601140114a37d024376a0366d38
027ecc2ab3579db1214d8a404d7d5fa6b1a64439
refs/heads/master
2016-09-05T23:05:57.117805
2009-12-14T09:41:58
2009-12-14T09:41:58
32,693,544
0
0
null
null
null
null
UTF-8
C++
false
false
3,383
cpp
#include "VerticalLineConvolutionOperator.h" #define VERTICAL_SOBEL_USE_COLORS 0 namespace sauron { VerticalLineConvolutionOperator::VerticalLineConvolutionOperator() { } VerticalLineConvolutionOperator::~VerticalLineConvolutionOperator() { } void VerticalLineConvolutionOperator::convolve( Image &im ) { cvSmooth( im, im, CV_GAUSSIAN); #if VERTICAL_SOBEL_USE_COLORS int sumR = 0; int sumG = 0; int sumB = 0; #else int sumGray = 0; #endif //const int kernelValues[] = //{ // 1, 1, 0, -1, -1, // 1, 1, 0, -1, -1, // 1, 1, 0, -1, -1, // 1, 1, 0, -1, -1, // 1, 1, 0, -1, -1, // 1, 1, 0, -1, -1, // 1, 1, 0, -1, -1, //}; //const int kernelValues[] = //{ // 2, 2, 0, -2, -2, // 2, 2, 0, -2, -2, //}; const int kernelValues[] = { 2, 0, -2, 2, 0, -2, 2, 0, -2, 2, 0, -2, 2, 0, -2, 2, 0, -2, 2, 0, -2, }; const uint matrixWidth = 3; // Remember to change each time the kernelValues are modified const uint matrixHeight = 3; // Remember to change each time the kernelValues are modified const uint matrixCenterWidth = (matrixWidth) >> 1; const uint matrixCenterHeight = (matrixHeight) >> 1; const uint imageWidth = im.getWidth() - matrixCenterWidth; const uint imageHeight = im.getHeight() - matrixCenterHeight; const float scale = 0.5f; cvScale( im, im, scale ); #if !VERTICAL_SOBEL_USE_COLORS im.convertToGray(); #endif Image buffer( im ); for ( register unsigned int i = matrixCenterWidth; i < imageWidth; ++i ) { for ( register unsigned int j = matrixCenterHeight; j < imageHeight; ++j ) { #if VERTICAL_SOBEL_USE_COLORS sumR = 0; sumG = 0; sumB = 0; #else sumGray = 0; #endif int unfinishedIndex = 0; for( register unsigned int r = 0; r < matrixHeight; ++r ) { unfinishedIndex = matrixWidth * r; for ( register unsigned int c = 0; c < matrixWidth; ++c ) { int kernelValue = kernelValues[ unfinishedIndex + c]; Pixel pixel = buffer(i - matrixCenterWidth + c, j - matrixCenterHeight + r); #if VERTICAL_SOBEL_USE_COLORS sumR += (pixel.R()) * kernelValue; //* scale; sumG += (pixel.G()) * kernelValue; // * scale; sumB += (pixel.B()) * kernelValue; // * scale; #else sumGray += pixel.Gray() * kernelValue; //* scale; #endif } } #if VERTICAL_SOBEL_USE_COLORS byte rgb[3]; rgb[0] = (byte)(sumR < 0 ? (-sumR > 255 ? 255 : -sumR) : (sumR > 255 ? 255 : sumR)); rgb[1] = (byte)(sumG < 0 ? (-sumG > 255 ? 255 : -sumG) : (sumG > 255 ? 255 : sumG)); rgb[2] = (byte)(sumB < 0 ? (-sumB > 255 ? 255 : -sumB) : (sumB > 255 ? 255 : sumB)); im(i, j).set( rgb[0], rgb[1], rgb[2] ); #else im(i, j).Gray() = (byte)(sumGray < 0 ? (-sumGray > 255 ? 255 : -sumGray) : (sumGray > 255 ? 255 : sumGray)); #endif } } } } // namespace sauron
[ "fggodoy@8373e73c-ebb0-11dd-9ba5-89a75009fd5d" ]
[ [ [ 1, 118 ] ] ]
fe3e9f29f193b97bfbb34044cce75f894a94bafc
b2d46af9c6152323ce240374afc998c1574db71f
/cursovideojuegos/theflostiproject/3rdParty/boost/libs/program_options/src/cmdline.cpp
e82eea16d1fb302302804fc8ef6857f2b4bad4cd
[]
no_license
bugbit/cipsaoscar
601b4da0f0a647e71717ed35ee5c2f2d63c8a0f4
52aa8b4b67d48f59e46cb43527480f8b3552e96d
refs/heads/master
2021-01-10T21:31:18.653163
2011-09-28T16:39:12
2011-09-28T16:39:12
33,032,640
0
0
null
null
null
null
UTF-8
C++
false
false
25,183
cpp
// Copyright Vladimir Prus 2002-2004. // 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) #define BOOST_PROGRAM_OPTIONS_SOURCE #include <boost/program_options/config.hpp> #include <boost/config.hpp> #include <boost/program_options/detail/cmdline.hpp> #include <boost/program_options/errors.hpp> #include <string> #include <utility> #include <vector> #include <cassert> #include <cstring> #include <cctype> #include <cstdio> namespace boost { namespace program_options { using namespace std; using namespace boost::program_options::command_line_style; invalid_command_line_syntax:: invalid_command_line_syntax(const std::string& tokens, kind_t kind) : invalid_syntax(tokens, error_message(kind)), m_kind(kind) {} std::string invalid_command_line_syntax::error_message(kind_t kind) { // Initially, store the message in 'const char*' variable, // to avoid conversion to std::string in all cases. const char* msg; switch(kind) { case long_not_allowed: msg = "long options are not allowed"; break; case long_adjacent_not_allowed: msg = "parameters adjacent to long options not allowed"; break; case short_adjacent_not_allowed: msg = "parameters adjust to short options are not allowed"; break; case empty_adjacent_parameter: msg = "adjacent parameter is empty"; break; case missing_parameter: msg = "required parameter is missing"; break; case extra_parameter: msg = "extra parameter"; break; default: msg = "unknown error"; } return msg; } invalid_command_line_syntax::kind_t invalid_command_line_syntax::kind() const { return m_kind; } }} namespace boost { namespace program_options { namespace detail { // vc6 needs this, but borland chokes when this is added. #if BOOST_WORKAROUND(_MSC_VER, <= 1200) using namespace std; using namespace program_options; #endif cmdline::cmdline(const std::vector<std::string>& args, int style, bool allow_unregistered) { init(args, style, allow_unregistered); } cmdline::cmdline(int argc, const char*const * argv, int style, bool allow_unregistered) { #if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) vector<string> args; copy(argv+1, argv+argc, inserter(args, args.end())); init(args, style, allow_unregistered); #else init(vector<string>(argv+1, argv+argc), style, allow_unregistered); #endif } void cmdline::init(const std::vector<std::string>& args, int style, bool allow_unregistered) { if (style == 0) style = default_style; check_style(style); this->args = args; this->style = style_t(style); this->allow_unregistered = allow_unregistered, index = 0; m_current = 0; m_next = 0; pending_short_option = 0; m_no_more_options = false; m_error_description = ed_success; m_num_tokens = 0; } void cmdline::check_style(int style) const { bool allow_some_long = (style & allow_long) || (style & allow_long_disguise); const char* error = 0; if (allow_some_long && !(style & long_allow_adjacent) && !(style & long_allow_next)) error = "style disallows parameters for long options"; if (!error && (style & allow_short) && !(style & short_allow_adjacent) && !(style & short_allow_next)) error = "style disallows parameters for short options"; if (!error && (style & allow_short) && !(style & allow_dash_for_short) && !(style & allow_slash_for_short)) error = "style disallows all characters for short options"; if (error) throw invalid_command_line_style(error); // Need to check that if guessing and long disguise are enabled // -f will mean the same as -foo } void cmdline::set_additional_parser(additional_parser p) { m_additional_parser = p; } void cmdline::add_option(const std::string& long_name, char short_name, char properties, int index) { options.push_back(option(long_name, short_name, translate_property(properties), index)); } void cmdline::add_option(const char* long_name, char short_name, char properties, int index) { add_option(string(long_name), short_name, properties, index); } cmdline& cmdline::operator++() { next(); clear_error(); return *this; } bool cmdline::at_option() const { return m_element_kind == ek_option; } bool cmdline::at_argument() const { return m_element_kind == ek_argument; } void cmdline::next() { if (!*this) return; // Skip over current element advance(m_num_tokens); // We might have consumed all tokens by now. if (!*this) return; m_last = m_current; m_opt = 0; m_num_tokens = 0; m_disguised_long = false; m_option_name = std::string(); m_option_values.clear(); m_argument = std::string(); m_element_kind = ek_option; if (pending_short_option) { if (handle_short_option(pending_short_option)) m_option_index = m_opt->index; // TODO: should decide what to do in this case assert(!m_disguised_long); } else { if (m_additional_parser) { pair<string, string> p = m_additional_parser(m_current); if (!p.first.empty()) if (handle_additional_parser(p)) { m_option_index = m_opt ? m_opt->index : 1; return; } else { // handle_additional_parser should have set // error code accordingly. return; } } switch(is_option(m_current)) { case error_option: break; case no_option: if (strcmp(m_current, "--") == 0) { m_no_more_options = true; advance(1); next(); return; } else { m_element_kind = ek_argument; m_argument = m_current; m_arguments.push_back(m_argument); m_num_tokens = 1; } break; case long_option: if (handle_long_option(m_current + 2)) m_option_index = m_opt ? m_opt->index : 1; break; case short_option: if (handle_short_option(m_current + 1)) m_option_index = m_opt ? m_opt->index : 1; break; case dos_option: if (handle_dos_option(m_current + 1)) m_option_index = m_opt ? m_opt->index : 1; break; } } } const string& cmdline::argument() const { return m_argument; } const string& cmdline::option_name() const { return m_option_name; } int cmdline::option_index() const { return m_option_index; } const string& cmdline::raw_option_name() const { return m_raw_option_name; } const string& cmdline::option_value() const { static string empty; if (m_option_values.size() > 1) throw multiple_values("multiple values"); return m_option_values.empty() ? empty : m_option_values.front(); } const std::vector<std::string>& cmdline::option_values() const { return m_option_values; } const vector<string>& cmdline::arguments() const { return m_arguments; } const string& cmdline::last() const { return m_last; } namespace detail { int strncmp_nocase(const char* s1, const char* s2, size_t n) { size_t i(0); for(;*s1 && *s2 && i < n; ++s1, ++s2, ++i) { char c1 = *s1; char c2 = *s2; if (c1 == c2) continue; c1 = tolower(*s1); c2 = tolower(*s2); if (c1 < c2) return -1; else if (c1 > c2) return 1; } if (i == n) return 0; else if (!*s1 && *s2) return -1; else if (*s1 && !*s2) return 1; else return 0; } // Standard strncmp has "C" linkage and Comeau compiler // issues error when we select between strncmp_nocase // and strncmp using ?:, below int strncmp_case(const char* s1, const char* s2, size_t n) { // At least intel-win32-7.1-vc6 does not like "std::" prefix below, // so add using directive make everyone happy using namespace std; // But some msvc version don't like using directive :-( #if BOOST_WORKAROUND(_MSC_FULL_VER, >= 13102292) &&\ BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13103077)) return std::strncmp(s1, s2, n); #else return strncmp(s1, s2, n); #endif } } void test_cmdline_detail() { using detail::strncmp_nocase; assert(strncmp_nocase("a", "a", 5) == 0); assert(strncmp_nocase("a", "d", 5) < 0); assert(strncmp_nocase("d", "a", 5) > 0); assert(strncmp_nocase("abc", "abcd", 4) < 0); assert(strncmp_nocase("abcd", "abc", 4) > 0); assert(strncmp_nocase("abcd", "abc", 3) == 0); } const cmdline::option* cmdline::find_long_option(const char* name) { // some systems does not have strchr et.al. in namespace std using namespace std; // Handle the case of '=' in name, which is not part of option name const char* eq = strchr(name, '='); // Comeau reports ambiguity between C (global) and C++ (std::) versions. #if BOOST_WORKAROUND(__COMO__, BOOST_TESTED_AT(4303)) std::size_t n = eq ? eq - name : std::strlen(name); #else std::size_t n = eq ? eq - name : strlen(name); #endif int (*cmp)(const char*, const char*, size_t); cmp = (style & case_insensitive) ? detail::strncmp_nocase : detail::strncmp_case; const option* result = 0; for (size_t i = 0; i < options.size(); ++i) { const char* known_name = options[i].long_name.c_str(); bool prefix = (*options[i].long_name.rbegin() == '*'); std::size_t n2 = n; if (prefix) n2 = options[i].long_name.size()-1; if (cmp(name, known_name, n2) == 0) { // Is there match without guessing? if (options[i].long_name.size() == n2 || (prefix && options[i].long_name.size() > n2)) { result = &options[i]; break; } else if (style & allow_guessing) { if (result) { result = 0; m_error_description = ed_ambiguous_option; break; } else { result = &options[i]; } } } } if (!result && m_error_description == ed_success) m_error_description = ed_unknown_option; return result; } const cmdline::option* cmdline::find_short_option(char name) { for (size_t i = 0; i < options.size(); ++i) { if (name == options[i].short_name) return &options[i]; } m_error_description = ed_unknown_option; return 0; } bool cmdline::handle_long_option(const char* s) { // some systems does not have strchr et.al. in namespace std using namespace std; const option* opt = find_long_option(s); m_opt = opt; if (opt || allow_unregistered) { // We always use the long name as specified by the // user, not abbreviation or otherwise-cased one we // get on the command line. if (opt) m_option_name = opt->long_name; bool adjacent_parameter(false), next_parameter(false); const char* eq = strchr(s, '='); if (eq) { // But store option spelling from command line as well. m_raw_option_name = string(s, eq); if (eq[1]) { if (!(style & long_allow_adjacent)) { m_error_description = ed_long_adjacent_not_allowed; return false; } else { adjacent_parameter = true; m_option_values.push_back(string(eq+1)); } } else { m_error_description = ed_empty_adjacent_parameter; return false; } } else { m_raw_option_name = s; if (m_next && is_option(m_next) == no_option && (style & long_allow_next)) { next_parameter = true; } m_error_description = ed_success; } if (!opt) m_option_name = m_raw_option_name; return process_parameter(opt, adjacent_parameter, next_parameter); } else { // Option not found, 'find_long_option' has set error code already. return false; } } bool cmdline::handle_short_option(const char* s, bool ignore_sticky) { pending_short_option = 0; if (style & allow_long_disguise) { const option* opt = find_long_option(s); m_opt = opt; if (opt) { m_disguised_long = true; return handle_long_option(s); } else m_error_description = ed_success; } m_disguised_long = false; const option* opt = find_short_option(*s); m_opt = opt; if (opt || allow_unregistered) { if (opt && !opt->long_name.empty()) m_option_name = opt->long_name; else m_option_name = '-' + string(s, s+1); m_raw_option_name = string(s, 1); bool adjacent_parameter(false), next_parameter(false); if (s[1] != '\0') { if (!(style & short_allow_adjacent)) { m_error_description = ed_short_adjacent_not_allowed; return false; } else { adjacent_parameter = true; m_option_values.push_back(string(s+1)); } } else { if ((style & short_allow_next) && m_next) { option_kind kind = is_option(m_next); if (kind == no_option) { next_parameter = true; } else if (kind == short_option && opt && opt->properties == require_parameter) { // This handles a special case: // -a -1 // where "-1" is a parameter to "-a". It's pretty // hard to quote "-1" in any way on the comment line, so // we decide that if "-a" has required parameter then -1 // is the parameter. // We do so even if there's registered "-1" option, // since: // - that how getopt works // - it allows command line to be parsed, we'll // get error otherwise. next_parameter = true; } } // Reset error state that 'is_option' might have changed m_error_description = ed_success; } bool ok = process_parameter(opt, adjacent_parameter, next_parameter); if (!ok && m_error_description == ed_extra_parameter && (style & allow_sticky) && !ignore_sticky) if (find_short_option(s[1]) != 0) { m_error_description = ed_success; m_option_values.clear(); pending_short_option = s+1; m_num_tokens = 0; ok = true; } else { m_error_description = ed_extra_parameter; } return ok; } else { return false; } } bool cmdline::handle_dos_option(const char* s) { return handle_short_option(s, true); } bool cmdline::handle_additional_parser(const std::pair<string, string>& p) { m_option_name = p.first; m_raw_option_name = p.first; m_option_values.push_back(p.second); if (p.first[0] == '-') m_opt = find_short_option(p.first[1]); else m_opt = find_long_option(p.first.c_str()); if (m_opt && !m_opt->long_name.empty()) m_option_name = m_opt->long_name; else m_option_name = "-" + p.first.substr(1,1); return process_parameter(m_opt, !p.second.empty(), false); } /* Handles parameter assignments, setting m_option_value and m_num_tokens. 'opt' describes the detected option. If it's 0, it means the option is not registered, but the parser allows unregistered options. Assumes that this option allows but not requires a parameter. 'adjacent_parameter' says if there's a parameter in the same token as the option. In which case it must be already assigned to m_option_value. 'next_parameter' says if there's next token, which can be interpreted as argument. */ bool cmdline::process_parameter(const option* opt, bool adjacent_parameter, bool next_parameter) { properties_t properties; if (opt) properties = opt->properties; else properties = allow_parameter; bool accept_parameter((properties == allow_parameter) || (properties == require_parameter) || (properties == allow_parameters) || (properties == require_parameters)); bool ok(true); if (accept_parameter) { if (adjacent_parameter) { // Everything assigned already m_num_tokens = 1; } else { if (next_parameter) { m_option_values.push_back(m_next); m_num_tokens = 2; } else { // No, there's no parameter at all! if (properties == require_parameter) { m_error_description = ed_missing_parameter; ok = false; } else { m_num_tokens = 1; } } } } else { if (adjacent_parameter) { m_error_description = ed_extra_parameter; ok = false; } else { m_num_tokens = 1; } } // If multiple parameters are allowed, consume every non-option // token if (properties == allow_parameters || properties == require_parameters) { // Don't use m_current and m_next, but directly iterate over // input. for(size_t i = index + 2; i < args.size() && is_option(args[i].c_str()) == no_option && args[i] != "--"; ++i, ++m_num_tokens) { m_option_values.push_back(args[i]); } m_error_description = ed_success; } return ok; } cmdline::operator bool() const { return index < args.size() && m_error_description == ed_success; } cmdline::option_kind cmdline::is_option(const char* s) { if (m_no_more_options) return no_option; if (*s == '-' && *(s+1) == '-' && *(s+2) != '\0') if (style & allow_long) return long_option; else { m_error_description = ed_long_not_allowed; return error_option; } if (style & allow_short) { if ((style & allow_dash_for_short) && *s == '-' && *(s+1) != '-' && *(s+1) != '\0') return short_option; if ((style & allow_slash_for_short) && *s == '/') return dos_option; } return no_option; } void cmdline::advance(int count) { index += count; // Note that the 'args' array is not modified at all, // therefore storing results of c_str() is OK. m_current = index < args.size()? args[index].c_str() : 0; m_next = index+1 < args.size() ? args[index+1].c_str() : 0; } cmdline::properties_t cmdline::translate_property(char p) { if (p == '|') return no_parameter; else if (p == '?') return allow_parameter; else if (p == ':') return require_parameter; else if (p == '*') return allow_parameters; else if (p == '+') return require_parameters; else throw logic_error("Invalid property character"); } void cmdline::clear_error() { error_description_t e = m_error_description; m_error_description = ed_success; invalid_command_line_syntax::kind_t re; // FIXME: have no idea why g++ 3.2 wants it. typedef boost::program_options::unknown_option unknown_option; typedef boost::program_options::ambiguous_option ambiguous_option; if (e) { if (e == ed_unknown_option) throw unknown_option(m_current); if (e == ed_ambiguous_option) throw ambiguous_option(m_current, vector<string>()); switch(e) { case ed_long_not_allowed: re = invalid_command_line_syntax::long_not_allowed; break; case ed_long_adjacent_not_allowed: re = invalid_command_line_syntax::long_adjacent_not_allowed; break; case ed_short_adjacent_not_allowed: re = invalid_command_line_syntax::short_adjacent_not_allowed; break; case ed_empty_adjacent_parameter: re = invalid_command_line_syntax::empty_adjacent_parameter; break; case ed_missing_parameter: re = invalid_command_line_syntax::missing_parameter; break; case ed_extra_parameter: re = invalid_command_line_syntax::extra_parameter; break; default: ; // do nothing } throw invalid_command_line_syntax(m_current, re); } } }}}
[ "ohernandezba@71d53fa2-cca5-e1f2-4b5e-677cbd06613a" ]
[ [ [ 1, 771 ] ] ]
7195a35b64090edcb5a45230e2d4fbfdf378c439
119ba245bea18df8d27b84ee06e152b35c707da1
/unreal/branches/robots/qrgui/interpreters/robots/details/robotImplementations/brickImplementations/nullBrickImplementation.cpp
0a707ebd60f281ededd32067c5bbcef1f0931a93
[]
no_license
nfrey/qreal
05cd4f9b9d3193531eb68ff238d8a447babcb3d2
71641e6c5f8dc87eef9ec3a01cabfb9dd7b0e164
refs/heads/master
2020-04-06T06:43:41.910531
2011-05-30T19:30:09
2011-05-30T19:30:09
1,634,768
0
0
null
null
null
null
UTF-8
C++
false
false
405
cpp
#include "nullBrickImplementation.h" using namespace qReal::interpreters::robots; using namespace details::robotImplementations::brickImplementations; NullBrickImplementation::NullBrickImplementation() { } void NullBrickImplementation::playTone(unsigned freq, unsigned time) { Q_UNUSED(freq); Q_UNUSED(time); } void NullBrickImplementation::beep(unsigned time) { Q_UNUSED(time); }
[ [ [ 1, 18 ] ] ]
eb54eb26f6f35171587d2c5f86b8f068f5d53458
6f907ebd2c7dfa8887f8cbd068d989b2a59da161
/Simple3D_win32/S3DRect.h
12dea20be4cae2f471b43dbb92956e7b4230a772
[ "MIT" ]
permissive
AVGP/Simple3D
cd53aa0fda912467e9df870474220ee0a680fda1
9832cb9b4e008ca0349585d96e14b41317691fd9
refs/heads/master
2021-01-19T08:46:20.767336
2010-09-27T11:14:15
2010-09-27T11:14:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
653
h
/** * Simple3D * Basic, cross-platform 3D-Engine * (c)2010 by M.Naumann * Licenced under GPL 2! */ #ifndef _S3DRect_ #define _S3DRect_ #include "S3DPoint.h" #include "S3DPrimitive.h" class S3DRect : public S3DPrimitive { private: S3DPoint vertices[4]; unsigned long color; public: S3DRect(S3DPoint points[4]); S3DRect(S3DPoint a, S3DPoint b, S3DPoint c, S3DPoint d); void move(double dx, double dy, double dz); void rotate(double rx, double ry, double rz); void draw(S3DDevice *d,S3DSurface w,S3DContext g); void setColor(unsigned long c); unsigned long getColor(); S3DPoint *getPoints(); double getZ(); }; #endif
[ [ [ 1, 34 ] ] ]
96004ff9c394166c88b3975f136ce54abb3a366f
dc4f8d571e2ed32f9489bafb00b420ca278121c6
/scrib_compiler/cFile.cpp
16c23ca78a9503eb03e6079262cdc0ee25b42e28
[]
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
5,027
cpp
/******************************************************************************************************** /* /* file.cpp /* /* Copyright 2009 Robert Sacks /* /* This file is part of OsBxr. You may redistribute and/or modify OsBxr 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 OsBxr. If you did not, go to http://www.gnu.org. /* /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER 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" #if 1 #include "cFile.h" //======================================================================================================= // PROTOTYPES //======================================================================================================= static FILE * open_text_file_for_reading ( const wchar_t * pwFile ); static FILE * open_text_file_for_writing ( const wchar_t * pwFile ); //======================================================================================================= // CODE //======================================================================================================= //------------------------------------------------------------------------------------------------------- // GET LINE //------------------------------------------------------------------------------------------------------- bool cFileIn :: get_line ( mojo::cStrW * s ) { unsigned c, iQtyRead = 0; while ( WEOF != ( c = getwc ( h ) ) ) { iQtyRead ++; if ( 0x2028 == c ) // unicode line separator break; else if ( 0x0A == c ) break; else if ( 0x0D == c ) ; else { *s += static_cast<wchar_t> ( c ); } } return iQtyRead ? true : false; } //------------------------------------------------------------------------------------------------------- // CONSTRUCTOR //------------------------------------------------------------------------------------------------------- cFileIn :: cFileIn ( const wchar_t * pName ) : sName ( pName ) { h = open_text_file_for_reading ( pName ); } //------------------------------------------------------------------------------------------------------- // DESTRUCTOR //------------------------------------------------------------------------------------------------------- cFileIn :: ~cFileIn () { if ( h ) fclose ( h ); } //------------------------------------------------------------------------------------------------------- // OPEN TEXT FILE FOR READING // This will automatically open a file correctly // REGARDLESS OF WHETHER IT'S ANSI, UTF-8, or UTF-16 //------------------------------------------------------------------------------------------------------- static FILE * open_text_file_for_reading ( const wchar_t * pwFile ) { FILE * h; if ( 0 != _wfopen_s ( & h, pwFile, L"rt, ccs=UTF-8" ) ) return 0; else return h; } //------------------------------------------------------------------------------------------------------- // CONSTRUCTOR //------------------------------------------------------------------------------------------------------- cFileOut :: cFileOut ( const wchar_t * pName ) : sName ( pName ) { h = open_text_file_for_writing ( pName ); } //------------------------------------------------------------------------------------------------------- // DESTRUCTOR //------------------------------------------------------------------------------------------------------- cFileOut :: ~cFileOut () { if ( h ) fclose ( h ); } //------------------------------------------------------------------------------------------------------- // OPEN TEXT FILE FOR WRITING // This will automatically open a file correctly // REGARDLESS OF WHETHER IT'S ANSI, UTF-8, or UTF-16 //------------------------------------------------------------------------------------------------------- static FILE * open_text_file_for_writing ( const wchar_t * pwFile ) { FILE * h; if ( 0 != _wfopen_s ( & h, pwFile, L"wt, ccs=UTF-8" ) ) return 0; else return h; } #endif
[ [ [ 1, 142 ] ] ]
41ac39009037203f4c375fdd1a0b66093462215e
fcf03ead74f6dc103ec3b07ffe3bce81c820660d
/Base/IPC/Async/AcceptInput1/AcceptInput1.cpp
0087d9cfac73c1267f68556951402c2cb8495ac4
[]
no_license
huellif/symbian-example
72097c9aec6d45d555a79a30d576dddc04a65a16
56f6c5e67a3d37961408fc51188d46d49bddcfdc
refs/heads/master
2016-09-06T12:49:32.021854
2010-10-14T06:31:20
2010-10-14T06:31:20
38,062,421
2
0
null
null
null
null
UTF-8
C++
false
false
14,425
cpp
// AcceptInput1.cpp // // Copyright (C) Symbian Software Ltd 2000-2005. All rights reserved. // Asynchronous keyboard processing with messenger program. // A single CKeyMessengerProcessor active object (derived from // class CActiveConsole) which accepts input from keyboard, but does not // print it. // This object contains a CMessageTimer object which it activates if the // user inputs the character "m" and cancelled if the user inputs "c". #include "CommonFramework.h" // // Common literal text // _LIT(KTextEsc,"\n"); // panics enum { EPanicAlreadyActive=1000, }; ////////////////////////////////////////////////////////////////////////////// // // -----> CTimedMessenger (definition) // ////////////////////////////////////////////////////////////////////////////// class CTimedMessenger : public CTimer { public: // Construction CTimedMessenger(); // Destruction ~CTimedMessenger(); public: // Static construction static CTimedMessenger* NewLC(const TDesC& aGreeting, TInt aTicksRequested, TInt aTicksInterval ); static CTimedMessenger* NewL(const TDesC& aGreeting, TInt aTicksRequested, TInt aTicksInterval ); public: // Second phase construction void ConstructL(const TDesC& aGreeting, TInt aTicksRequested, TInt aTicksInterval ); // issue request void IssueRequest(); // Cancel request // Defined as pure virtual by CActive; // implementation provided by this class. void DoCancel(); // service completed request. // Defined as pure virtual by CActive; // implementation provided by this class. void RunL(); public: // data members defined by this class TBufC<20> iGreeting; // Text of the greeting. TInt iTicksRequested; // Total number of greetings CTimedMessenger // will emit. TInt iTicksInterval; // Number of seconds between each greeting. TInt iTicksDone; // Number of greetings issued so far. }; ////////////////////////////////////////////////////////////////////////////// // // -----> CExampleScheduler (definition) // ////////////////////////////////////////////////////////////////////////////// class CExampleScheduler : public CActiveScheduler { public: void Error (TInt aError) const; }; ////////////////////////////////////////////////////////////////////////////// // // -----> CActiveConsole (definition) // // An abstract class which provides the facility to issue key requests. // ////////////////////////////////////////////////////////////////////////////// class CActiveConsole : public CActive { public: // Construction CActiveConsole(CConsoleBase* aConsole); void ConstructL(); // Destruction ~CActiveConsole(); // Issue request void RequestCharacter(); // Cancel request. // Defined as pure virtual by CActive; // implementation provided by this class. void DoCancel(); // Service completed request. // Defined as pure virtual by CActive; // implementation provided by this class, void RunL(); // Called from RunL() - an implementation must be provided // by derived classes to handle the completed request virtual void ProcessKeyPress(TChar aChar) = 0; protected: // Data members defined by this class CConsoleBase* iConsole; // A console for reading from }; ////////////////////////////////////////////////////////////////////////////// // // -----> CWriteKeyProcessor (definition) // // This class is derived from CActiveConsole. // Request handling: accepts input from the keyboard and outputs it // to the console. // ////////////////////////////////////////////////////////////////////////////// class CWriteKeyProcessor : public CActiveConsole { public: // Construction CWriteKeyProcessor(CConsoleBase* aConsole); public: // Static constuction static CWriteKeyProcessor *NewLC (CConsoleBase* aConsole); static CWriteKeyProcessor *NewL(CConsoleBase* aConsole); // Service request void ProcessKeyPress(TChar aChar); }; ////////////////////////////////////////////////////////////////////////////// // // -----> CTimedMessenger (implementation) // ////////////////////////////////////////////////////////////////////////////// CTimedMessenger::CTimedMessenger() : CTimer(CActive::EPriorityStandard) // Construct zero-priority active object {}; CTimedMessenger* CTimedMessenger::NewLC(const TDesC& aGreeting, TInt aTicksRequested, TInt aTicksInterval ) { CTimedMessenger* self=new (ELeave) CTimedMessenger; CleanupStack::PushL(self); self->ConstructL(aGreeting,aTicksRequested,aTicksInterval); return self; } CTimedMessenger* CTimedMessenger::NewL(const TDesC& aGreeting, TInt aTicksRequested, TInt aTicksInterval ) { CTimedMessenger* self = NewLC(aGreeting,aTicksRequested,aTicksInterval); CleanupStack::Pop(); return self; } void CTimedMessenger::ConstructL(const TDesC& aGreeting, TInt aTicksRequested, TInt aTicksInterval ) { // Base class second-phase construction. CTimer::ConstructL(); // Set members from arguments iGreeting = aGreeting; // Set greeting text. iTicksRequested = aTicksRequested; // Ticks requested iTicksInterval = aTicksInterval; // Interval between ticks // Add active object to active scheduler CActiveScheduler::Add(this); } CTimedMessenger::~CTimedMessenger() { // Make sure we're cancelled Cancel(); } void CTimedMessenger::DoCancel() { // Base class CTimer::DoCancel(); // Reset this variable - needed if the object is re-activated later iTicksDone = 0; // Tell user _LIT(KMsgCancelled,"Outstanding Messenger request cancelled\n"); console->Printf(KMsgCancelled); } void CTimedMessenger::IssueRequest() { // There should never be an outstanding request at this point. _LIT(KMsgAlreadyActive,"Is already Active"); __ASSERT_ALWAYS(!IsActive(),User::Panic(KMsgAlreadyActive,EPanicAlreadyActive)); // Request another wait CTimer::After( iTicksInterval*1000000); } void CTimedMessenger::RunL() { // Handle request completion // One more tick done iTicksDone++; // Print greeting _LIT(KFormatString1,"%S \n"); console->Printf(KFormatString1,&iGreeting); // Issue new request, or stop if we have reached the limit if (iTicksDone < iTicksRequested) { IssueRequest(); } else { _LIT(KMsgFinished,"Messenger finished \n"); console->Printf(KMsgFinished); // Reset this variable - needed if the object is re-activated later iTicksDone=0; // Can now stop the active scheduler CActiveScheduler::Stop(); } } ////////////////////////////////////////////////////////////////////////////// // // -----> CExampleScheduler (implementation) // ////////////////////////////////////////////////////////////////////////////// void CExampleScheduler::Error(TInt aError) const { _LIT(KMsgSchedErr,"CExampleScheduler-error"); User::Panic(KMsgSchedErr,aError); } ////////////////////////////////////////////////////////////////////////////// // // -----> CActiveConsole (implementation) // ////////////////////////////////////////////////////////////////////////////// CActiveConsole::CActiveConsole( CConsoleBase* aConsole) : CActive(CActive::EPriorityUserInput) // Construct high-priority active object { iConsole = aConsole; } void CActiveConsole::ConstructL() { // Add to active scheduler CActiveScheduler::Add(this); } CActiveConsole::~CActiveConsole() { // Make sure we're cancelled Cancel(); } void CActiveConsole::DoCancel() { iConsole->ReadCancel(); } void CActiveConsole::RunL() { // Handle completed request ProcessKeyPress(TChar(iConsole->KeyCode())); } void CActiveConsole::RequestCharacter() { // A request is issued to the CConsoleBase to accept a // character from the keyboard. iConsole->Read(iStatus); SetActive(); } ////////////////////////////////////////////////////////////////////////////// // // -----> CWriteKeyProcessor (implementation) // ////////////////////////////////////////////////////////////////////////////// CWriteKeyProcessor::CWriteKeyProcessor(CConsoleBase* aConsole) : CActiveConsole(aConsole) {}; CWriteKeyProcessor* CWriteKeyProcessor::NewLC(CConsoleBase* aConsole) { CWriteKeyProcessor* self=new (ELeave) CWriteKeyProcessor(aConsole); CleanupStack::PushL(self); self->ConstructL(); return self; } CWriteKeyProcessor* CWriteKeyProcessor::NewL(CConsoleBase* aConsole) { CWriteKeyProcessor* self=NewLC(aConsole); CleanupStack::Pop(); return self; } void CWriteKeyProcessor::ProcessKeyPress(TChar aChar) { // "Esc" character prints a new line and stops the scheduler if (aChar == EKeyEscape) { iConsole->Printf(KTextEsc); CActiveScheduler::Stop(); return; } // "Enter" prints a new line character // An alphabetic or space is printed as a character; // anything else is printed as an integer. if (aChar == EKeyEnter) iConsole->Printf(KTextEsc); else { _LIT(KFormatString2,"%c"); _LIT(KFormatString3,"%d"); if (aChar.IsAlphaDigit()|| aChar.IsSpace()) iConsole->Printf(KFormatString2,TUint(aChar)); else iConsole->Printf(KFormatString3,TUint(aChar)); } // Issue another request RequestCharacter(); } ////////////////////////////////////////////////////////////////////////////// // // -----> CMessageKeyProcessor (definition) // // This class is derived from CActiveConsole. // Request handling: // if key is "m", a message timer request is issued. // if key is "c", any outstanding message timer request is cancelled. // If key is ESC, the wait loop is terminated. // ////////////////////////////////////////////////////////////////////////////// class CMessageKeyProcessor : public CActiveConsole { public: // Construction CMessageKeyProcessor(CConsoleBase* aConsole, CTimedMessenger* iMessenger); void ConstructL(); public: // Static construction static CMessageKeyProcessor* NewLC(CConsoleBase* aConsole, CTimedMessenger* iMessenger ); static CMessageKeyProcessor* NewL(CConsoleBase* aConsole, CTimedMessenger* iMessenger ); public: // service request void ProcessKeyPress(TChar aChar); private: // Data members defined by this class CTimedMessenger* iMessenger; }; ////////////////////////////////////////////////////////////////////////////// // // -----> CMessageKeyProcessor (implementation) // ////////////////////////////////////////////////////////////////////////////// CMessageKeyProcessor::CMessageKeyProcessor(CConsoleBase* aConsole, CTimedMessenger* aMessenger ) : CActiveConsole(aConsole) // construct zero-priority active object { iMessenger = aMessenger; } CMessageKeyProcessor* CMessageKeyProcessor::NewLC(CConsoleBase* aConsole, CTimedMessenger* aMessenger ) { CMessageKeyProcessor* self=new (ELeave) CMessageKeyProcessor(aConsole, aMessenger ); CleanupStack::PushL(self); self->ConstructL(); return self; } CMessageKeyProcessor* CMessageKeyProcessor::NewL(CConsoleBase* aConsole, CTimedMessenger* aMessenger ) { CMessageKeyProcessor* self = NewLC(aConsole, aMessenger); CleanupStack::Pop(); return self; } void CMessageKeyProcessor::ConstructL() { // Add to active scheduler CActiveScheduler::Add(this); } void CMessageKeyProcessor::ProcessKeyPress(TChar aChar) { // if key is ESC // cancel any outstanding request // stop the scheduler if (aChar == EKeyEscape) { iMessenger->Cancel(); CActiveScheduler::Stop(); return; } // If key is "m" or "M" // cancel any outstanding request // reset the tick counter // issue a message timer request. if (aChar == 'm' || aChar == 'M') { _LIT(KMsgStarting,"Starting Messenger.... \n"); iConsole->Printf(KMsgStarting); iMessenger->Cancel(); iMessenger ->IssueRequest(); } // If key is "c" or "C" // cancel any outstanding request if (aChar == 'c' || aChar == 'C') iMessenger->Cancel(); // Ask for another character. RequestCharacter(); } ////////////////////////////////////////////////////////////////////////////// // // Do the example // ////////////////////////////////////////////////////////////////////////////// LOCAL_C void doExampleL() { // Construct and install the active scheduler CExampleScheduler* exampleScheduler = new (ELeave) CExampleScheduler; // Push onto the cleanup stack CleanupStack::PushL(exampleScheduler); // Install as the active scheduler CActiveScheduler::Install(exampleScheduler); // Create a CTimedMessenger active object which will emit // 3 messages with an interval of 2 seconds between messages. _LIT(KMsgGoodMorning,"Good Morning!"); CTimedMessenger* messenger = CTimedMessenger::NewLC(KMsgGoodMorning, 3, 2); // Create aCMessageKeyProcessor active object. _LIT(KMsgTitleA,"A single CKeyMessengerProcessor active object which contains a CMessageTimer.\n"); console->Printf(KMsgTitleA); _LIT(KMsgTitleB,"Press 'm' to activate messenger; Press 'c' to cancel it.\nPress ESC to end.\n\n"); console->Printf(KMsgTitleB); CMessageKeyProcessor* keyProcesser = CMessageKeyProcessor::NewLC(console, messenger ); // Issue the first request keyProcesser->RequestCharacter(); // Main part of the program is a wait loop CActiveScheduler::Start(); // Remove from the cleanup stack and destroy: // 1. the CTimedMessenger active object // 2. the CMessageKeyProcessor active object. // 3. exampleScheduler CleanupStack::PopAndDestroy(3); }
[ "liuxk99@bdc341c6-17c0-11de-ac9f-1d9250355bca" ]
[ [ [ 1, 519 ] ] ]
315890cbc7ff820b2cde11f86fdcb2fdd371175d
b76d3f6e3fe5429021007431acbf683319183e42
/TestSVN/TestSVN/TestSVN.cpp
53c402f6caf010816c1b3954a5a52b9212699899
[]
no_license
AlexandrPuryshev/cfparser
82a520f7d15188decbb68ff3a8f125cbee8454c3
3d81fa67dab2b34035cac78380b246c2abb1bd65
refs/heads/master
2021-01-13T00:49:23.110243
2008-10-27T20:58:46
2008-10-27T20:58:46
47,927,807
0
0
null
null
null
null
UTF-8
C++
false
false
162
cpp
// TestSVN.cpp : Defines the entry point for the console application. // #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { return 0; }
[ "alexey.maggot@bef8c1c5-3d53-0410-ba26-178f7c86328d" ]
[ [ [ 1, 12 ] ] ]
b34ee5cb2efcde0e1c8e931cf6333f7367743e50
2f77d5232a073a28266f5a5aa614160acba05ce6
/01.DevelopLibrary/03.Code/UI/EasySmsUiCtrl.h
0adfab04361c0510b0e787d7e9983b08be21659b
[]
no_license
radtek/mobilelzz
87f2d0b53f7fd414e62c8b2d960e87ae359c81b4
402276f7c225dd0b0fae825013b29d0244114e7d
refs/heads/master
2020-12-24T21:21:30.860184
2011-03-26T02:19:47
2011-03-26T02:19:47
58,142,323
0
0
null
null
null
null
UTF-8
C++
false
false
1,779
h
#ifndef __EASYSMSUICTRL_h__ #define __EASYSMSUICTRL_h__ //#include "../Core/ServiceControl/CoreService.h" #include "EasySmsWndBase.h" //#include "../CommonLib/Xml/TinySrc/tinyxml.h" /* #include "../CommonLib/Xml/XmlStream.h" #include "../Core/ServiceControl/BasicService.h" #include "../CommonLib/FunctionLib/RequestXmlOperator.h" #include "../CommonLib/FunctionLib/ResultXmlOperator.h" #include "../Core/SmsService/SmsService.h" */ class CEasySmsUiCtrl { public: CEasySmsUiCtrl( void ); virtual ~CEasySmsUiCtrl( void ); public: HRESULT MakeUnReadRltListReq ( wchar_t **ppBuf, long *lSize ); HRESULT MakeUnReadListRlt ( CEasySmsListBase &clCEasySmsListBase, wchar_t *pwcRltStream ); HRESULT MakeCtorRltListReq ( wchar_t **ppBuf, long *lSize ); HRESULT MakeCtorRltList ( CEasySmsListBase &clCEasySmsListBase, wchar_t *pwcRltStream ); HRESULT MakeMsgRltListReq( wchar_t **ppBuf, long *lSize, long lPid , wchar_t *pDecode = NULL ); HRESULT MakeMsgRltList ( CEasySmsListBase &clCEasySmsListBase, wchar_t *pwcRltStream ); HRESULT MakeSendSmsInfo ( wchar_t **ppBuf, long *lSize, wchar_t *pwcSmsInfo, wchar_t* pwcsNumber ); HRESULT MakeDeleteSmsInfo ( OUT wchar_t **ppBuf, OUT long *lSize, IN long *plSid, IN long lCnt ); HRESULT MakeUpdateSmsStatusReq( wchar_t **ppBuf, long *lSize, long lSid, long lLock, long lRead ); HRESULT MakePassWordStatusReq ( wchar_t **ppBuf, long *lSize, long lPid, wchar_t* pwcDataKind, wchar_t* pwcCode, wchar_t* pwcNewCode ); HRESULT MakeDetailReq ( wchar_t **ppBuf, long *lSize, long lSid, wchar_t* pwcCode ); private: ImageContainer m_imgContainer; CCoreSmsUiCtrl m_clCCoreSmsUiCtrl; }; #endif
[ "[email protected]", "lidan8908589@8983de3c-2b35-11df-be6c-f52728ce0ce6" ]
[ [ [ 1, 33 ], [ 35, 56 ] ], [ [ 34, 34 ] ] ]
1971975549ad8cc4deacbd30d540f6d452d87680
d9a78f212155bb978f5ac27d30eb0489bca87c3f
/PB/src/PbFt/GeneratedFiles/Release/moc_fttourneyopener.cpp
9b12354d23be7325a2f2fe81f80ae8fce8778ce1
[]
no_license
marchon/pokerbridge
1ed4a6a521f8644dcd0b6ec66a1ac46879b8473c
97d42ef318bf08f3bc0c0cb1d95bd31eb2a3a8a9
refs/heads/master
2021-01-10T07:15:26.496252
2010-05-17T20:01:29
2010-05-17T20:01:29
36,398,892
0
0
null
null
null
null
UTF-8
C++
false
false
2,811
cpp
/**************************************************************************** ** Meta object code from reading C++ file 'fttourneyopener.h' ** ** Created: Thu 8. Apr 19:38:00 2010 ** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "stdafx.h" #include "..\..\fttourneyopener.h" #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'fttourneyopener.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 61 #error "This file was generated using the moc from 4.5.2. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE static const uint qt_meta_data_FTTourneyOpener[] = { // content: 2, // revision 0, // classname 0, 0, // classinfo 4, 12, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors // slots: signature, parameters, type, tag, flags 21, 17, 16, 16, 0x09, 44, 17, 16, 16, 0x09, 73, 70, 16, 16, 0x09, 121, 111, 16, 16, 0x09, 0 // eod }; static const char qt_meta_stringdata_FTTourneyOpener[] = { "FTTourneyOpener\0\0msg\0onOpenTable(RMessage*)\0" "onCloseTourney(RMessage*)\0tl\0" "onTourneyLobbyOpened(FTTourneyLobby*)\0" "tourneyId\0onTourneyLobbyClosed(QString)\0" }; const QMetaObject FTTourneyOpener::staticMetaObject = { { &FTListClicker::staticMetaObject, qt_meta_stringdata_FTTourneyOpener, qt_meta_data_FTTourneyOpener, 0 } }; const QMetaObject *FTTourneyOpener::metaObject() const { return &staticMetaObject; } void *FTTourneyOpener::qt_metacast(const char *_clname) { if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_FTTourneyOpener)) return static_cast<void*>(const_cast< FTTourneyOpener*>(this)); return FTListClicker::qt_metacast(_clname); } int FTTourneyOpener::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = FTListClicker::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: onOpenTable((*reinterpret_cast< RMessage*(*)>(_a[1]))); break; case 1: onCloseTourney((*reinterpret_cast< RMessage*(*)>(_a[1]))); break; case 2: onTourneyLobbyOpened((*reinterpret_cast< FTTourneyLobby*(*)>(_a[1]))); break; case 3: onTourneyLobbyClosed((*reinterpret_cast< QString(*)>(_a[1]))); break; default: ; } _id -= 4; } return _id; } QT_END_MOC_NAMESPACE
[ [ [ 1, 83 ] ] ]
93c7c04e437438137046640b55401f0b43c0dfd8
abafdd61ea123f3e90deb02fe5709951b453eec6
/fuzzy/patl/suffix_map.hpp
43b69832e084c893dc6f6f848fc56d5e264dab61
[ "BSD-3-Clause" ]
permissive
geoiq/geojoin-ruby
8a6a07938fe3d629de74aac50e61eb8af15ab027
247a80538c4fc68c365e71f9014b66d3c38526c1
refs/heads/master
2016-09-06T15:22:47.436634
2010-08-11T13:00:24
2010-08-11T13:00:24
13,863,658
2
0
null
null
null
null
WINDOWS-1251
C++
false
false
2,053
hpp
#ifndef PATL_SUFFIX_MAP_HPP #define PATL_SUFFIX_MAP_HPP #include "impl/suffix_map.hpp" #include "impl/suffix_generic.hpp" #include "bit_comp.hpp" namespace uxn { namespace patl { template < typename Type, typename Datum, sword_t Delta = 1, // расстояние в bit_size между соседними суффиксами typename BitComp = bit_comparator<Type>, typename Allocator = std::allocator<Type> > class suffix_map : public impl::suffix_generic< impl::suffix_map_traits<Type, Datum, Delta, BitComp, Allocator> > { typedef suffix_map<Type, Datum, Delta, BitComp, Allocator> this_t; typedef impl::suffix_generic< impl::suffix_map_traits<Type, Datum, Delta, BitComp, Allocator> > super; public: // constructor suffix_map( Type keys, typename super::size_type size = 0x100, const BitComp &bit_comp = BitComp(), const Allocator &alloc = Allocator()) : super(keys, size, bit_comp, alloc) { } // вставляем очередной суффикс // возвращает длину совпавшего префикса в битах // вставляем очередной суффикс const typename super::vertex *push_back(const Datum &datum) { if (this->endpoint()) // проверка на краевые точки { if (this->empty()) // если дерево пусто (нет корня) return this->push_back_root(typename super::node_type( datum, #ifdef PATL_DEBUG this->size() #endif )); else // иначе - полностью заполнено this->reserve(2 * this->capacity()); } return this->push_back_generic(typename super::node_type( datum, #ifdef PATL_DEBUG this->size() #endif )); } }; } // namespace patl } // namespace uxn #endif
[ "sderle@goldman.(none)" ]
[ [ [ 1, 67 ] ] ]
a44dc592f1833c8dbe446f62c00048f9997521af
6da3740464cfcc95b095d769974876eb8faf716d
/raytrace/Volume.cpp
199565a837af8cc735dc2587fa61bd3baac079ea
[]
no_license
thorlund/rendering
8e46b9f11e6c88eb105dfaf9b35ce3c8ca9588f7
648633722d7685f4a2c939595e96d79d34cba344
refs/heads/master
2021-01-24T06:12:27.825294
2011-09-28T09:01:13
2011-09-28T09:01:13
2,473,863
0
0
null
null
null
null
UTF-8
C++
false
false
984
cpp
// 02576 Rendering Framework // Written by Jeppe Revall Frisvad, 2010 // Copyright (c) DTU Informatics 2010 #include <optix_world.h> #include "HitInfo.h" #include "Volume.h" using namespace optix; float3 Volume::shade(const Ray& r, HitInfo& hit, bool emit) const { // If inside the volume, Find the direct transmission through the volume by using // the transmittance to modify the result from the Transparent shader. return Transparent::shade(r, hit, emit); } float3 Volume::get_transmittance(const HitInfo& hit) const { if(hit.material) { // Compute and return the transmittance using the diffuse reflectance of the material. // Diffuse reflectance rho_d does not make sense for a specular material, so we can use // this material property as an absorption coefficient. Since absorption has an effect // opposite that of reflection, using 1/rho_d-1 makes it more intuitive for the user. } return make_float3(1.0f); }
[ [ [ 1, 29 ] ] ]
4911f2e80bc96aac37319452d82792e58955d028
668dc83d4bc041d522e35b0c783c3e073fcc0bd2
/fbide-vs/Sdk/Editor/StcEditor.h
b9a0f8b56362c7195290600ac5b530f651b461cd
[]
no_license
albeva/fbide-old-svn
4add934982ce1ce95960c9b3859aeaf22477f10b
bde1e72e7e182fabc89452738f7655e3307296f4
refs/heads/master
2021-01-13T10:22:25.921182
2009-11-19T16:50:48
2009-11-19T16:50:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,367
h
/* * This file is part of FBIde project * * FBIde 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. * * FBIde 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 FBIde. If not, see <http://www.gnu.org/licenses/>. * * Author: Albert Varaksin <[email protected]> * Copyright (C) The FBIde development team */ #pragma once #include "../wxScintillaCtrl/stc.h" namespace fbi { // forward declarations class Editor; class StyleParser; class StyleInfo; class FreeBasicSyntax; /** * The editor */ class SDK_DLL StcEditor : public ::wxScintillaCtrl { public: // constructor StcEditor ( wxWindow * wnd, Editor * owner, int index, StcEditor * mirror ); // on mouse right up ( show context menu for the editor ) void OnMouseRight (wxMouseEvent & event); // update the ui void OnUpdateUi (wxStyledTextEvent & event); // zoom void OnZoom (wxStyledTextEvent & event); // Setup the editor. Load general config void Setup (StyleParser * styles); // Set style void SetStyle (int nr, const StyleInfo & styleInfo); private: // precalculate the line-number margin width void CalcLineMarginWidth(); // precalculated number margin widths int m_dynLNWidths[5]; // show line numbers bool m_showLineNumbers; // dynamically size the line-number margin int m_dynamicLineNumberWidth; // the owner of this editor Editor * m_owner; // editor index ( in MultiSplitWindow ) int m_index; // mirror the editor (for main null) StcEditor * m_mirror; // highlighter FreeBasicSyntax * m_highlighter; DECLARE_EVENT_TABLE() }; }
[ "vongodric@957c6b5c-1c3a-0410-895f-c76cfc11fbc7" ]
[ [ [ 1, 82 ] ] ]
28f0065329edba48db96d968bac62250593c295d
3eae1d8c99d08bca129aceb7c2269bd70e106ff0
/trunk/Codes/CLR/Libraries/SPOT/spot_native_Microsoft_SPOT_Hardware_SystemInfo.cpp
98f7af7aaf05da79847920308cd432e7db4ecefc
[]
no_license
yuaom/miniclr
9bfd263e96b0d418f6f6ba08cfe4c7e2a8854082
4d41d3d5fb0feb572f28cf71e0ba02acb9b95dc1
refs/heads/master
2023-06-07T09:10:33.703929
2010-12-27T14:41:18
2010-12-27T14:41:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,961
cpp
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) Microsoft Corporation. All rights reserved. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include "SPOT.h" HRESULT Library_spot_native_Microsoft_SPOT_Hardware_SystemInfo::GetSystemVersion___STATIC__VOID__BYREF_I4__BYREF_I4__BYREF_I4__BYREF_I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); { CLR_RT_HeapBlock hbMajor; CLR_RT_HeapBlock hbMinor; CLR_RT_HeapBlock hbBuild; CLR_RT_HeapBlock hbRevision; MfReleaseInfo releaseInfo; Solution_GetReleaseInfo( releaseInfo ); hbMajor.SetInteger( releaseInfo.version.usMajor ); TINYCLR_CHECK_HRESULT(hbMajor.StoreToReference( stack.Arg0(), 0 )); hbMinor.SetInteger( releaseInfo.version.usMinor ); TINYCLR_CHECK_HRESULT(hbMinor.StoreToReference( stack.Arg1(), 0 )); hbBuild.SetInteger( releaseInfo.version.usBuild ); TINYCLR_CHECK_HRESULT(hbBuild.StoreToReference( stack.Arg2(), 0 )); hbRevision.SetInteger( releaseInfo.version.usRevision ); TINYCLR_CHECK_HRESULT(hbRevision.StoreToReference( stack.Arg3(), 0 )); } TINYCLR_NOCLEANUP(); } HRESULT Library_spot_native_Microsoft_SPOT_Hardware_SystemInfo::get_OEMString___STATIC__STRING( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); { MfReleaseInfo releaseInfo; Solution_GetReleaseInfo( releaseInfo ); TINYCLR_SET_AND_LEAVE(stack.SetResult_String( (LPCSTR)releaseInfo.infoString )); } TINYCLR_NOCLEANUP(); }
[ [ [ 1, 49 ] ] ]
a271a8f1cd08806a9ec41c91e207d7b61d27fe75
20cf43a2e1854d71696a6264dea4ea8cbfdb16f2
/WinNT/comm_nt/ui_userchat.h
ae2413fff6e44b9051d2a67dc3e8b41eb4060cf2
[]
no_license
thebruno/comm-nt
fb0ece0a8d36715a8f0199ba3ce9f37859170ee3
6ba36941b123c272efe8d81b55555d561d8842f4
refs/heads/master
2016-09-07T19:00:59.817929
2010-01-14T20:38:58
2010-01-14T20:38:58
32,205,785
0
0
null
null
null
null
UTF-8
C++
false
false
3,954
h
/******************************************************************************** ** Form generated from reading ui file 'userchat.ui' ** ** Created: Fri 6. Nov 23:26:26 2009 ** by: Qt User Interface Compiler version 4.5.3 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! ********************************************************************************/ #ifndef UI_USERCHAT_H #define UI_USERCHAT_H #include <QtCore/QVariant> #include <QtGui/QAction> #include <QtGui/QApplication> #include <QtGui/QButtonGroup> #include <QtGui/QGroupBox> #include <QtGui/QHeaderView> #include <QtGui/QPlainTextEdit> #include <QtGui/QPushButton> #include <QtGui/QTextEdit> #include <QtGui/QWidget> QT_BEGIN_NAMESPACE class Ui_UserChat { public: QGroupBox *groupBox; QPushButton *pushButton; QPushButton *pushButton_2; QTextEdit *txtChatHistory; QPlainTextEdit *txtPlainChat; QPushButton *btnSend; QPushButton *btnClose; void setupUi(QWidget *UserChat) { if (UserChat->objectName().isEmpty()) UserChat->setObjectName(QString::fromUtf8("UserChat")); UserChat->resize(400, 300); QIcon icon; icon.addFile(QString::fromUtf8(":/icons/chat.ico"), QSize(), QIcon::Normal, QIcon::Off); UserChat->setWindowIcon(icon); groupBox = new QGroupBox(UserChat); groupBox->setObjectName(QString::fromUtf8("groupBox")); groupBox->setGeometry(QRect(10, 10, 371, 241)); pushButton = new QPushButton(groupBox); pushButton->setObjectName(QString::fromUtf8("pushButton")); pushButton->setGeometry(QRect(200, 260, 75, 23)); pushButton_2 = new QPushButton(groupBox); pushButton_2->setObjectName(QString::fromUtf8("pushButton_2")); pushButton_2->setGeometry(QRect(300, 270, 75, 23)); txtChatHistory = new QTextEdit(groupBox); txtChatHistory->setObjectName(QString::fromUtf8("txtChatHistory")); txtChatHistory->setGeometry(QRect(10, 20, 351, 111)); txtPlainChat = new QPlainTextEdit(groupBox); txtPlainChat->setObjectName(QString::fromUtf8("txtPlainChat")); txtPlainChat->setGeometry(QRect(10, 140, 351, 101)); btnSend = new QPushButton(UserChat); btnSend->setObjectName(QString::fromUtf8("btnSend")); btnSend->setGeometry(QRect(20, 260, 81, 23)); QIcon icon1; icon1.addFile(QString::fromUtf8(":/icons/send.ico"), QSize(), QIcon::Normal, QIcon::Off); btnSend->setIcon(icon1); btnSend->setAutoDefault(true); btnClose = new QPushButton(UserChat); btnClose->setObjectName(QString::fromUtf8("btnClose")); btnClose->setGeometry(QRect(290, 260, 75, 23)); QIcon icon2; icon2.addFile(QString::fromUtf8(":/icons/exit.ico"), QSize(), QIcon::Normal, QIcon::Off); btnClose->setIcon(icon2); retranslateUi(UserChat); QMetaObject::connectSlotsByName(UserChat); } // setupUi void retranslateUi(QWidget *UserChat) { UserChat->setWindowTitle(QApplication::translate("UserChat", "Form", 0, QApplication::UnicodeUTF8)); groupBox->setTitle(QApplication::translate("UserChat", "GroupBox", 0, QApplication::UnicodeUTF8)); pushButton->setText(QApplication::translate("UserChat", "PushButton", 0, QApplication::UnicodeUTF8)); pushButton_2->setText(QApplication::translate("UserChat", "PushButton", 0, QApplication::UnicodeUTF8)); btnSend->setText(QApplication::translate("UserChat", "Send", 0, QApplication::UnicodeUTF8)); btnClose->setText(QApplication::translate("UserChat", "Close", 0, QApplication::UnicodeUTF8)); Q_UNUSED(UserChat); } // retranslateUi }; namespace Ui { class UserChat: public Ui_UserChat {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_USERCHAT_H
[ "konrad.balys@08f01046-b83b-11de-9b33-83dc4fd2bb11" ]
[ [ [ 1, 98 ] ] ]
d8347a60399c4e39161bf1242f7eca123b7cf373
cd0987589d3815de1dea8529a7705caac479e7e9
/webkit/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h
7c5484a4c6e205ff1c64a15af300c541b4ad941f
[ "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
12,969
h
/* * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. */ #ifndef FrameLoaderClientOlympia_h #define FrameLoaderClientOlympia_h #include "FrameLoaderClient.h" #include "NotImplemented.h" #include "DocumentLoader.h" #include "FormState.h" #include "HTMLFormElement.h" #include "Frame.h" #include "ResourceError.h" #include "ResourceRequest.h" #include "Timer.h" #include "ViewportArguments.h" #include "Widget.h" namespace Olympia { namespace WebKit { class WebPage; class WebPlugin; class WebPluginClient; } } namespace WebCore { class FrameNetworkingContext; class PluginWidget; class FrameLoaderClientBlackBerry : public FrameLoaderClient { public: FrameLoaderClientBlackBerry(); ~FrameLoaderClientBlackBerry(); void setFrame(Frame* frame, Olympia::WebKit::WebPage* webPage) { m_frame = frame; m_webPage = webPage; } int playerId() const; PassRefPtr<Olympia::WebKit::WebPlugin> getCachedPlugin(HTMLElement* element); void cancelLoadingPlugin(int id); void cleanPluginList(); void mediaReadyStateChanged(int id, int state); void mediaVolumeChanged(int id, int volume); void mediaDurationChanged(int id, float duration); virtual void frameLoaderDestroyed(); virtual bool hasWebView() const { return true; } virtual void makeRepresentation(DocumentLoader*) { notImplemented(); } virtual void forceLayout() { notImplemented(); } virtual void forceLayoutForNonHTML() { notImplemented(); } virtual void setCopiesOnScroll() { notImplemented(); } virtual void detachedFromParent2(); virtual void detachedFromParent3() { notImplemented(); } virtual void assignIdentifierToInitialRequest(long unsigned int, DocumentLoader*, const ResourceRequest&) { notImplemented(); } virtual void dispatchWillSendRequest(DocumentLoader*, long unsigned int, ResourceRequest&, const ResourceResponse&); virtual bool shouldUseCredentialStorage(DocumentLoader*, long unsigned int) { notImplemented(); return false; } virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, long unsigned int, const AuthenticationChallenge&) { notImplemented(); } virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, long unsigned int, const AuthenticationChallenge&) { notImplemented(); } virtual void dispatchDidReceiveResponse(DocumentLoader*, long unsigned int, const ResourceResponse&) { notImplemented(); } virtual void dispatchDidReceiveContentLength(DocumentLoader*, long unsigned int, int) { notImplemented(); } virtual void dispatchDidFinishLoading(DocumentLoader*, long unsigned int) { notImplemented(); } virtual void dispatchDidFailLoading(DocumentLoader*, long unsigned int, const ResourceError&) { notImplemented(); } virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int) { notImplemented(); return false; } virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const ScriptString&) { notImplemented(); } virtual void dispatchDidHandleOnloadEvents() { notImplemented(); } virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() { notImplemented(); } virtual void dispatchDidCancelClientRedirect(); virtual void dispatchWillPerformClientRedirect(const KURL&, double, double); virtual void dispatchDidChangeLocationWithinPage(); virtual void dispatchDidPushStateWithinPage() { notImplemented(); } virtual void dispatchDidReplaceStateWithinPage() { notImplemented(); } virtual void dispatchDidPopStateWithinPage() { notImplemented(); } virtual void dispatchWillClose(); virtual void dispatchDidReceiveIcon() { notImplemented(); } virtual void dispatchDidStartProvisionalLoad(); virtual void dispatchDidReceiveTitle(const String&); virtual void dispatchDidCommitLoad(); virtual void dispatchDidFailProvisionalLoad(const ResourceError&); virtual void dispatchDidFailLoad(const ResourceError&); virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); virtual void dispatchDidFirstLayout() { notImplemented(); } virtual void dispatchDidFirstVisuallyNonEmptyLayout(); virtual Frame* dispatchCreatePage(); virtual void dispatchShow() { notImplemented(); } virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String& MIMEType, const ResourceRequest&); virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String& frameName); virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>); virtual void cancelPolicyCheck(); virtual void dispatchUnableToImplementPolicy(const ResourceError&) { notImplemented(); } virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>); virtual void dispatchDidLoadMainResource(DocumentLoader*) { notImplemented(); } virtual void revertToProvisionalState(DocumentLoader*) { notImplemented(); } virtual void setMainDocumentError(DocumentLoader*, const ResourceError&) { notImplemented(); } virtual void postProgressStartedNotification(); virtual void postProgressEstimateChangedNotification(); virtual void postProgressFinishedNotification(); virtual void setMainFrameDocumentReady(bool) { notImplemented(); } virtual void startDownload(const ResourceRequest&) { notImplemented(); } virtual void willChangeTitle(DocumentLoader*) { notImplemented(); } virtual void didChangeTitle(DocumentLoader*) { notImplemented(); } virtual void committedLoad(DocumentLoader*, const char*, int); virtual void finishedLoading(DocumentLoader*); virtual void updateGlobalHistory() { notImplemented(); } virtual void updateGlobalHistoryRedirectLinks() { notImplemented(); } virtual bool shouldGoToHistoryItem(HistoryItem*) const; virtual void dispatchDidAddBackForwardItem(HistoryItem*) const; virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const; virtual void dispatchDidChangeBackForwardIndex() const; virtual void didDisplayInsecureContent() { notImplemented(); } virtual void didRunInsecureContent(SecurityOrigin*) { notImplemented(); } virtual ResourceError cancelledError(const ResourceRequest&) { notImplemented(); return ResourceError("", 0, "", ""); } virtual ResourceError blockedError(const ResourceRequest&) { notImplemented(); return ResourceError("", 0, "", ""); } virtual ResourceError cannotShowURLError(const ResourceRequest&) { notImplemented(); return ResourceError("", 0, "", ""); } virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&) { notImplemented(); return ResourceError("", 0, "", ""); } virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&) { notImplemented(); return ResourceError("", 0, "", ""); } virtual ResourceError fileDoesNotExistError(const ResourceResponse&) { notImplemented(); return ResourceError("", 0, "", ""); } virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&) { notImplemented(); return ResourceError("", 0, "", ""); } virtual bool shouldFallBack(const ResourceError&) { notImplemented(); return false; } virtual bool canHandleRequest(const ResourceRequest&) const; virtual bool canShowMIMEType(const String&) const; virtual bool canShowMIMETypeAsHTML(const String&) const; virtual bool representationExistsForURLScheme(const String&) const { notImplemented(); return false; } virtual String generatedMIMETypeForURLScheme(const String&) const { notImplemented(); return String(); } virtual void frameLoadCompleted() { notImplemented(); } virtual void saveViewStateToItem(HistoryItem*); virtual void restoreViewState(); virtual void provisionalLoadStarted() { notImplemented(); } virtual void didFinishLoad() { notImplemented(); } virtual void prepareForDataSourceReplacement() { notImplemented(); } virtual WTF::PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest&, const SubstituteData&); virtual void setTitle(const String&, const KURL&) { notImplemented(); } virtual String userAgent(const KURL&); virtual void savePlatformDataToCachedFrame(CachedFrame*) { notImplemented(); } virtual void transitionToCommittedFromCachedFrame(CachedFrame*) { notImplemented(); } virtual void transitionToCommittedForNewPage(); virtual bool canCachePage() const { notImplemented(); return false; } virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&) { notImplemented(); } virtual WTF::PassRefPtr<Frame> createFrame(const KURL&, const String&, HTMLFrameOwnerElement*, const String&, bool, int, int); virtual WTF::PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const WTF::Vector<String, 0u>&, const WTF::Vector<String, 0u>&, const String&, bool); virtual void redirectDataToPlugin(Widget*) { notImplemented(); } virtual WTF::PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const WTF::Vector<String, 0u>&, const WTF::Vector<String, 0u>&) { notImplemented(); return 0; } #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) virtual WTF::PassRefPtr<Widget> createMediaPlayerProxyPlugin(const IntSize&, HTMLMediaElement*, const KURL&, const WTF::Vector<String>&, const WTF::Vector<String>&, const String&); #endif virtual ObjectContentType objectContentType(const KURL&, const String&); virtual String overrideMediaType() const { notImplemented(); return String(); } virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*); virtual void documentElementAvailable() { notImplemented(); } virtual void didPerformFirstNavigation() const { notImplemented(); } virtual void registerForIconNotification(bool) { notImplemented(); } virtual bool shouldLoadIconExternally() { return true; } virtual void loadIconExternally(const String& originalPageUrl, const String& finalPageUrl, const String& iconUrl); virtual void didTransferChildFrameToNewDocument() { notImplemented(); }; virtual void dispatchDidChangeIcons() { notImplemented(); }; virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) { notImplemented(); }; virtual void willDeferLoading(); virtual void didResumeLoading(); virtual void didCreateGeolocation(Geolocation*); virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext(); /** * Schedule a script that was loaded manually by the user (eg. a * bookmarklet) while page loading was deferred. */ void setDeferredManualScript(const KURL&); void readyToRender(bool pageIsVisuallyNonEmpty); void doPendingFragmentScroll(); virtual void hideMediaPlayerProxyPlugin(WebCore::Widget*); virtual void showMediaPlayerProxyPlugin(WebCore::Widget*); private: void receivedData(const char*, int, const String&); void didFinishOrFailLoading(const ResourceError&); bool isMainFrame() const; void invalidateBackForwardList() const; void invalidateBackForwardTimerFired(Timer<FrameLoaderClientBlackBerry>*); PassRefPtr<Widget> createPluginHolder(const IntSize& pluginSize,HTMLElement* element, const KURL& url, const Vector<String>& paramNames,const Vector<String>& paramValues, const String& mimeType,bool isPlaceHolder); PolicyAction decidePolicyForExternalLoad(const ResourceRequest &, bool isFragmentScroll, PassRefPtr<FormState> formState); void delayPolicyCheckUntilFragmentExists(const String& fragment, FramePolicyFunction); void deferredJobsTimerFired(Timer<FrameLoaderClientBlackBerry>*); Frame* m_frame; ResourceError m_loadError; Olympia::WebKit::WebPage* m_webPage; mutable Timer<FrameLoaderClientBlackBerry>* m_invalidateBackForwardTimer; typedef HashMap<HTMLElement*, RefPtr<Olympia::WebKit::WebPlugin> > PluginCacheMap; PluginCacheMap m_cachedPlugins; Timer<FrameLoaderClientBlackBerry>* m_deferredJobsTimer; KURL m_deferredManualScript; RefPtr<Geolocation> m_geolocation; bool m_sentReadyToRender; FramePolicyFunction m_pendingFragmentScrollPolicyFunction; String m_pendingFragmentScroll; bool m_clientRedirectIsPending; bool m_clientRedirectIsUserGesture; // this set includes the original and final urls for server redirects HashSet<KURL> m_historyNavigationSourceURLs; HashSet<KURL> m_redirectURLsToSkipDueToHistoryNavigation; }; } // WebCore #endif // FrameLoaderClientOlympia_h
[ [ [ 1, 226 ] ] ]
15379f7573d446d65f5bab66de57bbc04ee76154
1b3a26845c00ede008ea66d26f370c3542641f45
/pymfclib/pymwndbase.h
302b40e5ed00643287043648d48beb0a3aaedfa6
[]
no_license
atsuoishimoto/pymfc
26617fac259ed0ffd685a038b47702db0bdccd5f
1341ef3be6ca85ea1fa284689edbba1ac29c72cb
refs/heads/master
2021-01-01T05:50:51.613190
2010-12-29T07:38:01
2010-12-29T07:38:01
33,760,622
0
0
null
null
null
null
UTF-8
C++
false
false
8,512
h
// Copyright (c) 2001- Atsuo Ishimoto // See LICENSE for details. #ifndef _PYMWNDBASE_H #define _PYMWNDBASE_H #include "pymfcdefs.h" #include "pydt.h" //***************************************************** // PyMFCWndBase: // Base class for all Window objects. Provides // communication between Window and Python object. //***************************************************** class PYMFC_API PyMFCWndBase { public: PyMFCWndBase() :m_lockObj(false), m_tempWnd(false), m_threadId(GetCurrentThreadId()) { } void init(PyObject *obj) { m_obj.set(obj, false); } virtual ~PyMFCWndBase(){ } CWnd *getCWnd() { return dynamic_cast<CWnd *>(this); } // todo: should return const PyDTObject & PyDTObject &getPyObj() { return m_obj; } void lockObj() { if (!m_lockObj) { m_obj.incRef(true); m_lockObj = true; } } void unlockObj() { if (m_lockObj) { m_obj.free(); m_lockObj = false; } } bool isLocked() { return m_lockObj; } void setTemp(bool f) { m_tempWnd = f; } bool isTemp() { return m_tempWnd; } virtual void onWindowDestroyed(); virtual BOOL createWindow(DWORD dwExStyle, LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hwndParent, HMENU nIDorHMenu)=0; virtual LRESULT callDefaultMsgProc(UINT message, WPARAM wParam, LPARAM lParam, LRESULT ret=0)=0; DWORD m_threadId; virtual void parseMsg(UINT message, WPARAM wParam, LPARAM lParam, PyDTDict &ret)=0; virtual void encodeMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT lresult, PyDTDict &ret)=0; protected: virtual LRESULT dispatch_winmsg(PyMFCWndBase *wnd, UINT message, WPARAM wParam, LPARAM lParam); /* virtual bool dispatch_winmsg(PyMFCWndBase *wnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT &ret); virtual void listen_winmsg(PyMFCWndBase *wnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT ret); virtual void call_listener(PyMFCWndBase *wnd, PyMFCWndBase *target, PyDTDict &map, PyDTObject &msgkey, UINT message, WPARAM wParam, LPARAM lParam, LRESULT ret); */ protected: /* PyDTObject buildMsgKey(UINT message, WPARAM wParam, LPARAM lParam); void callHandler(PyMFCWndBase *wnd, PyDTObject &func, UINT message, WPARAM wParam, LPARAM lParam, LRESULT &ret); virtual void parseMsg(UINT message, WPARAM wParam, LPARAM lParam, PyDTDict &ret)=0; virtual void set_result(UINT message, WPARAM wParam, LPARAM lParam, LRESULT result, PyDTDict &msgdict)=0; */ protected: PyDTObject m_obj; // Stores Python object corresponding to this window. bool m_lockObj; static bool m_ime; bool m_tempWnd; protected: struct KeyValue { bool alt; bool ctrl; bool shift; char key; bool ascii; }; typedef std::vector<KeyValue> KEYVALUELIST; KEYVALUELIST m_curKey; bool onKeyDown(CWnd *wnd, UINT nVirtKey, UINT keyData); }; inline PyMFCWndBase *getWndBase(void *obj) { if (!obj) { throw PyMFCException("NULL CWnd"); } PyMFCWndBase *ret = dynamic_cast<PyMFCWndBase *>((CWnd*)obj); if (!ret) { throw PyMFCException("Invalid CWnd"); } return ret; } template <class T> inline T *getCWnd(void *obj) { CWnd *w = getWndBase(obj)->getCWnd(); T *ret = dynamic_cast<T*>(w); if (!ret) { throw PyMFCException("Invalid CWnd"); } return ret; } //***************************************************** // PyMFCWnd<T, P>: // Template class to inject PyMFCWndBase class into // existing MFC classes. // ex: // class PyMFCEdit:public PyMFCWnd<CEdit, PyMFCMsgParser> { // } //***************************************************** template <class T, class P> class PyMFCWnd:public T, public PyMFCWndBase { public: PyMFCWnd(PyObject *obj):T() { init(obj); } virtual ~PyMFCWnd() { } virtual int createWindow(DWORD dwExStyle, LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hwndParent, HMENU nIDorHMenu) { return CWnd::CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle, x, y, nWidth, nHeight, hwndParent, nIDorHMenu); } virtual void parseMsg(UINT message, WPARAM wParam, LPARAM lParam, PyDTDict &ret) { m_msgParser.parse(this, message, wParam, lParam, ret); } virtual void encodeMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT lresult, PyDTDict &ret) { m_msgParser.encodeMsg(this, message, wParam, lParam, lresult, ret); } /* int callCreate(DWORD dwExStyle, LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hwndParent, HMENU nIDorHMenu) { return T::CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle, x, y, nWidth, nHeight, hwndParent, nIDorHMenu); } */ BOOL PreTranslateMessage(MSG* pMsg) { if (pMsg->hwnd == m_hWnd) { if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN) { if (onKeyDown(this, pMsg->wParam, pMsg->lParam)) { return TRUE; } } } return T::PreTranslateMessage(pMsg); } LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // Ignore MFC private messages if ((message >= 0x0360 && message <= 0x037F && message != 0x036A) // Ignore MFC private messages but WM_KICKIDLE || (message == 0x0118) // Ignore WM_SYSTIMER || (message == WM_USER+3174)) // ? return T::WindowProc(message, wParam, lParam); if (message == WM_NCCREATE) { PyMFCEnterPython e; lockObj(); // Object shouldn't be destructed until window are destroyed. } if (message == WM_IME_STARTCOMPOSITION) { m_ime = true; } else if (message == WM_IME_ENDCOMPOSITION) { m_ime = false; } LRESULT ret=0; { PyMFCEnterPython e; PyDTObject wobj(m_obj); // ensure Window is not destructed. try { ret = dispatch_winmsg(this, message, wParam, lParam); } catch (PyDTException &exc) { // const char *s = exc.m_err.c_str(); // printf("*** Uncaught exception: %s\n", s); exc.setError(); PyErr_Print(); } if (message == WM_NCDESTROY) { onWindowDestroyed(); } } return ret; } virtual LRESULT callDefaultMsgProc(UINT message, WPARAM wParam, LPARAM lParam, LRESULT ret) { if (!m_hWnd) { return 0; } { PyMFCLeavePython lp; ret = T::WindowProc(message, wParam, lParam); } return ret; } /* virtual void parseMsg(UINT message, WPARAM wParam, LPARAM lParam, PyDTDict &ret) { m_msgParser.parse(this, message, wParam, lParam, ret); } virtual void set_result(UINT message, WPARAM wParam, LPARAM lParam, LRESULT result, PyDTDict &msgdict) { m_msgParser.set_result(message, wParam, lParam, result, msgdict); } */ P m_msgParser; }; //***************************************************** //* WndMsg //***************************************************** class PYMFC_API PyMFCWndMsgType { public: struct TypeInstance { PyObject_HEAD PyObject *x_attr; }; typedef PyDTExtDef<PyMFCWndMsgType> EXTDEF; static PyTypeObject *getBaseType(); static void initMethods(PyMFCWndMsgType::EXTDEF &def); static int onInitObj(TypeInstance *obj, PyObject *args, PyObject *kwds); static void onDeallocObj(TypeInstance *obj); static int traverse(TypeInstance *obj, visitproc visit, void *arg); static int clear(TypeInstance *obj); static PyDTObject getDict(PyDTObject &obj); static PyObject *getDict(TypeInstance *obj); static PyObject *get(TypeInstance *obj, PyObject *args); static PyObject *MSGTYPE; }; //***************************************************** // PyMFCMsgParser: // Parse window message and build dictionary. //***************************************************** class PYMFC_API PyMFCMsgParser { public: virtual void parse(CWnd *wnd, UINT message, WPARAM wParam, LPARAM lParam, PyDTDict &ret); virtual void encodeMsg(CWnd *wnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT lresult, PyDTDict &ret); // virtual void set_result(UINT message, WPARAM wParam, LPARAM lParam, LRESULT result, // PyDTDict &msgdict); protected: virtual void parse_command(CWnd *wnd, DWORD msg, WPARAM wParam, LPARAM lParam, PyDTDict &ret); virtual void parse_notify(CWnd *wnd, DWORD msg, WPARAM wParam, LPARAM lParam, PyDTDict &ret); }; #endif
[ [ [ 1, 314 ] ] ]
c44dcc464090b071d5a3bc4b3f7d2db9b5cd49eb
96b4d383b517e578d44f9beab0814bdf18797fce
/src/luanode_net_acceptor.cpp
993dce140ef723b41ae5d0830fa7b0faf2e842a2
[ "MIT" ]
permissive
mkottman/LuaNode
e675f2199acfaa8190cf6c9b09f85bb9f9196f36
b059225855939477147c5d4a6e8df3350c0a25fb
refs/heads/master
2021-01-16T19:19:29.942269
2011-01-30T00:09:50
2011-01-30T00:09:50
1,234,094
2
0
null
null
null
null
UTF-8
C++
false
false
6,313
cpp
#include "stdafx.h" #include "LuaNode.h" #include "luanode_net.h" #include "luanode_net_acceptor.h" #include "blogger.h" #include <boost/asio/placeholders.hpp> #include <boost/bind.hpp> using namespace LuaNode::Net; static unsigned long s_nextAcceptorId = 0; static unsigned long s_acceptorCount = 0; ////////////////////////////////////////////////////////////////////////// /// void LuaNode::Net::Acceptor::RegisterFunctions(lua_State* L) {} const char* Acceptor::className = "Acceptor"; const Acceptor::RegType Acceptor::methods[] = { {"open", &Acceptor::Open}, {"close", &Acceptor::Close}, {"setoption", &Acceptor::SetOption}, {"getsockname", &Acceptor::GetLocalAddress}, {"bind", &Acceptor::Bind}, {"listen", &Acceptor::Listen}, {"accept", &Acceptor::Accept}, {0} }; const Acceptor::RegType Acceptor::setters[] = { {0} }; const Acceptor::RegType Acceptor::getters[] = { {0} }; Acceptor::Acceptor(lua_State* L) : m_L(L), m_acceptorId(++s_nextAcceptorId), m_acceptor( GetIoService() ) { s_acceptorCount++; LogDebug("Constructing Acceptor (%p) (id=%d). Current acceptor count = %d", this, m_acceptorId, s_acceptorCount); } Acceptor::~Acceptor(void) { s_acceptorCount--; LogDebug("Destructing Acceptor (%p) (id=%d). Current acceptor count = %d", this, m_acceptorId, s_acceptorCount); } ////////////////////////////////////////////////////////////////////////// /// /*static*/ int Acceptor::tostring_T(lua_State* L) { userdataType* ud = static_cast<userdataType*>(lua_touserdata(L, 1)); Acceptor* obj = ud->pT; lua_pushfstring(L, "%s (%p) (id=%d)", className, obj, obj->m_acceptorId); return 1; } ////////////////////////////////////////////////////////////////////////// /// Open the acceptor using the specified protocol int Acceptor::Open(lua_State* L) { const char* kind = luaL_checkstring(L, 2); LogDebug("Acceptor::Open (%p) (id=%d) - %s", this, m_acceptorId, kind); boost::system::error_code ec; if(strcmp(kind, "tcp4") == 0) { m_acceptor.open( boost::asio::ip::tcp::v4(), ec ); } else if(strcmp(kind, "tcp6") == 0) { m_acceptor.open( boost::asio::ip::tcp::v6(), ec ); } return BoostErrorCodeToLua(L, ec); } ////////////////////////////////////////////////////////////////////////// /// int Acceptor::Close(lua_State* L) { LogDebug("Acceptor::Close (%p) (id=%d)", this, m_acceptorId); boost::system::error_code ec; m_acceptor.close(ec); return BoostErrorCodeToLua(L, ec); } ////////////////////////////////////////////////////////////////////////// /// int Acceptor::SetOption(lua_State* L) { const char* option = luaL_checkstring(L, 2); LogDebug("Acceptor::SetOption (%p) (id=%d) - %s", this, m_acceptorId, option); if(strcmp(option, "reuseaddr") == 0) { bool value = lua_toboolean(L, 3) != 0; m_acceptor.set_option( boost::asio::socket_base::reuse_address(value) ); } return 0; } ////////////////////////////////////////////////////////////////////////// /// int Acceptor::GetLocalAddress(lua_State* L) { const boost::asio::ip::tcp::endpoint& endpoint = m_acceptor.local_endpoint(); lua_pushstring(L, endpoint.address().to_string().c_str()); lua_pushinteger(L, endpoint.port()); return 2; } ////////////////////////////////////////////////////////////////////////// /// int Acceptor::Bind(lua_State* L) { const char* ip = luaL_checkstring(L, 2); unsigned short port = luaL_checkinteger(L, 3); LogDebug("Acceptor::Bind (%p) (id=%d) - (%s,%d)", this, m_acceptorId, ip, port); boost::system::error_code ec; boost::asio::ip::address address = boost::asio::ip::address::from_string(ip, ec); if(ec) { return BoostErrorCodeToLua(L, ec); } boost::asio::ip::tcp::endpoint endpoint( address, port ); m_acceptor.bind(endpoint, ec); return BoostErrorCodeToLua(L, ec); } ////////////////////////////////////////////////////////////////////////// /// int Acceptor::Listen(lua_State* L) { int backlog = luaL_optinteger(L, 2, boost::asio::socket_base::max_connections); LogDebug("Acceptor::Listen (%p) (id=%d) - backlog = %d", this, m_acceptorId, backlog); boost::system::error_code ec; m_acceptor.listen(backlog, ec); return BoostErrorCodeToLua(L, ec); } ////////////////////////////////////////////////////////////////////////// /// int Acceptor::Accept(lua_State* L) { LogDebug("Acceptor::Accept (%p) (id=%d)", this, m_acceptorId); boost::asio::ip::tcp::socket* socket = new boost::asio::ip::tcp::socket( GetIoService() ); // store a reference in the registry lua_pushvalue(L, 1); int reference = luaL_ref(L, LUA_REGISTRYINDEX); m_acceptor.async_accept( *socket, boost::bind(&Acceptor::HandleAccept, this, reference, socket, boost::asio::placeholders::error) ); return 0; } ////////////////////////////////////////////////////////////////////////// /// void Acceptor::HandleAccept(int reference, boost::asio::ip::tcp::socket* socket, const boost::system::error_code& error) { LogDebug("Acceptor::HandleAccept (%p) (id=%d) (new socket %p)", this, m_acceptorId, socket); lua_State* L = m_L; lua_rawgeti(L, LUA_REGISTRYINDEX, reference); luaL_unref(L, LUA_REGISTRYINDEX, reference); if(!error) { boost::asio::ip::address address = socket->remote_endpoint().address(); //OnConnectionEstablished(socket, address); lua_getfield(L, 1, "callback"); if(lua_type(L, 2) == LUA_TFUNCTION) { lua_newtable(L); int peer = lua_gettop(L); lua_pushstring(L, "socket"); Socket* luasocket = new Socket(L, socket); Socket::push(L, luasocket, true); // now Socket is the owner lua_rawset(L, peer); const std::string& sAddress = address.to_string(); lua_pushstring(L, "address"); lua_pushlstring(L, sAddress.c_str(), sAddress.length()); lua_rawset(L, peer); lua_pushstring(L, "port"); lua_pushnumber(L, socket->remote_endpoint().port()); lua_rawset(L, peer); LuaNode::GetLuaVM().call(1, LUA_MULTRET); } else { // do nothing? } } else { if(error != boost::asio::error::operation_aborted) { LogError("Acceptor::HandleAccept (%p) (id=%d) (new socket %p) - %s", this, m_acceptorId, socket, error.message().c_str()); } } lua_settop(L, 0); }
[ [ [ 1, 2 ] ], [ [ 3, 204 ] ] ]
d5d99182c04cb04a461bcaef72678752e6ee277f
5ac13fa1746046451f1989b5b8734f40d6445322
/minimangalore/Nebula2/code/nebula2/src/gui/nguiformlayout_cmds.cc
667b6ce46c0886df86d0fc1addab349b8fd983ac
[]
no_license
moltenguy1/minimangalore
9f2edf7901e7392490cc22486a7cf13c1790008d
4d849672a6f25d8e441245d374b6bde4b59cbd48
refs/heads/master
2020-04-23T08:57:16.492734
2009-08-01T09:13:33
2009-08-01T09:13:33
35,933,330
0
0
null
null
null
null
UTF-8
C++
false
false
3,247
cc
//------------------------------------------------------------------------------ // nguiformlayout_cmds.cc // (C) 2004 RadonLabs GmbH //------------------------------------------------------------------------------ #include "gui/nguiformlayout.h" static void n_attachform(void* slf, nCmd* cmd); static void n_attachwidget(void* slf, nCmd* cmd); static void n_attachpos(void* slf, nCmd* cmd); //----------------------------------------------------------------------------- /** @scriptclass nguiformlayout @cppclass nGuiFormLayout @superclass nguiwidget @classinfo A nguiformlayout arranges the position of size of child widgets according to the layout rules "Attach To Form", "Attach To Widget" or "Attach To Pos". */ void n_initcmds(nClass* cl) { cl->BeginCmds(); cl->AddCmd("i_attachform_osf", 'AFRM', n_attachform); cl->AddCmd("i_attachwidget_osof", 'AWGT', n_attachwidget); cl->AddCmd("i_attachpos_osf", 'APOS', n_attachpos); cl->EndCmds(); } //------------------------------------------------------------------------------ /** @cmd attachform @input o(Widget), s(Edge=top|bottom|left|right) @output v @info Attaches the given widget's edge to one of the form layout's edges. */ static void n_attachform(void* slf, nCmd* cmd) { nGuiFormLayout* self = (nGuiFormLayout*) slf; nGuiWidget* widget = (nGuiWidget*) cmd->In()->GetO(); nGuiFormLayout::Edge edge = nGuiFormLayout::StringToEdge(cmd->In()->GetS()); float offset = cmd->In()->GetF(); n_assert(widget->IsA("nguiwidget")); cmd->Out()->SetI(self->AttachForm(widget, edge, offset)); } //------------------------------------------------------------------------------ /** @cmd attachwidget @input o(Widget), s(Edge=top|bottom|left|right), o(OtherWidget) @output v @info Attaches the given widget's edge to one of the other child widgets close edge. */ static void n_attachwidget(void* slf, nCmd* cmd) { nGuiFormLayout* self = (nGuiFormLayout*) slf; nGuiWidget* widget = (nGuiWidget*) cmd->In()->GetO(); nGuiFormLayout::Edge edge = nGuiFormLayout::StringToEdge(cmd->In()->GetS()); nGuiWidget* other = (nGuiWidget*) cmd->In()->GetO(); float offset = cmd->In()->GetF(); n_assert(widget->IsA("nguiwidget")); n_assert(other->IsA("nguiwidget")); cmd->Out()->SetI(self->AttachWidget(widget, edge, other, offset)); } //------------------------------------------------------------------------------ /** @cmd attachpos @input o(Widget), s(Edge=top|bottom|left|right), f(RelativePos) @output v @info Attaches the given widget's edge to a relative position (0.0 .. 1.0) in the form. */ static void n_attachpos(void* slf, nCmd* cmd) { nGuiFormLayout* self = (nGuiFormLayout*) slf; nGuiWidget* widget = (nGuiWidget*) cmd->In()->GetO(); nGuiFormLayout::Edge edge = nGuiFormLayout::StringToEdge(cmd->In()->GetS()); float pos = cmd->In()->GetF(); n_assert(widget->IsA("nguiwidget")); cmd->Out()->SetI(self->AttachPos(widget, edge, pos)); }
[ "BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c" ]
[ [ [ 1, 105 ] ] ]
b90da45e48c7e55e6f476511e1209f5c1208834a
de2f72b217bc8a9b1f780090bedf425a2ad9587a
/Pangea/Physics/src/world/ParticleWorld.cpp
44f147500de309700aeb47b073df319ac473bd53
[]
no_license
axelwass/oliveira
65b32a7f16cb7e00a95cdf3051a731a2004aaf5f
4c34730a720465311e367f8e25cc1cced46801c7
refs/heads/master
2021-01-18T14:18:42.622080
2011-04-18T18:39:08
2011-04-18T18:39:08
32,120,045
0
0
null
null
null
null
UTF-8
C++
false
false
2,920
cpp
/* * ParticleWorld.cpp * * Created on: 25/09/2010 * Author: Mariano */ #include "../../include/world/ParticleWorld.h" #include "../../include/emitter/Emitter.h" #include <iostream> #include <math.h> #include <stdlib.h> #include <GL/glut.h> //#include <GL/glew.h> ParticleWorld::ParticleWorld(real precision) { this->precision = precision; this->time = 0.0; // threshold more than 2 to prevent possible infinite partition due to equal vectors groupsOctree = OctreePtr( new Octree<ParticleGroup> (Vector3(), 2, 100, true)); } /* * The main function of the engine */ void ParticleWorld::runPhysics() { particleEmission(); integrate(); time += precision; } void ParticleWorld::particleEmission() { list<Emitter *>::iterator e = emitters.begin(); for (; e != emitters.end(); e++) (*e)->emit(); } void ParticleWorld::addEmitter(Emitter * emitter) { this->emitters.push_back(emitter); } void ParticleWorld::addParticleGroup(ParticleGroupPtr group) { this->groups.push_back(group); if (!this->groupsOctree->put(group.get())) printf("Group octree failed\n"); } void ParticleWorld::removeParticleGroup(ParticleGroupPtr group) { this->groups.remove(group); this->groupsOctree->remove(group.get()); } void ParticleWorld::resolveGroupCollisions() { list<ParticleGroupPtr>::iterator g; for (g = groups.begin(); g != groups.end(); g++) { ShapePtr shape = (*g)->getCollisionShape(); list<Positionable<ParticleGroup> *> closestGroups = groupsOctree->getIntersectionElements(shape.get()); list<Positionable<ParticleGroup> *>::iterator closeGroup; for (closeGroup = closestGroups.begin(); closeGroup != closestGroups.end(); closeGroup++) { ParticleGroup * other = (*closeGroup)->getThis(); if (other != (*g).get()) { IntersectionData data = (*g)->checkCollision(*other); if (data.hasIntersected()) (*g)->resolveCollision(*other, data); } } } } /* * Integrates each group, synchronizing each step. * * TODO: Convertir esto en n~#particulas threads, sincronizados con un monitor */ void ParticleWorld::integrate() { list<ParticleGroupPtr>::iterator itr; // Integrate synchronized for (int i = 0; i < RK4::getMaxSteps(); i++) { groupsOctree->update(); //resolveGroupCollisions(); TODO // Evaluate for (itr = groups.begin(); itr != groups.end(); itr++) (*itr)->evaluate(time, precision); // Integrate for (itr = groups.begin(); itr != groups.end(); itr++) (*itr)->integrate(precision); RK4::nextStep(); } } // PARA TESTEAR!!! void ParticleWorld::render() { //groupsOctree->render(NULL, false); // Draw Particles list<ParticleGroupPtr>::iterator group; for (group = groups.begin(); group != groups.end(); group++) (*group)->render(); } real ParticleWorld::getTime() { return time; }
[ "merchante.mariano@d457d4b0-f835-b411-19da-99c4f284aa10" ]
[ [ [ 1, 121 ] ] ]
a26d5a5002c58a1945f1cc16756cf2449790ad01
0f8559dad8e89d112362f9770a4551149d4e738f
/Wall_Destruction/Havok/Source/Physics/Internal/Collide/Mopp/Machine/hkpMoppMachine.h
22881d1d406d55ac7a2726ed312a1671595c8881
[]
no_license
TheProjecter/olafurabertaymsc
9360ad4c988d921e55b8cef9b8dcf1959e92d814
456d4d87699342c5459534a7992f04669e75d2e1
refs/heads/master
2021-01-10T15:15:49.289873
2010-09-20T12:58:48
2010-09-20T12:58:48
45,933,002
0
0
null
null
null
null
UTF-8
C++
false
false
7,724
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-2009 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_COLLIDE2_MOPP_MACHINE_H #define HK_COLLIDE2_MOPP_MACHINE_H #include <Common/Base/hkBase.h> #include <Common/Visualize/Shape/hkDisplayGeometry.h> #include <Common/Base/Types/Color/hkColor.h> #include <Physics/Internal/Collide/Mopp/Machine/hkp26Dop.h> struct hkpMoppPlanesQueryInput { public: HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_MOPP, hkpMoppPlanesQueryInput ); enum { HK_MAX_NUM_PLANES = 32 }; /// The number of planes, a maximum of HK_MAX_NUM_PLANES int m_numPlanes; /// The planes. The distance to the plane is calculated using:<br> /// dist = m_planes[x].dot3( position ) + m_planes[x](3)<br> /// The planes are pointing away from the viewing frustum (they define a convex object) /// so they have the same direction as the planes in the hkpConvexVerticesShape const hkVector4 *m_planes; }; /// Output object for hkpMoppKDopGeometriesVirtualMachine. One of these is /// created for each KDop that is found, according to the hkpMoppKDopQuery. struct hkpMoppInfo { HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_MOPP, hkpMoppInfo ); /// The 26-plane bounded shape at each node of the mopp hkp26Dop m_dop; /// Shapekey of a terminal, if m_isTerminal is true hkpShapeKey m_shapeKey; /// The level this hkpMoppInfo represents hkInt8 m_level; /// Specifies whether this info represents a terminal. If it doesn't, /// it represents an intermediate hkBool m_isTerminal; }; /// Query object for hkpMoppKDopGeometriesVirtualMachine struct hkpMoppKDopQuery { HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_MOPP, hkpMoppKDopQuery ); /// Set true to exit after the first hit hkBool m_earlyExit; /// Depth of display kdops to display (-1 to just display nodes, 0 to display all) int m_kdopDepth; /// Set true to only save kdops that lead to the specified ID. hkBool m_useSpecifiedID; unsigned int m_specifiedId; hkpMoppKDopQuery() { m_earlyExit = false; m_kdopDepth = -1; m_useSpecifiedID = false; m_specifiedId = 0; } }; class hkpMoppModifier; extern "C" { /// Returns true if the obb hits a mopp leave node int HK_CALL hkMoppEarlyExitObbVirtualMachine_queryObb(const hkpMoppCode* code, const hkTransform& BvToWorld, const hkVector4& extent, const float& radius); /// Return all the keys in a mopp. Note: the order of keys in a mopp is consistant. /// Please read hkpMoppCompilerInput void HK_CALL hkMoppFindAllVirtualMachine_getAllKeys( const hkpMoppCode* code, hkArray<hkpShapeKey>* primitives_out); /// Returns at least keys in a mopp which overlap with the given obb void HK_CALL hkMoppObbVirtualMachine_queryObb(const hkpMoppCode* code, const hkTransform& BvToWorld, const hkVector4& halfExtent, const float radius, hkArray<hkpShapeKey>* primitives_out); /// Returns at least keys in a mopp which overlap with the given aabb void HK_CALL hkMoppObbVirtualMachine_queryAabb(const hkpMoppCode* code, const hkAabb& aabb, hkArray<hkpShapeKey>* primitives_out); /// Returns at least keys in a mopp which overlap with the given sphere void HK_CALL hkMoppSphereVirtualMachine_querySphere(const hkpMoppCode* code, const hkSphere &sphere, hkArray<hkpShapeKey>* primitives_out); /// Query optimized for frustum checks. It reports all hits intersecting the planes (partialHitsOut). /// and all hits completely inside the convex object defined by the planes (fullyIncludedHitsOut). void HK_CALL hkMoppUsingFloatAabbVirtualMachine_queryPlanes( const hkpMoppCode* code, const hkpMoppPlanesQueryInput &query, hkArray<hkpShapeKey>* partialHitsOut, hkArray<hkpShapeKey>* fullyIncludedHitsOut); /// Same as hkMoppUsingFloatAabbVirtualMachine_queryPlanes but instead of returning all hits which are fully included /// it returns ranges of hits in fullyIncludedHitsOut. /// You can use hkMoppFindAllVirtualMachine_getAllKeys to find about the ordering of keys and /// than either reorder your input or create two mapping arrays. /// Example:<br> /// If you call hkMoppFindAllVirtualMachine_getAllKeys you might get the following hits:<br> /// 1, 3, 2, 7, 5, 4, 8, 6<br> /// If hkMoppUsingFloatAabbVirtualMachine_queryPlanesOptimized returns the range [3,4], it means all hits between 3 and 4 inclusive, /// which is 3,2,7,5,4 void HK_CALL hkMoppUsingFloatAabbVirtualMachine_queryPlanesOptimized( const hkpMoppCode* code, const hkpMoppPlanesQueryInput &query, hkArray<hkpShapeKey>* partialHitsOut, hkArray<hkpShapeKey>* fullyIncludedHitsOut); /// Same as hkMoppUsingFloatAabbVirtualMachine_queryPlanes, but using a sphere instead of a convex object void HK_CALL hkMoppUsingFloatAabbVirtualMachine_querySphere( const hkpMoppCode* code, const hkSphere &query, hkArray<hkpShapeKey>* partialHitsOut, hkArray<hkpShapeKey>* fullyIncludedHitsOut); /// Same as hkMoppUsingFloatAabbVirtualMachine_queryPlanesOptimized, but using a sphere instead of a convex object void HK_CALL hkMoppUsingFloatAabbVirtualMachine_querySphereOptimized( const hkpMoppCode* code, const hkSphere &query, hkArray<hkpShapeKey>* partialHitsOut, hkArray<hkpShapeKey>* fullyIncludedHitsOut); /// Queries the mopp and calls shouldTerminalBeRemoved on at least all nodes which overlap the input aabbs. /// modifierOut returns whether you want to remove a node or not. /// For every subtree which only has 'to-be-removed' nodes the address ADDR of the root node of this /// subtree is calculated and m_modifierOut->addTerminalRemoveInfo(ADDR) called. If you set the moppcode at /// this relative address to zero, you will effectively disable this subtree.<br> /// In short: /// - call queryAabb with an aabb containing all your nodes you want to remove /// - for every node you want to remove, return true in you implementation of hkpMoppModifier::shouldTerminalBeRemoved /// - remember all mopp code addressed in hkpMoppModifier::addTerminalRemoveInfo /// - change the mopp at all those addresses to zero to apply the mopp changes. /// - optional: if you remember all the places you have changed, than you can undo your changes void HK_CALL hkMoppModifyVirtualMachine_queryAabb( const hkpMoppCode* code, const hkAabb& aabb, hkpMoppModifier* modifierOut ); /// void HK_CALL hkMoppKDopGeometriesVirtualMachine_query( const hkpMoppCode* code, const hkpMoppKDopQuery &query, hkpMoppInfo* kDopGeometries ); } #endif // HK_COLLIDE2_MOPP_MACHINE_H /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222) * * Confidential Information of Havok. (C) Copyright 1999-2009 * 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. * */
[ [ [ 1, 159 ] ] ]
a1a2c7cddbb66dd807667556e52fad90bb310829
0e275196669377fab0f02c6f95b0d019e5e3c83c
/API/GraphicsServer/GraphicsServer.cpp
a71d739a80d236b0ef86a2e9b77709f344447bdb
[]
no_license
xesf/lbapi
5dee17e264471369cf7900fa540a538bb5e2070c
c6cca032d042b9fc3747fbe4397b298cb3f0633d
refs/heads/master
2021-01-13T01:07:23.708528
2009-10-15T17:54:17
2009-10-15T17:54:17
33,751,591
0
0
null
null
null
null
UTF-8
C++
false
false
31
cpp
#include "GraphicsServer.h"
[ "itsmeadri@8e89a3b0-850b-11de-96fc-292cd5189532" ]
[ [ [ 1, 2 ] ] ]
e231c4b85de20d8f7fb8116709adc9bd61b8945a
502c86f9c20082d5b21fd389c693f244b19ad9be
/clipboard.cpp
ca722c03cc7df95ea34acdd18a4e1a1a178313df
[]
no_license
viranch/clipboard
0b30ef069fef309236bc48c3a595aadd84192e04
4b293bea494833ceeb8ffbf6094f5bd0c0211a32
refs/heads/master
2021-03-12T19:40:34.031055
2011-08-01T10:39:10
2011-08-01T10:39:10
2,118,192
1
0
null
null
null
null
UTF-8
C++
false
false
10,547
cpp
#include <QNetworkInterface> #include <QCheckBox> #include <QMessageBox> #include <QDateTime> #include <QSettings> #include "clipboard.h" #include "ui_clipboard.h" #include "messagedialog.h" #include "settingsdialog.h" #define BROADCAST_INTERVAL 5 #define BROADCAST_PORT 2562 #define TCP_PORT 8080 #define MAX_DATA_SIZE 1024 #define UI_CHECK_COLUMN 0 #define UI_NICK_COLUMN 1 #define UI_IP_COLUMN 2 void _broadcast(QString msg); ClipBoard::ClipBoard(QWidget *parent) : QMainWindow(parent), ui(new Ui::ClipBoard) { ui->setupUi(this); // set headers QStringList columns; columns << "" << "" << ""; columns [UI_NICK_COLUMN] = "Nickname"; columns [UI_IP_COLUMN] = "IP Address"; /*QTreeWidgetItem *item = new QTreeWidgetItem(columns); item->setCheckState(UI_CHECK_COLUMN, Qt::Unchecked); ui->peopleList->setHeaderItem(item);*/ ui->peopleList->setHeaderLabels(columns); ui->peopleList->header()->setResizeMode(UI_CHECK_COLUMN, QHeaderView::ResizeToContents); // header checkbox /*QCheckBox *checkBox = new QCheckBox(); QStringList columns; columns << "" << "Nickname" << "IP Address"; QTreeWidgetItem *header = new QTreeWidgetItem(columns); ui->peopleList->setItemWidget(header, 0, checkBox); ui->peopleList->setHeaderItem(header); connect(checkBox, SIGNAL(toggled(bool)), this, SLOT(updateCheckBoxes(bool))); checkBox->setChecked(false);*/ // nick name QSettings s("Stealth Flash", "Clipboard"); m_nick = s.value("nickname", QString(getenv("USER"))).toString(); if (!s.contains("nickname")) s.setValue("nickname", m_nick); // clipboard monitor m_clipboard = QApplication::clipboard(); //ui->clipboardContents->setPlainText(m_clipboard->text()); connect(m_clipboard, SIGNAL(dataChanged()), this, SLOT(updateTooltip())); // tray icon m_tray = new QSystemTrayIcon(QIcon(":/icons/images/clipboard-icon.png"), this); m_tray->show(); m_tray->setToolTip("Clipboard Contents:\n"+m_clipboard->text()); connect (m_tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleWindow(QSystemTrayIcon::ActivationReason))); m_trayMenu = new QMenu(this); m_trayMenu->addAction(QIcon(":/icons/images/clipboard-icon.png"), "Quick Paste", this, SLOT(on_pasteButton_clicked())); m_trayMenu->addAction(QIcon(":/icons/images/configure.png"), "Settings", this, SLOT(on_actionSettings_triggered())); m_trayMenu->addAction(QIcon(":/icons/images/application-exit.png"), "Quit", this, SLOT(on_actionQuit_triggered())); m_tray->setContextMenu(m_trayMenu); // TCP listener m_tcpServer = new QTcpServer(this); if (!m_tcpServer->listen(QHostAddress::Any, TCP_PORT)) { QMessageBox::critical(this, "ClipBoard", m_tcpServer->errorString()); } else { connect(m_tcpServer, SIGNAL(newConnection()), this, SLOT(connectToClient())); } // UDP listener m_udpSocket = new QUdpSocket(this); m_udpSocket->bind(QHostAddress::Any, BROADCAST_PORT); connect (m_udpSocket, SIGNAL(readyRead()), this, SLOT(readDatagrams())); // UDP talker m_broadcastTimer = new QTimer(this); connect(m_broadcastTimer, SIGNAL(timeout()), this, SLOT(broadcast())); broadcast(); m_broadcastTimer->start(BROADCAST_INTERVAL*1000); // message box connect (ui->incomingList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(showMessageBox(QTreeWidgetItem*,int))); } ClipBoard::~ClipBoard() { delete ui; } void ClipBoard::updateTooltip() { //ui->clipboardContents->setPlainText(m_clipboard->text()); m_tray->setToolTip("Clipboard Contents:\n"+m_clipboard->text()); } void ClipBoard::toggleWindow(QSystemTrayIcon::ActivationReason reason) { if (reason == QSystemTrayIcon::Trigger) { this->setHidden(!this->isHidden()); } } void ClipBoard::updateCheckBoxes(bool checked) { for (int i=0; i<ui->peopleList->topLevelItemCount(); i++) { QTreeWidgetItem *item = ui->peopleList->topLevelItem(i); QCheckBox *checkBox = (QCheckBox*) ui->peopleList->itemWidget(item, UI_CHECK_COLUMN); checkBox->setChecked(checked); } } void ClipBoard::connectToClient() { m_tcpClient = m_tcpServer->nextPendingConnection(); connect (m_tcpClient, SIGNAL(disconnected()), m_tcpClient, SLOT(deleteLater())); connect (m_tcpClient, SIGNAL(readyRead()), this, SLOT(receiveData())); } void ClipBoard::receiveData() { QDataStream in(m_tcpClient); char data[MAX_DATA_SIZE]; int len = in.readRawData(data, MAX_DATA_SIZE); data[len] = '\0'; QString string(data); QRegExp rx_msg("0x1d0x1e0x1f0x01(.*)0x00(.*)0x1f0x1e0x1d"); rx_msg.indexIn(string); QString msg = rx_msg.cap(2); if (msg.isEmpty()) return; QString now = QDateTime::currentDateTime().toString("MMM d, h:mmap"); QStringList columns; QString nick = m_people[m_tcpClient->peerAddress().toString()]; columns << nick << msg.trimmed() << now; QTreeWidgetItem *item = new QTreeWidgetItem(ui->incomingList, columns); m_tray->showMessage("Incoming text", "Sender: "+nick); } void ClipBoard::updatePeople(QString senderIP, QString datagram) { QRegExp rx_st("0x00(.*)0x1f"); rx_st.indexIn(datagram); QString status = rx_st.cap(1); if (status.toLower()=="live") { QRegExp rx_nick("0x02(.*)0x00"); rx_nick.indexIn(datagram); QString nick = rx_nick.cap(1); if (!m_people.contains(senderIP)) { m_people[senderIP] = nick; QStringList columns; columns << "" << "" << ""; columns [UI_NICK_COLUMN] = m_people[senderIP]; columns [UI_IP_COLUMN] = senderIP; QTreeWidgetItem *item = new QTreeWidgetItem(ui->peopleList, columns); item->setCheckState(UI_CHECK_COLUMN, Qt::Unchecked); } else { m_people[senderIP] = nick; QTreeWidgetItem *item = ui->peopleList->findItems(senderIP, Qt::MatchFixedString, UI_IP_COLUMN)[0]; item->setText(UI_NICK_COLUMN, nick); } } else if (status.toLower()=="dead") { QRegExp rx_nick("0x03(.*)0x00"); rx_nick.indexIn(datagram); QString nick = rx_nick.cap(1); QList<QTreeWidgetItem*> items_to_remove = ui->peopleList->findItems(senderIP, Qt::MatchFixedString, UI_IP_COLUMN); foreach (QTreeWidgetItem* item, items_to_remove) { int index_to_remove = ui->peopleList->indexOfTopLevelItem(item); ui->peopleList->takeTopLevelItem(index_to_remove); } m_people.remove(senderIP); } } void ClipBoard::readDatagrams() { QHostAddress sender; quint16 senderPort; char data[1024]; while (m_udpSocket->hasPendingDatagrams()) { QByteArray datagram; datagram.resize(m_udpSocket->pendingDatagramSize()); m_udpSocket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort); //if (sender != QHostAddress::LocalHost) { QDataStream in(&datagram, QIODevice::ReadOnly); int len = in.readRawData(data, 1024); data[len]='\0'; updatePeople(sender.toString(), QString(data)); //} } } void ClipBoard::broadcast() { QString msg = "0x1d0x1e0x1f0x02"+m_nick+"0x00LIVE0x1f0x1e0x1d"; _broadcast(msg); } void _broadcast(QString msg) { foreach (QHostAddress host, QNetworkInterface::allAddresses()) { if (host.protocol() == QAbstractSocket::IPv4Protocol) { QString ip_addr = host.toString(); //if (ip_addr == "127.0.0.1") continue; // get char* for writing raw message from QByteArray msgByteArray = msg.toAscii(); char *data = msgByteArray.data(); // write the raw message QByteArray block; QDataStream out(&block, QIODevice::WriteOnly); out.writeRawData(data, msg.length()); // send the raw message QUdpSocket socket; socket.writeDatagram(block, QHostAddress::Broadcast, BROADCAST_PORT); socket.close(); } } } void ClipBoard::showMessageBox (QTreeWidgetItem* item, int column) { messageDialog *dlg = new messageDialog(item->text(0), item->text(2), item->text(1), this); dlg->exec(); delete dlg; } void ClipBoard::on_actionQuit_triggered() { m_tcpServer->close(); m_udpSocket->close(); m_broadcastTimer->stop(); QString msg = "0x1d0x1e0x1f0x03"+m_nick+"0x00DEATH0x1f0x1e0x1d"; _broadcast(msg); m_people.clear(); close(); } QList<QTreeWidgetItem*> getSelectedItems(QTreeWidget* tree) { QList<QTreeWidgetItem*> selected; for (int i=0; i<tree->topLevelItemCount(); i++) { QTreeWidgetItem *item = tree->topLevelItem(i); if (item->checkState(UI_CHECK_COLUMN) == Qt::Checked) selected << item; } return selected; } void ClipBoard::on_pasteButton_clicked() { // prepare the data to be sent //QString text = ui->clipboardContents->toPlainText(); QString text = m_clipboard->text(); if (text.isEmpty()) return; QString msg = "0x1d0x1e0x1f0x01" + m_nick + "0x00" + text + "0x1f0x1e0x1d"; QByteArray byteData = msg.toAscii(); char *data = byteData.data(); foreach(QTreeWidgetItem *item, getSelectedItems(ui->peopleList)) { QTcpSocket *s = new QTcpSocket(this); s->connectToHost(item->text(UI_IP_COLUMN), TCP_PORT, QIODevice::WriteOnly); // wrap up the data QByteArray block; QDataStream out(&block, QIODevice::WriteOnly); out.writeRawData(data, msg.length()); // write the data to the socket and disconnect s->write(block); s->disconnectFromHost(); } } void ClipBoard::on_actionSettings_triggered() { SettingsDialog *dlg = new SettingsDialog(this); if (dlg->exec()) { QSettings s("Stealth Flash", "Clipboard"); m_nick = dlg->getNick(); s.setValue("nickname", m_nick); } delete dlg; }
[ [ [ 1, 316 ] ] ]
6995bb4a20a3b9f25ded51d2d209bba3da5ef36e
7b4c786d4258ce4421b1e7bcca9011d4eeb50083
/C++Primer中文版(第4版)/第一次-代码集合-20090414/第九章 顺序容器/20090209_测试9.3.6_访问元素_应该是前减还是后减.cpp
37bd6749eca02596b8396e9d2d23b4133963aba7
[]
no_license
lzq123218/guoyishi-works
dbfa42a3e2d3bd4a984a5681e4335814657551ef
4e78c8f2e902589c3f06387374024225f52e5a92
refs/heads/master
2021-12-04T11:11:32.639076
2011-05-30T14:12:43
2011-05-30T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
409
cpp
#include <iostream> #include <vector> using namespace std; int main() { vector<int> ivec; int ival; cout << "Enter some integers(Ctrl+Z to end):" << endl; while (cin >> ival) ivec.push_back(ival); cout << "The last element is :" << endl; vector<int>::iterator iter = ivec.end(); cout << *iter << endl; cout << *iter-- << endl; cout << *(--iter); cout << endl; return 0; }
[ "baicaibang@70501136-4834-11de-8855-c187e5f49513" ]
[ [ [ 1, 22 ] ] ]
1c0fb70b1c01e07be830aec5dc5c710fd12b6bac
27c26f4507ca383922f718d8cf725fa1ebed6721
/inc/PodOClockAppView.h
46968c012f8b26f6fce80ff79289005d30641fab
[]
no_license
hugovk/podoclock
453bedcd0b5462bd3e21c04e391723b864184b89
c527b616aba9bc25347f50b9bb6a322b3d97b030
refs/heads/master
2021-01-23T09:28:46.153771
2011-09-04T17:42:33
2011-09-04T17:42:33
32,327,744
0
0
null
null
null
null
UTF-8
C++
false
false
4,881
h
/* Pod O'Clock for Symbian phones. http://code.google.com/p/podoclock/ Copyright (C) 2010, 2011 Hugo van Kemenade This file is part of Pod O'Clock. Pod O'Clock 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. Pod O'Clock 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 Pod O'Clock. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __PODOCLOCKAPPVIEW_H__ #define __PODOCLOCKAPPVIEW_H__ #include <aknserverapp.h> // MAknServerAppExitObserver #include <apgcli.h> #include "PodOClockTimer.h" // CONSTANTS #ifdef __OVI_SIGNED__ _LIT(KVersion, "3.07"); #else _LIT(KVersion, "2.07"); #endif // FORWARD DECLARATIONS class CAknNavigationControlContainer; class CAknNavigationDecorator; class CDocumentHandler; class CPodOClockTouchFeedbackInterface; // CLASS DECLARATION class CPodOClockAppView : public CCoeControl, // public CAknAppUi, public MAknServerAppExitObserver, public MPodOClockTimerNotify { public: // Constructors and destructors static CPodOClockAppView* NewL(const TRect& aRect); static CPodOClockAppView* NewLC(const TRect& aRect); virtual ~CPodOClockAppView(); public: // Functions from base classes void Draw(const TRect& aRect) const; public: // New methods void SetAlarmL(const TTime aTime, const TBool aShowConfirmation = ETrue); void AskRepeatAlarmL(); TBool AskRemoveAlarmL(); void RemoveAlarm(); void AskDeleteFileL(); void DeleteFileL(); void PlayRandomFileL(); TBool AlarmActive() const { return iAlarmTimer ? iAlarmTimer->IsActive() : EFalse; } TTime AlarmTime() const { return iAlarmTime; } TBool FileNameKnown() const { return iCurrentFileName.Length() > 0; } TBool IsThirdEdition() const { return (iFeedback == NULL); } private: // from CCoeControl virtual void SizeChanged(); TTypeUid::Ptr MopSupplyObject(TTypeUid aId); TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); void HandlePointerEventL(const TPointerEvent& aPointerEvent); private: // from MPodOClockSleepTimerNotify void TimerExpiredL(TAny* aTimer, TInt aError); private: // from MAknServerAppExitObserver void HandleServerAppExit(TInt aReason); private: // Constructors void ConstructL(const TRect& aRect); CPodOClockAppView(); private: // New methods // Drawing methods void DrawText(const TDesC& aText, const TInt& aY, const TRgb& aPenColor) const; void DrawText(const TDesC& aText, const TRect& aRect, const TRgb& aPenColor) const; void DrawIcon(const CFbsBitmap& aIcon, const TRect& aRect, const TSize& aSize) const; void DoChangePaneTextL() const; void SetPositions(); void LoadIconL(TInt aIndex, CFbsBitmap*& aBitmap, CFbsBitmap*& aMask, TSize& aSize); void LoadResourceFileTextL(); void LoadSettingsL(); void SaveSettingsL(); void FindFilesOnDriveL(const TInt& aDriveNumber); void FindFilesInDir(TFindFile& aFinder, const TDesC& aDir); TBool IsAudioFile(const TDesC& aFileName, const TInt aFileSize); TBool IsAudioFileL(const TDesC& aFileName); void LaunchFileEmbeddedL(const TDesC& aFileName); private: // Text from resource files HBufC* iAlarmSetText; HBufC* iNoAlarmSetText; HBufC* iDeleteFileText; TRect iAlarmTextRect; TRect iDeleteAlarmButtonRect; TRect iPlayButtonRect; TRect iFileNameRect; TRect iDeleteFileButtonRect; TInt iHalfTextHeightInPixels; CFbsBitmap* iPlayIcon; CFbsBitmap* iPlayMask; TSize iPlayIconSize; CFbsBitmap* iDeleteIcon; CFbsBitmap* iDeleteMask; TSize iDeleteIconSize; const CFont* iFont; CAknsBasicBackgroundControlContext* iBackground; // for skins support TInt iRectWidth; CAknNavigationControlContainer *iNaviContainer; CAknNavigationDecorator* iNaviLabelDecorator; TTime iAlarmTime; CPodOClockTimer* iAlarmTimer; // For finding files RArray<TFileName> iFileArray; RApaLsSession iApaLsSession; TInt64 iSeed; // For keeping track of the playing track TFileName iCurrentFileName; TFileName iChoppedFileName; TInt iCurrentFileNumber; TInt iNumberOfFiles; TBool iAskRepeat; CDocumentHandler* iDocHandler; TPoint iLastTouchPosition; CPodOClockTouchFeedbackInterface* iFeedback; TUid iDtorIdKey; }; #endif // __PODOCLOCKAPPVIEW_H__ // End of file
[ "hugovk@373d2494-ea07-43fc-4ece-a9e515d930fe" ]
[ [ [ 1, 165 ] ] ]
044c0bdb6e30abba6176855c8a3e099dcd4fe351
05869e5d7a32845b306353bdf45d2eab70d5eddc
/soft/application/NetworkSimulator/Simulator/DataList.h
78fc15de18c37f783d5ddd7cd63ea3f571d81e9f
[]
no_license
shenfahsu/sc-fix
beb9dc8034f2a8fd9feb384155fa01d52f3a4b6a
ccc96bfaa3c18f68c38036cf68d3cb34ca5b40cd
refs/heads/master
2020-07-14T16:13:47.424654
2011-07-22T16:46:45
2011-07-22T16:46:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,240
h
/***************************************************************************** * Copyright Statement: * -------------------- * This software is protected by Copyright and the information contained * herein is confidential. The software may not be copied and the information * contained herein may not be used or disclosed except with the written * permission of COOLSAND Inc. (C) 2005 * * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("COOLSAND SOFTWARE") * RECEIVED FROM COOLSAND AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON * AN "AS-IS" BASIS ONLY. COOLSAND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. * NEITHER DOES COOLSAND PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR * SUPPLIED WITH THE COOLSAND SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. COOLSAND SHALL ALSO * NOT BE RESPONSIBLE FOR ANY COOLSAND SOFTWARE RELEASES MADE TO BUYER'S * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. * * BUYER'S SOLE AND EXCLUSIVE REMEDY AND COOLSAND'S ENTIRE AND CUMULATIVE * LIABILITY WITH RESPECT TO THE COOLSAND SOFTWARE RELEASED HEREUNDER WILL BE, * AT COOLSAND'S OPTION, TO REVISE OR REPLACE THE COOLSAND SOFTWARE AT ISSUE, * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO * COOLSAND FOR SUCH COOLSAND SOFTWARE AT ISSUE. * * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). * *****************************************************************************/ /************************************************************** FILENAME : DataList.h PURPOSE : Decalaration file REMARKS : nil AUTHOR : Vikram DATE : Aug 5,03 **************************************************************/ #if !defined(AFX_DATALIST_H__5C766C57_DF67_4858_8B55_4F30453F02CF__INCLUDED_) #define AFX_DATALIST_H__5C766C57_DF67_4858_8B55_4F30453F02CF__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "Data.h" class CDataList { public: CDataList(); CDataList(CDataList&); virtual ~CDataList(); CString GetName(){return m_csName;} CString GetDefault(){return m_csDefault;} void AddValue(CData& dataObj); void SetName(CString csName){m_csName = csName;} void SetDefault(CString csDefault){m_csDefault = csDefault;} CList<CData,CData&>& GetData(){return m_DataList;} CDataList& operator=(CDataList& dataObj); private: CString m_csName; CString m_csDefault; CList<CData,CData&> m_DataList; }; #endif // !defined(AFX_DATALIST_H__5C766C57_DF67_4858_8B55_4F30453F02CF__INCLUDED_)
[ "windyin@2490691b-6763-96f4-2dba-14a298306784" ]
[ [ [ 1, 78 ] ] ]
2c1fd5b88b8e5f95726217519d73022a44ae400e
33f59b1ba6b12c2dd3080b24830331c37bba9fe2
/Depend/Foundation/Approximation/Wm4ApprCircleFit2.cpp
f82a2ace88ca1309356629b2a71390d24e9e369e
[]
no_license
daleaddink/flagship3d
4835c223fe1b6429c12e325770c14679c42ae3c6
6cce5b1ff7e7a2d5d0df7aa0594a70d795c7979a
refs/heads/master
2021-01-15T16:29:12.196094
2009-11-01T10:18:11
2009-11-01T10:18:11
37,734,654
1
0
null
null
null
null
UTF-8
C++
false
false
3,038
cpp
// Geometric Tools, Inc. // http://www.geometrictools.com // Copyright (c) 1998-2006. All Rights Reserved // // The Wild Magic Version 4 Foundation Library source code is supplied // under the terms of the license agreement // http://www.geometrictools.com/License/Wm4FoundationLicense.pdf // and may not be copied or disclosed except in accordance with the terms // of that agreement. #include "Wm4FoundationPCH.h" #include "Wm4ApprCircleFit2.h" #include "Wm4ApprQuadraticFit2.h" namespace Wm4 { //---------------------------------------------------------------------------- template <class Real> bool CircleFit2 (int iQuantity, const Vector2<Real>* akPoint, int iMaxIterations, Circle2<Real>& rkCircle, bool bInitialCenterIsAverage) { // compute the average of the data points Vector2<Real> kAverage = akPoint[0]; int i0; for (i0 = 1; i0 < iQuantity; i0++) { kAverage += akPoint[i0]; } Real fInvQuantity = ((Real)1.0)/(Real)iQuantity; kAverage *= fInvQuantity; // initial guess if (bInitialCenterIsAverage) { rkCircle.Center = kAverage; } else { QuadraticCircleFit2<Real>(iQuantity,akPoint,rkCircle.Center, rkCircle.Radius); } int i1; for (i1 = 0; i1 < iMaxIterations; i1++) { // update the iterates Vector2<Real> kCurrent = rkCircle.Center; // compute average L, dL/da, dL/db Real fLAverage = (Real)0.0; Vector2<Real> kDerLAverage = Vector2<Real>::ZERO; for (i0 = 0; i0 < iQuantity; i0++) { Vector2<Real> kDiff = akPoint[i0] - rkCircle.Center; Real fLength = kDiff.Length(); if (fLength > Math<Real>::ZERO_TOLERANCE) { fLAverage += fLength; Real fInvLength = ((Real)1.0)/fLength; kDerLAverage -= fInvLength*kDiff; } } fLAverage *= fInvQuantity; kDerLAverage *= fInvQuantity; rkCircle.Center = kAverage + fLAverage*kDerLAverage; rkCircle.Radius = fLAverage; Vector2<Real> kDiff = rkCircle.Center - kCurrent; if (Math<Real>::FAbs(kDiff.X()) <= Math<Real>::ZERO_TOLERANCE && Math<Real>::FAbs(kDiff.Y()) <= Math<Real>::ZERO_TOLERANCE) { break; } } return i1 < iMaxIterations; } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // explicit instantiation //---------------------------------------------------------------------------- template WM4_FOUNDATION_ITEM bool CircleFit2<float> (int, const Vector2<float>*, int, Circle2<float>&, bool); template WM4_FOUNDATION_ITEM bool CircleFit2<double> (int, const Vector2<double>*, int, Circle2<double>&, bool); //---------------------------------------------------------------------------- }
[ "yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa" ]
[ [ [ 1, 93 ] ] ]
b080976b746c6ac71d8ca57b9b87883837f71566
1c9f99b2b2e3835038aba7ec0abc3a228e24a558
/Projects/elastix/elastix_sources_v4/src/Components/Transforms/WeightedCombinationTransform/elxWeightedCombinationTransform.cxx
3866264362c47f7dac7c87c2b25768c24631090c
[]
no_license
mijc/Diploma
95fa1b04801ba9afb6493b24b53383d0fbd00b33
bae131ed74f1b344b219c0ffe0fffcd90306aeb8
refs/heads/master
2021-01-18T13:57:42.223466
2011-02-15T14:19:49
2011-02-15T14:19:49
1,369,569
0
0
null
null
null
null
UTF-8
C++
false
false
683
cxx
/*====================================================================== This file is part of the elastix software. Copyright (c) University Medical Center Utrecht. All rights reserved. See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. ======================================================================*/ #include "elxWeightedCombinationTransform.h" elxInstallMacro( WeightedCombinationTransformElastix );
[ [ [ 1, 18 ] ] ]
a7715e685a65514b3d1d31ed2e2c02243d210dd3
5e61787e7adba6ed1c2b5e40d38098ebdf9bdee8
/sans/models/c_smearer/smearer2d_helper.cpp
82a4688fb3bdaed1c62aeb7c7e49280cf37d905b
[]
no_license
mcvine/sansmodels
4dcba43d18c930488b0e69e8afb04139e89e7b21
618928810ee7ae58ec35bbb839eba2a0117c4611
refs/heads/master
2021-01-22T13:12:22.721492
2011-09-30T14:01:06
2011-09-30T14:01:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,486
cpp
/** This software was developed by the University of Tennessee as part of the Distributed Data Analysis of Neutron Scattering Experiments (DANSE) project funded by the US National Science Foundation. If you use DANSE applications to do scientific research that leads to publication, we ask that you acknowledge the use of the software with the following sentence: "This work benefited from DANSE software developed under NSF award DMR-0520547." copyright 2009, University of Tennessee */ #include "smearer2d_helper.hh" #include <stdio.h> #include <math.h> using namespace std; /** * Constructor for BaseSmearer * * binning * @param qx: array of Qx values * @param qy: array of Qy values * @param nrbins: number of r bins * @param nphibins: number of phi bins */ Smearer_helper :: Smearer_helper(int npoints, double* qx, double* qy, double* dqx, double* dqy, double rlimit, int nrbins, int nphibins) { // Number of bins this->npoints = npoints; this->rlimit = rlimit; this->nrbins = nrbins; this->nphibins = nphibins; this->qx_values = qx; this->qy_values = qy; this->dqx_values = dqx; this->dqy_values = dqy; }; /** * Compute the point smearing matrix */ void Smearer_helper :: smear2d(double *weights, double *qx_out, double *qy_out){ double rbin_size = rlimit / double(nrbins); double phibin_size = 0.0; int tot_nbins = nrbins * nphibins; double rbin = 0.0; double phibin = 0.0; double qr = 0.0; double qphi = 0.0; double Pi = 4.0*atan(1.0); // Loop over q-values and multiply apply matrix for(int i=0; i<nrbins; i++){ rbin = rbin_size * (double(i) + 0.5); for(int j=0; j<nphibins; j++){ phibin_size = 2.0 * Pi / double(nphibins); phibin = phibin_size * (double(j)); for(int q_i=0; q_i<npoints; q_i++){ qr = sqrt(qx_values[q_i]*qx_values[q_i] + qy_values[q_i]*qy_values[q_i]); qphi = atan(qy_values[q_i]/qx_values[q_i]); qx_out[q_i + npoints*(nrbins * j + i)] = (rbin*dqx_values[q_i]*cos(phibin) + qr)*cos(qphi)- rbin*dqy_values[q_i]*sin(phibin)*sin(qphi); qy_out[q_i + npoints*(nrbins * j + i)] = (rbin*dqx_values[q_i]*cos(phibin) + qr)*sin(qphi)+ rbin*dqy_values[q_i]*sin(phibin)*cos(qphi); if (q_i==0){ weights[nrbins * j + i] = exp(-0.5 * ((rbin - rbin_size / 2.0) * (rbin - rbin_size / 2.0)))- exp(-0.5 * ((rbin + rbin_size / 2.0 ) * (rbin + rbin_size / 2.0))); } } } } }
[ [ [ 1, 77 ] ] ]
183d39ab4fd3297d8cb6ff45f069d8369a91616a
bfdfb7c406c318c877b7cbc43bc2dfd925185e50
/engine/test/Test_hyBitArray.cpp
6aafd60c7a39fbac7a9ec0fff30f09b7197165cd
[ "MIT" ]
permissive
ysei/Hayat
74cc1e281ae6772b2a05bbeccfcf430215cb435b
b32ed82a1c6222ef7f4bf0fc9dedfad81280c2c0
refs/heads/master
2020-12-11T09:07:35.606061
2011-08-01T12:38:39
2011-08-01T12:38:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,946
cpp
/* -*- coding: sjis-dos; -*- */ /* * copyright 2010 FUKUZAWA Tadashi. All rights reserved. */ #include "hyBitArray.h" #include "hyMemPool.h" #include <cppunit/extensions/HelperMacros.h> using namespace Hayat::Common; using namespace Hayat::Engine; class Test_BitArray : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(Test_BitArray); CPPUNIT_TEST(test_bitArray); CPPUNIT_TEST_SUITE_END(); public: Test_BitArray(void) {} void* hayatMemory; void setUp(void) { hayatMemory = HMD_ALLOC(10240); MemPool::initGMemPool(hayatMemory, 10240); } void tearDown(void) { HMD_FREE(hayatMemory); } void test_bitArray(void) { BitArray ba(20); CPPUNIT_ASSERT_EQUAL(20, ba.size()); ba.changeSize(100); CPPUNIT_ASSERT_EQUAL(100, ba.size()); ba.changeSize(50); CPPUNIT_ASSERT_EQUAL(50, ba.size()); CPPUNIT_ASSERT_EQUAL(false, ba.getAt(10)); ba.setAt(10, true); CPPUNIT_ASSERT_EQUAL(true, ba.getAt(10)); ba.setAt(10, false); CPPUNIT_ASSERT_EQUAL(false, ba.getAt(10)); ba.setAll(true); CPPUNIT_ASSERT_EQUAL(true, ba.getAt(30)); CPPUNIT_ASSERT_EQUAL(true, ba.getAt(40)); ba.setRange(10, 35, false); CPPUNIT_ASSERT_EQUAL(true, ba.getAt(9)); CPPUNIT_ASSERT_EQUAL(false, ba.getAt(10)); CPPUNIT_ASSERT_EQUAL(false, ba.getAt(35)); CPPUNIT_ASSERT_EQUAL(true, ba.getAt(36)); CPPUNIT_ASSERT_EQUAL(true, ba.getAt(40)); ba.insertAt(20, true); CPPUNIT_ASSERT_EQUAL(51, ba.size()); CPPUNIT_ASSERT_EQUAL(true, ba.getAt(20)); CPPUNIT_ASSERT_EQUAL(false, ba.getAt(36)); CPPUNIT_ASSERT_EQUAL(true, ba.getAt(37)); CPPUNIT_ASSERT_EQUAL(true, ba.getAt(41)); } }; CPPUNIT_TEST_SUITE_REGISTRATION(Test_BitArray);
[ [ [ 1, 70 ] ] ]
af3b64295f211c2de68f6e495b41139a13ed1ebd
9cc6fc798950fa3f3c9c132fd5c633a6ef4cc2b4
/MAIN_DLL/windowmessages.cpp
138dc5807b6f285786c73f33da9c7eb84f9e7fd3
[]
no_license
tsuckow/BackgroundPi4
4e986addc7b5dce88d3e7b4d1d0f745d039891c1
15edabe046a6508ec92ea328c589b77ebedccbe8
refs/heads/master
2016-09-05T17:30:23.601710
2007-05-21T01:08:23
2007-05-21T01:08:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,079
cpp
/* * * * * * * * * * * * * * Background Pi Client * * v4 * * * * Module: Main.DLL * * * * * * * * * * * * * * * */ #include "BPC_MAIN_DLL.h" //Invis Dialog LRESULT CALLBACK InvisDialogProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static UINT s_uTaskbarRestart; switch (message) /* handle the messages */ { case WM_INITDIALOG: SetClassLong(hwnd,GCL_HICON,(long) LoadIcon(thisinstance,"A")); SetClassLong(hwnd,GCL_HICONSM,(long) LoadIcon(thisinstance,"A")); s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated")); return false; break; case WM_NOTIFYICON: if ((UINT)lParam == WM_RBUTTONUP){ POINT cord; GetCursorPos(&cord); HMENU menu; menu = CreatePopupMenu(); AppendMenu(menu,MF_ENABLED|MF_STRING, ID_MENU_ABOUT,"&About"); AppendMenu(menu,MF_ENABLED|MF_STRING, ID_MENU_HELP,"&Help"); AppendMenu(menu,MF_ENABLED|MF_STRING, ID_MENU_SETT,"Se&ttings"); AppendMenu(menu,MF_ENABLED|MF_STRING, ID_MENU_STATUS,"&Status"); AppendMenu(menu,MF_ENABLED|MF_STRING, ID_MENU_EXIT,"&Exit"); SetForegroundWindow(hwnd); TrackPopupMenu(menu,TPM_RIGHTALIGN,cord.x,cord.y,0,hwnd,NULL); DestroyMenu(menu); PostMessage(hwnd, WM_NULL, 0, 0); } else if ((UINT)lParam == WM_LBUTTONDBLCLK) { PostMessage(hwnd,WM_COMMAND,ID_MENU_STATUS,0); } return 0; break; case WM_CLOSE: case WM_RQUIT: Windowlessquit = true; PostQuitMessage(0); break; // /* case WM_ENDSESSION: Windowlessquit = true; PostQuitMessage(0); return 0; // */ case WM_COMMAND: switch(LOWORD(wParam)) { case ID_MENU_EXIT: Windowlessquit = true; PostQuitMessage (0); break; case ID_MENU_STATUS: Stat.Create(); break; case ID_MENU_SETT: Sett.Create(); break; case ID_MENU_HELP: WinHelp(hwnd,"HELP.HLP",HELP_FINDER,0); break; case ID_MENU_ABOUT: if (!IsWindow(Aboutwnd)) { Aboutwnd = CreateDialog(thisinstance,MAKEINTRESOURCE(IDD_ABOUT),NULL,(DLGPROC)AboutDialogProcedure); ShowWindow(Aboutwnd,SW_SHOW); } SetForegroundWindow(Aboutwnd); break; } return 0; break; default: if( message == s_uTaskbarRestart) { hGlobalIcon->Remove(); Sleep(500); hGlobalIcon->Add(); break; } return false; } return 0; } //Status LRESULT CALLBACK StatusDialogProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_INITDIALOG: SetClassLong(hwnd,GCL_HICON,(long) LoadIcon(thisinstance,"A")); SetClassLong(hwnd,GCL_HICONSM,(long) LoadIcon(thisinstance,"A")); SetDlgItemText(hwnd,IDC_MODE,"Loading..."); SetDlgItemText(hwnd,IDC_PERC,"N/A"); SetDlgItemText(hwnd,IDC_ELAP,"N/A"); SetDlgItemText(hwnd,IDC_TIME,"N/A"); SetDlgItemText(hwnd,IDC_ITERN,"N/A"); SetDlgItemText(hwnd,IDC_ITERO,"N/A"); SetDlgItemText(hwnd,IDC_CALC,"N/A"); //_beginthread(StatusUpdate, 0, NULL); return false; break; case WM_CLOSE: DestroyWindow(hwnd); Stat.Statuswnd=NULL; return 0; break; default: /* for messages that we don't deal with */ //return DefWindowProc (hwnd, message, wParam, lParam); return false; } return 0; } //Splash Dialog LRESULT CALLBACK SplashDialogProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_INITDIALOG: SetClassLong(hwnd,GCL_HICON,(long) LoadIcon(thisinstance,"A")); SetClassLong(hwnd,GCL_HICONSM,(long) LoadIcon(thisinstance,"A")); SetDlgItemText(hwnd,IDC_LOAD,(char *)"Init..."); return false; break; case WM_SETLOADTEXT: return SetDlgItemText(hwnd,IDC_LOAD,(char *)lParam); case WM_CLOSE: DestroyWindow(hwnd); Splashwnd = NULL; break; default: return false; } return 0; } //Settings LRESULT CALLBACK SettingDialogProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message)/* handle the messages */ { case WM_INITDIALOG: SetClassLong(hwnd,GCL_HICON,(long) LoadIcon(thisinstance,"A")); SetClassLong(hwnd,GCL_HICONSM,(long) LoadIcon(thisinstance,"A")); { SendMessage(GetDlgItem(hwnd,IDC_ARCH),CB_ADDSTRING,0,(LPARAM)(LPCTSTR)Conf.Arch); std::ifstream AList; AList.open("Arch.txt",std::ios::in); if(AList.is_open()) { char Buffer[1001]; while(!AList.eof()) { AList.getline(Buffer,1000); if(Conf.Arch != Buffer) SendMessage(GetDlgItem(hwnd,IDC_ARCH),CB_ADDSTRING,0,(LPARAM)(LPCTSTR)Buffer); } AList.close(); } //SendMessage(GetDlgItem(hwnd,IDC_ARCH),CB_SETCURSEL,1,0); SendMessage(GetDlgItem(hwnd,IDC_ARCH),CB_SELECTSTRING,0,(LPARAM)(LPCTSTR)Conf.Arch); } return true; break; case WM_CLOSE: if(Sett.Close()) { DestroyWindow(hwnd); Sett.Settingwnd=NULL; } return 0; break; default: /* for messages that we don't deal with */ //return DefWindowProc (hwnd, message, wParam, lParam); return false; } return 0; } LRESULT CALLBACK AboutDialogProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message)/* handle the messages */ { case WM_INITDIALOG: SetClassLong(hwnd,GCL_HICON,(long) LoadIcon(thisinstance,"A")); SetClassLong(hwnd,GCL_HICONSM,(long) LoadIcon(thisinstance,"A")); //SetClassLong(hwnd,GCL_HBBACKGROUND,NULL); return true; break; case WM_CLOSE: DestroyWindow(hwnd); Aboutwnd=NULL; return 0; break; default: /* for messages that we don't deal with */ //return DefWindowProc (hwnd, message, wParam, lParam); return false; } return 0; }
[ "deathbob@b178b511-b3a6-47b4-93e2-b3608298d9af" ]
[ [ [ 1, 216 ] ] ]
8960caddc34a87a19637aa3ddd9f9648dc1a3213
e822fb29110ffae9e404e72ad244cd81d41b0335
/lib/Ogre/include/OgreTextAreaOverlayElement.h
9640c79aa62c92b8eef9d10eddc1552ff1b59293
[]
no_license
communityus-branch/LookingGlass-Viewer
4dda6d78973149d21e2bfc49296e77f1b7379f20
c80120e3e5cc8ed699280763c95ca8bb8db8174b
refs/heads/master
2020-06-02T17:50:41.255708
2011-07-28T05:37:50
2011-07-28T05:37:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,231
h
/*------------------------------------------------------------------------- This source file is a part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2009 Torus Knot Software Ltd 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 _TextAreaOverlayElement_H__ #define _TextAreaOverlayElement_H__ #include "OgreOverlayElement.h" #include "OgreFont.h" namespace Ogre { /** \addtogroup Core * @{ */ /** \addtogroup Overlays * @{ */ /** This class implements an overlay element which contains simple unformatted text. */ class _OgreExport TextAreaOverlayElement : public OverlayElement { public: enum Alignment { Left, Right, Center }; public: /** Constructor. */ TextAreaOverlayElement(const String& name); virtual ~TextAreaOverlayElement(); virtual void initialise(void); virtual void setCaption(const DisplayString& text); void setCharHeight( Real height ); Real getCharHeight() const; void setSpaceWidth( Real width ); Real getSpaceWidth() const; void setFontName( const String& font ); const String& getFontName() const; /** See OverlayElement. */ virtual const String& getTypeName(void) const; /** See Renderable. */ void getRenderOperation(RenderOperation& op); /** Overridden from OverlayElement */ void setMaterialName(const String& matName); /** Sets the colour of the text. @remarks This method establishes a constant colour for the entire text. Also see setColourBottom and setColourTop which allow you to set a colour gradient. */ void setColour(const ColourValue& col); /** Gets the colour of the text. */ const ColourValue& getColour(void) const; /** Sets the colour of the bottom of the letters. @remarks By setting a separate top and bottom colour, you can create a text area which has a graduated colour effect to it. */ void setColourBottom(const ColourValue& col); /** Gets the colour of the bottom of the letters. */ const ColourValue& getColourBottom(void) const; /** Sets the colour of the top of the letters. @remarks By setting a separate top and bottom colour, you can create a text area which has a graduated colour effect to it. */ void setColourTop(const ColourValue& col); /** Gets the colour of the top of the letters. */ const ColourValue& getColourTop(void) const; inline void setAlignment( Alignment a ) { mAlignment = a; mGeomPositionsOutOfDate = true; } inline Alignment getAlignment() const { return mAlignment; } /** Overridden from OverlayElement */ void setMetricsMode(GuiMetricsMode gmm); /** Overridden from OverlayElement */ void _update(void); //----------------------------------------------------------------------------------------- /** Command object for setting the caption. @see ParamCommand */ class _OgrePrivate CmdCaption : public ParamCommand { public: String doGet( const void* target ) const; void doSet( void* target, const String& val ); }; //----------------------------------------------------------------------------------------- /** Command object for setting the char height. @see ParamCommand */ class _OgrePrivate CmdCharHeight : public ParamCommand { public: String doGet( const void* target ) const; void doSet( void* target, const String& val ); }; //----------------------------------------------------------------------------------------- /** Command object for setting the width of a space. @see ParamCommand */ class _OgrePrivate CmdSpaceWidth : public ParamCommand { public: String doGet( const void* target ) const; void doSet( void* target, const String& val ); }; //----------------------------------------------------------------------------------------- /** Command object for setting the caption. @see ParamCommand */ class _OgrePrivate CmdFontName : public ParamCommand { public: String doGet( const void* target ) const; void doSet( void* target, const String& val ); }; //----------------------------------------------------------------------------------------- /** Command object for setting the top colour. @see ParamCommand */ class _OgrePrivate CmdColourTop : public ParamCommand { public: String doGet( const void* target ) const; void doSet( void* target, const String& val ); }; //----------------------------------------------------------------------------------------- /** Command object for setting the bottom colour. @see ParamCommand */ class _OgrePrivate CmdColourBottom : public ParamCommand { public: String doGet( const void* target ) const; void doSet( void* target, const String& val ); }; //----------------------------------------------------------------------------------------- /** Command object for setting the constant colour. @see ParamCommand */ class _OgrePrivate CmdColour : public ParamCommand { public: String doGet( const void* target ) const; void doSet( void* target, const String& val ); }; //----------------------------------------------------------------------------------------- /** Command object for setting the alignment. @see ParamCommand */ class _OgrePrivate CmdAlignment : public ParamCommand { public: String doGet( const void* target ) const; void doSet( void* target, const String& val ); }; protected: /// The text alignment Alignment mAlignment; /// Flag indicating if this panel should be visual or just group things bool mTransparent; /// Render operation RenderOperation mRenderOp; /// Method for setting up base parameters for this class void addBaseParameters(void); static String msTypeName; // Command objects static CmdCharHeight msCmdCharHeight; static CmdSpaceWidth msCmdSpaceWidth; static CmdFontName msCmdFontName; static CmdColour msCmdColour; static CmdColourTop msCmdColourTop; static CmdColourBottom msCmdColourBottom; static CmdAlignment msCmdAlignment; FontPtr mpFont; Real mCharHeight; ushort mPixelCharHeight; Real mSpaceWidth; ushort mPixelSpaceWidth; size_t mAllocSize; Real mViewportAspectCoef; /// Colours to use for the vertices ColourValue mColourBottom; ColourValue mColourTop; bool mColoursChanged; /// Internal method to allocate memory, only reallocates when necessary void checkMemoryAllocation( size_t numChars ); /// Inherited function virtual void updatePositionGeometry(); /// Inherited function virtual void updateTextureGeometry(); /// Updates vertex colours virtual void updateColours(void); }; /** @} */ /** @} */ } #endif
[ "Robert@LAKEOZ.(none)" ]
[ [ [ 1, 256 ] ] ]
94fffdb1136d9cce0f11eed7a5ce0d01fab0f33a
30bc461850851f22221127b065e9a4a2b18586c7
/src/algo/VNS.cpp
ee74b7eb1f384c5cd70bdc17e6dbf900f83090e9
[]
no_license
falcong/portfolio-opti
dfc5ee710747cfc6c586ffc9cfb6822ecf387c7d
0f4f311dd55ef9ace8576aa88ed868931910c36b
refs/heads/master
2021-01-15T18:01:00.619429
2008-03-23T11:32:20
2008-03-23T11:32:20
39,621,097
0
0
null
null
null
null
UTF-8
C++
false
false
1,069
cpp
#include "VNS.h" VNS::VNS() { iterationLimit = 0; } VNS::VNS(int _iterationLimit) { iterationLimit = _iterationLimit; } VNS::~VNS() { } Solution VNS::solve(DetQuadProblem& pb, Solver& s) const { int itLim = iterationLimit; if (itLim == 0) { itLim = pb.getK()/2; } LinearProblem lp = pb.getSimpleLinearProblem(); int i = 2; Solution sol = s.getAdmissibleSolution(&lp); if (sol.isNull()) { return sol; } Solution xPrim, xSecond; float min = pb.objectiveFunction(sol); #ifdef DEBUG std::cout << "Risk = " << min << " : "<< sol.toString() << std::endl; #endif while (i < itLim) { xPrim = lp.getNeighbour(sol, i); lp = pb.getFixedLP(xPrim); xPrim = s.getBestSolution(&lp); if (xPrim.isNull()) { ++i; } else { float risk = pb.objectiveFunction(xPrim); if (risk < min) { sol = xPrim; min = risk; i=2; #ifdef DEBUG std::cout << "Risk = " << min << " : "<< sol.toString() << std::endl; #endif } else { ++i; } } } sol.setZ(min); return sol; }
[ "antoinelangevin@81f11f40-563e-0410-b35f-45f700be9b36", "fortinmat@81f11f40-563e-0410-b35f-45f700be9b36", "pierre.ruyssen@81f11f40-563e-0410-b35f-45f700be9b36" ]
[ [ [ 1, 2 ], [ 4, 6 ], [ 8, 10 ], [ 13, 14 ], [ 20, 21 ], [ 28, 29 ], [ 42, 42 ], [ 54, 55 ], [ 57, 58 ] ], [ [ 3, 3 ], [ 7, 7 ], [ 11, 12 ], [ 15, 19 ], [ 22, 27 ], [ 30, 41 ], [ 43, 53 ] ], [ [ 56, 56 ] ] ]
c2a5b19d1a9fae6aaad1aa1b6d2000ec128d3b3d
1193b8d2ab6bb40ce2adbf9ada5b3d1124f1abb3
/branches/basicelements/libsonetto/include/SonettoWindowSkin.h
6614ed7ecf11a995c3dbce2c643c36d90b45f7e0
[]
no_license
sonetto/legacy
46bb60ef8641af618d22c08ea198195fd597240b
e94a91950c309fc03f9f52e6bc3293007c3a0bd1
refs/heads/master
2021-01-01T16:45:02.531831
2009-09-10T21:50:42
2009-09-10T21:50:42
32,183,635
0
2
null
null
null
null
UTF-8
C++
false
false
6,542
h
/*----------------------------------------------------------------------------- Copyright (c) 2009, Sonetto Project Developers 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 Sonetto Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -----------------------------------------------------------------------------*/ #ifndef SONETTO_WINDOWSKIN_H #define SONETTO_WINDOWSKIN_H #include <OgreResource.h> #include "SonettoPrerequisites.h" namespace Sonetto { struct TileCoord { float topLeftX; float topLeftY; float topRightX; float topRightY; float bottomLeftX; float bottomLeftY; float bottomRightX; float bottomRightY; }; struct WindowGeneral { // Cursor // 0x01: Use cursor horizontal animation // 0x02: Use cursor vertical animation // 0x04: Invert horizontal animation // 0x08: Invert hertical animation // 0x10: Use cursor trail (ToDo) uint32 cursorFlags; uint32 cursorMatId; TileCoord cursorCoords; float cursorColorR; float cursorColorG; float cursorColorB; float cursorColorA; float cursorAnimationSpeedX; float cursorAnimationSpeedY; float cursorAnimationAmplitudeX; float cursorAnimationAmplitudeY; uint32 cursorTrailNumIterations; uint32 cursorTrailMaterial; float cursorTrailSpeed; }; struct WindowStyle { uint32 flags0; // 0x1: Have Border uint32 flags1; // Reserved uint32 materialID; // Material used in this Window Style uint32 texCoordSettings; //FFFF - 0: Do not use, 1: Use Coords, 2: Use Stretch, 3: Use Tile //|||+-- TexCoord0 //||+--- TexCoord1 //|+---- TexCoord2 //+----- TexCoord3 float texCoordTileX0; float texCoordTileY0; float texCoordTileX1; float texCoordTileY1; float texCoordTileX2; float texCoordTileY2; float texCoordTileX3; float texCoordTileY3; TileCoord tileTopLeft; TileCoord tileTopCenter; TileCoord tileTopRight; TileCoord tileMiddleLeft; TileCoord tileMiddleCenter; TileCoord tileMiddleRight; TileCoord tileBottomLeft; TileCoord tileBottomCenter; TileCoord tileBottomRight; // Tailed Window Coords TileCoord tileTailTop; TileCoord tileTailBottom; // Alternative Corner Coords TileCoord tileTopLeftB; TileCoord tileTopRightB; TileCoord tileBottomLeftB; TileCoord tileBottomRightB; // Slim Windows Tex Coords TileCoord tileSlimLeft; TileCoord tileSlimCenter; TileCoord tileSlimRight; }; class SONETTO_API WindowSkin : public Ogre::Resource { protected: /// Load Implementation. void loadImpl(); /// Unload Implementation. void unloadImpl(); /// Calculates file size. size_t calculateSize() const; public: WindowSkin( Ogre::ResourceManager *creator, const Ogre::String &name, Ogre::ResourceHandle handle, const Ogre::String &group, bool isManual = false, Ogre::ManualResourceLoader *loader = 0); virtual ~WindowSkin(); static uint32 mFourCC; std::vector<WindowStyle> mTexCoordSet; std::vector<Ogre::MaterialPtr> mMaterial; std::vector<Ogre::Image *> mImage; }; class SONETTO_API WindowSkinPtr : public Ogre::SharedPtr<WindowSkin> { public: WindowSkinPtr() : Ogre::SharedPtr<WindowSkin>() {} explicit WindowSkinPtr(WindowSkin *rep) : Ogre::SharedPtr<WindowSkin>(rep) {} WindowSkinPtr(const WindowSkinPtr &r) : Ogre::SharedPtr<WindowSkin>(r) {} WindowSkinPtr(const Ogre::ResourcePtr &r) : Ogre::SharedPtr<WindowSkin>() { // lock & copy other mutex pointer OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME) OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME) pRep = static_cast<WindowSkin*>(r.getPointer()); pUseCount = r.useCountPointer(); if (pUseCount) { ++(*pUseCount); } } /// Operator used to convert a ResourcePtr to a WindowSkinPtr WindowSkinPtr& operator=(const Ogre::ResourcePtr& r) { if (pRep == static_cast<WindowSkin*>(r.getPointer())) return *this; release(); // lock & copy other mutex pointer OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME) OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME) pRep = static_cast<WindowSkin*>(r.getPointer()); pUseCount = r.useCountPointer(); if (pUseCount) { ++(*pUseCount); } return *this; } }; } #endif // SONETTO_WINDOWSKIN_H
[ [ [ 1, 187 ] ] ]
b99016522b6ed9e67217b9861c07d51c4eb433d6
1fab2f171271db026d5a12d9f9e08b5dc2021ce7
/pqueue/pqueue/CompleteTreeIndex.h
55c73b314ed11a135627e475086510300068b24b
[]
no_license
softwaredoug/CxxHeap
e35ee853120ee9313cac2da6fd1192fdb487501b
a7bce829d4a9311f190a50f980124d3fafe1314b
refs/heads/master
2021-01-22T13:51:39.362810
2011-02-21T02:14:30
2011-02-21T02:14:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,338
h
//******************************************************************** // FILE NAME: CompleteTreeIndex.h // // DESCRIPTION: Contains declaration for complete tree index class // which represents an index into a complete tree //********************************************************************* #ifndef COMPLETE_TREE_INDEX_20100811_H #define COMPLETE_TREE_INDEX_20100811_H #include <boost/cstdint.hpp> namespace pqueue { //! Responsible for representing an index in an array-based complete tree //! -- it will go on forever, the user must decide if the index has wandered off //! -- the tree class CCompleteTreeIndex { public: //! Construct a complete tree ind CCompleteTreeIndex(const boost::uint32_t& arrayIndex); ~CCompleteTreeIndex(); //! Return the index into the complete tree's array boost::uint32_t GetCurrentLocationInArray() const; //! Change this index to be the index where it's left child would be void MoveToLeft(); //! Change this index to be the index where it's right child would be void MoveToRight(); //! Change this index to be the index where it's parent would be void MoveToParent(); private: boost::uint32_t m_oneBasedIndex; //! The index in the complete tree's ( internally stored as a 1-based index) }; } #endif
[ [ [ 1, 43 ] ] ]
97dc383a8a5e8cebab0342577bbc10f75993553c
5fb9b06a4bf002fc851502717a020362b7d9d042
/developertools/GrannyViewer/Gfx.h
f6cf5f3567e69a12ef83909c29b4acc607a51534
[]
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
429
h
#pragma once int GfxAtoX(CString strNum); CString GfxXtoA(int iNum); CString GfxGetFullPath(CString strPath); CString GfxSprintf(LPCTSTR lpszFormat, ...); void GfxLog(LPCTSTR lpszFormat, ...); class CGrannyViewerDoc; CGrannyViewerDoc* GfxGetDocument(); const UINT INVALID_GRN_ID = 0xFFFFFFFF; #include <algorithm> #include <string> std::string getFileName(const std::string& path_name, char split='/');
[ "harkon@a725d9c3-d2eb-0310-b856-fa980ef11a19" ]
[ [ [ 1, 19 ] ] ]
b4393478e76c9fc84af8b95c207703d4bf668120
e95784c83b6cec527f3292d2af4f2ee9b257a0b7
/GV/Drivers/ILaunchSystem.h
c161ab5ad09fe348bd56c4524e79cdd85803f291
[]
no_license
ehaskins/scoe-robotics-onboard-controller
5e6818cb469c512a4429aa6ccb96478b89c9ce6f
f44887f79cf89c9ff85963e515381199c9b2b2d7
refs/heads/master
2020-06-06T12:53:54.350781
2011-05-01T00:26:17
2011-05-01T00:26:17
32,115,864
0
0
null
null
null
null
UTF-8
C++
false
false
936
h
/* * ILaunchSystem.h * * Created on: Apr 21, 2011 * Author: Nick */ #ifndef ILAUNCHSYSTEM_H_ #define ILAUNCHSYSTEM_H_ #include "IDevice.h" #include "IDigitalInput.h" #include "IMotor.h" class ILaunchSystem : public IDevice { public: // Initialization. virtual void init(IDigitalInput* loadSwitch, IDigitalInput* intakeSwitch, IMotor* launcher, IMotor* intake) = 0; // Components of the system. virtual IDigitalInput* getLoadSwitch() const = 0; virtual IDigitalInput* getIntakeSwitch() const = 0; virtual IMotor* getLauncher() const = 0; virtual IMotor* getIntake() const = 0; // Idle mode settings. virtual void setIdleSpeeds(int launchSpeed, int intakeSpeed) = 0; // Discrete controls. virtual bool isLoaded() = 0; virtual bool isIntakePrimed() = 0; virtual void driveIntake(int speed) = 0; virtual void driveLauncher(int speed) = 0; }; #endif /* ILAUNCHSYSTEM_H_ */
[ [ [ 1, 36 ] ] ]
e509cfb2b80131ea99ef82f0804b4930a9ed72d3
65f587a75567b51375bde5793b4ec44e4b79bc7d
/sklepSeqStep.h
5f95c1e6204ea700e7a1914a5936d0ac0915efcb
[]
no_license
discordance/sklepseq
ce4082074afbdb7e4f7185f042ce9e34d42087ef
8d4fa5a2710ba947e51f5572238eececba4fef74
refs/heads/master
2021-01-13T00:15:23.218795
2008-07-20T20:48:44
2008-07-20T20:48:44
49,079,555
0
0
null
null
null
null
UTF-8
C++
false
false
5,313
h
// sklepSeqStep.h: interface for the sklepSeqStep class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_SKLEPSEQSTEP_H__A7AE8B73_28EE_43D5_989D_AF567303C440__INCLUDED_) #define AFX_SKLEPSEQSTEP_H__A7AE8B73_28EE_43D5_989D_AF567303C440__INCLUDED_ #include <juce.h> class sklepSeqMainComponent; class sklepSeqStep : public ImageButton, public MidiKeyboardState { public: sklepSeqStep(int _index, int x, int y); ~sklepSeqStep(); int getX(); int getY(); void clicked (const ModifierKeys &modifiers); int getIndex(); bool getPopup(); bool getQuickPopup(); void setOff(); void setOn(); private: int posX, posY; Image *image; Image *imageOver; Image *imageOn; int midiChannel; int index; bool popup; bool quickPop; const char* ion[16]; int ions[16]; const char* iover[16]; int iovers[16]; const char* ioff[16]; int ioffs[16]; static const char* sq_step_on_1_png; static const int sq_step_on_1_pngSize; static const char* sq_step_on_2_png; static const int sq_step_on_2_pngSize; static const char* sq_step_on_3_png; static const int sq_step_on_3_pngSize; static const char* sq_step_on_4_png; static const int sq_step_on_4_pngSize; static const char* sq_step_on_5_png; static const int sq_step_on_5_pngSize; static const char* sq_step_on_6_png; static const int sq_step_on_6_pngSize; static const char* sq_step_on_7_png; static const int sq_step_on_7_pngSize; static const char* sq_step_on_8_png; static const int sq_step_on_8_pngSize; static const char* sq_step_on_9_png; static const int sq_step_on_9_pngSize; static const char* sq_step_on_10_png; static const int sq_step_on_10_pngSize; static const char* sq_step_on_11_png; static const int sq_step_on_11_pngSize; static const char* sq_step_on_12_png; static const int sq_step_on_12_pngSize; static const char* sq_step_on_13_png; static const int sq_step_on_13_pngSize; static const char* sq_step_on_14_png; static const int sq_step_on_14_pngSize; static const char* sq_step_on_15_png; static const int sq_step_on_15_pngSize; static const char* sq_step_on_16_png; static const int sq_step_on_16_pngSize; static const char* sq_step_off_1_png; static const int sq_step_off_1_pngSize; static const char* sq_step_off_2_png; static const int sq_step_off_2_pngSize; static const char* sq_step_off_3_png; static const int sq_step_off_3_pngSize; static const char* sq_step_off_4_png; static const int sq_step_off_4_pngSize; static const char* sq_step_off_5_png; static const int sq_step_off_5_pngSize; static const char* sq_step_off_6_png; static const int sq_step_off_6_pngSize; static const char* sq_step_off_7_png; static const int sq_step_off_7_pngSize; static const char* sq_step_off_8_png; static const int sq_step_off_8_pngSize; static const char* sq_step_off_9_png; static const int sq_step_off_9_pngSize; static const char* sq_step_off_10_png; static const int sq_step_off_10_pngSize; static const char* sq_step_off_11_png; static const int sq_step_off_11_pngSize; static const char* sq_step_off_12_png; static const int sq_step_off_12_pngSize; static const char* sq_step_off_13_png; static const int sq_step_off_13_pngSize; static const char* sq_step_off_14_png; static const int sq_step_off_14_pngSize; static const char* sq_step_off_15_png; static const int sq_step_off_15_pngSize; static const char* sq_step_off_16_png; static const int sq_step_off_16_pngSize; static const char* sq_step_over_1_png; static const int sq_step_over_1_pngSize; static const char* sq_step_over_2_png; static const int sq_step_over_2_pngSize; static const char* sq_step_over_3_png; static const int sq_step_over_3_pngSize; static const char* sq_step_over_4_png; static const int sq_step_over_4_pngSize; static const char* sq_step_over_5_png; static const int sq_step_over_5_pngSize; static const char* sq_step_over_6_png; static const int sq_step_over_6_pngSize; static const char* sq_step_over_7_png; static const int sq_step_over_7_pngSize; static const char* sq_step_over_8_png; static const int sq_step_over_8_pngSize; static const char* sq_step_over_9_png; static const int sq_step_over_9_pngSize; static const char* sq_step_over_10_png; static const int sq_step_over_10_pngSize; static const char* sq_step_over_11_png; static const int sq_step_over_11_pngSize; static const char* sq_step_over_12_png; static const int sq_step_over_12_pngSize; static const char* sq_step_over_13_png; static const int sq_step_over_13_pngSize; static const char* sq_step_over_14_png; static const int sq_step_over_14_pngSize; static const char* sq_step_over_15_png; static const int sq_step_over_15_pngSize; static const char* sq_step_over_16_png; static const int sq_step_over_16_pngSize; }; #endif // !defined(AFX_SKLEPSEQSTEP_H__A7AE8B73_28EE_43D5_989D_AF567303C440__INCLUDED_)
[ "kubiak.roman@0c9c7eae-764f-0410-aff0-6774c5161e44" ]
[ [ [ 1, 141 ] ] ]
02dacbbbb531e939420faf4be976775281ba035b
a2904986c09bd07e8c89359632e849534970c1be
/topcoder/completed/RecursiveFigures.cpp
42d35a06c46e1147085af2f086aa9bef5cd70196
[]
no_license
naturalself/topcoder_srms
20bf84ac1fd959e9fbbf8b82a93113c858bf6134
7b42d11ac2cc1fe5933c5bc5bc97ee61b6ec55e5
refs/heads/master
2021-01-22T04:36:40.592620
2010-11-29T17:30:40
2010-11-29T17:30:40
444,669
1
0
null
null
null
null
UTF-8
C++
false
false
1,772
cpp
// BEGIN CUT HERE // END CUT HERE #line 5 "RecursiveFigures.cpp" #include <iostream> #include <string> #include <vector> #include <sstream> #include <math.h> using namespace std; class RecursiveFigures { public: double getArea(int sideLength, int K) { double half = sideLength/2.0; double sum_area = half*half*M_PI; for(int i=1;i<K;i++){ half /= sqrt(2); sum_area = sum_area - pow(half*2,2) + (half*half*M_PI); } return sum_area; } // BEGIN CUT HERE public: void run_test(int Case) { if ((Case == -1) || (Case == 0)) test_case_0(); if ((Case == -1) || (Case == 1)) test_case_1(); if ((Case == -1) || (Case == 2)) test_case_2(); } private: template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); } void verify_case(int Case, const double &Expected, const double &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: \"" << Expected << '\"' << endl; cerr << "\tReceived: \"" << Received << '\"' << endl; } } void test_case_0() { int Arg0 = 10; int Arg1 = 1; double Arg2 = 78.53981633974483; verify_case(0, Arg2, getArea(Arg0, Arg1)); } void test_case_1() { int Arg0 = 10; int Arg1 = 2; double Arg2 = 67.80972450961724; verify_case(1, Arg2, getArea(Arg0, Arg1)); } void test_case_2() { int Arg0 = 10; int Arg1 = 3; double Arg2 = 62.444678594553444; verify_case(2, Arg2, getArea(Arg0, Arg1)); } // END CUT HERE }; // BEGIN CUT HERE int main() { RecursiveFigures ___test; ___test.run_test(-1); } // END CUT HERE
[ "shin@CF-7AUJ41TT52JO.(none)" ]
[ [ [ 1, 48 ] ] ]
ac08a12c32621f38b6e4575555c97db28c24492c
9c62af23e0a1faea5aaa8dd328ba1d82688823a5
/rl/tags/techdemo2/engine/rules/src/DsaDataLoader.cpp
374917afd7daea79d1b07819b320d782b839da6c
[ "ClArtistic", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
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
ISO-8859-3
C++
false
false
11,635
cpp
/* 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. */ #include <xercesc/framework/LocalFileInputSource.hpp> #include <xercesc/dom/DOM.hpp> #include <xercesc/util/XMLString.hpp> #include <xercesc/util/PlatformUtils.hpp> #include "DsaDataLoader.h" #include "XmlHelper.h" #include "XmlResourceManager.h" #include "DsaManager.h" #include "Talent.h" #include "Person.h" #include "Kampftechnik.h" #include "RulesSubsystem.h" #include "Exception.h" using namespace XERCES_CPP_NAMESPACE; using namespace std; namespace rl { using XERCES_CPP_NAMESPACE::DOMDocument; //XXX: Warum brauche ich das unter VS 2003? void DsaDataLoader::loadData(string filename) { XMLPlatformUtils::Initialize(); XmlHelper::initializeTranscoder(); XercesDOMParser* parser = new XercesDOMParser(); parser->setValidationScheme(XercesDOMParser::Val_Always); // optional. parser->setDoNamespaces(true); // optional XmlPtr res = XmlResourceManager::getSingleton().create(filename, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); res->parseBy(parser); DOMDocument* doc = parser->getDocument(); DOMElement* dataDocumentContent = XmlHelper::getChildNamed( doc->getDocumentElement(), "Inhalt"); initializeTalente(XmlHelper::getChildNamed(dataDocumentContent, "Talente")); initializeKampftechniken(XmlHelper::getChildNamed(dataDocumentContent, "Kampftechniken")); initializePersonen(XmlHelper::getChildNamed(dataDocumentContent, "Personen")); doc->release(); res.setNull(); XmlResourceManager::getSingleton().remove(filename); XMLPlatformUtils::Terminate(); } void DsaDataLoader::initializeTalente(DOMElement* rootTalente) { if (rootTalente == NULL) return; DOMNodeList* talentGruppen = rootTalente->getElementsByTagName(AutoXMLCh("Talentgruppe").data()); for (unsigned int gruppe = 0; gruppe < talentGruppen->getLength(); gruppe++) { DOMElement* gruppeData = reinterpret_cast<DOMElement*>(talentGruppen->item(gruppe)); DOMNodeList* talenteXml = gruppeData->getElementsByTagName(AutoXMLCh("Talent").data()); int numTalent = 0; for (unsigned int talentIdx = 0; talentIdx < talenteXml->getLength(); talentIdx++) { Talent* t = processTalent(gruppe, reinterpret_cast<DOMElement*>(talenteXml->item(talentIdx))); numTalent++; DsaManager::getSingleton()._addTalent(t); } } } Talent* DsaDataLoader::processTalent(int gruppe, DOMElement* talentXml) { CeGuiString desc = XmlHelper::getValueAsString(XmlHelper::getChildNamed(talentXml, "Beschreibung")); CeGuiString probe = XmlHelper::getValueAsString(XmlHelper::getChildNamed(talentXml, "Probe")); CeGuiString art = XmlHelper::getValueAsString(XmlHelper::getChildNamed(talentXml, "Art")); DOMElement* eBeNode = XmlHelper::getChildNamed(talentXml, "eBE"); int ebe = EBE_KEINE_BE; if (eBeNode != NULL) ebe = getEBeFromString(AutoChar(eBeNode->getFirstChild()->getNodeValue()).data()); CeGuiString name = XmlHelper::transcodeToString( talentXml->getAttribute(AutoXMLCh("ID").data())); EigenschaftTripel eigenschaften; eigenschaften.first = probe.substr(0,2); eigenschaften.second = probe.substr(3,2); eigenschaften.third = probe.substr(6,2); probe.clear(); Talent* t = new Talent( name, desc, eigenschaften, ebe, gruppe, art); return t; } int DsaDataLoader::getEBeFromString(const string& eBeString) { if (eBeString.length() == 0) return EBE_KEINE_BE; if (!(eBeString.substr(0, 2).compare("BE")) == 0) Throw(IllegalArgumentException, "Ungueltige EBE-Angabe."); string ebe = eBeString.substr(2); if (ebe.compare("x2") == 0) return EBE_BEx2; if (ebe.compare("") == 0) return 0; return atoi(ebe.c_str()); } void DsaDataLoader::initializeKampftechniken(DOMElement* rootKampftechniken) { if (rootKampftechniken == NULL) return; DOMNodeList* kampfarten = rootKampftechniken->getElementsByTagName(AutoXMLCh("Kampfart").data()); for (unsigned int art = 0; art < kampfarten->getLength(); art++) { DOMElement* artData = reinterpret_cast<DOMElement*>(kampfarten->item(art)); DOMNodeList* kampftechnikenXml = artData->getElementsByTagName(AutoXMLCh("Kampftechnik").data()); int numKampftechnik = 0; for (unsigned int kampftechnikIdx = 0; kampftechnikIdx < kampftechnikenXml->getLength(); kampftechnikIdx++) { Kampftechnik* k = processKampftechnik(reinterpret_cast<DOMElement*>(kampftechnikenXml->item(kampftechnikIdx))); numKampftechnik++; DsaManager::getSingleton()._addKampftechnik(k); } } } Kampftechnik* DsaDataLoader::processKampftechnik(DOMElement* kampftechnikXml) { CeGuiString desc = XmlHelper::getValueAsString(XmlHelper::getChildNamed(kampftechnikXml, "Beschreibung")); CeGuiString art = XmlHelper::getValueAsString(XmlHelper::getChildNamed(kampftechnikXml, "Art")); DOMElement* eBeNode = XmlHelper::getChildNamed(kampftechnikXml, "eBE"); int ebe = EBE_KEINE_BE; if (eBeNode != NULL) ebe = getEBeFromString(AutoChar(eBeNode->getFirstChild()->getNodeValue()).data()); CeGuiString name = XmlHelper::transcodeToString( kampftechnikXml->getAttribute(AutoXMLCh("ID").data())); Kampftechnik* k = new Kampftechnik( name, desc, ebe); return k; } void DsaDataLoader::initializePersonen(DOMElement* rootPersons) { if (rootPersons == NULL) return; DOMNodeList* personenXml = rootPersons->getElementsByTagName(AutoXMLCh("Person").data()); for (unsigned int idx = 0; idx < personenXml->getLength(); idx++) { Person* p = processPerson( reinterpret_cast<DOMElement*>(personenXml->item(idx))); DsaManager::getSingleton()._addPerson(p); } } Person* DsaDataLoader::processPerson(DOMElement* personXml) { AutoXMLCh TALENT = "Talent"; AutoXMLCh ID = "ID"; AutoXMLCh ABGELEITETER_WERT = "AbgeleiteterWert"; AutoXMLCh EIGENSCHAFT = "Eigenschaft"; CeGuiString name = XmlHelper::getValueAsString(XmlHelper::getChildNamed(personXml, "Name")); CeGuiString desc = XmlHelper::getValueAsString(XmlHelper::getChildNamed(personXml, "Beschreibung")); Person* rval = new Person(name, desc); // Eigenschaften laden DOMNodeList* eigensch = XmlHelper::getChildNamed(personXml, "Eigenschaften")-> getElementsByTagName(EIGENSCHAFT.data()); // Die Eigenschaftsnamen müssen durch ihre Abkürzung ersetzt werden. for (unsigned int idx = 0; idx < eigensch->getLength(); idx++) { DOMElement* eigenschXml = reinterpret_cast<DOMElement*>(eigensch->item(idx)); CeGuiString eigName = XmlHelper::transcodeToString(eigenschXml->getAttribute(ID.data())); if (eigName == DsaManager::getSingleton().getEigenschaft(E_MUT)->getName()) eigName = DsaManager::getSingleton().getEigenschaft(E_MUT)->getNameAbbreviation(); if (eigName == DsaManager::getSingleton().getEigenschaft(E_KLUGHEIT)->getName()) eigName = DsaManager::getSingleton().getEigenschaft(E_KLUGHEIT)->getNameAbbreviation(); if (eigName == DsaManager::getSingleton().getEigenschaft(E_INTUITION)->getName()) eigName = DsaManager::getSingleton().getEigenschaft(E_INTUITION)->getNameAbbreviation(); if (eigName == DsaManager::getSingleton().getEigenschaft(E_CHARISMA)->getName()) eigName = DsaManager::getSingleton().getEigenschaft(E_CHARISMA)->getNameAbbreviation(); if (eigName == DsaManager::getSingleton().getEigenschaft(E_FINGERFERTIGKEIT)->getName()) eigName = DsaManager::getSingleton().getEigenschaft(E_FINGERFERTIGKEIT)->getNameAbbreviation(); if (eigName == DsaManager::getSingleton().getEigenschaft(E_GEWANDTHEIT)->getName()) eigName = DsaManager::getSingleton().getEigenschaft(E_GEWANDTHEIT)->getNameAbbreviation(); if (eigName == DsaManager::getSingleton().getEigenschaft(E_KONSTITUTION)->getName()) eigName = DsaManager::getSingleton().getEigenschaft(E_KONSTITUTION)->getNameAbbreviation(); if (eigName == DsaManager::getSingleton().getEigenschaft(E_KOERPERKRAFT)->getName()) eigName = DsaManager::getSingleton().getEigenschaft(E_KOERPERKRAFT)->getNameAbbreviation(); int wert = XmlHelper::getValueAsInteger(XmlHelper::getChildNamed(eigenschXml, "Wert")); rval->setEigenschaft(eigName, wert); } // Abgeleitete Werte laden DOMNodeList* werte = XmlHelper::getChildNamed(personXml, "AbgeleiteteWerte")-> getElementsByTagName(ABGELEITETER_WERT.data()); for (unsigned int idx = 0; idx < werte->getLength(); idx++) { DOMElement* wertXml = reinterpret_cast<DOMElement*>(werte->item(idx)); int basis = XmlHelper::getValueAsInteger(XmlHelper::getChildNamed(wertXml, "Basiswert")); int wert = XmlHelper::getValueAsInteger(XmlHelper::getChildNamed(wertXml, "Wert")); AutoChar wertId = wertXml->getAttribute(ID.data()); if (strcmp(wertId.data(), "Lebensenergie") == 0) rval->setWert(WERT_MOD_LE, wert - basis); else if (strcmp(wertId.data(), "Ausdauer") == 0) rval->setWert(WERT_MOD_AU, wert - basis); else if (strcmp(wertId.data(), "AttackeBasis") == 0) rval->setWert(WERT_MOD_AT, wert - basis); else if (strcmp(wertId.data(), "ParadeBasis") == 0) rval->setWert(WERT_MOD_PA, wert - basis); else if (strcmp(wertId.data(), "FernkampfBasis") == 0) rval->setWert(WERT_MOD_FK, wert - basis); else if (strcmp(wertId.data(), "InitiativeBasis") == 0) rval->setWert(WERT_MOD_INI, wert - basis); else if (strcmp(wertId.data(), "Magieresistenz") == 0) rval->setWert(WERT_MOD_MR, wert - basis); else if (strcmp(wertId.data(), "Astralenergie") == 0) rval->setWert(WERT_MOD_AE, wert - basis); else if (strcmp(wertId.data(), "Sozialstatus") == 0) rval->setWert(WERT_SOZIALSTATUS, wert); } // Talente laden // Talente, die direkt unter <Person> angeordnet sind, // ergeben bereits die zusammengefassten Werte DOMNodeList* talente = XmlHelper::getChildNamed(personXml, "Talente")-> getElementsByTagName(TALENT.data()); for (unsigned int idx = 0; idx < talente->getLength(); idx++) { DOMElement* talentXml = reinterpret_cast<DOMElement*>(talente->item(idx)); CeGuiString talentName = XmlHelper::transcodeToString( talentXml->getAttribute(ID.data())); Talent* tal = DsaManager::getSingleton().getTalent(talentName); rval->addTalent(talentName); rval->setTalent( talentName, XmlHelper::getValueAsInteger(XmlHelper::getChildNamed(talentXml, "Wert"))); } return rval; } }
[ "tanis@4c79e8ff-cfd4-0310-af45-a38c79f83013" ]
[ [ [ 1, 298 ] ] ]
cbecdf4b4598a56cca0e1322f09554b0743c2325
f87f0a2e6c60be6dd7d126dfd7342dfb18f37092
/Source/TWM/core/entity.hpp
d00ea53731fb52b5c8eef7944f7913bac52b524f
[ "MIT" ]
permissive
SamOatesUniversity/Year-2---Animation-Simulation---PigDust
aa2d9d3a6564abd5440b8e9fdc0e24f65a44d75c
2948d39d5e24137b25c91878eaeebe3c8e9e00d1
refs/heads/master
2021-01-10T20:10:29.003591
2011-04-29T20:45:19
2011-04-29T20:45:19
41,170,833
0
0
null
null
null
null
UTF-8
C++
false
false
2,114
hpp
/* Copyright (c) 2010 Tyrone Davison, Teesside University 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. */ #pragma once #ifndef __TWM_CORE_ENTITY__ #define __TWM_CORE_ENTITY__ #include "types.hpp" #include "component.hpp" namespace twm { class WorldDatabase; class Entity { public: Entity() : _db(0), _id(kNullEntity) {} Entity( WorldDatabase* db, EntityId id ) : _db(db), _id(id) {} public: bool Exists() const; bool HasType( ComponentType ) const; bool IsValid() const { return _db != 0 && _id != kNullEntity; } EntityId GetId() const { return _id; } CacheId GetCacheId() const; void Destroy(); void SetParent( Entity ); Entity CreateChild(); void SetTransformation( const Matrix& ); Matrix GetLocalTransformation() const; Matrix GetWorldTransformation() const; Component CreateComponent( ComponentType ); void AttachComponent( Component ); void DetachComponent( Component ); Component GetComponent( ComponentType ) const; private: WorldDatabase* _db; EntityId _id; }; } #endif
[ [ [ 1, 61 ] ] ]
0105c7ef64ce391df85054f5319b03b9d892db9f
84bfae4052b39215fd97ab9df5b0336ebd62acff
/sample/warOfWorlds/Server/app.cpp
e55bf73e027e880be9d1069c90eb7bac5362f2ed
[]
no_license
achew22/unccs480-snippets
0c0660bced647112582e3a0dc0d564e39f986083
15db17bba53497087a980f70f682cfe7a0564f28
refs/heads/master
2021-01-19T19:35:19.759604
2008-11-04T22:11:13
2008-11-04T22:11:13
32,130,941
0
0
null
null
null
null
UTF-8
C++
false
false
6,769
cpp
#include <SDL/SDL.h> #include <cmath> #include "app.h" #include "GUI.h" #include "GUIButton.h" #include "GUITextHandler.h" #include "point.h" #include "camera.h" #include "physicsManager.h" #include "textureManager.h" #include "ballServer.h" #ifndef PI #define PI 3.1415926 #endif //PI /** * Default constructor for test loader * creates model to draw and then sets up the camera and such */ App::App() { width = 640; height = 640; init(); BallServer* myBallServer = new BallServer; //Turn on lighting enableLighting(); //Enable light 0 (thats the default one in glLightingStruct()) enableLight(new glLightingStruct()); //Define a gui GUI* myGui = new GUI; myGui->addElement(new GUITextHandler( App::key )); addGUI("main", myGui); setActiveGUI("main"); //Create a texture from the file /* myMesh = new Mesh(); myMesh->loadObj("E:\\Documents\\School\\CS480\\unccs480-snippets\\sample\\objects\\car.obj"); //myMesh->loadObj("D:\\Documents\\School\\CS480\\unccs480-snippets\\sample\\objects\\proog.obj"); myMesh->loadTexture("E:\\Documents\\School\\CS480\\unccs480-snippets\\sample\\textures\\car.bmp"); */ //Path for camera myPath = new Path<Point3>(0, 15000); for (int i = 0; i < 50; i++) { myPath->addPoint(Point3(i*cos(i*2*PI/50.0),i*sin(i*2*PI/50.0),i)); } for (int i = 0; i < 10; i++) { myPath->addPoint(Point3(5,0,5*(1 - i/5.0))); } for (int i = 0; i < 50; i++) { myPath->addPoint(Point3(5*cos(i*2*PI/50.0),5*sin(i*2*PI/50.0),-5)); } for (int i = 0; i < 10; i++) { myPath->addPoint(Point3(5,0,5*(-1 + i/5.0))); } myPath->makeCyclic(); //New physics object Point3 color = addBall(0); printf("Color is %f, %f, %f\n", color.x, color.y, color.z); /* Ball* ball1 = new Ball; ball1->loadObj("G:\\Documents\\School\\CS480\\unccs480-snippets\\sample\\objects\\earth.obj"); //ball1->loadTexture("G:\\Documents\\School\\CS480\\unccs480-snippets\\sample\\textures\\car.bmp"); ball1->calculateCenter(); ball1->calculateRadius(); ball1->resize(1); ball1->setMass(1); ball1->moveCenterTo(Point3(10,0,11)); Path<Point3> force1(0,2000); force1.addPoint(Point3(-5,0,-5)); //force1.makeCyclic(); ball1->addForce(force1); //Path<Point3> force2(2000,4000); //force2.addPoint(Point3(0,0,50)); //ball1->addForce(force2); //ball1->addGravity(Point3(0,0,-1)); //ball1->setVelocity(Point3(0,-1,0)); myBalls.push_back(ball1); */ //Dont set the camera at 0, it will disapear //This is an error, I will look into it //Set the camera's positions //camera->followPath(*myPath); camera->setEyePosition(0,0,50); camera->setUpDirection(0,1,0); camera->setLookAtPosition(0,0,0); PhysicsManager::start(); PhysicsManager::getInstance()->setDamping(0.995); } /** * Display the information to the user */ void App::display() { glClearColor(1,1,1,0); for (std::map<int, Ball*>::iterator iter = balls.begin(); iter != balls.end(); iter++) { iter->second->draw(); } //Draw the current mesh glPushMatrix(); { glColor3f(1,1,1); //myMesh->drawMesh(); /* //Set the active texture glBindTexture(GL_TEXTURE_2D, texNum); glBegin(GL_QUADS); { glTexCoord2f(1,1); //glVertex3f(1,1,0); myPath->getPoint().doVertex(); glTexCoord2f(0,1); glVertex3f(-1,1,0); glTexCoord2f(0,0); glVertex3f(-1,-1,0); glTexCoord2f(1,0); glVertex3f(1,-1,0); } glEnd(); */ } glPopMatrix(); } /** * Overloaded idle function. Not strictly necessary, but fun to have anyways! */ void App::idle() { } Point3 App::addBall(int id) { if (balls.find(id) != balls.end()) { return Point3(-1,-1,-1); } //Find a place to put the ball Ball* newBall = new Ball(); newBall->loadObj("G:\\Documents\\School\\CS480\\unccs480-snippets\\sample\\objects\\earth.obj"); newBall->calculateCenter(); newBall->calculateRadius(); srand(id); Point3 color(1.0/(rand()%5 + 1),1.0/(rand()%5 + 1),1.0/(rand()%5 + 1)); newBall->setColor(color); newBall->resize(1); newBall->setMass(1); newBall->moveCenterTo(Point3(0,0,10)); balls[id] = newBall; return color; } bool App::recieveEvent(int id, int direction, bool up) { if (balls.find(id) == balls.end()) { return false; } Path<Point3> newForce(0,1000); if (up) { switch (direction) { case SDLK_LEFT: newForce.addPoint(Point3(-50,0,0)); newForce.makeCyclic(); this->leftForceId = this->balls[id]->addForce(newForce); break; case SDLK_RIGHT: newForce.addPoint(Point3(50,0,0)); newForce.makeCyclic(); this->rightForceId = this->balls[id]->addForce(newForce); break; case SDLK_DOWN: newForce.addPoint(Point3(0,-50,0)); newForce.makeCyclic(); this->downForceId = this->balls[id]->addForce(newForce); break; case SDLK_UP: newForce.addPoint(Point3(0,50,0)); newForce.makeCyclic(); this->upForceId = this->balls[id]->addForce(newForce); break; default: break; } } else { switch (direction) { case SDLK_LEFT: this->balls[id]->removeForce(this->leftForceId); break; case SDLK_RIGHT: this->balls[id]->removeForce(this->rightForceId); break; case SDLK_DOWN: this->balls[id]->removeForce(this->downForceId); break; case SDLK_UP: this->balls[id]->removeForce(this->upForceId); break; default: break; } } } /** * */ bool App::key(SDL_Event event) { App::getInstance()->recieveEvent(0, event.key.keysym.sym, event.type == SDL_KEYDOWN); return true; } /** * Click callback on the buttons */ bool App::click() { } App * App::pinstance = NULL; extern App * App::getInstance() { if (App::pinstance == 0) { App::pinstance = new App(); } return App::pinstance; }
[ "brian.shourd@eb85dc16-8f5f-11dd-9a11-5fe6a12f7d96" ]
[ [ [ 1, 240 ] ] ]
f759d7c0babc79a26875f494bf23f79b390cc9a1
fa609a5b5a0e7de3344988a135b923a0f655f59e
/Tests/Source/TestValueDate.cpp
07b2c1cd21f6a4d04b9a7048b7c0a822a807c578
[ "MIT" ]
permissive
Sija/swift
3edfd70e1c8d9d54556862307c02d1de7d400a7e
dddedc0612c0d434ebc2322fc5ebded10505792e
refs/heads/master
2016-09-06T09:59:35.416041
2007-08-30T02:29:30
2007-08-30T02:29:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,939
cpp
#include "stdafx.h" #include <cppunit/extensions/HelperMacros.h> #include "../../Source/stdafx.h" #include "../../Source/values/Date.h" #include "../../Source/values/Bool.h" using namespace Swift; class TestValueDate : public CPPUNIT_NS::TestFixture { public: CPPUNIT_TEST_SUITE(TestValueDate); CPPUNIT_TEST(testInit); CPPUNIT_TEST(testAssign); CPPUNIT_TEST(testGet); CPPUNIT_TEST(testSetClear); CPPUNIT_TEST(testOperators); CPPUNIT_TEST_SUITE_END(); public: void setUp() { } void tearDown() { } protected: void testInit() { CPPUNIT_ASSERT(iValue::hasTypeString(Values::Date::id)); } void testAssign() { oValue d(Date64(true)); CPPUNIT_ASSERT(d->getID() == Values::Date::id); } void testGet() { CPPUNIT_ASSERT(oValue(Date64(true)) >> Date64() == Date64(true)); CPPUNIT_ASSERT(((Values::Date*) oValue(Date64()).get())->output() == Date64()); } void testSetClear() { oValue v(Date64(true)); v->clear(); CPPUNIT_ASSERT(v >> Date64() == Date64()); Values::Date* d = (Values::Date*) v.get(); d->set(Date64((time_t) 5443)); CPPUNIT_ASSERT(v >> Date64() == Date64((time_t) 5443)); } void testOperators() { CPPUNIT_ASSERT((oValue(Date64((time_t) 100)) == oValue(Date64((time_t) 100))) >> bool()); CPPUNIT_ASSERT((oValue(Date64((time_t) 50000)) != oValue(Date64((time_t) 876555))) >> bool()); CPPUNIT_ASSERT(((oValue(Date64((time_t) 560000)) + oValue(Date64((time_t) 40000))) == oValue(Date64((time_t) 600000))) >> bool()); CPPUNIT_ASSERT(((oValue(Date64((time_t) 480000)) - oValue(Date64((time_t) 120000))) == oValue(Date64((time_t) 360000))) >> bool()); CPPUNIT_ASSERT((oValue() << Date64())->getID() == Values::Date::id); CPPUNIT_ASSERT((oValue(Date64((time_t) 123)) >> Date64()) == Date64((time_t) 123)); } }; CPPUNIT_TEST_SUITE_REGISTRATION(TestValueDate);
[ [ [ 1, 65 ] ] ]
cec7c14d7e9bb9f8684f3c82b26bc2fed905d22f
1e01b697191a910a872e95ddfce27a91cebc57dd
/BNFPushItem.cpp
12aff678b7e3900b6ead418eec583c53432b2a31
[]
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
4,685
cpp
/* "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] */ #ifdef WIN32 #pragma warning (disable : 4786) #endif #include "ScpStream.h" #include "CppCompilerEnvironment.h" #include "CGRuntime.h" #include "DtaScriptVariable.h" #include "ExprScriptVariable.h" #include "DtaBNFScript.h" #include "DtaVisitor.h" #include "BNFPushItem.h" namespace CodeWorker { BNFPushItem::BNFPushItem(DtaBNFScript* pBNFScript, GrfBlock* pParent) : _pBNFScript(pBNFScript), GrfBlock(pParent), _pVariable(NULL) {} BNFPushItem::~BNFPushItem() { } void BNFPushItem::accept(DtaVisitor& visitor, DtaVisitorEnvironment& env) { visitor.visitBNFPushItem(*this, env); } bool BNFPushItem::isABNFCommand() const { return true; } SEQUENCE_INTERRUPTION_LIST BNFPushItem::execute(DtaScriptVariable& visibility) { SEQUENCE_INTERRUPTION_LIST result; DtaScriptVariable* pVariable = visibility.getExistingVariable(*_pVariable); bool bCreation = (pVariable == NULL); if (bCreation) { pVariable = visibility.getVariable(*_pVariable); if (pVariable->isLocal()) CGRuntime::throwBNFExecutionError("declare the local variable '" + _pVariable->toString() + "' before calling '#pushItem'"); } pVariable->pushItem(""); int iCursor = CGRuntime::getInputLocation(); int iImplicitCopyPosition = ((_pBNFScript->implicitCopy()) ? CGRuntime::getOutputLocation() : -1); result = GrfBlock::executeInternal(visibility); if (result != NO_INTERRUPTION) { if (bCreation && !pVariable->isLocal()) CGRuntime::removeVariable(pVariable); else CGRuntime::removeLastElement(pVariable); CGRuntime::setInputLocation(iCursor); if (iImplicitCopyPosition >= 0) CGRuntime::resizeOutputStream(iImplicitCopyPosition); } return result; } void BNFPushItem::compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const { std::vector<GrfCommand*>::const_iterator i = getCommands().begin(); if (i != getCommands().end()) { CW_BODY_INDENT << "// " << toString(); CW_BODY_ENDL; int iCursor = theCompilerEnvironment.newCursor(); CW_BODY_INDENT << "int _compilerClauseCursor_" << iCursor << " = CGRuntime::getInputLocation();"; CW_BODY_ENDL; CW_BODY_INDENT << "bool _compilerClauseCreation_" << iCursor << " = CGRuntime::existVariable("; _pVariable->compileCpp(theCompilerEnvironment); CW_BODY_STREAM << ");"; CW_BODY_ENDL; CW_BODY_INDENT; _pVariable->compileCppForSet(theCompilerEnvironment); CW_BODY_STREAM << ".pushItem(\"\");";CW_BODY_ENDL; CW_BODY_INDENT << "if (_compilerClauseCreation_" << iCursor << " && "; _pVariable->compileCpp(theCompilerEnvironment); CW_BODY_STREAM << ".isLocal()) CGRuntime::throwBNFExecutionError(\"declare the local variable '" << _pVariable->toString() << "' before calling '#pushItem'\");";CW_BODY_ENDL; GrfBlock::compileCppBNFSequence(theCompilerEnvironment); CW_BODY_INDENT << "if (!_compilerClauseSuccess) {";CW_BODY_ENDL; CW_BODY_INDENT << "\tif (!_compilerClauseCreation_" << iCursor << ") CGRuntime::removeVariable("; _pVariable->compileCpp(theCompilerEnvironment); CW_BODY_STREAM << ");";CW_BODY_ENDL; CW_BODY_INDENT << "\telse CGRuntime::removeLastElement("; _pVariable->compileCpp(theCompilerEnvironment); CW_BODY_STREAM << ");";CW_BODY_ENDL; CW_BODY_INDENT << "\tCGRuntime::setInputLocation(_compilerClauseCursor_" << iCursor << ");";CW_BODY_ENDL; CW_BODY_INDENT << "}";CW_BODY_ENDL; } } std::string BNFPushItem::toString() const { std::string sText = "#pushItem(" + _pVariable->toString() + ")"; for (std::vector<GrfCommand*>::const_iterator i = getCommands().begin(); i != getCommands().end(); i++) { if ((*i)->isABNFCommand()) { if (i != getCommands().begin()) sText += " "; sText += (*i)->toString(); } } return sText; } }
[ "cedric.p.r.lemaire@28b3f5f3-d42e-7560-b87f-5f53cf622bc4" ]
[ [ [ 1, 112 ] ] ]
c6291c14cd7c484c89181f6e66910ba5480434e6
e1bf514046ee44622d96b7f4541cf406d87a9ee6
/Engine/src/Window.cpp
2e2bd9bb7d1c7ccedea5f3ce82a4aa72102dd74d
[]
no_license
phigley/VehicleTestBed
89d97d8439492062be53d29904b6f8e392cd3f63
340b5c920b3ccc179bb910f39c16d473864bed0c
refs/heads/master
2021-01-13T12:56:42.496354
2009-10-30T00:59:28
2009-10-30T00:59:28
350,645
1
0
null
null
null
null
UTF-8
C++
false
false
2,831
cpp
#include "Engine/Window.h" #include <GL/glfw.h> namespace { // It would be nice t move these into Window. // But glfw does not support multiple windows, // hence it does not have user-data associated with // its reshape callback. double projectionWidth = 1.0; double projectionHeight = 1.0; double adjustedProjectionWidth = projectionWidth; double adjustedProjectionHeight = projectionHeight; void GLFWCALL reshape( int w, int h ) { glViewport( 0, 0, (GLsizei)w, (GLsizei)h ); adjustedProjectionWidth = projectionWidth; adjustedProjectionHeight = projectionHeight; // w/pw > h/ph if (double(w)*projectionHeight >= double(h)*projectionWidth) { adjustedProjectionWidth = double(w)/double(h)*projectionHeight; } else { adjustedProjectionHeight = double(h)/double(w)*projectionWidth; } glMatrixMode( GL_PROJECTION ); glLoadIdentity(); gluOrtho2D(-adjustedProjectionWidth/2, adjustedProjectionWidth/2, -adjustedProjectionHeight/2, adjustedProjectionHeight/2); } } Engine::Window::Window(int width, int height, const char* title) { // Initialize GLFW glfwInit(); glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4); // Open an OpenGL window if( !glfwOpenWindow( width, height, 0,0,0,0,0,0, GLFW_WINDOW ) ) { glfwTerminate(); return; } glfwSetWindowTitle( title ); glfwSetWindowSizeCallback( reshape ); // Tearing is ugly! glfwSwapInterval( 1 ); glShadeModel(GL_SMOOTH); // Enable Smooth Shading glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background //glClearDepth(1.0f); // Depth Buffer Setup //glEnable(GL_DEPTH_TEST); // Enables Depth Testing //glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do //glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations // // Go ahead and enable these, although // // point will never be used. // glEnable(GL_POINT_SMOOTH); // glHint(GL_POINT_SMOOTH, GL_NICEST); // glEnable(GL_LINE_SMOOTH); // glHint(GL_LINE_SMOOTH, GL_NICEST); // glEnable(GL_POLYGON_SMOOTH); // glHint(GL_POLYGON_SMOOTH, GL_NICEST); // This probably doesn't matter, but it keeps me // honest about my vertex order! glCullFace(GL_BACK); glEnable(GL_CULL_FACE); // Keep keys active until they are checked. glfwEnable( GLFW_STICKY_KEYS ); } Engine::Window::~Window() { glfwTerminate(); } void Engine::Window::setProjectionSize(float width, float height) { // Store the new size. projectionWidth = width; projectionHeight = height; // Reshape the window. int w,h; glfwGetWindowSize(&w, &h); reshape(w,h); } Engine::Vector2 Engine::Window::getProjectionSize() const { return Engine::Vector2(float(adjustedProjectionWidth), float(adjustedProjectionHeight)); }
[ [ [ 1, 105 ] ] ]
37eed3f04b1b3e12d0c52d63a53d5d158f262aaf
9f2d447c69e3e86ea8fd8f26842f8402ee456fb7
/shooting2011/shooting2011/FirePatternEnemy.cpp
f07a0fddfb1b91ab22ad5294706fc84534421b98
[]
no_license
nakao5924/projectShooting2011
f086e7efba757954e785179af76503a73e59d6aa
cad0949632cff782f37fe953c149f2b53abd706d
refs/heads/master
2021-01-01T18:41:44.855790
2011-11-07T11:33:44
2011-11-07T11:33:44
2,490,410
0
1
null
null
null
null
UTF-8
C++
false
false
1,023
cpp
#include "main.h" #include "movePattern.h" #include "firePattern.h" #include "enemyBullet.h" #include "enemy.h" #include "shootingAccessor.h" FirePatternEnemy::FirePatternEnemy(const vector<int> &fs,const vector<vector<MovePattern *> > &_vvmp,int _maxFrame,bool _loop){ frames = fs; vvmp = _vvmp; maxFrame = _maxFrame; loop = _loop; curFrame = 0; index = 0; } bool FirePatternEnemy::isFire(){ curFrame++; if(index == frames.size()) { if(curFrame==maxFrame){ curFrame=0; index = 0; } return false; } else if(frames[index]==curFrame){ index++; return true; } return false; } void FirePatternEnemy::action(MovingObject *){ /*if(isFire()){ vector<MovingObject *> ret; for(int i=0;i<vvmp[index].size();i++){ ShootingAccessor::addEnemyBullet(new EnemyBullet()); } }*/ } FirePatternEnemy::~FirePatternEnemy(){ for(int i=0;i<vvmp.size();i++){ for(vector<MovePattern *>::iterator j = vvmp[i].begin();j!=vvmp[i].end();j++){ delete *j; } } }
[ [ [ 1, 44 ] ], [ [ 45, 45 ] ] ]
a2da1dd5fca4a7b0e57e9379c54d8d0d673fc8b8
7c51155f60ff037d1b8d6eea1797c7d17e1d95c2
/linux-interpreter-end2-debug/ByteCode.h
60ffb54d9b776ff98e5fef711332d066215632dd
[]
no_license
BackupTheBerlios/ejvm
7258cd180256970d57399d0c153d00257dbb127c
626602de9ed55a825efeefd70970c36bcef0588d
refs/heads/master
2020-06-11T19:47:07.882834
2006-07-10T16:39:59
2006-07-10T16:39:59
39,960,044
0
0
null
null
null
null
UTF-8
C++
false
false
534
h
#ifndef BYTECODE_H_ #define BYTECODE_H_ #include "typeDefs.h" //#include "ExceptionTable.h" class ExceptionTable; class ByteCode { //private: public: u2 nameIndex; u4 length; u2 maxStack; u2 maxLocals; u4 codeLength; u1 * code; ExceptionTable * exceptionTable; u2 getMaxLocals(){return maxLocals;} u2 getMaxStack(){return maxStack;} ByteCode(const byte inputFile [],int inPtr, u2 nameIndex, u4 length); ~ByteCode(); u1 * getCode(){return code;} }; #endif /*BYTECODE_H_*/
[ "almahallawy" ]
[ [ [ 1, 27 ] ] ]
1e9eed0535a9d348e36022abee8a7fd12af445fd
fcdddf0f27e52ece3f594c14fd47d1123f4ac863
/TeCom/src/TdkLayout/Header Files/TdkScaleUnitProperty.h
ec80a6f960e2406366d1af465a297303e62ec6a1
[]
no_license
radtek/terra-printer
32a2568b1e92cb5a0495c651d7048db6b2bbc8e5
959241e52562128d196ccb806b51fda17d7342ae
refs/heads/master
2020-06-11T01:49:15.043478
2011-12-12T13:31:19
2011-12-12T13:31:19
null
0
0
null
null
null
null
ISO-8859-2
C++
false
false
1,974
h
/****************************************************************************** * FUNCATE - GIS development team * * TerraLib Components - TeCOM * * @(#) TdkScaleUnitProperty.h * ******************************************************************************* * * $Rev$: * * $Author: rui.gregorio $: * * $Date: 2010/08/23 13:21:20 $: * ******************************************************************************/ // Elaborated by Rui Mauricio Gregório #ifndef __TDK_SCALE_UNIT_PROPERTY_H #define __TDK_SCALE_UNIT_PROPERTY_H #include <TdkAbstractProperty.h> //! \class TdkScaleUnitProperty /*! Class to manipulate the scale unit property of object */ class TdkScaleUnitProperty : public TdkAbstractProperty { public : enum Unit { meters=0, kilometers=1 }; protected : Unit _value; public : //! \brief TdkScaleUnitProperty /*! Constructor \param newVal new width value */ TdkScaleUnitProperty(const Unit &newVal=meters); //! \brief Destructor virtual ~TdkScaleUnitProperty(); //! \brief setValue /*! Method to set the new value to width property \param newVal new width value */ virtual void setValue(const Unit &newVal); //! \brief getValue /*! Method to return the scale unit \return returns the scale unit value of object */ virtual Unit getValue(); //! \brief getValue /*! Method to return the scale unit by reference */ virtual void getValue(double &value); //! \brief operator /*! Operator = overload \param other other TdkScaleUnitProperty object \return returns the object with same values that old object */ TdkScaleUnitProperty& operator=(const TdkScaleUnitProperty &other); //! \brief operator /*! Operator = overload \param other other TdkAbstractProperty object \return returns the object with same values that old object */ TdkScaleUnitProperty& operator=(const TdkAbstractProperty &other); }; #endif
[ "[email protected]@58180da6-ba8b-8960-36a5-00cc02a3ddec" ]
[ [ [ 1, 81 ] ] ]
022782d5624170d219a7e398e0abfcdf84df9632
9c62af23e0a1faea5aaa8dd328ba1d82688823a5
/rl/tags/v0-1/engine/rules/src/RulesSubsystem.cpp
4c9cafc5c8673037d70e6c282fdaee12ef92070d
[ "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
2,537
cpp
/* 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. */ #include "RulesSubsystem.h" #include "ActionManager.h" #include "DsaManager.h" #include "DsaDataLoader.h" #include "Logger.h" #include "TimerManager.h" #include "QuestBook.h" template <> rl::RulesSubsystem* Singleton<rl::RulesSubsystem> ::ms_Singleton = 0; namespace rl { RulesSubsystem& RulesSubsystem::getSingleton(void) { return Singleton<RulesSubsystem>::getSingleton(); } RulesSubsystem* RulesSubsystem::getSingletonPtr(void) { return Singleton<RulesSubsystem>::getSingletonPtr(); } RulesSubsystem::RulesSubsystem() : mQuestBook(NULL) { Logger::getSingleton().log(Logger::RULES, Ogre::LML_TRIVIAL, "Start"); //Zufallsgenerator initialisieren srand(static_cast<unsigned int>(time(NULL))); //Singletons erzeugen new ActionManager(); Logger::getSingleton().log(Logger::RULES, Ogre::LML_TRIVIAL, "ActionManager erzeugt"); new DsaManager(); Logger::getSingleton().log(Logger::RULES, Ogre::LML_TRIVIAL, "DsaManager erzeugt"); new TimerManager(); Logger::getSingleton().log(Logger::RULES, Ogre::LML_TRIVIAL, "TimerManager erzeugt"); resetQuestBook(); Logger::getSingleton().log(Logger::RULES, Ogre::LML_TRIVIAL, "Questverwaltung erzeugt"); //Daten laden DsaDataLoader::loadData("basis.xdi"); Logger::getSingleton().log(Logger::RULES, Ogre::LML_TRIVIAL, "Basisdaten geladen"); Logger::getSingleton().log(Logger::RULES, Ogre::LML_TRIVIAL, "Erzeugen abgeschlossen"); } RulesSubsystem::~RulesSubsystem() { delete DsaManager::getSingletonPtr(); } QuestBook* RulesSubsystem::getQuestBook() { return mQuestBook; } void RulesSubsystem::resetQuestBook() { delete mQuestBook; mQuestBook = new QuestBook(); } }
[ "blakharaz@4c79e8ff-cfd4-0310-af45-a38c79f83013" ]
[ [ [ 1, 78 ] ] ]
de6901107ea480fe4e0850f211bf77985623d686
1e01b697191a910a872e95ddfce27a91cebc57dd
/GrfQuantifyExecution.cpp
9980ee0e807bc1d5289332e27655ef5b007700af
[]
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
18,295
cpp
/* "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] */ #ifdef WIN32 #pragma warning(disable: 4503) #pragma warning (disable : 4786) #endif #include <math.h> #include <fstream> #include "ScpStream.h" #include "UtlException.h" #include "UtlTimer.h" #ifndef WIN32 # include "UtlString.h" // for Debian/gcc 2.95.4 #endif #include "CGRuntime.h" #include "DtaScript.h" #include "DtaProject.h" #include "ExprScriptFunction.h" #include "GrfFunction.h" #include "BNFClauseCall.h" #include "GrfQuantifyExecution.h" namespace CodeWorker { bool DtaQuantifyFunction::operator < (const DtaQuantifyFunction& function) const { return (_sName < function._sName); } bool DtaQuantifyFunction::operator > (const DtaQuantifyFunction& function) const { return (_sName > function._sName); } bool DtaQuantifyFunction::operator ==(const DtaQuantifyFunction& function) const { return (_sName == function._sName) && (_sFile == function._sFile) && (_iLocation == function._iLocation); } bool DtaQuantifyFunction::operator !=(const DtaQuantifyFunction& function) const { return !((*this) == function); } GrfQuantifyExecution::~GrfQuantifyExecution() { delete _pFilename; } void GrfQuantifyExecution::handleBeforeExecutionCBK(GrfCommand* pCommand, DtaScriptVariable& /*visibility*/) { incrementCounter(pCommand); } void GrfQuantifyExecution::handleAfterExecutionCBK(GrfCommand* /*pCommand*/, DtaScriptVariable& /*visibility*/) {} void GrfQuantifyExecution::handleAfterExceptionCBK(GrfCommand* /*pCommand*/, DtaScriptVariable& /*visibility*/, UtlException& /*exception*/) {} void GrfQuantifyExecution::handleStartingFunction(GrfFunction* pFunction) { GrfExecutionContext::handleStartingFunction(pFunction); pFunction->startTimer(); } void GrfQuantifyExecution::handleEndingFunction(GrfFunction* pFunction) { pFunction->stopTimer(); GrfExecutionContext::handleEndingFunction(pFunction); } void GrfQuantifyExecution::handleStartingBNFClause(BNFClauseCall* pBNFClause) { GrfExecutionContext::handleStartingBNFClause(pBNFClause); pBNFClause->startTimer(); } void GrfQuantifyExecution::handleEndingBNFClause(BNFClauseCall* pBNFClause) { pBNFClause->stopTimer(); GrfExecutionContext::handleEndingBNFClause(pBNFClause); } SEQUENCE_INTERRUPTION_LIST GrfQuantifyExecution::openSession(DtaScriptVariable& visibility) { SEQUENCE_INTERRUPTION_LIST result; CGRuntime::traceLine("-- quantify session --"); std::string sFilename; try { _listOfPredefinedFunctions = std::map<std::string, int>(); _listOfUserFunctions = std::map<std::string, std::map<std::string, DtaQuantifyFunction> >(); ExprScriptFunction::clearCounters(); _iCoveredCode = 0; _iTotalCode = 0; if (_pFilename != NULL) { sFilename = _pFilename->getValue(visibility); if (sFilename.size() < 5) throw UtlException("HTML file must have extension '.htm' or '.html'"); std::string sExtension = sFilename.substr(sFilename.size() - 5); if ((stricmp(sExtension.c_str(), ".html") != 0) && (stricmp(sExtension.c_str() + 1, ".htm") != 0)) throw UtlException("HTML file must have extension '.htm' or '.html'"); } UtlTimer myTimer; myTimer.start(); result = GrfBlock::executeInternal(visibility); myTimer.stop(); char tcMessage[80]; sprintf(tcMessage, "quantify execution time = %dms", myTimer.getTimeInMillis()); CGRuntime::traceLine(tcMessage); } catch(UtlException&/* exception*/) { CGRuntime::traceLine("-- quantify session interrupted by an exception --"); throw/* UtlException(exception)*/; } applyRecursively(recoverData); if (sFilename.empty()) displayResults(visibility); else generateHTMLFile(sFilename.c_str(), visibility); CGRuntime::traceLine("-- end of quantify session --"); return result; } void GrfQuantifyExecution::handleBeforeScriptExecutionCBK(GrfCommand* /*pCommand*/, DtaScriptVariable& /*visibility*/) {} void GrfQuantifyExecution::handleAfterScriptExecutionCBK(GrfCommand* pCommand, DtaScriptVariable& /*visibility*/) { pCommand->applyRecursively(recoverData); } void GrfQuantifyExecution::recoverData(GrfCommand* pCommand) { if (pCommand->getFunctionName() != NULL) { if (pCommand->isAPredefinedFunction()) getCurrentQuantify()->registerPredefinedFunction(pCommand); else getCurrentQuantify()->registerUserFunction((GrfFunction*) pCommand); } getCurrentQuantify()->registerCode(pCommand); } void GrfQuantifyExecution::registerCode(GrfCommand* pCommand) { if (getParsingFilePtr(pCommand) != NULL) { _iTotalCode++; if (getCounter(pCommand) > 0) _iCoveredCode++; _coveredLines[getParsingFilePtr(pCommand)][getFileLocation(pCommand)] = getCounter(pCommand); } } void GrfQuantifyExecution::registerUserFunction(GrfFunction* pFunction) { if (getParsingFilePtr(pFunction) != NULL) { std::map<std::string, std::map<std::string, DtaQuantifyFunction> >::iterator iterateFile = _listOfUserFunctions.find(getParsingFilePtr(pFunction)); if (iterateFile != _listOfUserFunctions.end()) { std::map<std::string, DtaQuantifyFunction>::iterator iterateName = iterateFile->second.find(pFunction->getFunctionName()); if (iterateName != iterateFile->second.end()) { iterateName->second._iCounter = getCounter(pFunction); iterateName->second._iTimeInMillis = getTimeInMillis(pFunction); } else { DtaQuantifyFunction& myFunction = iterateFile->second[pFunction->getFunctionName()]; myFunction._sName = pFunction->getFunctionName(); myFunction._sFile = getParsingFilePtr(pFunction); myFunction._iLocation = getFileLocation(pFunction); myFunction._iCounter = getCounter(pFunction); myFunction._iTimeInMillis = getTimeInMillis(pFunction); } } else { DtaQuantifyFunction& myFunction = _listOfUserFunctions[getParsingFilePtr(pFunction)][pFunction->getFunctionName()]; myFunction._sName = pFunction->getFunctionName(); myFunction._sFile = getParsingFilePtr(pFunction); myFunction._iLocation = getFileLocation(pFunction); myFunction._iCounter = getCounter(pFunction); myFunction._iTimeInMillis = getTimeInMillis(pFunction); } } } void GrfQuantifyExecution::registerPredefinedFunction(GrfCommand* pCommand) { _listOfPredefinedFunctions[pCommand->getFunctionName()] = _listOfPredefinedFunctions[pCommand->getFunctionName()] + getCounter(pCommand); } void GrfQuantifyExecution::displayResults(DtaScriptVariable& visibility) { if (!_listOfUserFunctions.empty()) { CGRuntime::traceLine("User defined functions:"); for (std::map<std::string, std::map<std::string, DtaQuantifyFunction> >::iterator i = _listOfUserFunctions.begin(); i != _listOfUserFunctions.end(); i++) { std::string sCompleteFileName; std::ifstream* pFile = openInputFileFromIncludePath(i->first.c_str(), sCompleteFileName); for (std::map<std::string, DtaQuantifyFunction>::iterator j = i->second.begin(); j != i->second.end(); j++) { CGRuntime::traceText(" " + j->second._sName + "(...) file \"" + j->second._sFile); if (pFile != NULL) { setLocation(*pFile, j->second._iLocation); char tcMessage[40]; sprintf(tcMessage, "\" at %d", getLineCount(*pFile)); CGRuntime::traceText(tcMessage); } char tcMessage[80]; sprintf(tcMessage, ": %d occurences in %dms", j->second._iCounter, j->second._iTimeInMillis); CGRuntime::traceLine(tcMessage); } if (pFile != NULL) { pFile->close(); delete pFile; } } } CGRuntime::traceLine("Predefined functions:"); for (std::map<std::string, DtaFunctionInfo>::iterator i = ExprScriptFunction::getFunctionRegister().begin(); i != ExprScriptFunction::getFunctionRegister().end(); i++) { if (*(i->second.pCounter) > 0) { CGRuntime::traceText(" " + i->first + "(...): "); char tcMessage[40]; sprintf(tcMessage, "%d occurrences", *(i->second.pCounter)); CGRuntime::traceLine(tcMessage); } } if (!_listOfPredefinedFunctions.empty()) { CGRuntime::traceLine("Procedures:"); for (std::map<std::string, int>::iterator i = _listOfPredefinedFunctions.begin(); i != _listOfPredefinedFunctions.end(); i++) { CGRuntime::traceText(" " + i->first + "(...): "); char tcMessage[40]; sprintf(tcMessage, "%d occurrences", i->second); CGRuntime::traceLine(tcMessage); } } double dCoveredCode = getCoveredCode(); double dTotalCode = getTotalCode(); double dPercentCovered = floor(100.0 * dCoveredCode / dTotalCode); char tcMessage[80]; sprintf(tcMessage, "Covered source code: %d%%", (int) dPercentCovered); CGRuntime::traceLine(tcMessage); } void GrfQuantifyExecution::generateHTMLFile(const char* sFilename, DtaScriptVariable& visibility) { static const char* tColorArray[6][6]={{"#ff0000", "#0000ff", "#0000ff", "#0000ff", "#0000ff", "#0000ff"}, {"#0000ff", "#ff0000", "#ffff00", "#ffff00", "#00ff00", "#00ff00"}, {"#0000ff", "#ffff00", "#ff0000", "#ff8000", "#ffff00", "#ffff00"}, {"#0000ff", "#ffff00", "#ff8000", "#ff0000", "#ff8000", "#ff8000"}, {"#0000ff", "#00ff00", "#ffff00", "#ff8000", "#ff0000", "#ff00ff"}, {"#0000ff", "#00ff00", "#ffff00", "#ff8000", "#ff00ff", "#ff0000"}}; if ((sFilename != NULL) && (sFilename[0] != '\0')) { std::fstream* pHTMLFile = DtaScript::openOutputFile(sFilename, true); CGRuntime::traceLine("Generating HTML file \"" + std::string(sFilename) + "\""); (*pHTMLFile) << "<HTML>" << std::endl; (*pHTMLFile) << "<HEAD>" << std::endl; (*pHTMLFile) << "<TITLE>Covered source code</TITLE>" << std::endl; (*pHTMLFile) << "</HEAD>" << std::endl; (*pHTMLFile) << "<BODY>" << std::endl; // generates predefined functions occurences bool bInitialized = false; for (std::map<std::string, DtaFunctionInfo>::iterator i1 = ExprScriptFunction::getFunctionRegister().begin(); i1 != ExprScriptFunction::getFunctionRegister().end(); i1++) { if (*(i1->second.pCounter) > 0) { if (!bInitialized) { bInitialized = true; (*pHTMLFile) << "<H1>Predefined functions:</H1>" << std::endl; (*pHTMLFile) << "<TABLE BORDER CELLSPACING=1 CELLPADDING=7 WIDTH=360>" << std::endl; (*pHTMLFile) << " <TR>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"69%\" VALIGN=\"TOP\"><B><FONT SIZE=3><P ALIGN=\"CENTER\">Function name</B></FONT></TD>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"31%\" VALIGN=\"TOP\"><B><FONT SIZE=3><P ALIGN=\"CENTER\">Occurence</B></FONT></TD>" << std::endl; (*pHTMLFile) << " </TR>" << std::endl; } (*pHTMLFile) << " <TR>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"69%\" VALIGN=\"TOP\"><B><FONT SIZE=2><P>" << i1->first << "(...) " << "</B></FONT></TD>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"31%\" VALIGN=\"TOP\"><FONT SIZE=2><P>" << *(i1->second.pCounter) << "</FONT></TD>" << std::endl; (*pHTMLFile) << " </TR>" << std::endl; } } if (bInitialized) (*pHTMLFile) << "</TABLE>" << std::endl; // generates instructions occurrences if (!_listOfPredefinedFunctions.empty()) { (*pHTMLFile) << "<H1>Procedures:</H1>" << std::endl; (*pHTMLFile) << "<TABLE BORDER CELLSPACING=1 CELLPADDING=7 WIDTH=360>" << std::endl; (*pHTMLFile) << " <TR>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"69%\" VALIGN=\"TOP\"><B><FONT SIZE=3><P ALIGN=\"CENTER\">Instruction name</B></FONT></TD>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"31%\" VALIGN=\"TOP\"><B><FONT SIZE=3><P ALIGN=\"CENTER\">Occurence</B></FONT></TD>" << std::endl; (*pHTMLFile) << " </TR>" << std::endl; for (std::map<std::string, int>::iterator i2 = _listOfPredefinedFunctions.begin(); i2 != _listOfPredefinedFunctions.end(); i2++) { (*pHTMLFile) << " <TR>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"69%\" VALIGN=\"TOP\"><B><FONT SIZE=2><P>" << i2->first << "(...) " << "</B></FONT></TD>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"31%\" VALIGN=\"TOP\"><FONT SIZE=2><P>" << i2->second << "</FONT></TD>" << std::endl; (*pHTMLFile) << " </TR>" << std::endl; } (*pHTMLFile) << "</TABLE>" << std::endl; } // generates by file for (std::map<std::string, std::map<int, int> >::const_iterator i = _coveredLines.begin(); i != _coveredLines.end(); i++) { std::string sCompleteFileName; std::ifstream* pFile = openInputFileFromIncludePath(i->first.c_str(), sCompleteFileName); if (pFile != NULL) { (*pHTMLFile) << "<H1>File \"" << i->first << "\":</H1>" << std::endl; // generates predefined functions bInitialized = false; std::map<std::string, std::map<std::string, DtaQuantifyFunction> >::iterator i3 = _listOfUserFunctions.find(i->first); if (i3 != _listOfUserFunctions.end()) { for (std::map<std::string, DtaQuantifyFunction>::iterator i4 = i3->second.begin(); i4 != i3->second.end(); i4++) { if (!bInitialized) { bInitialized = true; (*pHTMLFile) << "<TABLE BORDER CELLSPACING=1 CELLPADDING=7 WIDTH=480>" << std::endl; (*pHTMLFile) << " <TR>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"60%\" VALIGN=\"TOP\"><B><FONT SIZE=3><P ALIGN=\"CENTER\">User defined function</B></FONT></TD>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"20%\" VALIGN=\"TOP\"><B><FONT SIZE=3><P ALIGN=\"CENTER\">Occurence</B></FONT></TD>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"20%\" VALIGN=\"TOP\"><B><FONT SIZE=3><P ALIGN=\"CENTER\">Time in ms</B></FONT></TD>" << std::endl; (*pHTMLFile) << " </TR>" << std::endl; } setLocation(*pFile, i4->second._iLocation); (*pHTMLFile) << " <TR>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"60%\" VALIGN=\"TOP\"><B><FONT SIZE=2><P>" << i4->second._sName << "(...) at " << getLineCount(*pFile) << "</B></FONT></TD>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"20%\" VALIGN=\"TOP\"><FONT SIZE=2><P>" << i4->second._iCounter << "</FONT></TD>" << std::endl; (*pHTMLFile) << " <TD WIDTH=\"20%\" VALIGN=\"TOP\"><FONT SIZE=2><P>" << i4->second._iTimeInMillis << "</FONT></TD>" << std::endl; (*pHTMLFile) << " </TR>" << std::endl; } } if (bInitialized) { (*pHTMLFile) << "</TABLE>" << std::endl; setLocation(*pFile, 0); } // generates colored source std::map<int, int>::const_iterator j; int iMaxCounter = 0; for (j = i->second.begin(); j != i->second.end(); j++) if (j->second > iMaxCounter) iMaxCounter = j->second; double dShare = ((double) iMaxCounter) / 6.0; std::string sEmptyFormat; char sSizeFormat[10]; sprintf(sSizeFormat, "%d", iMaxCounter); int iSizeFormat = strlen(sSizeFormat); for (int k = 0; k < iSizeFormat; k++) sEmptyFormat += "&nbsp;"; std::string sLine; int iPrecLocation = 0; j = i->second.begin(); while (readLine(*pFile, sLine)) { int iNextLocation = getLocation(*pFile); while ((j->first < iPrecLocation) && (j != i->second.end())) j++; int iNbLines = iMaxCounter + 1; while ((j->first < iNextLocation) && (j != i->second.end())) { if (iNbLines > j->second) iNbLines = j->second; j++; } (*pHTMLFile) << "<FONT FACE=\"Courier New\" SIZE=2><BR>"; if ((iNbLines > iMaxCounter) || (iNbLines == 0)) (*pHTMLFile) << "&nbsp;&nbsp;" << sEmptyFormat; else { char sLineCount[16]; sprintf(sLineCount, "%d", iNbLines); (*pHTMLFile) << "[" << (sEmptyFormat.c_str() + 6*strlen(sLineCount)) << sLineCount << "]"; } (*pHTMLFile) << "</FONT>"; if (iNbLines <= iMaxCounter) { (*pHTMLFile) << "<B><FONT SIZE=2 COLOR=\""; if (iNbLines == 0) (*pHTMLFile) << "#808080" << "\">"; else if (dShare < 1.0) (*pHTMLFile) << tColorArray[iMaxCounter - 1][iNbLines] << "\">"; else { int iIndex = (int) (((double) (iNbLines - 1)) / dShare); (*pHTMLFile) << tColorArray[5][iIndex] << "\">"; } int iFirstChar = 0; do { if (sLine[iFirstChar] == ' ') (*pHTMLFile) << "&nbsp;"; else if (sLine[iFirstChar] == '\t') (*pHTMLFile) << "&nbsp;&nbsp;&nbsp;&nbsp;"; else break; iFirstChar++; } while (true); (*pHTMLFile) << (sLine.c_str() + iFirstChar) << "</B></FONT>" << std::endl; } else { int iFirstChar = 0; do { if (sLine[iFirstChar] == ' ') (*pHTMLFile) << "&nbsp;"; else if (sLine[iFirstChar] == '\t') (*pHTMLFile) << "&nbsp;&nbsp;&nbsp;&nbsp;"; else break; iFirstChar++; } while (true); (*pHTMLFile) << "<FONT SIZE=2>" << (sLine.c_str() + iFirstChar) << "</FONT>" << std::endl; } iPrecLocation = iNextLocation; } pFile->close(); delete pFile; } } double dPercentCovered = floor(100.0 * ((double) getCoveredCode()) / ((double) getTotalCode())); (*pHTMLFile) << "<H1>Covered source code: <FONT COLOR=\"#ff0000\">" << dPercentCovered << "%</FONT></H1>" << std::endl; (*pHTMLFile) << "</BODY>" << std::endl; (*pHTMLFile) << "</HTML>" << std::endl; pHTMLFile->close(); delete pHTMLFile; } } }
[ "cedric.p.r.lemaire@28b3f5f3-d42e-7560-b87f-5f53cf622bc4" ]
[ [ [ 1, 384 ] ] ]
79728d2630c92c87f95c9088552fcdc039892390
cfa6cdfaba310a2fd5f89326690b5c48c6872a2a
/References/Chat/ChatS/ChatSDlg.cpp
4f3b3192c5b6accec9764a5f8c699a4c03082db4
[]
no_license
asdlei00/project-jb
1cc70130020a5904e0e6a46ace8944a431a358f6
0bfaa84ddab946c90245f539c1e7c2e75f65a5c0
refs/heads/master
2020-05-07T21:41:16.420207
2009-09-12T03:40:17
2009-09-12T03:40:17
40,292,178
0
0
null
null
null
null
UHC
C++
false
false
16,887
cpp
// ChatSDlg.cpp : 구현 파일 // #include "stdafx.h" #include "ChatS.h" #include "ChatSDlg.h" #include "AdduserDlg.h" #include "Data.h" #include "Mgr.h" #include "flag.h" #include ".\chatsdlg.h" #ifdef _DEBUG #define new DEBUG_NEW int clntNumber=0; #endif // CChatSDlg 대화 상자 CChatSDlg::CChatSDlg(CWnd* pParent /*=NULL*/) : CDialog(CChatSDlg::IDD, pParent) , m_strList2(_T("")) , m_strList1(_T("")) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CChatSDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_LBString(pDX, IDC_LIST2, m_strList2); DDX_LBString(pDX, IDC_LIST1, m_strList1); DDX_Control(pDX, IDC_LIST1, m_ctrlList1); DDX_Control(pDX, IDC_LIST2, m_ctrlList2); } BEGIN_MESSAGE_MAP(CChatSDlg, CDialog) ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1) ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2) END_MESSAGE_MAP() // CChatSDlg 메시지 처리기 BOOL CChatSDlg::OnInitDialog() { CDialog::OnInitDialog(); // 이 대화 상자의 아이콘을 설정합니다. 응용 프로그램의 주 창이 대화 상자가 아닐 경우에는 // 프레임워크가 이 작업을 자동으로 수행합니다. SetIcon(m_hIcon, FALSE); // 큰 아이콘을 설정합니다. SetIcon(m_hIcon, TRUE); // 작은 아이콘을 설정합니다. // TODO: 여기에 추가 초기화 작업을 추가합니다. // 프로그램 실행시. (하나만 실행) HANDLE hMutex = CreateMutex(NULL, TRUE, "메신저 서버"); if(GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); AfxMessageBox("프로그램이 이미 실행중입니다.", MB_ICONSTOP); //return FALSE; ExitProcess(1); } // 리스트박스 초기화 m_ctrlList2.InsertColumn(0,"아이디",LVCFMT_LEFT,60); m_ctrlList2.InsertColumn(1,"대화명",LVCFMT_LEFT,99); m_ctrlList2.InsertColumn(2,"상태",LVCFMT_LEFT,60); m_ctrlList2.SetExtendedStyle(LVS_EX_FULLROWSELECT); // 서버소켓 초기화 (현재객체,포트번호) m_ServerSocket.Init(this,3666); m_ctrlList1.AddString(_T("*** 서버가 실행되었습니다 ***")); // 멤버 리스트 list.Init(this); // 멤버리스트 초기화 return TRUE; // 컨트롤에 대한 포커스를 설정하지 않을 경우 TRUE를 반환합니다. } // 대화 상자에 최소화 단추를 추가할 경우 아이콘을 그리려면 // 아래 코드가 필요합니다. 문서/뷰 모델을 사용하는 MFC 응용 프로그램의 경우에는 // 프레임워크에서 이 작업을 자동으로 수행합니다. void CChatSDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // 그리기를 위한 디바이스 컨텍스트 SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); // 클라이언트 사각형에서 아이콘을 가운데에 맞춥니다. int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // 아이콘을 그립니다. dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); } } // 사용자가 최소화된 창을 끄는 동안에 커서가 표시되도록 시스템에서 // 이 함수를 호출합니다. HCURSOR CChatSDlg::OnQueryDragIcon() { return static_cast<HCURSOR>(m_hIcon); } void CChatSDlg::OnBnClickedButton1() // 사용자 추가 { // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. CAdduserDlg dlg; if(dlg.DoModal() == IDOK) { if(list.Addmember(dlg.m_strId,dlg.m_strPass,dlg.m_strName)){ // 멤버추가가 됐을 경우 다이얼로그에 표시.. m_ctrlList2.InsertItem(list.m_Membernum-1, dlg.m_strId); m_ctrlList2.SetItemText(list.m_Membernum-1, 1, dlg.m_strName); m_ctrlList2.SetItemText(list.m_Membernum-1, 2, "오프라인"); } else { AfxMessageBox(_T("같은 아이디가 이미 존재합니다.")); } } } void CChatSDlg::OnBnClickedButton2() // 사용자 삭제 { // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. POSITION pos = m_ctrlList2.GetFirstSelectedItemPosition(); if(!pos) { AfxMessageBox(_T("삭제할 아이디를 선택해주십시오.")); } else { UpdateData(TRUE); int nSel = m_ctrlList2.GetNextSelectedItem(pos); CString id = list.GetMemberID(nSel); CString str; str.Format("%s - 정말 삭제하시겠습니까?", id); if(AfxMessageBox(str,MB_YESNO) == IDYES){ if(list.Delmember(id)){ //삭제가 성공할경우 //화면에서 삭제 while(pos = m_ctrlList2.GetFirstSelectedItemPosition()){ int nSelItem = m_ctrlList2.GetNextSelectedItem(pos); m_ctrlList2.DeleteItem(nSelItem); } } else { AfxMessageBox(_T("아이디 삭제 실패")); } } } } void CChatSDlg::ShowMember(int i, CString id, CString name) { m_ctrlList2.InsertItem(i, id); m_ctrlList2.SetItemText(i, 1, name); m_ctrlList2.SetItemText(i, 2, "오프라인"); } void CChatSDlg::OnAccept() { // 데이터소켓 생성 m_pDataSocket = new CDataSocket(this); // 서버소켓과 데이터소켓을 연결시켜 줌 if(!m_ServerSocket.Accept(*m_pDataSocket)) { AfxMessageBox(_T("클라이언트 접속 실패")); return; } // 리스트에 소켓추가.. m_ListDataSocks.AddTail(m_pDataSocket); // 데이터소켓, archive 초기화 m_pDataSocket->Init(this); // 알림 CString str; str.Format("* 새로운 클라이언트가 접속했습니다."); m_ctrlList1.AddString(str); m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); return; } void CChatSDlg::OnReceive(CDataSocket *pDataSocket) { // 통신 버퍼에 있는 데이터를 전부 수신할 때까지 반복 do { //데이터 수신 CData data; *pDataSocket >> data; CString str; //수신된 데이터 처리 switch(data.m_flag) { case D_LOGIN: //////// 로그인 요청 str.Format("%s - 서버 접속 성공", data.m_strId); m_ctrlList1.AddString(str); m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); Receive_LOGIN(pDataSocket, &data); break; case D_MOD_NAME: //////// 대화명 변경 요청 str.Format("%s - 대화명 변경", data.m_strId); m_ctrlList1.AddString(str); m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); Receive_MOD_NAME(pDataSocket, data.m_strId, data.m_strName); break; case D_JOIN_MEMBER: //////// 회원가입 요청 str.Format("%s - 가입요청", data.m_strId); m_ctrlList1.AddString(str); m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); Receive_JOIN_MEMBER(pDataSocket, data.m_strId, data.m_strPass, data.m_strName); break; case D_MESSAGE: //////// 채팅 메시지를 보낸 경우 Receive_MESSAGE(pDataSocket, &data); break; case D_ADD_MYLIST : //////// 대화상대 추가를 한 경우 Receive_ADD_MYLIST(pDataSocket, data.m_strId, data.m_strDestId); break; case D_DEL_MYLIST: //////// 대화상대 삭제를 한 경우 Receive_DEL_MYLIST(pDataSocket, &data); break; default : break; } } while(!(*pDataSocket).m_pArIn -> IsBufferEmpty()); return; } void CChatSDlg::OnDisconnectClient(CDataSocket* pDataSocket){ // 클라이언트의 연결이 끊겼을 때 처리 // 데이터소켓 리스트에서 찾기 POSITION pos; pos=m_ListDataSocks.Find(pDataSocket); CString id = pDataSocket->m_id; if(pDataSocket->m_id != ""){ // 상태창에 로그아웃 표시 CString str; str.Format("%s - 로그아웃",id); m_ctrlList1.AddString(str); m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); // 리스트에 오프라인 표시 int nSel = list.ExistMember(id); m_ctrlList2.SetItemText(nSel,2,"오프라인"); // 멤버정보를 오프라인 상태로 변경 list.SetMemberOnline(id, false, NULL); // 접속된 사람들에게 로그아웃 알림 Send_LOGOUT_MEMBER(id); } // 데이터소켓 리스트에서 삭제 m_ListDataSocks.RemoveAt(pos); } void CChatSDlg::Receive_LOGIN(CDataSocket * pDataSocket, CData * pData) { //////// 로그인 요청 CString str; bool tf=false; int nSel = list.ExistMember(pData->m_strId); if (nSel == -1) { // 아이디가 존재하지 않을 경우 (접속취소) CString str; str.Format("%s - 로그인 실패(존재하지 않는 아이디)", pData->m_strId); m_ctrlList1.AddString(str); m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); // 실패메시지 세팅 (*pData).Setdata(D_LOGIN_RESULT,false); } else { // 아이디가 존재할 경우 //비번 검사 if(list.CheckPass(pData->m_strId, pData->m_strPass)) { if(list.GetMemberOnline(pData->m_strId) == false) { str.Format("%s - 로그인 성공", pData->m_strId); tf=true; } else { // 이미 로그인 되어 있는 경우.. // 먼저 로그인 되어 있는 접속을 해제 Send_LOGOUT(pData->m_strId); str.Format("%s - 중복 로그인, 이전 접속 해제", pData->m_strId); tf=true; } } else { str.Format("%s - 로그인 실패(잘못된 비밀번호)", pData->m_strId); } } ///// 결과 처리 if(tf) // 로그인 성공 { // 데이터소켓 리스트에 추가 pDataSocket->m_id = pData->m_strId; // 멤버정보를 온라인 상태로 변경 list.SetMemberOnline(pData->m_strId, true, pDataSocket); // 리스트에 표시 nSel = list.ExistMember(pData->m_strId); m_ctrlList2.SetItemText(nSel,2,"온라인"); // 성공 결과 세팅 CString id=pData->m_strId; (*pData).Setdata( D_LOGIN_RESULT, true, id, list.GetMemberName(id) ); } else // 로그인 실패 { // 실패 결과 세팅 (*pData).Setdata(D_LOGIN_RESULT,false); } m_ctrlList1.AddString(str); // 상태창에 출력 m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); Send_LOGIN_RESULT(pDataSocket, pData); // 결과 전송 } void CChatSDlg::Send_LOGIN_RESULT(CDataSocket * pDataSocket, CData * pData) { int nSel; if(pData->m_result == true) { nSel = list.ExistMember(pData->m_strId); int listnum = list.GetMemberMylistnum(nSel); // 대화상대 리스트 데이터 세팅 pData->m_mylistnum = listnum; for(int i=0;i<listnum ; i++) { pData->m_mylist[i] = list.GetMemberMylist(nSel, i); } } // 로그인 결과 전송 *pDataSocket << *pData; // 로그인이 성공했을때 추가 작업 if(pData->m_result == true) { // 지금 로그인한 멤버에게, 이미 로그인 되어있는 멤버 알림 Send_LOGIN_MEMBER_INIT(pDataSocket); // 대화상대의 접속자에게 로긴사실을 알림 Send_LOGIN_MEMBER(pDataSocket, pData->m_strId, list.GetMemberName(nSel)); } } void CChatSDlg::Receive_MESSAGE(CDataSocket * pDataSocket, CData * pData) { //////// 채팅 메시지를 보내려는 경우 // 대상 아이디가 온라인인지 확인 if( list.GetMemberOnline(pData->m_strDestId) ) { // 온라인일때 Send_MESSAGE(pData->m_strId, pData->m_strName, pData->m_strData, pData->m_strDestId); } else { // 온라인이 아닐때 Send_MESSAGE_FAIL(pDataSocket); } } void CChatSDlg::Receive_MOD_NAME(CDataSocket * pDataSocket, CString id, CString name) { // 멤버 찾기 int nSel = list.ExistMember(id); if (nSel != -1) { // 데이터 변경 list.ModMemberName(nSel, name); // 리스트에 대화명 변경 m_ctrlList2.SetItemText(nSel,1,name); // 변경사실 알림.. Send_LOGIN_MEMBER(pDataSocket, id, name); } } void CChatSDlg::Send_MESSAGE(CString id, CString name, CString message, CString destid) { ////////// 채팅 메시지 전송! CDataSocket * pDataSocket; CData data; CString str; str.Format("%s : %s",id, message); m_ctrlList1.AddString(str); m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); // 대상 멤버의 데이터소켓 구함 -_-;; if( (pDataSocket=list.GetMemberSocket(destid)) != NULL) { data.Setdata(D_MESSAGE, true, id, name, message, destid); *pDataSocket << data; } } void CChatSDlg::Send_MESSAGE_FAIL(CDataSocket * pDataSocket) { CData data; data.Setdata(D_MESSAGE_FAIL); *pDataSocket << data; } void CChatSDlg::Send_LOGIN_MEMBER_INIT(CDataSocket * pDataSocket) { //////// 자신의 대화상대 중, 로긴되어있는 멤버의 데이터소켓 구함 -_-;; CDataSocket * p; CData data; // 로긴되어있는 멤버의 데이터소켓 구함 -_-;; for(int i=0;i<list.m_Membernum;i++) { // 새로 로긴한 사람에게 이미 온라인인 사람들의 리스트를 보냄. p=list.GetMemberSocket(i); if((p != NULL) && (p!=pDataSocket)) { data.Setdata(D_LOGIN_MEMBER, true, list.GetMemberID(i), list.GetMemberName(i)); *pDataSocket << data; } } } void CChatSDlg::Send_LOGIN_MEMBER(CDataSocket * pDataSocket, CString id, CString name) { //////// 대화상대의 접속자들에게 로긴사실을 알림 CDataSocket * p; CData data; // 로긴되어있는 멤버의 데이터소켓 구함 -_-;; for(int i=0;i<list.m_Membernum;i++) { p=list.GetMemberSocket(i); if( (p != NULL) && (p!=pDataSocket) ) { // 이미 온라인인 사람들에게 방금 로그인 한것을 알림. data.Setdata(D_LOGIN_MEMBER, true, id, name); *p << data; } } } void CChatSDlg::Send_LOGOUT_MEMBER(CString id) { CDataSocket * p; CData data; // 로긴되어있는 멤버의 데이터소켓 구함 -_-;; for(int i=0;i<list.m_Membernum;i++) { p=list.GetMemberSocket(i); if(p != NULL) { // 이미 온라인인 사람들에게 방금 로그아웃 한것을 알림. data.Setdata(D_LOGOUT_MEMBER,true,id); *p << data; } } } void CChatSDlg::Send_LOGOUT(CString id) { // 해당 아이디의 연결을 강제로 해제 CDataSocket * p; CData data; for(int i=0;i<list.m_Membernum;i++) { if(list.GetMemberID(i) == id) { // 로그아웃하라는 메시지 전달 p = list.GetMemberSocket(i); data.Setdata(D_LOGOUT,true); *p << data; break; } } } void CChatSDlg::Receive_ADD_MYLIST(CDataSocket * pDataSocket, CString id, CString destid) { // 멤버 찾기 int nSel = list.ExistMember(id); int nSel2 = list.ExistMember(destid); int nSel3 = list.GetMemberMylistExist(nSel, destid); CData data; CString str; str.Format("%s - 대화상대 %s 추가 요청", id, destid); m_ctrlList1.AddString(str); m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); if (nSel != -1 && nSel2 != -1 && nSel3 == -1 && nSel != nSel2) { str.Format("%s - 대화상대 %s 추가 성공", id, destid); m_ctrlList1.AddString(str); m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); // 데이터 변경 list.AddMemberMylist(nSel, destid); // 대화상대 추가 성공 결과 세팅 data.Setdata(D_ADD_MYLIST, true, destid); *pDataSocket << data; // 새로 추가한 대화상대가 로그인 되어있는 경우, 대화상대가 로그인했다고 전송 if(list.GetMemberOnline(nSel2)) { data.Setdata(D_LOGIN_MEMBER, true, list.GetMemberID(nSel2), list.GetMemberName(nSel2)); *pDataSocket << data; } } else { // 아이디가 존재하지 않는 경우 또는 대화상대를 이미 추가했던 경우. // 실패 결과 세팅 data.Setdata(D_ADD_MYLIST,false); *pDataSocket << data; } } void CChatSDlg::Receive_DEL_MYLIST(CDataSocket * pDataSocket, CData * pData) { // 멤버 찾기 int nSel = list.ExistMember(pData->m_strId); int nSel3 = list.GetMemberMylistExist(nSel, pData->m_strDestId); if (nSel != -1 && nSel3 != -1) { CString str; str.Format("%s - 대화상대 %s 삭제", pData->m_strId, pData->m_strDestId); m_ctrlList1.AddString(str); m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); // 데이터 변경 list.DelMemberMylist(nSel, pData->m_strDestId); } } void CChatSDlg::Receive_JOIN_MEMBER(CDataSocket * pDataSocket, CString id, CString pass, CString name) { /// 회원가입 요청시.. CData data; if(list.Addmember(id,pass,name)){ // 멤버추가가 됐을 경우 다이얼로그에 표시.. m_ctrlList2.InsertItem(list.m_Membernum-1, id); m_ctrlList2.SetItemText(list.m_Membernum-1, 1, name); m_ctrlList2.SetItemText(list.m_Membernum-1, 2, "오프라인"); data.Setdata(D_JOIN_RESULT,true,id); CString str; str.Format("%s - 회원가입", id); m_ctrlList1.AddString(str); m_ctrlList1.SetCurSel(m_ctrlList1.GetCount()-1); } else { data.Setdata(D_JOIN_RESULT,false,id); } * pDataSocket << data; }
[ [ [ 1, 609 ] ] ]
c6ae62bae17c0ec324ca0aa0d67cbb08a72dce4d
b08e948c33317a0a67487e497a9afbaf17b0fc4c
/Display/Font.h
03d4940ce4ff0bfd662810249e01fff5b4dea7da
[]
no_license
15831944/bastionlandscape
e1acc932f6b5a452a3bd94471748b0436a96de5d
c8008384cf4e790400f9979b5818a5a3806bd1af
refs/heads/master
2023-03-16T03:28:55.813938
2010-05-21T15:00:07
2010-05-21T15:00:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,208
h
#ifndef __FONT_H__ #define __FONT_H__ #include "../Display/Display.h" namespace ElixirEngine { //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- class DisplayFontText : public DisplayObject { public: DisplayFontText(); virtual ~DisplayFontText(); virtual void SetText(const wstring& _wstrText) = 0; virtual void SetColor(const Vector4& _f4Color) = 0; }; //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- class DisplayFont : public CoreObject { public: DisplayFont(DisplayFontManagerRef _rFontManager); virtual ~DisplayFont(); virtual DisplayFontTextPtr CreateText() = 0; virtual void ReleaseText(DisplayFontTextPtr _pText) = 0; virtual DisplayRef GetDisplay() = 0; protected: DisplayFontManagerRef m_rFontManager; }; //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- class DisplayFontLoader : public CoreObject { public: DisplayFontLoader(DisplayFontManagerRef _rFontManager); virtual ~DisplayFontLoader(); virtual DisplayFontPtr Load(const string& _strFileName) = 0; virtual void Unload(DisplayFontPtr _pFont) = 0; protected: DisplayFontManagerRef m_rFontManager; }; //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- class DisplayFontManager : public CoreObject { public: DisplayFontManager(DisplayRef _rDisplay); virtual ~DisplayFontManager(); virtual bool Create(const boost::any& _rConfig); virtual void Update(); virtual void Release(); bool Load(const Key& _uNameKey, const string& _strFileName); void Unload(const Key& _uNameKey); DisplayFontPtr Get(const Key& _uNameKey); DisplayRef GetDisplay(); protected: struct Link { Link(); Link(DisplayFontPtr _pFont, DisplayFontLoaderPtr _pLoader); DisplayFontPtr m_pFont; DisplayFontLoaderPtr m_pLoader; }; typedef map<Key, Link> LinkMap; protected: bool RegisterLoader(const Key& _uExtensionKey, DisplayFontLoaderPtr _pLoader); void UnregisterLoader(const Key& _uExtensionKey); DisplayFontLoaderPtr GetLoader(const Key& _uExtensionKey); protected: DisplayRef m_rDisplay; LinkMap m_mFonts; DisplayFontLoaderPtrMap m_mLoaders; }; } #endif
[ "voodoohaust@97c0069c-804f-11de-81da-11cc53ed4329" ]
[ [ [ 1, 100 ] ] ]
2911977037dcf90032e3ea835197aaae34a63ec6
26706a661c23f5c2c1f97847ba09f44b7b425cf6
/TaskManager/perfmon.h
80a3b758afb95503bd026a4d2e40fbb9a35404c6
[]
no_license
124327288/nativetaskmanager
96a54dbe150f855422d7fd813d3631eaac76fadd
e75b3d9d27c902baddbb1bef975c746451b1b8bb
refs/heads/master
2021-05-29T05:18:26.779900
2009-02-10T13:23:28
2009-02-10T13:23:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,374
h
// PerfMon.h: interface for the CPerfMon class. // ////////////////////////////////////////////////////////////////////// // By Mike Ryan ([email protected]) // Copyright (c) 2000, portions (c) Allen Denver // 07.30.2000 // // Some of the code based on Allen Denver's article "Using the Performance Data Helper Library" // // Free usage granted in all applications including commercial. // Do NOT distribute without permission from me. I can be reached // at [email protected], http://www.codexia.com // Please feel free to email me about this class. // // Compatibility: // Windows 98, Windows NT 4.0 SP 3 (Dlls required), Windows 2000 // // Development Environ: // Visual C++ 6.0 // // Libraries / DLLs: // pdh.lib (linked in) // pdh.dll (provided with Windows 2000, must copy in for NT 4.0) // ////////////////////////////////////////////////////////////////////// #ifndef _PERFMON_H #define _PERFMON_H #include <afxtempl.h> #include <pdh.h> #include <pdhmsg.h> #include <list> #pragma comment(lib,"pdh") using namespace std; namespace PDH { #define MAX_RAW_VALUES 20 //// DEFINES FOR COUNTER NAMES //// //#define CNTR_CPU "\\Processor(_Total)\\% Processor Time" // % of cpu in use //#define CNTR_MEMINUSE_BYTES "\\Memory\\Committed Bytes" // mem in use measured in bytes //#define CNTR_MEMAVAIL_BYTES "\\Memory\\Available Bytes" // mem available measured in bytes //#define CNTR_MEMAVAIL_KB "\\Memory\\Available KBytes" // mem avail in kilobytes //#define CNTR_MEMAVAIL_MB "\\Memory\\Available MBytes" // mem avail in megabytes //#define CNTR_MEMINUSE_PERCENT "\\Memory\\% Committed Bytes In Use" // % of mem in use //#define CNTR_MEMLIMIT_BYTES "\\Memory\\Commit Limit" // commit limit on memory in bytes // NOTE: Find other counters using the function PdhBrowseCounters() (lookup in MSDN). // This function was not implemented in this class. typedef struct _tag_PDHCounterStruct { int nIndex; // The index of this counter, returned by AddCounter() LONG lValue; // The current value of this counter HCOUNTER hCounter; // Handle to the counter - given to use by PDH Library int nNextIndex; // element to get the next raw value int nOldestIndex; // element containing the oldes raw value int nRawCount; // number of elements containing raw values PDH_RAW_COUNTER a_RawValue[MAX_RAW_VALUES]; // Ring buffer to contain raw values } PDHCOUNTERSTRUCT, *PPDHCOUNTERSTRUCT; class CPerfMon { public: CPerfMon(); virtual ~CPerfMon(); //// SETUP //// BOOL Initialize(void); void Uninitialize(void); //// COUNTERS //// int AddCounter(LPCTSTR pszCounterName); BOOL RemoveCounter(int nIndex); BOOL RemoveAllCounter(); //// DATA //// BOOL CollectQueryData(void); BOOL GetStatistics(long *nMin, long *nMax, long *nMean, int nIndex); long GetCounterValue(int nIndex); protected: //// COUNTERS //// PPDHCOUNTERSTRUCT GetCounterStruct(int nIndex); //// VALUES //// BOOL UpdateValue(PPDHCOUNTERSTRUCT pCounter); BOOL UpdateRawValue(PPDHCOUNTERSTRUCT pCounter); private: //// VARIABLES //// HQUERY m_hQuery; // the query to the PDH list<PPDHCOUNTERSTRUCT> m_vecPer; int m_nNextIndex; }; // end of class }; // end of namespace #endif
[ "[email protected]@97a26042-f463-11dd-a7be-4b3ef3b0700c" ]
[ [ [ 1, 108 ] ] ]
59ca920ed05fa37905d3569891af2a888e3e097d
04fec4cbb69789d44717aace6c8c5490f2cdfa47
/include/wx/generic/dataview.h
db51530bb3656fcdd89c0ab724d0edf47f5cc7e5
[]
no_license
aaryanapps/whiteTiger
04f39b00946376c273bcbd323414f0a0b675d49d
65ed8ffd530f20198280b8a9ea79cb22a6a47acd
refs/heads/master
2021-01-17T12:07:15.264788
2010-10-11T20:20:26
2010-10-11T20:20:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
10,596
h
///////////////////////////////////////////////////////////////////////////// // Name: wx/generic/dataview.h // Purpose: wxDataViewCtrl generic implementation header // Author: Robert Roebling // Id: $Id: dataview.h 41659 2006-10-06 09:50:45Z RR $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __GENERICDATAVIEWCTRLH__ #define __GENERICDATAVIEWCTRLH__ #include "wx/defs.h" #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" #include "wx/scrolwin.h" #include "wx/icon.h" // --------------------------------------------------------- // classes // --------------------------------------------------------- class WXDLLIMPEXP_ADV wxDataViewCtrl; class WXDLLIMPEXP_ADV wxDataViewMainWindow; class WXDLLIMPEXP_ADV wxDataViewHeaderWindow; // --------------------------------------------------------- // wxDataViewRenderer // --------------------------------------------------------- class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase { public: wxDataViewRenderer( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); virtual ~wxDataViewRenderer(); virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0; virtual wxSize GetSize() = 0; virtual bool Activate( wxRect WXUNUSED(cell), wxDataViewListModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row) ) { return false; } virtual bool LeftClick( wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), wxDataViewListModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row) ) { return false; } virtual bool RightClick( wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), wxDataViewListModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row) ) { return false; } virtual bool StartDrag( wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), wxDataViewListModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row) ) { return false; } // Create DC on request virtual wxDC *GetDC(); private: wxDC *m_dc; protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer) }; // --------------------------------------------------------- // wxDataViewCustomRenderer // --------------------------------------------------------- class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer { public: wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer) }; // --------------------------------------------------------- // wxDataViewTextRenderer // --------------------------------------------------------- class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewCustomRenderer { public: wxDataViewTextRenderer( const wxString &varianttype = wxT("string"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); bool SetValue( const wxVariant &value ); bool GetValue( wxVariant &value ); bool Render( wxRect cell, wxDC *dc, int state ); wxSize GetSize(); private: wxString m_text; protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer) }; // --------------------------------------------------------- // wxDataViewBitmapRenderer // --------------------------------------------------------- class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewCustomRenderer { public: wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); bool SetValue( const wxVariant &value ); bool GetValue( wxVariant &value ); bool Render( wxRect cell, wxDC *dc, int state ); wxSize GetSize(); private: wxIcon m_icon; wxBitmap m_bitmap; protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer) }; // --------------------------------------------------------- // wxDataViewToggleRenderer // --------------------------------------------------------- class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewCustomRenderer { public: wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); bool SetValue( const wxVariant &value ); bool GetValue( wxVariant &value ); bool Render( wxRect cell, wxDC *dc, int state ); bool Activate( wxRect cell, wxDataViewListModel *model, unsigned int col, unsigned int row ); wxSize GetSize(); private: bool m_toggle; protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer) }; // --------------------------------------------------------- // wxDataViewProgressRenderer // --------------------------------------------------------- class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer { public: wxDataViewProgressRenderer( const wxString &label = wxEmptyString, const wxString &varianttype = wxT("long"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); virtual ~wxDataViewProgressRenderer(); bool SetValue( const wxVariant &value ); virtual bool Render( wxRect cell, wxDC *dc, int state ); virtual wxSize GetSize(); private: wxString m_label; int m_value; protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) }; // --------------------------------------------------------- // wxDataViewDateRenderer // --------------------------------------------------------- class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer { public: wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"), wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE ); bool SetValue( const wxVariant &value ); virtual bool Render( wxRect cell, wxDC *dc, int state ); virtual wxSize GetSize(); virtual bool Activate( wxRect cell, wxDataViewListModel *model, unsigned int col, unsigned int row ); private: wxDateTime m_date; protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer) }; // --------------------------------------------------------- // wxDataViewColumn // --------------------------------------------------------- class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase { public: wxDataViewColumn( const wxString &title, wxDataViewRenderer *renderer, unsigned int model_column, int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); wxDataViewColumn( const wxBitmap &bitmap, wxDataViewRenderer *renderer, unsigned int model_column, int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); virtual ~wxDataViewColumn(); virtual void SetTitle( const wxString &title ); virtual void SetBitmap( const wxBitmap &bitmap ); virtual void SetAlignment( wxAlignment align ); virtual void SetSortable( bool sortable ); virtual bool GetSortable(); virtual void SetSortOrder( bool ascending ); virtual bool IsSortOrderAscending(); virtual int GetWidth(); private: int m_width; int m_fixedWidth; protected: DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn) }; // --------------------------------------------------------- // wxDataViewCtrl // --------------------------------------------------------- class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase, public wxScrollHelperNative { public: wxDataViewCtrl() : wxScrollHelperNative(this) { Init(); } wxDataViewCtrl( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator ) : wxScrollHelperNative(this) { Create(parent, id, pos, size, style, validator ); } virtual ~wxDataViewCtrl(); void Init(); bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator ); virtual bool AssociateModel( wxDataViewListModel *model ); virtual bool AppendColumn( wxDataViewColumn *col ); virtual void SetSelection( int row ); // -1 for unselect virtual void SetSelectionRange( unsigned int from, unsigned int to ); virtual void SetSelections( const wxArrayInt& aSelections); virtual void Unselect( unsigned int row ); virtual bool IsSelected( unsigned int row ) const; virtual int GetSelection() const; virtual int GetSelections(wxArrayInt& aSelections) const; private: friend class wxDataViewMainWindow; friend class wxDataViewHeaderWindow; wxDataViewListModelNotifier *m_notifier; wxDataViewMainWindow *m_clientArea; wxDataViewHeaderWindow *m_headerArea; private: void OnSize( wxSizeEvent &event ); // we need to return a special WM_GETDLGCODE value to process just the // arrows but let the other navigation characters through #ifdef __WXMSW__ virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); #endif // __WXMSW__ WX_FORWARD_TO_SCROLL_HELPER() private: DECLARE_DYNAMIC_CLASS(wxDataViewCtrl) DECLARE_NO_COPY_CLASS(wxDataViewCtrl) DECLARE_EVENT_TABLE() }; #endif // __GENERICDATAVIEWCTRLH__
[ [ [ 1, 311 ] ] ]
9fdfeb30927c2a42658fc7192db0f54e28839cbd
854ee643a4e4d0b7a202fce237ee76b6930315ec
/arcemu_svn/src/sun/src/CustomTeleporter/skillnpc.cpp
56035adb9c2be98e96b26c6a483c9ee95ade4520
[]
no_license
miklasiak/projekt
df37fa82cf2d4a91c2073f41609bec8b2f23cf66
064402da950555bf88609e98b7256d4dc0af248a
refs/heads/master
2021-01-01T19:29:49.778109
2008-11-10T17:14:14
2008-11-10T17:14:14
34,016,391
2
0
null
null
null
null
IBM852
C++
false
false
12,731
cpp
// Major Updates, Fixes, and Core by Nebels // Some help by insanesk8123 <3 // Version 3.0 #include "StdAfx.h" #include "Setup.h" class SCRIPT_DECL SkillNPC : public GossipScript{ public: void GossipHello(Object *pObject, Player *Plr, bool AutoSend); void GossipSelectOption(Object *pObject, Player *Plr, uint32 Id, uint32 IntId, const char *Code); void GossipEnd(Object *pObject, Player *Plr); void Destroy(){ delete this; } }; void SkillNPC::GossipEnd(Object * pObject, Player* Plr){ GossipScript::GossipEnd(pObject, Plr); } void SkillNPC::GossipHello(Object *pObject, Player *Plr, bool AutoSend){ GossipMenu *Menu; objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr); if (Plr->getClass() == 1) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Krieger lernen?", 1); } if (Plr->getClass() == 2) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Paladine lernen?", 2); } if (Plr->getClass() == 3) { Menu->AddItem(0, "Welche Zauber k\195\182nnen J\195\164ger lernen?", 3); } if (Plr->getClass() == 9) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Hexenmeister lernen?", 4); } if (Plr->getClass() == 11) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Druiden lernen?", 5); } if (Plr->getClass() == 4) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Schurken lernen?", 6); } if (Plr->getClass() == 5) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Priester lernen?", 7); } if (Plr->getClass() == 7) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Schamanen lernen?", 8); } if (Plr->getClass() == 8) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Magier lernen?", 9); } Menu->AddItem(5, "Talentpunkte zur\195\188cksetzen", 98); Menu->SendTo(Plr); } void SkillNPC::GossipSelectOption(Object *pObject, Player *Plr, uint32 Id, uint32 IntId, const char *Code){ Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT) ? ((Creature*)pObject) : NULL; GossipMenu * Menu; switch(IntId){ case 0: // Return to start GossipHello(pObject, Plr, true); break; case 1: objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr); Menu->AddItem(5, "Spott", 10); Menu->AddItem(5, "Abfangen", 13); Menu->AddItem(5, "T÷dlicher Sto▀", 14); Menu->AddItem(5, "Verteidigungshaltung", 11); Menu->AddItem(5, "Berserkerhaltung", 12); Menu->AddItem(0, "[Zur\195\188ck]", 99); Menu->SendTo(Plr); break; case 2: objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr); Menu->AddItem(5, "Erl\195\182sung", 22); Menu->AddItem(5, "Schlachtross beschw\195\182ren", 20); Menu->AddItem(5, "Streitross beschw\195\182ren", 21); Menu->AddItem(0, "[Zur\195\188ck]", 99); Menu->SendTo(Plr); break; case 3: objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr); Menu->AddItem(5, "Pet spells", 30); Menu->AddItem(0, "[Zur\195\188ck]", 99); Menu->SendTo(Plr); break; case 4: objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr); Menu->AddItem(5, "Pet Spells", 40); Menu->AddItem(5, "Teufelsross beschw\195\182ren", 41); Menu->AddItem(5, "Schreckensross beschw\195\182ren", 42); Menu->AddItem(0, "[Zur\195\188ck]", 99); Menu->SendTo(Plr); break; case 5: objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr); Menu->AddItem(5, "Knurren", 50); Menu->AddItem(5, "Zerfleischen", 55); Menu->AddItem(5, "B\195\164rengestalt", 54); Menu->AddItem(5, "Terrorb\195\164rengestalt", 51); Menu->AddItem(5, "Wassergestalt", 56); Menu->AddItem(5, "Fluggestalt", 52); Menu->AddItem(5, "Schnelle Fluggestalt", 53); Menu->AddItem(0, "[Zur\195\188ck]", 99); Menu->SendTo(Plr); break; case 6: objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr); Menu->AddItem(0, "[Zur\195\188ck]", 99); Menu->SendTo(Plr); break; case 7: objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr); Menu->AddItem(0, "[Zur\195\188ck]", 99); Menu->SendTo(Plr); break; case 8: objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr); Menu->AddItem(0, "[Zur\195\188ck]", 99); Menu->SendTo(Plr); break; case 9: objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr); Menu->AddItem(0, "[Zur\195\188ck]", 99); Menu->SendTo(Plr); break; case 10: // Warrior-Taunt if(Plr->getLevel() >= 10) { Plr->addSpell(355); Plr->BroadcastMessage("Du hast Spott erlernt."); }else{ Plr->BroadcastMessage("Du musst mindestens Level 10 sein, um Spott zu erlernen."); } break; case 11: // Warrior-Defensive Stance if(Plr->getLevel() >= 10) { Plr->addSpell(71); Plr->BroadcastMessage("Du hast die Verteidigungshaltung erlernt."); }else{ Plr->BroadcastMessage("Du musst mindestens Level 10 sein, um die Verteidigungshaltung zu erlernen."); } break; case 12: // Warrior-Beserker Stance if(Plr->getLevel() >= 30) { Plr->addSpell(2458); Plr->BroadcastMessage("Du hast die Berserkerhaltung erlernt."); }else{ Plr->BroadcastMessage("Du musst mindestens Level 30 sein, um die Berserkerhaltung zu erlernen."); } break; case 13: // Warrior-Intercept if(Plr->getLevel() >= 10) { Plr->addSpell(25275); Plr->BroadcastMessage("Du hast Abfangen erlernt."); }else{ Plr->BroadcastMessage("Du musst mindestens Level 10 sein, um Abfangen zu erlernen."); } break; case 14: // Warrior-Mortal Strike if(Plr->getLevel() >= 40) { Plr->addSpell(30330); Plr->BroadcastMessage("Du hast T÷dlicher Sto▀ erlernt."); }else{ Plr->BroadcastMessage("Du musst mindestens Level 40 sein, um T÷dlicher Sto▀ zu erlernen."); } break; case 20: // Paladin-Warhorse if(Plr->getLevel() >= 40) { Plr->addSpell(13819); Plr->BroadcastMessage("Du hast Schlachtross beschw\195\182ren erlernt."); }else{ Plr->BroadcastMessage("Du musst mindestens Level 40 sein, um Schlachtross beschw\195\182ren zu erlernen."); } break; case 21: // Paladin-Charger if(Plr->getLevel() >= 60) { Plr->addSpell(34767); Plr->BroadcastMessage("Du hast Streitross beschw\195\182ren erlernt."); }else{ Plr->BroadcastMessage("Du musst mindestens Level 60 sein, um Streitross beschw\195\182ren zu erlernen."); } break; case 22: // Paladin-Redemption if(Plr->getLevel() >= 10) { Plr->addSpell(20773); Plr->BroadcastMessage("Du hast Erl\195\182sung erlernt."); }else{ Plr->BroadcastMessage("Du musst mindestens Level 10 sein, um Erl\195\182sung zu erlernen."); } break; case 30: // Hunter-Pet Spells if(Plr->getLevel() >= 10) { Plr->addSpell(1515); Plr->addSpell(883); Plr->addSpell(5149); Plr->addSpell(982); Plr->addSpell(6991); Plr->BroadcastMessage("Du hast deine J\195\164ger Pet Spells erlernt."); Plr->Gossip_Complete(); }else{ Plr->BroadcastMessage("Du musst mindestens Level 10 sein."); Plr->Gossip_Complete(); } break; case 40: // Warlock-Pet Spells if(Plr->getLevel() >= 10) { Plr->addSpell(688); Plr->addSpell(697); Plr->addSpell(712); Plr->addSpell(691); Plr->BroadcastMessage("Du hast deine Hexenmeister Pet Spells erlernt."); Plr->Gossip_Complete(); }else{ Plr->BroadcastMessage("Du musst mindestens Level 10 sein."); Plr->Gossip_Complete(); } break; case 41: // Warlock-Felsteed if(Plr->getLevel() >= 40) { Plr->addSpell(5784); Plr->BroadcastMessage("Du hast Teufelsross beschw\195\182ren erlernt."); Plr->Gossip_Complete(); }else{ Plr->BroadcastMessage("Du musst mindestens Level 40 sein, um Teufelsross beschw\195\182ren zu erlernen."); Plr->Gossip_Complete(); } break; case 42: // Warlock-Dreadsteed if(Plr->getLevel() >= 60) { Plr->addSpell(23161); Plr->BroadcastMessage("Du hast Schreckensross beschw\195\182ren erlernt."); Plr->Gossip_Complete(); }else{ Plr->BroadcastMessage("Du musst mindestens Level 60 sein, um Schreckensross beschw\195\182ren zu erlernen."); Plr->Gossip_Complete(); } break; case 50: // Druid-Growl if(Plr->getLevel() >= 10) { Plr->addSpell(6795); Plr->BroadcastMessage("Du hast Knurren erlernt."); Plr->Gossip_Complete(); }else{ Plr->BroadcastMessage("Du musst mindestens Level 10 sein, um Knurren zu erlernen."); Plr->Gossip_Complete(); } break; case 51: // Druid-Dire Bear Form if(Plr->getLevel() >= 30) { Plr->addSpell(9634); Plr->BroadcastMessage("Du hast die Terrorb\195\164rengestalt erlernt."); Plr->Gossip_Complete(); }else{ Plr->BroadcastMessage("Du musst mindestens Level 30 sein, um die Terrorb\195\164rengestalt zu erlernen."); Plr->Gossip_Complete(); } break; case 52: // Druid-Normal Flight Form if(Plr->getLevel() >= 68) { Plr->addSpell(33943); Plr->BroadcastMessage("Du hast die Fluggestalt erlernt."); Plr->Gossip_Complete(); }else{ Plr->BroadcastMessage("Du musst mindestens Level 68 sein, um die Fluggestalt zu erlernen."); Plr->Gossip_Complete(); } break; case 53: // Druid-Epic Flight Form if(Plr->getLevel() >= 70) { Plr->addSpell(40120); Plr->BroadcastMessage("Du hast die Schnelle Fluggestalt erlernt."); Plr->Gossip_Complete(); }else{ Plr->BroadcastMessage("Du musst mindestens Level 70 sein, um die Schnelle Fluggestalt zu erlernen."); Plr->Gossip_Complete(); } case 54: // Druid- if(Plr->getLevel() >= 10) { Plr->addSpell(6795); Plr->BroadcastMessage("Du hast die B\195\164rengestalt erlernt"); Plr->Gossip_Complete(); }else{ Plr->BroadcastMessage("Du musst mindesten Level 10 sein, um die B\195\164rengestalt zu erlernen."); Plr->Gossip_Complete(); } break; case 55: // Druid-Maul if(Plr->getLevel() >= 67) { Plr->addSpell(6795); Plr->BroadcastMessage("Du hast Zerfleischen erlernt."); Plr->Gossip_Complete(); }else{ Plr->BroadcastMessage("Du musst mindestens Level 67 sein, um Zerfleischen zu erlernen."); Plr->Gossip_Complete(); } break; case 56: // Druid-Aquatic Form if(Plr->getLevel() >= 20) { Plr->addSpell(6795); Plr->BroadcastMessage("Du hast die Wassergestalt erlernt."); Plr->Gossip_Complete(); }else{ Plr->BroadcastMessage("Du musst mindestens Level 67 sein, um die Wassergestalt zu erlernen."); Plr->Gossip_Complete(); } break; case 98: // Reset Talents { Plr->Reset_Talents(); Plr->BroadcastMessage("Du hast deine Talentpunkte zur\195\188ckgesetzt."); Plr->Gossip_Complete(); } break; case 99: //Main Menu objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr); if (Plr->getClass() == 1) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Krieger lernen?", 1); } if (Plr->getClass() == 2) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Paladine lernen?", 2); } if (Plr->getClass() == 3) { Menu->AddItem(0, "Welche Zauber k\195\182nnen J\195\164ger lernen?", 3); } if (Plr->getClass() == 9) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Hexenmeister lernen?", 4); } if (Plr->getClass() == 11) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Druiden lernen?", 5); } if (Plr->getClass() == 4) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Schurken lernen?", 6); } if (Plr->getClass() == 5) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Priester lernen?", 7); } if (Plr->getClass() == 7) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Schamanen lernen?", 8); } if (Plr->getClass() == 8) { Menu->AddItem(0, "Welche Zauber k\195\182nnen Magier lernen?", 9); } Menu->AddItem(5, "Talentpunkte zur\195\188cksetzen", 98); Menu->SendTo(Plr); break; } } void SetupSkillNPC(ScriptMgr * mgr) { mgr->register_gossip_script(30010, (GossipScript*) new SkillNPC()); }
[ "[email protected]@3074cc92-8d2b-11dd-8ab4-67102e0efeef" ]
[ [ [ 1, 414 ] ] ]
e920c8e2b16560982c021d1e152aa40cae33460e
eec9d789e04bc81999ac748ca2c70f0a612dadb7
/testProject/injectDll/stdafx.cpp
fdc14fc859d854237678532c460f995049694657
[]
no_license
scriptkitz/myfirstpro-test
45d79d9a35fe5ee1e8f237719398d08d7d86b859
a3400413e3a7900657774a278006faea7d682955
refs/heads/master
2021-01-22T07:13:27.100583
2010-11-16T15:02:50
2010-11-16T15:02:50
38,792,869
0
0
null
null
null
null
UTF-8
C++
false
false
296
cpp
// stdafx.cpp : source file that includes just the standard includes // injectDll.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file
[ "scriptkitz@da890e6b-1f8b-8dbb-282d-e1a1f9b2274c" ]
[ [ [ 1, 8 ] ] ]
5397adeb479fd3cc5a95465e5834a45b4cdcd6e7
6baa03d2d25d4685cd94265bd0b5033ef185c2c9
/TGL/src/objects/TGLobject_bullet_missile.cpp
ba4698760ed7f49ef23498fb6e1cdd5b3902eeb3
[]
no_license
neiderm/transball
6ac83b8dd230569d45a40f1bd0085bebdc4a5b94
458dd1a903ea4fad582fb494c6fd773e3ab8dfd2
refs/heads/master
2021-01-10T07:01:43.565438
2011-12-12T23:53:54
2011-12-12T23:53:54
55,928,360
0
0
null
null
null
null
UTF-8
C++
false
false
2,278
cpp
#ifdef KITSCHY_DEBUG_MEMORY #include "debug_memorymanager.h" #endif #ifdef _WIN32 #include <windows.h> #endif #include <stdio.h> #include <stdlib.h> #include "math.h" #include "string.h" #include "gl.h" #include "glu.h" #include "SDL.h" #include "SDL_mixer.h" #include "SDL_ttf.h" #include "List.h" #include "Symbol.h" #include "2DCMC.h" #include "auxiliar.h" #include "GLTile.h" #include "2DCMC.h" #include "sound.h" #include "keyboardstate.h" #include "randomc.h" #include "VirtualController.h" #include "GLTManager.h" #include "SFXManager.h" #include "TGLobject.h" #include "TGLobject_bullet.h" #include "TGLobject_bullet_missile.h" #include "TGLobject_enemy.h" #include "TGLobject_FX_particle.h" #include "TGLmap.h" #include "debug.h" TGLobject_bullet_missile::TGLobject_bullet_missile(float x,float y,int ao,int angle,float speed,int power,GLTile *tile,GLTile *tile2,TGLobject *ship) : TGLobject_bullet(x,y,ao,angle,speed,power,tile,ship) { m_tile2=tile2; } /* TGLobject_bullet_missile::TGLobject_bullet_missile */ bool TGLobject_bullet_missile::cycle(VirtualController *k,class TGLmap *map,GLTManager *GLTM,SFXManager *SFXM,int sfx_volume) { if ((m_cycle%4)==0) map->add_auxiliary_back_object(new TGLobject_FX_particle(get_x(),get_y(),rand()%60,0,0,1,false,0.125f,0,0.25f,0.75f,50,GLTM->get("objects/smoke"))); return TGLobject_bullet::cycle(k,map,GLTM,SFXM,sfx_volume); } /* TGLobject_bullet_missile::cycle */ void TGLobject_bullet_missile::draw(GLTManager *GLTM) { if (((m_cycle/4)%2)==0) m_last_tile=m_tile; else m_last_tile=m_tile2; if (m_last_tile!=0) m_last_tile->draw(m_x,m_y,0,float(m_angle),1); } /* TGLobject_bullet_missile::draw */ bool TGLobject_bullet_missile::is_a(Symbol *c) { if (c->cmp("TGLobject_bullet_missile")) return true; return TGLobject_bullet::is_a(c); } /* TGLobject_bullet_missile::is_a */ bool TGLobject_bullet_missile::is_a(char *c) { bool retval; Symbol *s=new Symbol(c); retval=is_a(s); delete s; return retval; } /* TGLobject_bullet_missile::is_a */ const char *TGLobject_bullet_missile::get_class(void) { return "TGLobject_bullet_missile"; } /* TGLobject_bullet_missile::get_class */
[ "santi.ontanon@535450eb-5f2b-0410-a0e9-a13dc2d1f197" ]
[ [ [ 1, 92 ] ] ]
5af92bddb01863a8703146c4ec9e3949de3a9439
43626054205d6048ec98c76db5641ce8e42b8237
/source/SGD Wrappers/CSGD_TextureManager.h
cc9679d9bce1824ae6a95d52297a9a246174f24b
[]
no_license
Wazoobi/whitewings
b700da98b855a64442ad7b7c4b0be23427b0ee23
a53fdb832cfb1ce8605209c9af47f36b01c44727
refs/heads/master
2021-01-10T19:33:22.924792
2009-08-05T18:30:07
2009-08-05T18:30:07
32,119,981
0
0
null
null
null
null
UTF-8
C++
false
false
7,405
h
//////////////////////////////////////////////////////// // File : "CSGD_TextureManager.h" // // Author : Jensen Rivera (JR) // // Date Created : 6/26/2006 // // Purpose : Wrapper class for Direct3D. //////////////////////////////////////////////////////// /* Disclaimer: This source code was developed for and is the property of: Full Sail University Game Development Curriculum 2008-2009 and Full Sail Real World Education Game Design Curriculum 2000-2008 Full Sail students may not redistribute this code, but may use it in any project for educational purposes. */ #pragma once // The include files for Direct3D9 #include <d3d9.h> #include <d3dx9.h> #include <vector> using std::vector; using std::string; class CSGD_TextureManager { private: // All the data we need to contain a texture. typedef struct _TEXTURE { char filename[_MAX_PATH]; // The filename of this texture. int ref; // The number of times this texture has be loaded. LPDIRECT3DTEXTURE9 texture; // A pointer to the texture. int Width; // The width of the texture. int Height; // The Height of the texture. // Default constructor. _TEXTURE() { filename[0] = '\0'; ref = 0; texture = NULL; Width = 0; Height = 0; } } TEXTURE, *LPTEXTURE; private: /////////////////////////////////////////////////////////////////// // Function: CSGD_TextureManager(Constructors) /////////////////////////////////////////////////////////////////// CSGD_TextureManager(void); CSGD_TextureManager(CSGD_TextureManager &ref); CSGD_TextureManager &operator=(CSGD_TextureManager &ref); private: vector<TEXTURE> m_Textures; // A list of all the loaded textures. LPDIRECT3DDEVICE9 m_lpDevice; // A pointer to the Direct3D device. LPD3DXSPRITE m_lpSprite; // A pointer to the sprite interface. static CSGD_TextureManager m_Instance; // An instance to this class. public: /////////////////////////////////////////////////////////////////// // Function: CSGD_TextureManager(Destructor) /////////////////////////////////////////////////////////////////// ~CSGD_TextureManager(void); /////////////////////////////////////////////////////////////////// // Function: "GetInstance" // // Last Modified: 6/26/2006 // // Input: void // // Return: An instance to this class. // // Purpose: Gets an instance to this class. /////////////////////////////////////////////////////////////////// static CSGD_TextureManager *GetInstance(void); /////////////////////////////////////////////////////////////////// // Function: "InitializeTextureManager" // // Last Modified: 8/29/2006 // // Input: lpDevice - A pointer to the Direct3D device. // lpSprite - A pointer to the sprite object. // // Return: true, if successful. // // Purpose: Initializes the texture manager. /////////////////////////////////////////////////////////////////// bool InitTextureManager(LPDIRECT3DDEVICE9 lpDevice, LPD3DXSPRITE lpSprite); /////////////////////////////////////////////////////////////////// // Function: "ShutdownTextureManager" // // Last Modified: 10/29/2008 // // Input: void // // Return: void // // Purpose: Unloads all the loaded textures and // releases references to sprite and d3d devices. /////////////////////////////////////////////////////////////////// void ShutdownTextureManager(void); /////////////////////////////////////////////////////////////////// // Function: "LoadTexture" // // Last Modified: 10/29/2008 // // Input: szFilename - The file to load. // dwColorkey - The color key to use on the texture (use D3DCOLOR_XRGB() Macro). // NOTE: 0 = no color key (which will use the alpha from the image instead) // // Return: The id to the texture that was loaded or found, -1 if it failed. // // NOTE: The function searches to see if the texture was already loaded // and returns the id if it was. // // Purpose: To load a texture from a file. // // NOTE: Image dimensions must be a power of 2 (i.e. 256x64). // // Supports .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, // .ppm, and .tga files. /////////////////////////////////////////////////////////////////// int LoadTexture(const char* szFilename, DWORD dwColorkey = 0); /////////////////////////////////////////////////////////////////// // Function: "UnloadTexture" // // Last Modified: 10/29/2008 // // Input: nID - The id to the texture to release. // // Return: void // // Purpose: Releases a reference to a given texture. When the // reference to the texture is zero, the texture is // released from memory. /////////////////////////////////////////////////////////////////// void UnloadTexture(int nID); /////////////////////////////////////////////////////////////////// // Function: "GetTextureWidth" // // Last Modified: 9/21/2006 // // Input: nID - The id to the texture who's width you want. // // Return: The width of the given texture. // // Purpose: Gets the width of a specified texture. /////////////////////////////////////////////////////////////////// int GetTextureWidth(int nID); /////////////////////////////////////////////////////////////////// // Function: "GetTextureHeight" // // Last Modified: 9/21/2006 // // Input: nID - The id to the texture who's height you want. // // Return: The height of the given texture. // // Purpose: Gets the height of a specified texture. /////////////////////////////////////////////////////////////////// int GetTextureHeight(int nID); /////////////////////////////////////////////////////////////////// // Function: "GetTextureFilename" // // Last Modified: 7/24/2009 // // Input: nID - The id to the texture who's filename you want. // // Return: The filename of the given texture. // // Purpose: Gets the filename of a specified texture. /////////////////////////////////////////////////////////////////// string GetTextureFilename(int nID); /////////////////////////////////////////////////////////////////// // Function: "DrawTexture" // // Last Modified: 7/09/2008 // // Input: nID - The id of the texture to draw. // nX - The x position to draw the texture at. // nY - The y position to draw the texture at. // fScaleX - How much to scale the texture in the x. // fScaleY - How much to scale the texture in the y. // pSection - The section of the bitmap to draw. // fRotCenterX - The x center to apply the rotation from. // fRotCenterY - The y center to apply the rotation from. // fRotation - How much to rotate the texture. // dwColor - The color to apply to the texture (use D3DCOLOR_XRGB() Macro). // // Return: true if successful. // // Purpose: Draws a texture to the screen. // // NOTE: Drawing a section of an image will only work properly if // that image is a power of 2! /////////////////////////////////////////////////////////////////// bool Draw(int nID, int nX, int nY, float fScaleX = 1.0f, float fScaleY = 1.0f, RECT* pSection = NULL, float fRotCenterX = 0.0f, float fRotCenterY = 0.0f, float fRotation = 0.0f, DWORD dwColor = 0xFFFFFFFF); };
[ "Juno05@1cfc0206-7002-11de-8585-3f51e31374b7", "gameatronMC@1cfc0206-7002-11de-8585-3f51e31374b7" ]
[ [ [ 1, 28 ], [ 30, 178 ], [ 193, 218 ] ], [ [ 29, 29 ], [ 179, 192 ] ] ]
5248e0dd38a9aa826a1f0744a71469f5267db30e
4323418f83efdc8b9f8b8bb1cc15680ba66e1fa8
/Trunk/Battle Cars/Battle Cars/Source/ParticleManager.h
288179f72f0772f4c19c24ee3b7b4c680138c630
[]
no_license
FiveFourFive/battle-cars
5f2046e7afe5ac50eeeb9129b87fcb4b2893386c
1809cce27a975376b0b087a96835347069fe2d4c
refs/heads/master
2021-05-29T19:52:25.782568
2011-07-28T17:48:39
2011-07-28T17:48:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,632
h
#ifndef PARTICLEMANAGER_H_ #define PARTICLEMANAGER_H_ #include <vector> using std::vector; class Emittor; class CBase; class CCamera; enum emittor_types{ COLLISION_EMITTOR, MISSLE_EMITTOR, EXPLOSION_SMOKE_EMITTOR, EXPLOSION_FIREBURST1_EMITTOR, EXPLOSION_FIREBURST2_EMITTOR, EXPLOSION_FIREBURST3_EMITTOR, EXPLOSION_FLAME_EMITTOR, AFTEREXPLOSION_SMOKE_EMITTOR, AFTEREXPLOSION_FLAME_EMITTOR, FLAMETHROWER_EMITTOR, BARREL_EMITTOR, TOTAL_EMITTOR}; class ParticleManager { private: static ParticleManager* instance; // make it a singleton vector<Emittor*> m_GameEmittors; // All the emittors used for the game will be contained here. vector< Emittor*> m_ActiveEmittors; // Active Emittors currently being used. int Count; int ActiveCount; // Constructor ParticleManager(); // Trilogy of Evil: // Destructor // Assignment Operator // Copy Constructor ~ParticleManager(); ParticleManager& operator=(const ParticleManager& ); ParticleManager(const ParticleManager& ); public: //////////////////////////////////////////////// // // Return: The Instance of the Particle Manager // // Input : Void // // Used to grab instance of particle manager to make function calls. //////////////////////////////////////////////// static ParticleManager* GetInstance(); static void DeleteInstance(); // Never actually used, do not call this function without the right authority. //////////////////////////////////////////////// // // Return: void // // Input : delta time // // Calls each emittors individual update. //////////////////////////////////////////////// void UpdateEmittors(float fElapsedTime); //////////////////////////////////////////////// // // Return: void // // Input : void // // Calls each emittors individual render. //////////////////////////////////////////////// void RenderEmittors(CCamera* camera); //////////////////////////////////////////////// // // Return: true if load was succesful, false otherwise // // Input : The name of the file to load from // // Will load the emittors data and then add it to the list // if everything was loaded correctly. //////////////////////////////////////////////// bool LoadEmittor(const char* FileName); ////////////////////////////////////////////////// // // Return: void // // Input: the base object to attach to, and the emittor that will be attaching // // This will Set the emittors position to the base position and "attach" it ////////////////////////////////////////////////////////// void AttachToBase(CBase* base, Emittor* emittor); ////////////////////////////////////////////////// // // Return: void // // Input: the offset // // This will set the emittors position to an offset of the Base, // as well as set the base as the emittors base. ////////////////////////////////////////////////// void AttachToBasePosition(CBase* base, Emittor* emittor, float offsetX = 0, float offsetY = 0); /////////////////////////////////////////////////// // // Return: Emittor* // // Input: Emittor* // // This will create a new emittor without overriding the default loaded onces. // Purpose is to reuse the effect and create multiple effects without overriding each other. //////////////////////////////////////////////////// Emittor* CreateEffect( Emittor* temp_emittor, float posX, float posY, float accelX = 0.0f, float accelY = 0.0f); void ShutDownParticleManager(); Emittor* GetEmittor(int id); Emittor* GetActiveEmittor(int id); }; #endif
[ "[email protected]@598269ab-7e8a-4bc4-b06e-4a1e7ae79330", "[email protected]@598269ab-7e8a-4bc4-b06e-4a1e7ae79330" ]
[ [ [ 1, 8 ], [ 10, 10 ], [ 15, 23 ], [ 25, 69 ], [ 71, 103 ], [ 115, 117 ], [ 120, 122 ] ], [ [ 9, 9 ], [ 11, 14 ], [ 24, 24 ], [ 70, 70 ], [ 104, 114 ], [ 118, 119 ] ] ]
8f8e950b42afa414b6b00256375c4f35341ad399
3fb39751cdf6bb5c5229c4408cda110e2ae547c1
/src/SchemeSources.h
b542cc805966b2adfc9345c07fde87c6ea5f9a20
[]
no_license
josephzizys/CM
7308704f9d33f81938f7aeff31b64fb3d217db24
8f8e9a0550e76debfc47fb0f90772a05ca06805b
refs/heads/master
2020-05-20T11:40:06.824661
2011-06-15T11:47:29
2011-06-15T11:47:29
2,552,460
0
0
null
null
null
null
UTF-8
C++
false
false
1,545
h
/* (Auto-generated binary data file). */ #ifndef BINARY_SCHEMESOURCES_H #define BINARY_SCHEMESOURCES_H namespace SchemeSources { extern const char* automata_scm; const int automata_scmSize = 8886; extern const char* fomus_scm; const int fomus_scmSize = 21869; extern const char* genffi_scm; const int genffi_scmSize = 22476; extern const char* loop_scm; const int loop_scmSize = 38481; extern const char* osc_scm; const int osc_scmSize = 5176; extern const char* patterns_scm; const int patterns_scmSize = 36965; extern const char* plot_scm; const int plot_scmSize = 13332; extern const char* ports_scm; const int ports_scmSize = 20101; extern const char* processes_scm; const int processes_scmSize = 7768; extern const char* s7_scm; const int s7_scmSize = 5809; extern const char* sal_scm; const int sal_scmSize = 77308; extern const char* sc_scm; const int sc_scmSize = 4658; extern const char* sndlibws_scm; const int sndlibws_scmSize = 28400; extern const char* spectral_scm; const int spectral_scmSize = 34833; extern const char* toolbox_scm; const int toolbox_scmSize = 41799; extern const char* utilities_scm; const int utilities_scmSize = 15355; }; #endif
[ "taube@d60aafaf-7936-0410-ba4d-d307febf7868" ]
[ [ [ 1, 58 ] ] ]
aaca49f4a65f02e6f38e45c0c0490dc25fbb74c9
ef23e388061a637f82b815d32f7af8cb60c5bb1f
/src/mame/includes/blstroid.h
b8c29570c92e2f94b3f47bb1d3c7b398621749a8
[]
no_license
marcellodash/psmame
76fd877a210d50d34f23e50d338e65a17deff066
09f52313bd3b06311b910ed67a0e7c70c2dd2535
refs/heads/master
2021-05-29T23:57:23.333706
2011-06-23T20:11:22
2011-06-23T20:11:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
627
h
/************************************************************************* Atari Blasteroids hardware *************************************************************************/ #include "machine/atarigen.h" class blstroid_state : public atarigen_state { public: blstroid_state(running_machine &machine, const driver_device_config_base &config) : atarigen_state(machine, config) { } UINT16 * m_priorityram; }; /*----------- defined in video/blstroid.c -----------*/ VIDEO_START( blstroid ); SCREEN_UPDATE( blstroid ); void blstroid_scanline_update(screen_device &screen, int scanline);
[ "Mike@localhost" ]
[ [ [ 1, 24 ] ] ]
6bc052c78102c1b1bdefa9b29c726be0fc2688a7
4e87902f5557521a91f189c174319184c8cd17d9
/src/job.h
2c0daf6d4b07de110da2fd8f0521a2ee334d4511
[ "MIT" ]
permissive
anjinkristou/GTasks
a1ed7435244c6fa8b4e004b4981bfe36fa5cb4c0
1d3b4ba271ea79e65025995585a4a91ee2b86c85
refs/heads/master
2021-01-18T02:45:13.687494
2011-07-30T23:59:23
2011-07-30T23:59:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,259
h
/* * GTasks - A C++/Qt API client for Google Tasks * * Copyright (C) 2011 Gregory Schlomoff <[email protected]> * http://gregschlom.com * * 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 GTASKS_JOB_H #define GTASKS_JOB_H #include <QObject> #include <QVariant> #include <QUrl> class QNetworkReply; class QNetworkRequest; namespace GTasks { class Service; class Error; class Job : public QObject { Q_OBJECT public: enum HttpMethod { Get, Post, Put, Delete, Head }; explicit Job(Service* service, HttpMethod method, const QUrl& url, const char* result); void start(); void startAndCallback(QObject* object, const char* callbackSlot); protected: void addRequestParam(const QString& param, const QVariant& value); void setRequestData(const QVariantMap& data); virtual void parseReply(const QVariantMap& response, const GTasks::Error& error) = 0; private slots: void parseReply(); private: Service* m_service; HttpMethod m_method; QUrl m_url; QMap<QString, QString> m_parameters; QNetworkReply* m_reply; const char* m_resultSignal; QVariantMap m_data; }; } #endif // GTASKS_JOB_H
[ "[email protected]", "greg@.(none)" ]
[ [ [ 1, 38 ], [ 40, 53 ], [ 55, 70 ] ], [ [ 39, 39 ], [ 54, 54 ] ] ]
ee0e22d39f996f1fa490bb04766650f747c26860
54cacc105d6bacdcfc37b10d57016bdd67067383
/trunk/source/io/files/NavFile.cpp
69e5032c42902224254e93b6ac8db0f899562fdb
[]
no_license
galek/hesperus
4eb10e05945c6134901cc677c991b74ce6c8ac1e
dabe7ce1bb65ac5aaad144933d0b395556c1adc4
refs/heads/master
2020-12-31T05:40:04.121180
2009-12-06T17:38:49
2009-12-06T17:38:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
885
cpp
/*** * hesperus: NavFile.cpp * Copyright Stuart Golodetz, 2009. All rights reserved. ***/ #include "NavFile.h" #include <fstream> #include <source/exceptions/Exception.h> #include <source/io/sections/NavSection.h> namespace hesp { //#################### LOADING METHODS #################### NavManager_Ptr NavFile::load(const std::string& filename) { std::ifstream is(filename.c_str(), std::ios_base::binary); if(is.fail()) throw Exception("Could not open " + filename + " for reading"); return NavSection::load(is); } //#################### SAVING METHODS #################### void NavFile::save(const std::string& filename, const NavManager_CPtr& navManager) { std::ofstream os(filename.c_str(), std::ios_base::binary); if(os.fail()) throw Exception("Could not open " + filename + " for writing"); NavSection::save(os, navManager); } }
[ [ [ 1, 31 ] ] ]
5fdba566681147d4ed2af24df8486aad580e2449
2ca3ad74c1b5416b2748353d23710eed63539bb0
/Pilot/Lokapala_Observe/Raptor/OSDecisionSD.cpp
1bc96b7b09ac6981e60e378943c60815ada19194
[]
no_license
sjp38/lokapala
5ced19e534bd7067aeace0b38ee80b87dfc7faed
dfa51d28845815cfccd39941c802faaec9233a6e
refs/heads/master
2021-01-15T16:10:23.884841
2009-06-03T14:56:50
2009-06-03T14:56:50
32,124,140
0
0
null
null
null
null
UHC
C++
false
false
670
cpp
/**@file OSDecisionSD.cpp * @brief OSM의 DecisionSD의 멤버함수 구현 * @author siva */ #include "stdafx.h" #include "OSDecisionSD.h" #include "Resource.h" /**@brief 실행된 프로세스를 알린다.\n * 테스트에서는 단순히 리스트박스에 그 이름만 표시한다. * @param a_executedProcess 실행된 프로세스의 이름 */ void COSDecisionSD::NotifyExecutedProcess(CString a_executedProcess) { CListBox *pListBox = (CListBox *)( (CCBFMediator::Instance()->GetMainDlg())->GetDlgItem(IDC_LISTTEST) ); pListBox->AddString(a_executedProcess); CCBFMediator::Instance()->NotifyExecutedProcess(a_executedProcess); }
[ "nilakantha38@b9e76448-5c52-0410-ae0e-a5aea8c5d16c" ]
[ [ [ 1, 20 ] ] ]
11e804b54ea383f7e9bf42596508b468f9f41b29
24adabaec8e7b0c8bb71366fea2b02e4e8b34203
/db-builder/lib/src/texturefilters/mergetexturefilter.cpp
ecfb58107f8e62b617b987ded8a857091b1c47fe
[]
no_license
weimingtom/db-verkstan
246fb8ce2890b3833a2a84f2369e8e0e5495390f
9101195975ec48f4eed33e65e33c83b2dd9ba8c0
refs/heads/master
2021-01-10T01:36:39.787220
2009-02-23T22:36:09
2009-02-23T22:36:09
43,455,399
1
0
null
null
null
null
UTF-8
C++
false
false
2,794
cpp
#include "db-util.hpp" #include "builder.hpp" #include "filters.hpp" #include "texture.hpp" Texture* TextureFilters::merge(Texture* texture1, Texture* texture2, int mode, bool inPlace) { Texture* newTexture; if (!inPlace) { newTexture = new Texture(); texture1->copy(newTexture); } else { newTexture = texture1; } newTexture->lock(); texture2->lock(); for (int y = 0; y < 256; y++) { for (int x = 0; x < 256; x++) { D3DCOLOR dstColor = newTexture->getPixel(x, y); int r = D3DCOLOR_R(dstColor); int g = D3DCOLOR_G(dstColor); int b = D3DCOLOR_B(dstColor); int a = 255; float rf = r / 255.0f; float gf = g / 255.0f; float bf = b / 255.0f; D3DCOLOR c = texture2->getPixel(x, y); switch(mode) { case 0: // Add Clamp r += D3DCOLOR_R(c); g += D3DCOLOR_G(c); b += D3DCOLOR_B(c); r = r > 255 ? 255 : r; g = g > 255 ? 255 : g; b = b > 255 ? 255 : b; break; case 1: // Add Wrap r += D3DCOLOR_R(c); g += D3DCOLOR_G(c); b += D3DCOLOR_B(c); r = r % 256; g = g % 256; b = b % 256; break; case 2: // Sub Clamp r -= D3DCOLOR_R(c); g -= D3DCOLOR_G(c); b -= D3DCOLOR_B(c); r = r < 0 ? 0 : r; g = g < 0 ? 0 : g; b = b < 0 ? 0 : b; break; case 3: // Sub Wrap r -= D3DCOLOR_R(c); g -= D3DCOLOR_G(c); b -= D3DCOLOR_B(c); r = r < 0 ? r + 256 : r; g = g < 0 ? g + 256 : g; b = b < 0 ? b + 256 : b; break; case 4: // Mult rf *= D3DCOLOR_R(c) / 255.0f; gf *= D3DCOLOR_G(c) / 255.0f; bf *= D3DCOLOR_B(c) / 255.0f; r = (int)(rf * 255.0f); g = (int)(gf * 255.0f); b = (int)(bf * 255.0f); break; case 5: // Alpha a = D3DCOLOR_R(c); break; } newTexture->putPixel(x, y, D3DCOLOR_ARGB(a, r, g, b)); } } texture2->unlock(); newTexture->unlock(); return newTexture; }
[ "olof.naessen@75511648-93a4-11dd-b566-b74dd1c53f51" ]
[ [ [ 1, 96 ] ] ]
fb266e554b45ee7d8672cd39e8fb84421dba28d2
b2d46af9c6152323ce240374afc998c1574db71f
/cursovideojuegos/3enraya2/Source/BoardRender.cpp
64cd0940404edf422039abfb97527dd96015cdf1
[]
no_license
bugbit/cipsaoscar
601b4da0f0a647e71717ed35ee5c2f2d63c8a0f4
52aa8b4b67d48f59e46cb43527480f8b3552e96d
refs/heads/master
2021-01-10T21:31:18.653163
2011-09-28T16:39:12
2011-09-28T16:39:12
33,032,640
0
0
null
null
null
null
UTF-8
C++
false
false
115
cpp
// Class automatically generated by Dev-C++ New Class wizard #include "Boardrender.h" // class's header file
[ "ohernandezba@71d53fa2-cca5-e1f2-4b5e-677cbd06613a" ]
[ [ [ 1, 4 ] ] ]
ac52c57fcd1b0fb5de2917f99393bc341d19ec73
d752d83f8bd72d9b280a8c70e28e56e502ef096f
/Shared/Utility/Threading/Threads.cpp
cdf57f6da712f1238fa98294f3a955305496a29d
[]
no_license
apoch/epoch-language.old
f87b4512ec6bb5591bc1610e21210e0ed6a82104
b09701714d556442202fccb92405e6886064f4af
refs/heads/master
2021-01-10T20:17:56.774468
2010-03-07T09:19:02
2010-03-07T09:19:02
34,307,116
0
0
null
null
null
null
UTF-8
C++
false
false
11,737
cpp
// // The Epoch Language Project // Shared Library Code // // Platform-dependent threading wrappers // // Note that we use a fairly intricate system here to provide certain semantics // during data read and write operations. In particular, we store a map that // links thread names with their descriptor blocks (which contain information // necessary to perform communication with the thread, etc.). Since this map // is modified each time a thread starts or exits, it is protected by a mutex // in the thread start/stop functions, and a set of cooperative operations for // functions which need to read the map but will never write to it. // // Although we are effectively locking on access to the lookup map, there is // a system established to allow readers to examine the map without locking // against each other. In other words, anyone who simply wants to read from // the map can do so without locking, unless a thread start/stop operation is // pending, in which case the read must wait for the write to be completed. // // The message send and receive operations both read from the map but do not // write to it. Therefore, these operations are guarded by a Windows Event. // This event is signalled during normal operation, and set to a non-signalled // state when a thread start/stop is being performed. Therefore, the read // operations will wait until the start/stop is completed before executing. // // The second element is a simple counter which tracks how many readers are // currently examining the map. If this counter is greater than zero, any // thread writes are blocked until the counter reaches zero. Once this // occurs, the pending write thread is woken back up, and performs its task // as usual. // #include "pch.h" #include "Utility/Threading/Threads.h" #include "Utility/Threading/ThreadExceptions.h" #include "Utility/Threading/Synchronization.h" #include "Utility/Strings.h" #include "User Interface/Output.h" using namespace Threads; //------------------------------------------------------------------------------- // Internal data //------------------------------------------------------------------------------- // Internal tracking namespace { CriticalSection ThreadManagementCriticalSection; HANDLE ThreadStartStopGuard; HANDLE ThreadAccessCounterIsZero; unsigned ThreadAccessCounter; DWORD TLSIndex; std::map<std::wstring, ThreadInfo*> ThreadInfoTable; // Internal helpers void CleanupThisThread(); void WaitForThreadsToFinish(); void ClearThreadTracking(); } //------------------------------------------------------------------------------- // Thread functionality //------------------------------------------------------------------------------- // // Initialize the threading management logic // void Threads::Init() { ThreadAccessCounter = 0; TLSIndex = ::TlsAlloc(); if(TLSIndex == TLS_OUT_OF_INDEXES) throw ThreadException("Failed to allocate thread-local storage"); ThreadAccessCounterIsZero = ::CreateEvent(NULL, true, true, NULL); ThreadStartStopGuard = ::CreateEvent(NULL, true, true, NULL); std::auto_ptr<ThreadInfo> threadinfo(new ThreadInfo); threadinfo->CodeBlock = NULL; threadinfo->HandleToSelf = ::GetCurrentThreadId(); threadinfo->TaskOrigin = 0; threadinfo->MessageEvent = ::CreateEvent(NULL, false, false, NULL); threadinfo->LocalHeapHandle = ::HeapCreate(HEAP_NO_SERIALIZE, 0, 0); ::TlsSetValue(TLSIndex, threadinfo.get()); // This must be set AFTER the TLS is set up, because the mailbox // code will attempt to use the general use memory pool. threadinfo->Mailbox = new LocklessMailbox<MessageInfo>(NULL); ThreadInfoTable.insert(std::make_pair(L"@main-thread", threadinfo.release())); } // // Shutdown the thread management system. // void Threads::Shutdown() { WaitForThreadsToFinish(); CleanupThisThread(); ClearThreadTracking(); ::CloseHandle(ThreadStartStopGuard); ::CloseHandle(ThreadAccessCounterIsZero); ::TlsFree(TLSIndex); } // // Create a new thread, executing the specified function // void Threads::Create(const std::wstring& name, ThreadFuncPtr func, VM::Block* codeblock, VM::Program* runningprogram) { CriticalSection::Auto mutex(ThreadManagementCriticalSection); ::WaitForSingleObject(ThreadAccessCounterIsZero, INFINITE); struct safety { safety() { ::ResetEvent(ThreadStartStopGuard); } ~safety() { ::SetEvent(ThreadStartStopGuard); } } safetywrapper; std::map<std::wstring, ThreadInfo*>::const_iterator iter = ThreadInfoTable.find(name); if(iter != ThreadInfoTable.end()) throw ThreadException("Cannot fork a task with this name - name is already in use!"); std::auto_ptr<ThreadInfo> info(new ThreadInfo); info->CodeBlock = codeblock; info->MessageEvent = ::CreateEvent(NULL, false, false, NULL); info->TaskOrigin = reinterpret_cast<ThreadInfo*>(::TlsGetValue(TLSIndex))->HandleToSelf; info->BoundFuture = NULL; info->RunningProgram = runningprogram; ThreadInfoTable[name] = info.get(); HANDLE newthread = ::CreateThread(NULL, 0, func, info.get(), CREATE_SUSPENDED, &info->HandleToSelf); std::auto_ptr<LocklessMailbox<MessageInfo> > mailbox(new LocklessMailbox<MessageInfo>(newthread)); info->Mailbox = mailbox.get(); info.release(); mailbox.release(); ::ResumeThread(newthread); } // // Fork a thread specifically for computing the value of a future. // // In general this overload should not be called directly; instead, // it should be accessed indirectly via the futures interface. // void Threads::Create(const std::wstring& name, ThreadFuncPtr func, VM::Future* boundfuture, VM::Operation* op, VM::Program* runningprogram) { CriticalSection::Auto mutex(ThreadManagementCriticalSection); ::WaitForSingleObject(ThreadAccessCounterIsZero, INFINITE); struct safety { safety() { ::ResetEvent(ThreadStartStopGuard); } ~safety() { ::SetEvent(ThreadStartStopGuard); } } safetywrapper; std::map<std::wstring, ThreadInfo*>::const_iterator iter = ThreadInfoTable.find(name); if(iter != ThreadInfoTable.end()) throw ThreadException("Cannot fork a task with this name - name is already in use!"); std::auto_ptr<ThreadInfo> info(new ThreadInfo); info->OpPointer = op; info->MessageEvent = ::CreateEvent(NULL, false, false, NULL); info->TaskOrigin = reinterpret_cast<ThreadInfo*>(::TlsGetValue(TLSIndex))->HandleToSelf; info->BoundFuture = boundfuture; info->RunningProgram = runningprogram; ThreadInfoTable[name] = info.get(); HANDLE newthread = ::CreateThread(NULL, 0, func, info.get(), CREATE_SUSPENDED, &info->HandleToSelf); std::auto_ptr<LocklessMailbox<MessageInfo> > mailbox(new LocklessMailbox<MessageInfo>(newthread)); info->Mailbox = mailbox.get(); info.release(); mailbox.release(); ::ResumeThread(newthread); } // // Initialize a thread environment. // All forked threads MUST call this function before executing // void Threads::Enter(void* info) { ::TlsSetValue(TLSIndex, info); static_cast<ThreadInfo*>(info)->LocalHeapHandle = ::HeapCreate(HEAP_NO_SERIALIZE, 0, 0); } // // Clean up tracking resources reserved for the current thread. // All forked threads MUST call this function before returning // void Threads::Exit() { CriticalSection::Auto mutex(ThreadManagementCriticalSection); struct safety { safety() { ::ResetEvent(ThreadStartStopGuard); } ~safety() { ::SetEvent(ThreadStartStopGuard); } } safetywrapper; CleanupThisThread(); } namespace { // // Free resources used to track this thread's information // void CleanupThisThread() { for(std::map<std::wstring, ThreadInfo*>::iterator iter = ThreadInfoTable.begin(); iter != ThreadInfoTable.end(); ) { if(iter->second->HandleToSelf == ::GetCurrentThreadId()) { delete iter->second->Mailbox; ::HeapDestroy(iter->second->LocalHeapHandle); ::CloseHandle(iter->second->MessageEvent); delete iter->second; iter = ThreadInfoTable.erase(iter); } else ++iter; } } } // // Send a message to another thread // void Threads::SendEvent(const std::wstring& threadname, const std::wstring& eventname, const std::list<VM::EpochVariableTypeID>& payloadtypes, HeapStorage* storageblock) { SyncCounter sync(&ThreadAccessCounter, ThreadAccessCounterIsZero); ::WaitForSingleObject(ThreadStartStopGuard, INFINITE); std::auto_ptr<HeapStorage> storageblockwrapper(storageblock); std::auto_ptr<MessageInfo> msg(new MessageInfo); msg->MessageName = eventname; msg->PayloadTypes = payloadtypes; msg->StorageBlock = storageblock; msg->Origin = ::GetCurrentThreadId(); std::map<std::wstring, ThreadInfo*>::const_iterator iter = ThreadInfoTable.find(threadname); if(iter == ThreadInfoTable.end()) { UI::OutputStream output; output << UI::lightred; output << L"WARNING - failed to send message \"" << eventname << L"\" to task \"" << threadname; output << L"\"\nHas the task already exited?" << std::endl; output << UI::resetcolor; return; } iter->second->Mailbox->AddMessage(msg.release()); ::SetEvent(iter->second->MessageEvent); storageblockwrapper.release(); } // // Suspend the thread until a new message arrives // MessageInfo* Threads::WaitForEvent() { LocklessMailbox<MessageInfo>* mailbox; { SyncCounter sync(&ThreadAccessCounter, ThreadAccessCounterIsZero); ::WaitForSingleObject(ThreadStartStopGuard, INFINITE); mailbox = reinterpret_cast<ThreadInfo*>(::TlsGetValue(TLSIndex))->Mailbox; MessageInfo* mail = mailbox->GetMessage(); if(mail) return mail; } ::WaitForSingleObject(reinterpret_cast<ThreadInfo*>(::TlsGetValue(TLSIndex))->MessageEvent, INFINITE); return mailbox->GetMessage(); } namespace { // // Clean up all thread tracking // void ClearThreadTracking() { for(std::map<std::wstring, ThreadInfo*>::iterator iter = ThreadInfoTable.begin(); iter != ThreadInfoTable.end(); ++iter) { ::HeapDestroy(iter->second->LocalHeapHandle); ::CloseHandle(iter->second->MessageEvent); delete iter->second->Mailbox; delete iter->second; } ThreadInfoTable.clear(); } } // // Look up a thread's name given its ID number. // This has to do a little bit of magic to avoid searching the // name map without introducing synchronization problems. // See the header comments of this file for details. // std::wstring Threads::GetThreadNameGivenID(unsigned id) { SyncCounter sync(&ThreadAccessCounter, ThreadAccessCounterIsZero); ::WaitForSingleObject(ThreadStartStopGuard, INFINITE); for(std::map<std::wstring, ThreadInfo*>::iterator iter = ThreadInfoTable.begin(); iter != ThreadInfoTable.end(); ++iter) { if(iter->second->HandleToSelf == id) return iter->first; } throw ThreadException("Could not locate any task with the given ID; has it already finished execution?"); } // // Sit around until all threads exit. Mainly useful // for when the VM shuts down and we need to let // things terminate gracefully. // void Threads::WaitForThreadsToFinish() { while(ThreadInfoTable.size() > 1) // The main thread will remain registered, so we count down to 1 instead of 0 { ::Sleep(100); } } // // Retrieve the thread's information block from thread-local storage // const ThreadInfo& Threads::GetInfoForThisThread() { return *reinterpret_cast<ThreadInfo*>(::TlsGetValue(TLSIndex)); } // // Return the system handle for the thread-local storage slot used by the threading system // DWORD Threads::GetTLSIndex() { return TLSIndex; }
[ "[email protected]", "don.apoch@localhost", "Mike Lewis@localhost" ]
[ [ [ 1, 2 ], [ 4, 37 ], [ 39, 54 ], [ 57, 123 ], [ 125, 125 ], [ 127, 144 ], [ 146, 164 ], [ 166, 166 ], [ 168, 185 ], [ 187, 215 ], [ 217, 273 ], [ 275, 276 ], [ 278, 371 ] ], [ [ 3, 3 ], [ 38, 38 ], [ 55, 56 ], [ 124, 124 ], [ 126, 126 ], [ 145, 145 ], [ 165, 165 ], [ 167, 167 ], [ 186, 186 ], [ 216, 216 ], [ 372, 381 ] ], [ [ 274, 274 ], [ 277, 277 ] ] ]
ab5c24e15bf0d4cee18be963717e43d3f44d94b0
611fc0940b78862ca89de79a8bbeab991f5f471a
/src/Teki/Boss/Majo/LightKobito.h
2c35bac3f87f9474dfc26a868af6c2c4f17a3911
[]
no_license
LakeIshikawa/splstage2
df1d8f59319a4e8d9375b9d3379c3548bc520f44
b4bf7caadf940773a977edd0de8edc610cd2f736
refs/heads/master
2021-01-10T21:16:45.430981
2010-01-29T08:57:34
2010-01-29T08:57:34
37,068,575
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
663
h
#pragma once #include "..\\..\\Teki.h" #include "..\\..\\..\\Mob\\LightResponseAble.h" #include "Majo.h" /* ライトに反応する小人(ボス用) */ class LightKobito : public Teki, public LightResponseAble { public: LightKobito(); LightKobito( Majo* parent ); void RunTask(); void Fall(); void _Move(); void DieIfGamenGai(); void CollisionResponse(ICollidable *rCollObject, int rThisGroupId, int rOpGroupId); enum STATUS{ WALK, FALL }; STATUS mStatus; protected: Majo* mParent; void Init(); // 設定定数 float LKOBITO_JTK; float LKOBITO_BOUNDTK1; float LKOBITO_BOUNDTK2; };
[ "lakeishikawa@c9935178-01ba-11df-8f7b-bfe16de6f99b" ]
[ [ [ 1, 43 ] ] ]
656b6291ebb9fc24f34b7c10ac893f2f5548b8ea
463c3b62132d215e245a097a921859ecb498f723
/lib/dlib/lz77_buffer.h
fc7d73deb5f7262bf512327d2f8afb2bb061285b
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
athulan/cppagent
58f078cee55b68c08297acdf04a5424c2308cfdc
9027ec4e32647e10c38276e12bcfed526a7e27dd
refs/heads/master
2021-01-18T23:34:34.691846
2009-05-05T00:19:54
2009-05-05T00:19:54
197,038
4
1
null
null
null
null
UTF-8
C++
false
false
1,055
h
// Copyright (C) 2004 Davis E. King ([email protected]) // License: Boost Software License See LICENSE.txt for the full license. #ifndef DLIB_LZ77_BUFFEr_ #define DLIB_LZ77_BUFFEr_ #include "lz77_buffer/lz77_buffer_kernel_1.h" #include "lz77_buffer/lz77_buffer_kernel_2.h" #include "lz77_buffer/lz77_buffer_kernel_c.h" #include "sliding_buffer.h" namespace dlib { class lz77_buffer { lz77_buffer() {} typedef sliding_buffer<unsigned char>::kernel_1a sb1; public: //----------- kernels --------------- // kernel_1a typedef lz77_buffer_kernel_1<sb1> kernel_1a; typedef lz77_buffer_kernel_c<kernel_1a> kernel_1a_c; // kernel_2a typedef lz77_buffer_kernel_2<sb1> kernel_2a; typedef lz77_buffer_kernel_c<kernel_2a> kernel_2a_c; }; } #endif // DLIB_LZ77_BUFFEr_
[ "jimmy@DGJ3X3B1.(none)" ]
[ [ [ 1, 47 ] ] ]
9a7b3cbb7968dd4bf16ba5731ac075d8dac85180
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/wave/test/testwave/testfiles/t_6_067.hpp
8a2bdd01306213df262290f3ddd8111cc3e75827
[ "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,311
hpp
/*============================================================================= Boost.Wave: A Standard compliant C++ preprocessor library http://www.boost.org/ Copyright (c) 2001-2006 Hartmut Kaiser. 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) The tests included in this file were initially taken from the mcpp V2.5 preprocessor validation suite and were modified to fit into the Boost.Wave unit test requirements. The original files of the mcpp preprocessor are distributed under the license reproduced at the end of this file. =============================================================================*/ // Tests error reporting: undefined behavior: End of a source file with an // unterminated comment. int dummy = 0; /*- * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <[email protected]> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ /* unterminated comment ...
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 48 ] ] ]
5a23da3da5d1c2cff76dfc77b5866d1365dd354e
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/os/shortlinksrv/Bluetooth/T_BTSdpAPI/inc/T_DataRSdpDatabase.h
45576b4445397ac43991b03e466c85bfe1a95369
[]
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
2,681
h
/* * Copyright (c) 2007-2008 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: * */ #if (!defined __T_DATA_RSDP_DATABASE_H__ ) #define __T_DATA_RSDP_DATABASE_H__ // User Includes #include "CRSdpHandleArray.h" #include "DataWrapperBase.h" // EPOC includes #include <btsdp.h> #include <e32base.h> /** * Test Active Notification class * */ class CT_DataRSdpdatabase : public CDataWrapperBase { public: /** * Two phase constructor */ static CT_DataRSdpdatabase* NewL(); /** * Public destructor */ ~CT_DataRSdpdatabase(); /** * Process a command read from the ini file * * @param aDataWrapper test step requiring command to be processed * @param aCommand the command to process * @param aSection the entry in the ini file requiring the command to be processed * * @return ETrue if the command is processed */ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); /** * Return a pointer to the object that the data wraps * * @return pointer to the object that the data wraps */ virtual TAny* GetObject() { return iHandleArray; } /** * Set the object that the data wraps * * @param aObject object that the wrapper is testing * */ virtual void SetObjectL(TAny* aAny); /** * The object will no longer be owned by this * * @leave KErrNotSupported if the the function is not supported */ virtual void DisownObjectL(); inline virtual TCleanupOperation CleanupOperation(); protected: /** * Protected constructor. First phase construction */ CT_DataRSdpdatabase(); /** * Second phase construction */ void ConstructL(); private: static void CleanupOperation(TAny* aAny); /** * Helper methods */ void DestroyData(); inline void DoCmdConstructor(); inline void DoCmdOpen(const TDesC& aSection); inline void DoCmdClose(); inline void DoCmdCreateServiceRecordL(const TDesC& aSection); inline void DoCmdDeleteRecordL(const TDesC& aSection); inline void DoCmdDeleteAttributeL(const TDesC& aSection); inline void DoCmdUpdateAttributeL(const TDesC& aSection); private: CRSdpHandleArray* iHandleArray; TSdpServRecordHandle iRecHandle; }; #endif /* __T_DATA_RSDP_DATABASE_H__*/
[ "none@none" ]
[ [ [ 1, 115 ] ] ]
3bf43340c34e3c58e3278f5b501ff126b3afcf5c
d0cf8820b4ad21333e15f7cec1e4da54efe1fdc5
/DES_GOBSTG/DES_GOBSTG/Class/Replay.cpp
20bef00d022fe523fc3960af4dea0d5e7c391ccc
[]
no_license
CBE7F1F65/c1bf2614b1ec411ee7fe4eb8b5cfaee6
296b31d342e39d1d931094c3dfa887dbb2143e54
09ed689a34552e62316e0e6442c116bf88a5a88b
refs/heads/master
2020-05-30T14:47:27.645751
2010-10-12T16:06:11
2010-10-12T16:06:11
32,192,658
0
0
null
null
null
null
UTF-8
C++
false
false
4,863
cpp
#include "Replay.h" #include "Process.h" #include "Player.h" #include "Data.h" #include "BResource.h" Replay rpy; Replay::Replay() { ZeroMemory(&rpyinfo, sizeof(replayInfo)); } Replay::~Replay() { } void Replay::Fill() { SYSTEMTIME systime; GetLocalTime(&systime); rpyinfo.modeflag = (mp.rangemode?RPYMODE_RANGE:0)|(mp.practicemode?RPYMODE_PRACTICE:0); rpyinfo.usingchara = mp.luchara; rpyinfo.maxplayer = mp.maxplayer; rpyinfo.startscene = mp.startscene; rpyinfo.endscene = mp.endscene; rpyinfo.alltime = mp.alltime; rpyinfo.year = systime.wYear; rpyinfo.month = systime.wMonth; rpyinfo.day = systime.wDay; rpyinfo.hour = systime.wHour; rpyinfo.minute = systime.wMinute; rpyinfo.score = Player::p.nScore; rpyinfo.miss = Player::p.ncMiss; rpyinfo.bomb = Player::p.ncBomb; rpyinfo.cont = Player::p.ncCont; rpyinfo.get = Player::p.ncGet; rpyinfo.pause = Player::p.ncPause; rpyinfo.point = Player::p.nPoint; rpyinfo.aliveness = Player::p.nAliveness; strcpy(rpyinfo.username, mp.username); rpyinfo.lost = Player::p.lostStack / mp.framecounter; rpyinfo.circlerate = (float)Player::p.circleCounter / mp.alltime; rpyinfo.fastrate = (float)Player::p.fastCounter / mp.alltime; rpyinfo.difflv = mp.nowdifflv; if(rpyinfo.endscene == S1) rpyinfo.laststage = 0xff; else rpyinfo.laststage = rpyinfo.endscene / M_STAGENSCENE; for (int i=0; i<M_GETRANGEMAX; i++) { rpyinfo.getrange[i] = Player::p.getrange[i]; } } void Replay::partFill(BYTE part) { if (part < RPYPARTMAX) { partinfo[part].offset = replayIndex + 1; partinfo[part].scene = mp.scene; partinfo[part].seed = mp.seed; partinfo[part].nowplayer = Player::p.nLife; partinfo[part].nowbomb = Player::p.nBomb; partinfo[part].nowpower = Player::p.nPower; } else part = 0; partinfo[part].nowaliveness = Player::p.nAliveness; partinfo[part].nowpoint = Player::p.nPoint; partinfo[part].nowgraze = Player::p.nGraze; partinfo[part].nowscore = Player::p.nScore; } bool Replay::Check(char * filename) { BYTE * content; bool ret = false; char treplayfilename[M_PATHMAX]; strcpy(treplayfilename, res.resdata.replayfoldername); strcat(treplayfilename, filename); hge->Resource_AttachPack(treplayfilename, data.password ^ REPLAYPASSWORD_XORMAGICNUM); content = hge->Resource_Load(hge->Resource_GetPackFirstFileName(treplayfilename)); if(content) { if(strcmp((char *)(content + RPYOFFSET_SIGNATURE), res.resdata.replaysignature11)) goto exit; if(*(DWORD *)(content + RPYOFFSET_VERSION) != GAME_VERSION) goto exit; if(strcmp((char *)(content + RPYOFFSET_COMPLETESIGN), res.resdata.replaycompletesign3)) goto exit; ret = true; } exit: hge->Resource_Free(content); return ret; } bool Replay::Load(char * filename, bool getInput) { bool ret = false; if(Check(filename)) { char treplayfilename[M_PATHMAX]; strcpy(treplayfilename, res.resdata.replayfoldername); strcat(treplayfilename, filename); ret = Export::rpyLoad(treplayfilename, &rpyinfo, partinfo, getInput ? replayframe : NULL); if (getInput) { replayIndex = 0; } } return ret; } void Replay::Save(char * filename) { if(!filename) return; char buffer[M_STRITOAMAX]; DWORD _size = RPYOFFSET_INPUTDATA + (replayIndex + 1) * RPYSIZE_FRAME; BYTE * _rpydata = (BYTE *)malloc(_size); DWORD tdw; memcpy(_rpydata + RPYOFFSET_SIGNATURE, res.resdata.replaysignature11, RPYSIZE_SIGNATURE); tdw = GAME_VERSION; memcpy(_rpydata + RPYOFFSET_VERSION, &tdw, RPYSIZE_VERSION); memcpy(_rpydata + RPYOFFSET_COMPLETESIGN, res.resdata.replaycompletesign3, RPYSIZE_COMPLETESIGN); memcpy(_rpydata + RPYOFFSET_TAG, res.resdata.replaytag3, RPYSIZE_TAG); tdw = RPYOFFSET_PARTINFO; memcpy(_rpydata + RPYOFFSET_INFOOFFSET, &tdw, RPYSIZE_INFOOFFSET); strcpy(buffer, ""); memcpy(_rpydata + RPYOFFSET_APPEND, buffer, RPYSIZE_APPEND); memcpy(_rpydata + RPYOFFSET_RPYINFO, &rpyinfo, RPYSIZE_RPYINFO); memcpy(_rpydata + RPYOFFSET_PARTINFO, partinfo, RPYSIZE_PARTINFO * RPYPARTMAX); memcpy(_rpydata + RPYOFFSET_INPUTDATA, replayframe, replayIndex * RPYSIZE_FRAME); replayFrame buff; buff.bias = 0; buff.input = 0xff; memcpy(_rpydata + _size-sizeof(replayFrame), &buff, sizeof(replayFrame)); char treplayfilename[M_PATHMAX]; strcpy(treplayfilename, res.resdata.replayfoldername); strcat(treplayfilename, filename); char crcfilename[M_PATHMAX]; strcpy(crcfilename, filename); strcat(crcfilename, itoa(hge->Resource_GetCRC(_rpydata, _size), buffer, 10)); hgeMemoryFile memfile; memfile.filename = crcfilename; memfile.data = _rpydata; memfile.size = _size; hge->Resource_CreatePack(treplayfilename, data.password ^ REPLAYPASSWORD_XORMAGICNUM, &memfile, NULL); free(_rpydata); }
[ "CBE7F1F65@e00939f0-95ee-11de-8df0-bd213fda01be" ]
[ [ [ 1, 169 ] ] ]
c8c64f1b0b3634244ca499da1e97b748303820a7
e587b7fd4e2762dddf7161019bbd6a84b848f8c1
/swarm/game/client/skeleton/GameUI/BaseModPanel.cpp
49f8e45bab9e0bbc541a224492438b57c91c9100
[ "Apache-2.0" ]
permissive
code-google-com/sourcesdk-skeleton
6bf0791c7fb2c7c17125b11f8172dc1ea03b35d0
016933bfc10331e293dd752750108d7ae76fabb3
refs/heads/master
2021-01-20T08:43:50.735666
2011-08-27T18:14:25
2011-08-27T18:14:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,915
cpp
#include "cbase.h" #include "gameui/swarm/basemodpanel.h" #include "./GameUI/IGameUI.h" #include "ienginevgui.h" #include "engine/ienginesound.h" #include "EngineInterface.h" #include "tier0/dbg.h" #include "ixboxsystem.h" #include "GameUI_Interface.h" #include "game/client/IGameClientExports.h" #include "gameui/igameconsole.h" #include "inputsystem/iinputsystem.h" #include "FileSystem.h" #include "filesystem/IXboxInstaller.h" #include "tier2/renderutils.h" using namespace BaseModUI; using namespace vgui; CBaseModPanel* CBaseModPanel::m_CFactoryBasePanel = 0; CBaseModPanel::CBaseModPanel(): BaseClass(0, "CBaseModPanel"), m_bClosingAllWindows( false ), m_lastActiveUserId( 0 ) { m_CFactoryBasePanel = this; } CBaseModPanel::~CBaseModPanel() { } CBaseModPanel& CBaseModPanel::GetSingleton() { Assert(m_CFactoryBasePanel != 0); return *m_CFactoryBasePanel; } void CBaseModPanel::ApplySchemeSettings(IScheme *pScheme) { BaseClass::ApplySchemeSettings(pScheme); } void CBaseModPanel::RunFrame() { } void CBaseModPanel::PaintBackground() { } void CBaseModPanel::CloseAllWindows( int ePolicyFlags ) { } void CBaseModPanel::OnCommand(const char *command) { BaseClass::OnCommand( command ); } void CBaseModPanel::OnSetFocus() { BaseClass::OnSetFocus(); } void CBaseModPanel::OnGameUIActivated() { if ( m_DelayActivation ) return; SetVisible(true); } void CBaseModPanel::OnGameUIHidden() { SetVisible(false); } void CBaseModPanel::OnLevelLoadingStarted( char const *levelName, bool bShowProgressDialog ) { CloseAllWindows(); } bool CBaseModPanel::UpdateProgressBar( float progress, const char *statusText ) { return false; } void CBaseModPanel::OnNavigateTo( const char* panelName ) { } void CBaseModPanel::OnMovedPopupToFront() { } void CBaseModPanel::OnEvent( KeyValues *pEvent ) { }
[ "[email protected]@6febd7a2-65a9-c2d8-fb53-b51429dd0aeb" ]
[ [ [ 1, 99 ] ] ]
f75bb5fee3d40804a459b0569c7a798633e2b8c0
670c614fea64d683cd517bf973559217a4b8d4b6
/ mindmap-search/mindmap-search/XercesCXMLParser.cpp
fd4ee4ae0ac26022e374a4cea2742d78e6f3402e
[]
no_license
mcpanic/mindmap-search
5ce3e9a75d9a91224c38d7c0faa4089d9ea2487b
67fd93be5f60c61a33d84f18cbaa1c5dd7ae7166
refs/heads/master
2021-01-18T13:33:19.390091
2009-04-06T11:42:07
2009-04-06T11:42:07
32,127,402
0
0
null
null
null
null
UTF-8
C++
false
false
10,232
cpp
#include "StdAfx.h" #include "XercesCXMLParser.h" XercesCXMLParser::XercesCXMLParser() { } XercesCXMLParser::~XercesCXMLParser() { } void XercesCXMLParser::Release() { delete m_pParser; delete m_pErrHandler; XMLPlatformUtils::Terminate(); delete this; } bool XercesCXMLParser::OpenFile(string a_szFilename) { m_szFilename = a_szFilename; return true; } bool XercesCXMLParser::Parse() { try { XMLPlatformUtils::Initialize(); } catch (const XMLException& toCatch) { char* message = XMLString::transcode(toCatch.getMessage()); std::cout << "Error during initialization! :\n" << message << "\n"; XMLString::release(&message); return false; } m_pParser = new XercesDOMParser(); m_pErrHandler = (ErrorHandler*) new HandlerBase(); //XercesDOMParser* parser = new XercesDOMParser(); m_pParser->setValidationScheme(XercesDOMParser::Val_Auto); //parser->setLoadExternalDTD(true); m_pParser->setDoNamespaces(false); m_pParser->setDoSchema(true); //m_pParser->setValidationSchemaFullChecking(true); //ErrorHandler* m_pErrHandler = (ErrorHandler*) new HandlerBase(); m_pParser->setErrorHandler(m_pErrHandler); const char *xmlFile = m_szFilename.c_str(); try { m_pParser->parse(xmlFile); } catch (const OutOfMemoryException&) { std::cout << "Exception message is: \n" << "OutOfMemoryException" << "\n"; return false; } catch (const XMLException& toCatch) { char* message = XMLString::transcode(toCatch.getMessage()); std::cout << "Exception message is: \n" << message << "\n"; XMLString::release(&message); return false; } catch (const DOMException& toCatch) { char* message = XMLString::transcode(toCatch.msg); std::cout << "Exception message is: \n" << message << "\n"; XMLString::release(&message); return false; } catch (const SAXException& toCatch) { char* message = XMLString::transcode(toCatch.getMessage()); std::cout << "SAX Exception message is: \n" << message << "\n"; XMLString::release(&message); return false; } catch (...) { std::cout << "Unexpected Exception \n" ; return false; } m_pDocument = m_pParser->getDocument(); // for the debugging purpose //PrintFile(); return true; } string XercesCXMLParser::GetParentNodeID (DOMNode *node) { char *name; DOMNode *parent; parent = node->getParentNode(); if (!parent) // Error check (parent == NULL) return "NONE"; if (parent->hasAttributes()) { // get all the attributes of the node DOMNamedNodeMap *pAttributes = parent->getAttributes(); int nSize = pAttributes->getLength(); for(int i=0;i<nSize;++i) { DOMAttr *pAttributeNode = (DOMAttr*) pAttributes->item(i); name = XMLString::transcode(pAttributeNode->getName()); if (strcmp(name, "ID") == 0) { XMLString::release(&name); name = XMLString::transcode(pAttributeNode->getValue()); return name; } //XMLString::release(&name); } } return "NONE"; } // Transform parsed node data into DBEntry format int XercesCXMLParser::ProcessParsed(DOMNode *node, bool bPrint, vector<DBEntry> &a_vNodes) { DOMNode *child; EATTRTYPE eAttrType; int count = 0; if (node) { if (node->getNodeType() == DOMNode::ELEMENT_NODE) { if(bPrint) { DBEntry *dbEntry = new DBEntry; char *name = XMLString::transcode(node->getNodeName()); XERCES_STD_QUALIFIER cout <<"----------------------------------------------------------"<<XERCES_STD_QUALIFIER endl; XERCES_STD_QUALIFIER cout <<"Encountered Element : "<< name << XERCES_STD_QUALIFIER endl; dbEntry->SetNodeName (name); XMLString::release(&name); // Set the parent ID dbEntry->SetParentNodeID(GetParentNodeID(node)); if(node->hasAttributes()) { // get all the attributes of the node DOMNamedNodeMap *pAttributes = node->getAttributes(); int nSize = pAttributes->getLength(); XERCES_STD_QUALIFIER cout <<"\tAttributes" << XERCES_STD_QUALIFIER endl; XERCES_STD_QUALIFIER cout <<"\t----------" << XERCES_STD_QUALIFIER endl; for(int i=0;i<nSize;++i) { DOMAttr *pAttributeNode = (DOMAttr*) pAttributes->item(i); // get attribute name char *name = XMLString::transcode(pAttributeNode->getName()); if (strcmp(name, "ID") == 0) { eAttrType = eAttrNodeID; } else if (strcmp(name, "CREATED") == 0) { eAttrType = eAttrTimeCreated; } else if (strcmp(name, "MODIFIED") == 0) { eAttrType = eAttrTimeModified; } else if (strcmp(name, "TEXT") == 0) { eAttrType = eAttrNodeText; } else { // do nothing for now eAttrType = eAttrOther; } XERCES_STD_QUALIFIER cout << "\t" << name << "="; XMLString::release(&name); // get attribute type name = XMLString::transcode(pAttributeNode->getValue()); if (eAttrType == eAttrNodeID) { dbEntry->SetNodeID (name); } else if (eAttrType == eAttrTimeCreated) { dbEntry->SetTimeCreated (name); } else if (eAttrType == eAttrTimeModified) { dbEntry->SetTimeModified (name); } else if (eAttrType == eAttrNodeText) { dbEntry->SetNodeText (name); } else { // do nothing for now } XERCES_STD_QUALIFIER cout << name << XERCES_STD_QUALIFIER endl; XMLString::release(&name); } } //dbEntry->PrintNode(); // Add the entry into the vector a_vNodes.push_back (*dbEntry); } ++count; } for (child = node->getFirstChild(); child != 0; child=child->getNextSibling()) count += ProcessParsed(child, bPrint, a_vNodes); } return count; } void XercesCXMLParser::Build(vector<DBEntry> &a_vNodes) { unsigned int elementCount = 0; if (m_pDocument) { elementCount = ProcessParsed((DOMNode*)m_pDocument->getDocumentElement(), true, a_vNodes); } } void XercesCXMLParser::PrintFile() { DOMImplementation *pImplement = NULL; // these two are needed to display DOM output. DOMWriter *pSerializer = NULL; XMLFormatTarget *pTarget = NULL; // get a serializer, an instance of DOMWriter (the "LS" stands for load-save). pImplement = DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("LS")); pSerializer = ( (DOMImplementationLS*)pImplement )->createDOMWriter(); pTarget = new StdOutFormatTarget(); // set user specified end of line sequence and output encoding pSerializer->setNewLine( XMLString::transcode("\n") ); // set feature if the serializer supports the feature/mode if ( pSerializer->canSetFeature(XMLUni::fgDOMWRTSplitCdataSections, false) ) pSerializer->setFeature(XMLUni::fgDOMWRTSplitCdataSections, false); if ( pSerializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent, false) ) pSerializer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent, false); // turn off serializer "pretty print" option if ( pSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, false) ) pSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, false); if ( pSerializer->canSetFeature(XMLUni::fgDOMWRTBOM, false) ) pSerializer->setFeature(XMLUni::fgDOMWRTBOM, false); pSerializer->writeNode(pTarget, *m_pDocument); } /* DOMNamedNodeMap *pNodeMap; DOMNode *currentNode; DOMElement *pElement = m_pDocument->getDocumentElement(); // create an iterator to visit all text nodes. DOMTreeWalker *iterator = m_pDocument->createTreeWalker(pElement, DOMNodeFilter::SHOW_TEXT, NULL, true); // use the tree walker to print out the text nodes. for ( currentNode = iterator->nextNode(); currentNode != 0; currentNode = iterator->nextNode() ) { //currentNode->normalize(); // note: this leaks memory! cout << "child : " << currentNode->hasAttributes() << endl; cout << "attr : " << currentNode->hasChildNodes() << endl; cout << "parent : " << currentNode->getParentNode() << endl; cout << "child : " << currentNode->getFirstChild() << endl; cout << "sibprev: " << currentNode->getPreviousSibling() << endl; cout << "sibnext: " << currentNode->getNextSibling() << endl; //cout << "URI : " << XMLString::transcode(currentNode->getNamespaceURI()) << endl; //cout << "prefi : " << XMLString::transcode(currentNode->getPrefix()) << endl; //cout << "local : " << XMLString::transcode(currentNode->getLocalName()) << endl; cout << "name : " << XMLString::transcode(currentNode->getNodeName()) << endl; cout << "type : " << currentNode->getNodeType() << endl; cout << "value : " << XMLString::transcode(currentNode->getNodeValue()) << endl; cout << "text : " << XMLString::transcode(currentNode->getTextContent()) << endl; pNodeMap= currentNode->getAttributes(); if (pNodeMap) { cout << "leng : " << pNodeMap->getLength() << endl; cout << "COLOR: " << pNodeMap->getNamedItem(XMLString::transcode("COLOR")) << endl; cout << "CREATED: " << pNodeMap->getNamedItem(XMLString::transcode("CREATED")) << endl; } cout << endl; } */ /* int errorCount = 0; errorCount = m_pParser->getErrorCount(); if (errorCount == 0) { XERCES_STD_QUALIFIER cout << "\nFinished parsing the memory buffer containing the following " << XERCES_STD_QUALIFIER endl; } */
[ "truepanic@ba4b31b2-0743-0410-801d-7d2edeec4cc6" ]
[ [ [ 1, 335 ] ] ]
5ee6e2b1c0a6485c64cde24a0e45b86baa4e3d01
3daaefb69e57941b3dee2a616f62121a3939455a
/mgllib/src/august/AugustRoot.cpp
82771e0507d03ac235d98b13caf78fe0046f20c4
[]
no_license
myun2ext/open-mgl-legacy
21ccadab8b1569af8fc7e58cf494aaaceee32f1e
8faf07bad37a742f7174b454700066d53a384eae
refs/heads/master
2016-09-06T11:41:14.108963
2009-12-28T12:06:58
2009-12-28T12:06:58
null
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
406
cpp
////////////////////////////////////////////////////////// // // AugustRoot // - MglGraphicManager レイヤークラス // ////////////////////////////////////////////////////////// #include "stdafx.h" #include "AugustRoot.h" using namespace agh; using namespace std; // コンストラクタ CAugustRoot::CAugustRoot() { } // デストラクタ CAugustRoot::~CAugustRoot() { }
[ "myun2@6d62ff88-fa28-0410-b5a4-834eb811a934" ]
[ [ [ 1, 22 ] ] ]
c9a6b3a8ad03838c45459d022ccff799f499c73e
710981ad55d08ec46a9ffa06df2f07aa54ae5dcd
/player/src/readers/stevent.cpp
2eefedf9c091fdc922ca188188e51da63140e7c0
[]
no_license
weimingtom/easyrpg
b2ee6acf5a97a4744554b26feede7367b7c16233
8877364261e4d4f52cd36cbb43929ed1351f06e1
refs/heads/master
2021-01-10T02:14:36.939339
2009-02-15T03:45:32
2009-02-15T03:45:32
44,462,893
1
0
null
null
null
null
ISO-8859-10
C++
false
false
91,085
cpp
#include <stdlib.h> #include <stdio.h> #include <string> #include "../tools/tools.h" #include "stevent.h" void Event_comand_Simple:: show(){ printf("\n Comand %d ",Comand); } void Event_comand_Message:: show(){ printf("\nText %s\n", Text.c_str()); } void Event_comand_Message_options:: show(){ printf("\nTransparency %d ",Transparency); printf("\nPosition %d ",Position); printf("\nPrevent_Hiding %d ",Prevent_Hiding); printf("\nAllow_parallel %d ",Allow_parallel); } void Event_comand_Select_face:: show(){ printf("\nFilename %s\n", Filename.c_str()); printf("\nIndex %d ",Index); printf("\nPlace_at_Right %d ",Place_at_Right); printf("\nFlip_Image %d ",Flip_Image); } void Event_comand_Show_choice:: show(){ printf("\nText %s\n", Text.c_str()); printf("\nCancel_option %d ",Cancel_option); } void Event_comand_Show_choice_option:: show(){ printf("\nText %s\n", Text.c_str()); printf("\nChoice_number %d ",Choice_number); } void Event_comand_Number_input:: show(){ printf("\nPrevent_Hiding %d ",Digits_to_input); printf("\nAllow_parallel %d ",variable_to_store); } void Event_comand_Change_switch:: show(){ printf("\nMode %d ",Mode); printf("\nstart_switch %d ",start_switch); printf("\nend_switch %d ",end_switch); printf("\ntoggle_option %d ",toggle_option); } void Event_comand_Change_var:: show(){ printf("\nMode %d ",Mode); printf("\nstart_switch %d ",start_switch); printf("\nend_switch %d ",end_switch); printf("\noperation %d ",operation); printf("\nop_mode %d ",op_mode); printf("\nop_data1 %d ",op_data1); printf("\nop_data2 %d ",op_data2); } void Event_comand_Timer_manipulation:: show(){ printf("\nSet %d ",Set); printf("\nBy_Value %d ",By_Value); printf("\nSeconds %d ",Seconds); printf("\nDisplay %d ",Display); printf("\nRuns_in_Battle %d ",Runs_in_Battle); printf("\nop_data1 %d ",op_data1); } void Event_comand_Change_cash_held:: show(){ printf("\nDisplay %d ",Add); printf("\nRuns_in_Battle %d ",By_Value); printf("\nop_data1 %d ",Amount); } void Event_comand_Change_inventory:: show(){ printf("\nDisplay %d ",Add); printf("\nBy_ID %d ",By_ID); printf("\nItem_ID %d ",Item_ID); printf("\nBy_Count %d ",By_Count); printf("\nCount %d ",Count); } void Event_comand_Change_party:: show(){ printf("\nDisplay %d ",Add); printf("\nBy_ID %d ",By_ID); printf("\nHero_ID %d ",Hero_ID); } void Event_comand_Change_experience:: show(){ printf("\nAll %d ",All); printf("\nHero_ID %d ",Hero_ID); printf("\nAdd %d ",Add); printf("\nBy_Count %d ",By_Count); printf("\nCount %d ",Count); printf("\nShow_Level_Up_Message %d ",Show_Level_Up_Message); } void Event_comand_Change_level:: show(){ printf("\nAll %d ",All); printf("\nHero_ID %d ",Hero_ID); printf("\nAdd %d ",Add); printf("\nBy_Count %d ",By_Count); printf("\nCount %d ",Count); printf("\nShow_Level_Up_Message %d ",Show_Level_Up_Message); } void Event_comand_Change_statistics:: show(){ printf("\nAll %d ",All); printf("\nHero_ID %d ",Hero_ID); printf("\nAdd %d ",Add); printf("\nBy_Count %d ",By_Count); printf("\nCount %d ",Count); } void Event_comand_Learn_forget_skill:: show(){ printf("\nHero %d ",Hero); printf("\nHero_ID %d ",Hero_ID); printf("\nLearn %d ",Learn); printf("\nBy_Count %d ",By_Count); printf("\nCount %d ",Count); } void Event_comand_Change_equipment:: show(){ printf("\nAll %d ",All); printf("\nHero_ID %d ",Hero_ID); printf("\nAdd_Remove %d ",Add_Remove); printf("\nBy_Count %d ",By_Count); printf("\nCount %d ",Count); } void Event_comand_Change_HP:: show(){ printf("\nAll %d ",All); printf("\nHero_ID %d ",Hero_ID); printf("\nAdd %d ",Add); printf("\nBy_Count %d ",By_Count); printf("\nCount %d ",Count); printf("\nPossible_Death %d ",Possible_Death); } void Event_comand_Change_MP:: show(){ printf("\nAll %d ",All); printf("\nHero_ID %d ",Hero_ID); printf("\nAdd %d ",Add); printf("\nBy_Count %d ",By_Count); printf("\nCount %d ",Count); } void Event_comand_Change_Status:: show(){ printf("\nAll %d ",All); printf("\nHero_ID %d ",Hero_ID); printf("\nInflict %d ",Inflict); printf("\nStatus_effect %d ",Status_effect); } void Event_comand_Full_Recovery:: show(){ printf("\nAll %d ",All); printf("\nHero_ID %d ",Hero_ID); } void Event_comand_Inflict_Damage:: show(){ printf("\nAll %d ",All); printf("\nHero_ID %d ",Hero_ID); printf("\nInflict %d ",Damage); printf("\nDefense_effect %d ",Defense_effect); printf("\nMind_effect %d ",Mind_effect); printf("\nVariance %d ",Variance); printf("\nSave_damage_to_var %d ",Save_damage_to_var); printf("\nVar_ID %d ",Var_ID); } void Event_comand_Change_Hero_Name:: show(){ printf("\nNew_name %s\n", New_name.c_str()); printf("\nHero_ID %d ",Hero_ID); } void Event_comand_Change_Hero_Class:: show(){ printf("\n New_class %s\n", strNew_class.c_str()); printf("\n Hero_ID %d ",Hero_ID); } void Event_comand_Change_Hero_Graphic:: show(){ printf("\nNew_graphic %s\n", New_graphic.c_str()); printf("\nHero_ID %d ",Hero_ID); printf("\nSprite_ID %d ",Sprite_ID); printf("\nTransparent %d ",Transparent); } void Event_comand_Change_Hero_Face:: show(){ printf("\nNew_graphic %s\n", New_graphic.c_str()); printf("\nHero_ID %d ",Hero_ID); printf("\nFace_ID %d ",Face_ID); } void Event_comand_Change_Vehicle:: show(){ printf("\nNew_graphic %s\n", New_graphic.c_str()); printf("\nVehicle_ID %d ",Vehicle_ID); printf("\nSprite_ID %d ",Sprite_ID); } void Event_comand_Change_System_BGM:: show(){ printf("\nNew_BGM %s\n", New_BGM.c_str()); printf("\nBGM_ID %d ",BGM_ID); printf("\nFadein_time %d ",Fadein_time); printf("\nVolume %d ",Volume); printf("\nTempo %d ",Tempo); printf("\nBalance %d ",Balance); } void Event_comand_Change_System_SE:: show(){ printf("\nNew_SE %s\n", New_SE.c_str()); printf("\nSE_ID %d ",SE_ID); printf("\nVolume %d ",Volume); printf("\nTempo %d ",Tempo); printf("\nBalance %d ",Balance); } void Event_comand_Change_System_GFX:: show(){ printf("\nNew_graphic %s\n", New_graphic.c_str()); printf("\nStretch %d ",Stretch); printf("\nGothic_font %d ",Gothic_font); } void Event_comand_Change_Transition:: show(){ printf("\nStyle %d ",Type); printf("\nStyle %d ",Transition); } void Event_comand_Start_Combat:: show(){ printf("\nBackground %s\n", Background.c_str()); printf("\nFixed_group %d ",Fixed_group); printf("\nGroup_ID %d ",Group_ID); printf("\nBackground_Flag %d ",Background_Flag); printf("\nEscape %d ",Escape); printf("\nDefeat %d ",Defeat); printf("\nFirst_strike %d ",First_strike); } void Event_comand_Call_Shop:: show(){ printf("\nStyle %d ",Style); printf("\nMessage_style %d ",Message_style); printf("\nHandler_on_purchase %d ",Handler_on_purchase); std:: vector <int> Item_IDs; } void Event_comand_Call_Inn:: show(){ printf("\nStyle %d ",Style); printf("\nMessage_style %d ",Message_style); printf("\nCost %d ",Cost); printf("\nHandler_on_rest %d ",Handler_on_rest); } void Event_comand_Enter_hero_name:: show(){ printf("\nHero_ID %d ",Hero_ID); printf("\nInitial_method %d ",Initial_method); printf("\nShow_initial_name %d ",Show_initial_name); } void Event_comand_Teleport_Party:: show(){ printf("\nMap_ID %d ",Map_ID); printf("\nX %d ",X); printf("\nY %d ",Y); } void Event_comand_Store_hero_location:: show(){ printf("\nMap_ID_Var %d ",Map_ID_Var); printf("\nX_Var %d ",X_Var); printf("\nY_Var %d ",Y_Var); } void Event_comand_Recall_to_location:: show(){ printf("\nMap_ID_Var %d ",Map_ID_Var); printf("\nX_Var %d ",X_Var); printf("\nY_Var %d ",Y_Var); } void Event_comand_Teleport_Vehicle:: show(){ printf("\ntype %d ",type); printf("\nLocation %d ",Location); printf("\nMap_ID %d ",Map_ID); printf("\nX %d ",X); printf("\nY %d ",Y); } void Event_comand_Teleport_Event:: show(){ printf("\nEvent_ID %d ",Event_ID); printf("\nBy_value %d ",By_value); printf("\nX %d ",X); printf("\nY %d ",Y); } void Event_comand_Swap_Event_Positions:: show(){ printf("\nFirst_event %d ",First_event); printf("\nSecond_event %d ",Second_event); } void Event_comand_Get_Terrain_ID:: show(){ printf("\nBy_value %d ",By_value); printf("\nX %d ",X); printf("\nY %d ",Y); printf("\nVariable_to_store %d ",Variable_to_store); } void Event_comand_Get_Event_ID:: show(){ printf("\nBy_value %d ",By_value); printf("\nX %d ",X); printf("\nY %d ",Y); printf("\nVariable_to_store %d ",Variable_to_store); } void Event_comand_Erase_screen:: show(){ printf("\nTransition %d ",Transition); } void Event_comand_Show_screen:: show(){ printf("\nShow_screen %d ",Show_screen); } void Event_comand_Set_screen_tone:: show(){ printf("\nRed_diffuse %d ",Red_diffuse); printf("\nGreen_diffuse %d ",Green_diffuse); printf("\nBlue_diffuse %d ",Blue_diffuse); printf("\nChroma_diffuse %d ",Chroma_diffuse); printf("\nLength %d ",Length); printf("\nWait %d ",Wait); } void Event_comand_Flash_screen:: show(){ printf("\nRed_diffuse %d ",Red_diffuse); printf("\nGreen_diffuse %d ",Green_diffuse); printf("\nBlue_diffuse %d ",Blue_diffuse); printf("\nStrength %d ",Strength); printf("\nLength %d ",Length); printf("\nWait %d ",Wait); } void Event_comand_Shake_screen:: show(){ printf("\nPower %d ",Power); printf("\nSpeed %d ",Speed); printf("\nLength %d ",Length); printf("\nWait %d ",Wait); } void Event_comand_Pan_screen:: show(){ printf("\nType %d ",Type); printf("\nDirection %d ",Direction); printf("\nDistance %d ",Distance); printf("\nSpeed %d ",Speed); printf("\nWait %d ",Wait); } void Event_comand_Weather_Effects:: show(){ printf("\nType %d ",Type); printf("\nSpeed %d ",Speed); } void Event_comand_Show_Picture:: show(){ printf("\nImage_file %s\n", Image_file.c_str()); printf("\nPicture_ID %d ",Picture_ID); printf("\nBy_Value %d ",By_Value); printf("\nX %d ",X); printf("\nY %d ",Y); printf("\nMove_Map %d ",Move_Map); printf("\nMagnification %d ",Magnification); printf("\nOpacity %d ",Opacity); printf("\nUse_color_key %d ",Use_color_key); printf("\nRed_diffuse %d ",Red_diffuse); printf("\nGreen_diffuse %d ",Green_diffuse); printf("\nBlue_diffuse %d ",Blue_diffuse); printf("\nChroma_diffuse %d ",Chroma_diffuse); printf("\nEffect %d ",Effect); printf("\nPower %d ",Power); } void Event_comand_Move_Picture:: show(){ printf("\nPicture_ID %d ",Picture_ID); printf("\nBy_Value %d ",By_Value); printf("\nX %d ",X); printf("\nY %d ",Y); printf("\nMagnification %d ",Magnification); printf("\nOpacity %d ",Opacity); printf("\nRed_diffuse %d ",Red_diffuse); printf("\nGreen_diffuse %d ",Green_diffuse); printf("\nBlue_diffuse %d ",Blue_diffuse); printf("\nChroma_diffuse %d ",Chroma_diffuse); printf("\nEffect %d ",Effect); printf("\nPower %d ",Power); printf("\nLength %d ",Length); printf("\nWait %d ",Wait); } void Event_comand_Erase_Picture:: show(){ printf("\nOpacity %d ",Picture_ID); } void Event_comand_Show_Battle_Anim:: show(){ printf("\nAnimation_ID %d ",Animation_ID); printf("\nTarget %d ",Target); printf("\nWait %d ",Wait); printf("\nFull_screen %d ",Full_screen); } void Event_comand_Set_hero_opacity:: show(){ printf("\nOpacity %d ",Opacity); } void Event_comand_Flash_event:: show(){ printf("\nTarget %d ",Target); printf("\nRed %d ",Red); printf("\nGreen %d ",Green); printf("\nBlue %d ",Blue); printf("\nStrength %d ",Strength); printf("\nLength %d ",Length); printf("\nWait %d ",Wait); } void Event_comand_Move_event:: show(){ int j,i; printf("\nTarget %d ",Target); printf("\nFrequency %d ",Frequency); printf("\nRepeat_actions %d ",Repeat_actions); printf("\nIgnore_impossible %d ",Ignore_impossible); i=Directions.size(); for ( j=0; j<i;j++) printf("\nDirections, %d %d ",j,Directions[j]); } void Event_comand_Wait:: show(){ printf("\nLength %d ",Length); } void Event_comand_Play_BGM:: show(){ printf("\nBGM_name %s\n", BGM_name.c_str()); printf("\nFade_in_time %d ",Fade_in_time); printf("\nVolume %d ",Volume); printf("\nTempo %d ",Tempo); printf("\nBalance %d ",Balance); } void Event_comand_Fade_out_BGM:: show(){ printf("\nFade_in_time %d ",Fade_in_time); } void Event_comand_Play_SE:: show(){ printf("\nSE_name %s\n", SE_name.c_str()); printf("\nVolume %d ",Volume); printf("\nTempo %d ",Tempo); printf("\nBalance %d ",Balance); } void Event_comand_Play_movie:: show(){ printf("\nMovie_file %s\n", Movie_file.c_str()); printf("\nBy_value %d ",By_value); printf("\nX %d ",X); printf("\nY %d ",Y); printf("\nWidth %d ",Width); printf("\nHeight %d ",Height); } void Event_comand_Key_input:: show(){ printf("\nVariable_to_store %d ",Variable_to_store); printf("\nWait_for_key %d ",Wait_for_key); printf("\nDirectionals %d ",Directionals); printf("\nAccept %d ",Accept); printf("\nCancel %d ",Cancel); } void Event_comand_Change_tile:: show(){ printf("\nNew_tile %d ",New_tile); } void Event_comand_Change_background:: show(){ printf("\nParallax_BG %s\n", Parallax_BG.c_str()); printf("\nX_pan %d ",X_pan); printf("\nY_pan %d ",Y_pan); printf("\nX_auto_pan %d ",X_auto_pan); printf("\nX_pan_speed %d ",X_pan_speed); printf("\nY_auto_pan %d ",Y_auto_pan); printf("\nY_pan_speed %d ",Y_pan_speed); } void Event_comand_Change_encounter_rate:: show(){ printf("\nEncounter_rate %d ",Encounter_rate); } void Event_comand_Change_single_tile:: show(){ printf("\nLayer %d ",Layer); printf("\nOld_tile %d ",Old_tile); printf("\nNew_tile %d ",New_tile); } void Event_comand_Set_teleport_location:: show(){ printf("\nAdd %d ",Add); printf("\nMap_ID %d ",Map_ID); printf("\nX %d ",X); printf("\nY %d ",Y); printf("\nSwitch %d ",Switch); printf("\nSwitch_ID %d ",Switch_ID); } void Event_comand_Enable_teleport:: show(){ printf("\nEnable %d ",Enable); } void Event_comand_Set_escape_location:: show(){ printf("\nMap_ID %d ",Map_ID); printf("\nX %d ",X); printf("\nY %d ",Y); printf("\nSwitch %d ",Switch); printf("\nSwitch_ID %d ",Switch_ID); } void Event_comand_Enable_escape:: show(){ printf("\nEnable %d ",Enable); } void Event_comand_Enable_saving:: show(){ printf("\nEnable %d ",Enable); } void Event_comand_Enable_system_menu:: show(){ printf("\nEnable %d ",Enable); } void Event_comand_Conditional:: show(){ // por confirmar printf("\nSwich %d ",Swich); printf("\nHero_ID %d ",Hero_ID); printf("\nTempo %d ",Tempo); printf("\nBy_Count %d ",By_Count); printf("\nCount %d ",Count); printf("\nMusic %d ",Music); } void Event_comand_Label:: show(){ printf("\nLabel_id %d ",Label_id); } void Event_comand_Go_to_label:: show(){ printf("\nLabel_id %d ",Label_id); } void Event_comand_Call_event:: show(){ printf("\nMethod %d ",Method); printf("\nEvent_ID %d ",Event_ID); printf("\nEvent_page %d ",Event_page); } void Event_comand_Comment_Text:: show(){ printf("\nText %s\n", Text.c_str());//0x15 } void Event_comand_Add_line_to_comment:: show(){ printf("\nText %s\n", Text.c_str());//0x15 } void Event_comand_Change_Profetion:: show(){ printf("\nHero_ID %d ",Hero_ID); printf("\nComands %d ",Comands); printf("\nLevels %d ",Levels); printf("\nSkills %d ",Skills); printf("\nValues %d ",Values); printf("\nOptions %d ",Options); } void Event_comand_Change_Batle_Comands:: show() { printf("\n remove %d ",remove); printf("\n Hero_ID %d ",Hero_ID); printf("\n Batle_Comand %d ",Batle_Comand); printf("\n Add %d ",Add); } Event_comand * stEvent::EventcommandMessageChunk(int Command,int Depth,FILE * Stream) { Event_comand_Message * Message; Message = new Event_comand_Message(); Message->Comand=Command; Message->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); //longitud de cadena Message->Text = ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 return (Message); } Event_comand * stEvent::EventcommandMessageoptionsChunk(int Command,int Depth,FILE * Stream) { Event_comand_Message_options * Message_options; Message_options= new Event_comand_Message_options(); Message_options->Comand=Command; Message_options->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 04 Message_options->Transparency= ReadCompressedInteger(Stream); Message_options->Position= ReadCompressedInteger(Stream); Message_options->Prevent_Hiding= ReadCompressedInteger(Stream); Message_options->Allow_parallel= ReadCompressedInteger(Stream); return (Message_options); } Event_comand * stEvent::EventcommandSelectfaceChunk(int Command,int Depth,FILE * Stream) { Event_comand_Select_face * Select_face; Select_face = new Event_comand_Select_face(); Select_face->Comand=Command; Select_face->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); //longitud de cadena Select_face->Filename = ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 Select_face->Index= ReadCompressedInteger(Stream); Select_face->Place_at_Right= ReadCompressedInteger(Stream); Select_face->Flip_Image= ReadCompressedInteger(Stream); return (Select_face); } Event_comand * stEvent::EventcommandShowchoiceChunk(int Command,int Depth,FILE * Stream) { Event_comand_Show_choice * choice; choice = new Event_comand_Show_choice(); choice->Depth=Depth; choice->Comand=Command; ChunkInfo.Length= ReadCompressedInteger(Stream); //longitud de cadena choice->Text = ReadString(Stream, ChunkInfo.Length); // opcion /opcion/opcion ChunkInfo.Length= ReadCompressedInteger(Stream); //longitud 01 choice->Cancel_option= ReadCompressedInteger(Stream); return (choice); } Event_comand * stEvent::EventcommandSimpleEvent_comand(int Command,int Depth,FILE * Stream) { Event_comand_Simple * comand; comand = new Event_comand_Simple(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); //longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); //longitud 00 return (comand); } Event_comand * stEvent::EventcommandShow_choice_option(int Command,int Depth,FILE * Stream) { Event_comand_Show_choice_option * comand; comand = new Event_comand_Show_choice_option(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); //longitud de cadena comand->Text = ReadString(Stream, ChunkInfo.Length); // choice ChunkInfo.Length= ReadCompressedInteger(Stream); //longitud 01 //Choice number (zero offset) comand->Choice_number= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandNumber_input(int Command,int Depth,FILE * Stream) { Event_comand_Number_input * comand; comand = new Event_comand_Number_input(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 0 comand->Digits_to_input= ReadCompressedInteger(Stream); comand->variable_to_store= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_switch(int Command,int Depth,FILE * Stream) { Event_comand_Change_switch * comand; comand = new Event_comand_Change_switch(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 04 //Mode (single, range, indirect) comand->Mode= ReadCompressedInteger(Stream); comand->start_switch= ReadCompressedInteger(Stream); comand->end_switch= ReadCompressedInteger(Stream); comand->toggle_option= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_var(int Command,int Depth,FILE * Stream) { Event_comand_Change_var * comand; comand = new Event_comand_Change_var(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 07 //Mode (single, range, indirect) comand->Mode= ReadCompressedInteger(Stream); comand->start_switch= ReadCompressedInteger(Stream); comand->end_switch= ReadCompressedInteger(Stream); comand->operation= ReadCompressedInteger(Stream); comand->op_mode= ReadCompressedInteger(Stream); comand->op_data1= ReadCompressedInteger(Stream); comand->op_data2= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandTimer_manipulation(int Command,int Depth,FILE * Stream) { Event_comand_Timer_manipulation * comand; comand = new Event_comand_Timer_manipulation(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 06 //Set (1:start, 2:stop) comand->Set= ReadCompressedInteger(Stream); comand->By_Value= ReadCompressedInteger(Stream); comand->Seconds= ReadCompressedInteger(Stream); comand->Display= ReadCompressedInteger(Stream); comand->Runs_in_Battle= ReadCompressedInteger(Stream); if(ChunkInfo.Length<5) comand->op_data1= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_cash_held(int Command,int Depth,FILE * Stream) { Event_comand_Change_cash_held * comand; comand = new Event_comand_Change_cash_held(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 06 comand->Add= ReadCompressedInteger(Stream); comand->By_Value= ReadCompressedInteger(Stream); comand->Amount= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_inventory(int Command,int Depth,FILE * Stream) { Event_comand_Change_inventory * comand; comand = new Event_comand_Change_inventory(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream);// longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 06 comand->Add= ReadCompressedInteger(Stream); comand->By_ID= ReadCompressedInteger(Stream); comand->Item_ID= ReadCompressedInteger(Stream); comand->By_Count= ReadCompressedInteger(Stream); comand->Count= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_party(int Command,int Depth,FILE * Stream) { Event_comand_Change_party * comand; comand = new Event_comand_Change_party(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream);// longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 06 //Add (1:remove) comand->Add= ReadCompressedInteger(Stream); comand->By_ID= ReadCompressedInteger(Stream); comand->Hero_ID= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_experience(int Command,int Depth,FILE * Stream) { Event_comand_Change_experience * comand; //aqui comand = new Event_comand_Change_experience(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 07 comand->All= ReadCompressedInteger(Stream); comand->Hero_ID= ReadCompressedInteger(Stream); comand->Add= ReadCompressedInteger(Stream); comand->By_Count= ReadCompressedInteger(Stream); comand->Count= ReadCompressedInteger(Stream); comand->Show_Level_Up_Message= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_level(int Command,int Depth,FILE * Stream) { Event_comand_Change_level * comand; comand = new Event_comand_Change_level(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 07 comand->All= ReadCompressedInteger(Stream); comand->Hero_ID= ReadCompressedInteger(Stream); comand->Add= ReadCompressedInteger(Stream); comand->By_Count= ReadCompressedInteger(Stream); comand->Count= ReadCompressedInteger(Stream); comand->Show_Level_Up_Message= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_statistics(int Command,int Depth,FILE * Stream) { Event_comand_Change_statistics * comand; comand = new Event_comand_Change_statistics(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 07 comand->All= ReadCompressedInteger(Stream); comand->Hero_ID= ReadCompressedInteger(Stream); comand->Add= ReadCompressedInteger(Stream); comand->Stat= ReadCompressedInteger(Stream); comand->By_Count= ReadCompressedInteger(Stream); comand->Count= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandLearn_forget_skill(int Command,int Depth,FILE * Stream) { Event_comand_Learn_forget_skill * comand; comand = new Event_comand_Learn_forget_skill(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 00 ChunkInfo.Length= ReadCompressedInteger(Stream); // longitud 07 comand->Hero= ReadCompressedInteger(Stream); comand->Hero_ID= ReadCompressedInteger(Stream); comand->Learn= ReadCompressedInteger(Stream); comand->By_Count= ReadCompressedInteger(Stream); comand->Count= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_equipment(int Command,int Depth,FILE * Stream) { Event_comand_Change_equipment * comand; comand = new Event_comand_Change_equipment(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->All=ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); comand->Add_Remove=ReadCompressedInteger(Stream); comand->By_Count=ReadCompressedInteger(Stream); comand->Count=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_HP(int Command,int Depth,FILE * Stream) { Event_comand_Change_HP * comand; comand = new Event_comand_Change_HP(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->All=ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); comand->Add=ReadCompressedInteger(Stream); comand->By_Count=ReadCompressedInteger(Stream); comand->Count=ReadCompressedInteger(Stream); comand->Possible_Death=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_MP(int Command,int Depth,FILE * Stream) { Event_comand_Change_MP * comand; comand = new Event_comand_Change_MP(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->All=ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); comand->Add=ReadCompressedInteger(Stream); comand->By_Count=ReadCompressedInteger(Stream); comand->Count=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_Status(int Command,int Depth,FILE * Stream) { Event_comand_Change_Status * comand; comand = new Event_comand_Change_Status(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->All=ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); comand->Inflict=ReadCompressedInteger(Stream); comand->Status_effect=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandFull_Recovery(int Command,int Depth,FILE * Stream) { Event_comand_Full_Recovery * comand; comand = new Event_comand_Full_Recovery(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->All=ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandInflict_Damage(int Command,int Depth,FILE * Stream) { Event_comand_Inflict_Damage * comand; comand = new Event_comand_Inflict_Damage(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->All=ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); comand->Damage=ReadCompressedInteger(Stream); comand->Defense_effect=ReadCompressedInteger(Stream); comand->Mind_effect=ReadCompressedInteger(Stream); comand->Variance=ReadCompressedInteger(Stream); comand->Save_damage_to_var=ReadCompressedInteger(Stream); comand->Var_ID=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_Hero_Name(int Command,int Depth,FILE * Stream) { Event_comand_Change_Hero_Name * comand; comand = new Event_comand_Change_Hero_Name(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->New_name= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_Hero_Class(int Command,int Depth,FILE * Stream) { Event_comand_Change_Hero_Class * comand; comand = new Event_comand_Change_Hero_Class(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->strNew_class= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Hero_ID= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_Hero_Graphic(int Command,int Depth,FILE * Stream) { Event_comand_Change_Hero_Graphic * comand; comand = new Event_comand_Change_Hero_Graphic(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->New_graphic= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); comand->Sprite_ID=ReadCompressedInteger(Stream); comand->Transparent=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_Hero_Face(int Command,int Depth,FILE * Stream) { Event_comand_Change_Hero_Face * comand; comand = new Event_comand_Change_Hero_Face(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->New_graphic= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); comand->Face_ID=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_Vehicle(int Command,int Depth,FILE * Stream) { Event_comand_Change_Vehicle * comand; comand = new Event_comand_Change_Vehicle(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->New_graphic= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Vehicle_ID=ReadCompressedInteger(Stream); comand->Sprite_ID=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_System_BGM(int Command,int Depth,FILE * Stream) { Event_comand_Change_System_BGM * comand; comand = new Event_comand_Change_System_BGM(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->New_BGM= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->BGM_ID=ReadCompressedInteger(Stream); comand->Fadein_time=ReadCompressedInteger(Stream); comand->Volume=ReadCompressedInteger(Stream); comand->Tempo=ReadCompressedInteger(Stream); comand->Balance=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_System_SE(int Command,int Depth,FILE * Stream) { Event_comand_Change_System_SE * comand; comand = new Event_comand_Change_System_SE(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->New_SE= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->SE_ID=ReadCompressedInteger(Stream); comand->Volume=ReadCompressedInteger(Stream); comand->Tempo=ReadCompressedInteger(Stream); comand->Balance=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_System_GFX(int Command,int Depth,FILE * Stream) { Event_comand_Change_System_GFX * comand; comand = new Event_comand_Change_System_GFX(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->New_graphic= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Stretch=ReadCompressedInteger(Stream); comand->Gothic_font=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_Transition(int Command,int Depth,FILE * Stream) { Event_comand_Change_Transition * comand; comand = new Event_comand_Change_Transition(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Type=ReadCompressedInteger(Stream); comand->Transition=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandStart_Combat(int Command,int Depth,FILE * Stream) { Event_comand_Start_Combat * comand; comand = new Event_comand_Start_Combat(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Background= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); //9 datos en el 2003 //6 datos en el 2000 comand->Fixed_group=ReadCompressedInteger(Stream); comand->Group_ID=ReadCompressedInteger(Stream); comand->Background_Flag=ReadCompressedInteger(Stream); comand->Escape=ReadCompressedInteger(Stream); comand->Defeat=ReadCompressedInteger(Stream); comand->First_strike=ReadCompressedInteger(Stream); if(ChunkInfo.Length==9)//datos que desconosco { ReadCompressedInteger(Stream); ReadCompressedInteger(Stream); ReadCompressedInteger(Stream); } return (comand); } Event_comand * stEvent::EventcommandCall_Shop(int Command,int Depth,FILE * Stream) { Event_comand_Call_Shop * comand; comand = new Event_comand_Call_Shop(); int itemasnum,dat; comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Style=ReadCompressedInteger(Stream); comand->Message_style=ReadCompressedInteger(Stream); comand->Handler_on_purchase=ReadCompressedInteger(Stream); itemasnum=ReadCompressedInteger(Stream);//0x00 while(itemasnum--) {dat=ReadCompressedInteger(Stream); comand->Item_IDs.push_back(dat);} return (comand); } Event_comand * stEvent::EventcommandCall_Inn(int Command,int Depth,FILE * Stream) { Event_comand_Call_Inn * comand; comand = new Event_comand_Call_Inn(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); //3 datos 2003 //4 datos en 2000 if(ChunkInfo.Length==4) comand->Style=ReadCompressedInteger(Stream); comand->Message_style=ReadCompressedInteger(Stream); comand->Cost=ReadCompressedInteger(Stream); comand->Handler_on_rest=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandEnter_hero_name(int Command,int Depth,FILE * Stream) { Event_comand_Enter_hero_name * comand; comand = new Event_comand_Enter_hero_name(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); comand->Initial_method=ReadCompressedInteger(Stream); comand->Show_initial_name=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandTeleport_Party(int Command,int Depth,FILE * Stream) { Event_comand_Teleport_Party * comand; comand = new Event_comand_Teleport_Party(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Map_ID=ReadCompressedInteger(Stream); comand->X=ReadCompressedInteger(Stream); comand->Y=ReadCompressedInteger(Stream); if(ChunkInfo.Length==4) ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandStore_hero_location(int Command,int Depth,FILE * Stream) { Event_comand_Store_hero_location * comand; comand = new Event_comand_Store_hero_location(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Map_ID_Var=ReadCompressedInteger(Stream); comand->X_Var=ReadCompressedInteger(Stream); comand->Y_Var=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandRecall_to_location(int Command,int Depth,FILE * Stream) { Event_comand_Recall_to_location * comand; comand = new Event_comand_Recall_to_location(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Map_ID_Var=ReadCompressedInteger(Stream); comand->X_Var=ReadCompressedInteger(Stream); comand->Y_Var=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandTeleport_Vehicle(int Command,int Depth,FILE * Stream) { Event_comand_Teleport_Vehicle * comand; comand = new Event_comand_Teleport_Vehicle(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->type=ReadCompressedInteger(Stream); comand->Location=ReadCompressedInteger(Stream); comand->Map_ID=ReadCompressedInteger(Stream); comand->X=ReadCompressedInteger(Stream); comand->Y=ReadCompressedInteger(Stream);//2003 6 datos if(ChunkInfo.Length==6) ReadCompressedInteger(Stream); // 2000 5 datos return (comand); } Event_comand * stEvent::EventcommandTeleport_Event(int Command,int Depth,FILE * Stream) { Event_comand_Teleport_Event * comand; comand = new Event_comand_Teleport_Event(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Event_ID=ReadCompressedInteger(Stream); comand->By_value=ReadCompressedInteger(Stream); comand->X=ReadCompressedInteger(Stream); comand->Y=ReadCompressedInteger(Stream);//2003 5 datos // 2000 4 datos if(ChunkInfo.Length==5) ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandSwap_Event_Positions(int Command,int Depth,FILE * Stream) { Event_comand_Swap_Event_Positions * comand; comand = new Event_comand_Swap_Event_Positions(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->First_event=ReadCompressedInteger(Stream); comand->Second_event=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandGet_Terrain_ID(int Command,int Depth,FILE * Stream) { Event_comand_Get_Terrain_ID * comand; comand = new Event_comand_Get_Terrain_ID(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->By_value=ReadCompressedInteger(Stream); comand->X=ReadCompressedInteger(Stream); comand->Y=ReadCompressedInteger(Stream); comand->Variable_to_store=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandGet_Event_ID(int Command,int Depth,FILE * Stream) { Event_comand_Get_Event_ID * comand; comand = new Event_comand_Get_Event_ID(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->By_value=ReadCompressedInteger(Stream); comand->X=ReadCompressedInteger(Stream); comand->Y=ReadCompressedInteger(Stream); comand->Variable_to_store=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandErase_screen(int Command,int Depth,FILE * Stream) { Event_comand_Erase_screen * comand; comand = new Event_comand_Erase_screen(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Transition=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandShow_screen(int Command,int Depth,FILE * Stream) { Event_comand_Show_screen * comand; comand = new Event_comand_Show_screen(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Show_screen=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandSet_screen_tone(int Command,int Depth,FILE * Stream) { Event_comand_Set_screen_tone * comand; comand = new Event_comand_Set_screen_tone(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Red_diffuse=ReadCompressedInteger(Stream); comand->Green_diffuse=ReadCompressedInteger(Stream); comand->Blue_diffuse=ReadCompressedInteger(Stream); comand->Chroma_diffuse=ReadCompressedInteger(Stream); comand->Length=ReadCompressedInteger(Stream); comand->Wait=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandFlash_screen(int Command,int Depth,FILE * Stream) { Event_comand_Flash_screen * comand; comand = new Event_comand_Flash_screen(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Red_diffuse=ReadCompressedInteger(Stream); comand->Green_diffuse=ReadCompressedInteger(Stream); comand->Blue_diffuse=ReadCompressedInteger(Stream); comand->Strength=ReadCompressedInteger(Stream); comand->Length=ReadCompressedInteger(Stream); comand->Wait=ReadCompressedInteger(Stream); //2000 6 datos 2003 7 datos if(ChunkInfo.Length==7) ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandShake_screen(int Command,int Depth,FILE * Stream) { Event_comand_Shake_screen * comand; comand = new Event_comand_Shake_screen(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Power=ReadCompressedInteger(Stream); comand->Speed=ReadCompressedInteger(Stream); comand->Length=ReadCompressedInteger(Stream); comand->Wait=ReadCompressedInteger(Stream); //2000 4 datos 2003 5 datos if(ChunkInfo.Length==5) ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandPan_screen(int Command,int Depth,FILE * Stream) { Event_comand_Pan_screen * comand; comand = new Event_comand_Pan_screen(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Type=ReadCompressedInteger(Stream); comand->Direction=ReadCompressedInteger(Stream); comand->Distance=ReadCompressedInteger(Stream); comand->Speed=ReadCompressedInteger(Stream); comand->Wait=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandWeather_Effects(int Command,int Depth,FILE * Stream) { Event_comand_Weather_Effects * comand; comand = new Event_comand_Weather_Effects(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Type=ReadCompressedInteger(Stream); comand->Speed=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandShow_Picture(int Command,int Depth,FILE * Stream) { Event_comand_Show_Picture * comand; comand = new Event_comand_Show_Picture(); comand->Comand=Command; comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Image_file= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Picture_ID=ReadCompressedInteger(Stream); comand->By_Value=ReadCompressedInteger(Stream); comand->X=ReadCompressedInteger(Stream); comand->Y=ReadCompressedInteger(Stream); comand->Move_Map=ReadCompressedInteger(Stream); comand->Magnification=ReadCompressedInteger(Stream); comand->Opacity=ReadCompressedInteger(Stream); comand->Use_color_key=ReadCompressedInteger(Stream); comand->Red_diffuse=ReadCompressedInteger(Stream); comand->Green_diffuse=ReadCompressedInteger(Stream); comand->Blue_diffuse=ReadCompressedInteger(Stream); comand->Chroma_diffuse=ReadCompressedInteger(Stream); comand->Effect=ReadCompressedInteger(Stream); comand->Power=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandMove_Picture(int Command,int Depth,FILE * Stream) { Event_comand_Move_Picture * comand; comand = new Event_comand_Move_Picture(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Picture_ID=ReadCompressedInteger(Stream); comand->By_Value=ReadCompressedInteger(Stream); comand->X=ReadCompressedInteger(Stream); comand->Y=ReadCompressedInteger(Stream); comand->Magnification=ReadCompressedInteger(Stream); comand->Opacity=ReadCompressedInteger(Stream); comand->Red_diffuse=ReadCompressedInteger(Stream); comand->Green_diffuse=ReadCompressedInteger(Stream); comand->Blue_diffuse=ReadCompressedInteger(Stream); comand->Chroma_diffuse=ReadCompressedInteger(Stream); comand->Effect=ReadCompressedInteger(Stream); comand->Power=ReadCompressedInteger(Stream); comand->Length=ReadCompressedInteger(Stream); comand->Wait=ReadCompressedInteger(Stream); // optional data if(ChunkInfo.Length>14) ReadCompressedInteger(Stream); if(ChunkInfo.Length>15) ReadCompressedInteger(Stream); if(ChunkInfo.Length>16) ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandErase_Picture(int Command,int Depth,FILE * Stream) { Event_comand_Erase_Picture * comand; comand = new Event_comand_Erase_Picture(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Picture_ID=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandShow_Battle_Anim(int Command,int Depth,FILE * Stream) { Event_comand_Show_Battle_Anim * comand; comand = new Event_comand_Show_Battle_Anim(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Animation_ID=ReadCompressedInteger(Stream); comand->Target=ReadCompressedInteger(Stream); comand->Wait=ReadCompressedInteger(Stream); comand->Full_screen=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandSet_hero_opacity(int Command,int Depth,FILE * Stream) { Event_comand_Set_hero_opacity * comand; comand = new Event_comand_Set_hero_opacity(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Opacity=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandFlash_event(int Command,int Depth,FILE * Stream) { Event_comand_Flash_event * comand; comand = new Event_comand_Flash_event(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Target=ReadCompressedInteger(Stream); comand->Red=ReadCompressedInteger(Stream); comand->Green=ReadCompressedInteger(Stream); comand->Blue=ReadCompressedInteger(Stream); comand->Strength=ReadCompressedInteger(Stream); comand->Length=ReadCompressedInteger(Stream); comand->Wait=ReadCompressedInteger(Stream); return(comand); } Event_comand * stEvent::EventcommandMove_event(int Command,int Depth,FILE * Stream) { Event_comand_Move_event * comand; comand = new Event_comand_Move_event(); int dat; comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Target=ReadCompressedInteger(Stream); comand->Frequency=ReadCompressedInteger(Stream); comand->Repeat_actions=ReadCompressedInteger(Stream); comand->Ignore_impossible=ReadCompressedInteger(Stream); // minimo 4 comandos ChunkInfo.Length-=4; while(ChunkInfo.Length--) {dat=ReadCompressedInteger(Stream); comand->Directions.push_back(dat);} return (comand); } Event_comand * stEvent::EventcommandWait(int Command,int Depth,FILE * Stream) { Event_comand_Wait * comand; comand = new Event_comand_Wait(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Length=ReadCompressedInteger(Stream); // 2000 1 dato 2003 2 datos if(ChunkInfo.Length==2) ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandPlay_BGM(int Command,int Depth,FILE * Stream) { Event_comand_Play_BGM * comand; comand = new Event_comand_Play_BGM(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->BGM_name= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Fade_in_time=ReadCompressedInteger(Stream); comand->Volume=ReadCompressedInteger(Stream); comand->Tempo=ReadCompressedInteger(Stream); comand->Balance=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandFade_out_BGM(int Command,int Depth,FILE * Stream) { Event_comand_Fade_out_BGM * comand; comand = new Event_comand_Fade_out_BGM(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Fade_in_time=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandPlay_SE(int Command,int Depth,FILE * Stream) { Event_comand_Play_SE * comand; comand = new Event_comand_Play_SE(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->SE_name= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Volume=ReadCompressedInteger(Stream); comand->Tempo=ReadCompressedInteger(Stream); comand->Balance=ReadCompressedInteger(Stream); return(comand); } Event_comand * stEvent::EventcommandPlay_movie(int Command,int Depth,FILE * Stream) { Event_comand_Play_movie * comand; comand = new Event_comand_Play_movie(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Movie_file= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->By_value=ReadCompressedInteger(Stream); comand->X=ReadCompressedInteger(Stream); comand->Y=ReadCompressedInteger(Stream); comand->Width=ReadCompressedInteger(Stream); comand->Height=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandKey_input(int Command,int Depth,FILE * Stream) { Event_comand_Key_input * comand; comand = new Event_comand_Key_input(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Variable_to_store=ReadCompressedInteger(Stream); comand->Wait_for_key=ReadCompressedInteger(Stream); comand->Directionals=ReadCompressedInteger(Stream); comand->Accept=ReadCompressedInteger(Stream); comand->Cancel=ReadCompressedInteger(Stream); // unknown data if(ChunkInfo.Length>5) ReadCompressedInteger(Stream); if(ChunkInfo.Length>6) ReadCompressedInteger(Stream); if(ChunkInfo.Length>7) ReadCompressedInteger(Stream); if(ChunkInfo.Length>8) ReadCompressedInteger(Stream); if(ChunkInfo.Length>9) ReadCompressedInteger(Stream); if(ChunkInfo.Length>10) ReadCompressedInteger(Stream); if(ChunkInfo.Length>11) ReadCompressedInteger(Stream); if(ChunkInfo.Length>12) ReadCompressedInteger(Stream); if(ChunkInfo.Length>13) ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_tile(int Command,int Depth,FILE * Stream) { Event_comand_Change_tile * comand; comand = new Event_comand_Change_tile(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->New_tile=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_background(int Command,int Depth,FILE * Stream) { Event_comand_Change_background * comand; comand = new Event_comand_Change_background(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Parallax_BG= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->X_pan=ReadCompressedInteger(Stream); comand->Y_pan=ReadCompressedInteger(Stream); comand->X_auto_pan=ReadCompressedInteger(Stream); comand->X_pan_speed=ReadCompressedInteger(Stream); comand->Y_auto_pan=ReadCompressedInteger(Stream); comand->Y_pan_speed=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_encounter_rate(int Command,int Depth,FILE * Stream) { Event_comand_Change_encounter_rate * comand; comand = new Event_comand_Change_encounter_rate(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Encounter_rate=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_single_tile(int Command,int Depth,FILE * Stream) { Event_comand_Change_single_tile * comand; comand = new Event_comand_Change_single_tile(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Layer=ReadCompressedInteger(Stream); comand->Old_tile=ReadCompressedInteger(Stream); comand->New_tile=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandSet_teleport_location(int Command,int Depth,FILE * Stream) { Event_comand_Set_teleport_location * comand; comand = new Event_comand_Set_teleport_location(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Add=ReadCompressedInteger(Stream); comand->Map_ID=ReadCompressedInteger(Stream); comand->X=ReadCompressedInteger(Stream); comand->Y=ReadCompressedInteger(Stream); comand->Switch=ReadCompressedInteger(Stream); comand->Switch_ID=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandEnable_teleport(int Command,int Depth,FILE * Stream) { Event_comand_Enable_teleport * comand; comand = new Event_comand_Enable_teleport(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Enable=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandSet_escape_location(int Command,int Depth,FILE * Stream) { Event_comand_Set_escape_location * comand; comand = new Event_comand_Set_escape_location(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Map_ID=ReadCompressedInteger(Stream); comand->X=ReadCompressedInteger(Stream); comand->Y=ReadCompressedInteger(Stream); comand->Switch=ReadCompressedInteger(Stream); comand->Switch_ID=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandEnable_escape(int Command,int Depth,FILE * Stream) { Event_comand_Enable_escape * comand; comand = new Event_comand_Enable_escape(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Enable=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandEnable_saving(int Command,int Depth,FILE * Stream) { Event_comand_Enable_saving * comand; comand = new Event_comand_Enable_saving(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Enable=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandEnable_system_menu(int Command,int Depth,FILE * Stream) { Event_comand_Enable_system_menu * comand; comand = new Event_comand_Enable_system_menu(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Enable=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandConditional(int Command,int Depth,FILE * Stream) { Event_comand_Conditional * comand; comand = new Event_comand_Conditional(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Swich=ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); comand->Tempo=ReadCompressedInteger(Stream); comand->By_Count=ReadCompressedInteger(Stream); comand->Count=ReadCompressedInteger(Stream); comand->Music=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandLabel(int Command,int Depth,FILE * Stream) { Event_comand_Label * comand; comand = new Event_comand_Label(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Label_id=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandGo_to_label(int Command,int Depth,FILE * Stream) { Event_comand_Go_to_label * comand; comand = new Event_comand_Go_to_label(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Label_id=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandCall_event(int Command,int Depth,FILE * Stream) { Event_comand_Call_event * comand; comand = new Event_comand_Call_event(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Method=ReadCompressedInteger(Stream); comand->Event_ID=ReadCompressedInteger(Stream); comand->Event_page=ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandComment_Text(int Command,int Depth,FILE * Stream) { Event_comand_Comment_Text * comand; comand = new Event_comand_Comment_Text(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Text= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandAdd_line_to_comment(int Command,int Depth,FILE * Stream) { Event_comand_Add_line_to_comment * comand; comand = new Event_comand_Add_line_to_comment(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Text= ReadString(Stream, ChunkInfo.Length); ChunkInfo.Length= ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_Profetion(int Command,int Depth,FILE * Stream) { Event_comand_Change_Profetion * comand; comand = new Event_comand_Change_Profetion(); comand->Comand=Command;comand->Depth=Depth; ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); //7 datos falta 1 comand->Hero_ID=ReadCompressedInteger(Stream); comand->Comands=ReadCompressedInteger(Stream); comand->Levels=ReadCompressedInteger(Stream); comand->Skills=ReadCompressedInteger(Stream); comand->Values=ReadCompressedInteger(Stream); comand->Options=ReadCompressedInteger(Stream); ReadCompressedInteger(Stream); return (comand); } Event_comand * stEvent::EventcommandChange_Batle_Comands(int Command,int Depth,FILE * Stream) { Event_comand_Change_Batle_Comands * comand; comand = new Event_comand_Change_Batle_Comands(); ChunkInfo.Length= ReadCompressedInteger(Stream); ChunkInfo.Length= ReadCompressedInteger(Stream); comand->Comand=Command; comand->Depth=Depth; comand->remove=ReadCompressedInteger(Stream); comand->Hero_ID=ReadCompressedInteger(Stream); comand->Batle_Comand=ReadCompressedInteger(Stream); comand->Add=ReadCompressedInteger(Stream); return (comand); } std:: vector <Event_comand * > stEvent::EventcommandChunk(FILE * Stream)//instrucciones de la paguina { tChunk ChunkInfo; // informacion del pedazo leido int data,depth; string name; std:: vector <Event_comand * > vcEvent_comand; data= ReadCompressedInteger(Stream); //de depth=ReadCompressedInteger(Stream); //profundidad //printf(" data %04X ",data); data =data; if(data!=0) { while(data!=0) { // printf(" Main data %04X ",data); switch(data)// tipo de la primera dimencion { case Message:// llamar una funcion con el id que retorne un objeto comando vcEvent_comand.push_back( EventcommandMessageChunk(data,depth,Stream)); break; case Add_line_to_message:// 0x819D0E, vcEvent_comand.push_back( EventcommandMessageChunk(data,depth,Stream)); break; case Message_options:// 0xCF08, vcEvent_comand.push_back(EventcommandMessageoptionsChunk(data,depth,Stream)); break; case Select_message_face:// 0xCF12, vcEvent_comand.push_back(EventcommandSelectfaceChunk(data,depth,Stream)); break; case Show_choice:// 0xCF1C, vcEvent_comand.push_back(EventcommandShowchoiceChunk(data,depth,Stream)); break; case Nested_block:// 0x0A vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Show_choice_option:// 0x819D2C, vcEvent_comand.push_back(EventcommandShow_choice_option(data,depth,Stream)); break; case End_Choice_block:// 0x819D2D, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Number_input:// 0xCF26, vcEvent_comand.push_back(EventcommandNumber_input(data,depth,Stream)); break; case Change_switch:// 0xCF62, vcEvent_comand.push_back(EventcommandChange_switch(data,depth,Stream)); break; case Change_var:// 0xCF6C, vcEvent_comand.push_back(EventcommandChange_var(data,depth,Stream)); break; case Timer_manipulation:// 0xCF76, vcEvent_comand.push_back(EventcommandTimer_manipulation(data,depth,Stream)); break; case Change_cash_held:// 0xD046, vcEvent_comand.push_back(EventcommandChange_cash_held(data,depth,Stream)); break; case Change_inventory:// 0xD050, vcEvent_comand.push_back(EventcommandChange_inventory(data,depth,Stream)); break; case Change_party:// 0xD05A, vcEvent_comand.push_back(EventcommandChange_party(data,depth,Stream)); break; case Change_experience:// 0xD12A, vcEvent_comand.push_back(EventcommandChange_experience(data,depth,Stream)); break; case Change_level:// 0xD134, vcEvent_comand.push_back(EventcommandChange_level(data,depth,Stream)); break; case Change_statistics:// 0xD13E, vcEvent_comand.push_back(EventcommandChange_statistics(data,depth,Stream)); break; case Learn_forget_skill:// 0xD148, vcEvent_comand.push_back(EventcommandLearn_forget_skill(data,depth,Stream)); break; case Change_equipment:// 0xD152, vcEvent_comand.push_back(EventcommandChange_equipment(data,depth,Stream)); break; case Change_HP:// 0xD15C, vcEvent_comand.push_back(EventcommandChange_HP(data,depth,Stream)); break; case Change_MP:// 0xD166, vcEvent_comand.push_back(EventcommandChange_MP(data,depth,Stream)); break; case Change_Status:// 0xD170, vcEvent_comand.push_back(EventcommandChange_Status(data,depth,Stream)); break; case Full_Recovery:// 0xD17A, vcEvent_comand.push_back(EventcommandFull_Recovery(data,depth,Stream)); break; case Inflict_Damage:// 0xD204, vcEvent_comand.push_back(EventcommandInflict_Damage(data,depth,Stream)); break; case Change_Hero_Name:// 0xD272, vcEvent_comand.push_back(EventcommandChange_Hero_Name(data,depth,Stream)); break; case Change_Hero_Class:// 0xD27C, vcEvent_comand.push_back(EventcommandChange_Hero_Class(data,depth,Stream)); break; case Change_Hero_Graphic:// 0xD306, vcEvent_comand.push_back(EventcommandChange_Hero_Graphic(data,depth,Stream)); break; case Change_Hero_Face:// 0xD310, vcEvent_comand.push_back(EventcommandChange_Hero_Face(data,depth,Stream)); break; case Change_Vehicle:// 0xD31A, vcEvent_comand.push_back(EventcommandChange_Vehicle(data,depth,Stream)); break; case Change_System_BGM:// 0xD324, vcEvent_comand.push_back(EventcommandChange_System_BGM(data,depth,Stream)); break; case Change_System_SE:// 0xD32E, vcEvent_comand.push_back(EventcommandChange_System_SE(data,depth,Stream)); break; case Change_System_GFX:// 0xD338, vcEvent_comand.push_back(EventcommandChange_System_GFX(data,depth,Stream)); break; case Change_Transition:// 0xD342, vcEvent_comand.push_back(EventcommandChange_Transition(data,depth,Stream)); break; case Start_Combat:// 0xD356, vcEvent_comand.push_back(EventcommandStart_Combat(data,depth,Stream)); break; case Call_Shop:// 0xD360, vcEvent_comand.push_back(EventcommandCall_Shop(data,depth,Stream)); break; case Start_success_block:// 0x81A170, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Start_failure_block:// 0x81A171, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case End_shop_block:// 0x81A172, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Call_Inn:// 0xD36A, vcEvent_comand.push_back(EventcommandCall_Inn(data,depth,Stream)); break; case Start_success_block2:// 0x81A17A, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Start_failure_block2:// 0x81A17B, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case End_block:// 0x81A17C, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Enter_hero_name:// 0xD374, vcEvent_comand.push_back(EventcommandEnter_hero_name(data,depth,Stream)); break; case Teleport_Party:// 0xD34A , vcEvent_comand.push_back(EventcommandTeleport_Party(data,depth,Stream)); break; case Store_hero_location:// 0xD444, vcEvent_comand.push_back(EventcommandStore_hero_location(data,depth,Stream)); break; case Recall_to_location:// 0xD44E, vcEvent_comand.push_back(EventcommandRecall_to_location(data,depth,Stream)); break; case Ride_Dismount:// 0xD458 , vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Teleport_Vehicle:// 0xD462, vcEvent_comand.push_back(EventcommandTeleport_Vehicle(data,depth,Stream)); break; case Teleport_Event:// 0xD46C, vcEvent_comand.push_back(EventcommandTeleport_Event(data,depth,Stream)); break; case Swap_Event_Positions:// 0xD476, vcEvent_comand.push_back(EventcommandSwap_Event_Positions(data,depth,Stream)); break; case Get_Terrain_ID:// 0xD51E, vcEvent_comand.push_back(EventcommandGet_Terrain_ID(data,depth,Stream)); break; case Get_Event_ID:// 0xD528, vcEvent_comand.push_back(EventcommandGet_Event_ID(data,depth,Stream)); break; case Erase_screen:// 0xD602, vcEvent_comand.push_back(EventcommandErase_screen(data,depth,Stream)); break; case Show_screen:// 0xD60C, vcEvent_comand.push_back(EventcommandShow_screen(data,depth,Stream)); break; case Set_screen_tone:// 0xD616, vcEvent_comand.push_back(EventcommandSet_screen_tone(data,depth,Stream)); break; case Flash_screen:// 0xD620, vcEvent_comand.push_back(EventcommandFlash_screen(data,depth,Stream)); break; case Shake_screen:// 0xD62A, vcEvent_comand.push_back(EventcommandShake_screen(data,depth,Stream)); break; case Pan_screen:// 0xD634, vcEvent_comand.push_back(EventcommandPan_screen(data,depth,Stream)); break; case Weather_Effects:// 0xD63E, vcEvent_comand.push_back(EventcommandWeather_Effects(data,depth,Stream)); break; case Show_Picture:// 0xD666, vcEvent_comand.push_back(EventcommandShow_Picture(data,depth,Stream)); break; case Move_Picture:// 0xD670, vcEvent_comand.push_back(EventcommandMove_Picture(data,depth,Stream)); break; case Erase_Picture:// 0xD67A, vcEvent_comand.push_back(EventcommandErase_Picture(data,depth,Stream)); break; case Show_Battle_Anim :// 0xD74A, vcEvent_comand.push_back(EventcommandShow_Battle_Anim(data,depth,Stream)); break; case Set_hero_opacity:// 0xD82E, vcEvent_comand.push_back(EventcommandSet_hero_opacity(data,depth,Stream)); break; case Flash_event:// 0xD838, vcEvent_comand.push_back(EventcommandFlash_event(data,depth,Stream)); break; case Move_event:// 0xD842, vcEvent_comand.push_back(EventcommandMove_event(data,depth,Stream)); break; case Wait_until_moved:// 0xD84C, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Stop_all_movement:// 0xD856, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Wait:// 0xD912, vcEvent_comand.push_back(EventcommandWait(data,depth,Stream)); break; case Play_BGM:// 0xD976, vcEvent_comand.push_back(EventcommandPlay_BGM(data,depth,Stream)); break; case Fade_out_BGM:// 0xDA00, vcEvent_comand.push_back(EventcommandFade_out_BGM(data,depth,Stream)); break; case Memorize_BGM:// 0xDA0A, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Play_memorized:// 0xDA14, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Play_sound_effect:// 0xDA1E, vcEvent_comand.push_back(EventcommandPlay_SE(data,depth,Stream)); break; case Play_movie:// 0xDA28, vcEvent_comand.push_back(EventcommandPlay_movie(data,depth,Stream)); break; case Key_input:// 0xDA5A, vcEvent_comand.push_back(EventcommandKey_input(data,depth,Stream)); break; case Change_tile_set:// 0xDB3E , vcEvent_comand.push_back(EventcommandChange_tile(data,depth,Stream)); break; case Change_background:// 0xDB48, vcEvent_comand.push_back(EventcommandChange_background(data,depth,Stream)); break; case Change_encounter_rate:// 0xDB5C, vcEvent_comand.push_back(EventcommandChange_encounter_rate(data,depth,Stream)); break; case Change_single_tile:// 0xDB66, vcEvent_comand.push_back(EventcommandChange_single_tile(data,depth,Stream)); break; case Set_teleport_location:// 0xDC22, vcEvent_comand.push_back(EventcommandSet_teleport_location(data,depth,Stream)); break; case Enable_teleport:// 0xDC2C, vcEvent_comand.push_back(EventcommandEnable_teleport(data,depth,Stream)); break; case Set_escape_location:// 0xDC36, vcEvent_comand.push_back(EventcommandSet_escape_location(data,depth,Stream)); break; case Enable_escape:// 0xDC40, vcEvent_comand.push_back(EventcommandEnable_escape(data,depth,Stream)); break; case Call_save_menu:// 0xDD06, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Enable_saving:// 0xDD1A, vcEvent_comand.push_back(EventcommandEnable_saving(data,depth,Stream)); break; case Call_system_menu:// 0xDD2E, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Enable_system_menu:// 0xDD38, vcEvent_comand.push_back(EventcommandEnable_system_menu(data,depth,Stream)); break; case Conditional:// 0xDD6A, vcEvent_comand.push_back(EventcommandConditional(data,depth,Stream)); break; case Else_case:// 0x81AB7A, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case End_conditional:// 0x81AB7B, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Label:// 0xDE4E, vcEvent_comand.push_back(EventcommandLabel(data,depth,Stream)); break; case Go_to_label:// 0xDE58, vcEvent_comand.push_back(EventcommandGo_to_label(data,depth,Stream)); break; case Start_loop:// 0xDF32, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case End_loop:// 0x81AD42, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Break:// 0xDF3C, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Stop_all_events:// 0xE016, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Delete_event:// 0xE020, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Call_event:// 0xE02A, vcEvent_comand.push_back(EventcommandCall_event(data,depth,Stream)); break; case Comment:// 0xE07A, vcEvent_comand.push_back(EventcommandComment_Text(data,depth,Stream)); break; case Add_line_to_comment:// 0x81AF0A, vcEvent_comand.push_back(EventcommandAdd_line_to_comment(data,depth,Stream)); break; case Game_over:// 0xE104, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Return_to_title_screen:// 0xE15E, vcEvent_comand.push_back(EventcommandSimpleEvent_comand(data,depth,Stream)); break; case Change_Profetion:// 0xE104, vcEvent_comand.push_back(EventcommandChange_Profetion(data,depth,Stream)); break; case Change_Batle_Comands:// 0xE15E, vcEvent_comand.push_back(EventcommandChange_Batle_Comands(data,depth,Stream)); break; case End_of_event: break; default: //instruccion estandar ChunkInfo.Length= ReadCompressedInteger(Stream); //primera longitud name = ReadString(Stream, ChunkInfo.Length); // printf(name.c_str()); ChunkInfo.Length= ReadCompressedInteger(Stream); //segunda longitud while(ChunkInfo.Length--)//seguro longitud {data= ReadCompressedInteger(Stream); printf("lol %d ",data);} break; } data = ReadCompressedInteger(Stream); // lectura de tipo del pedazo if(data!=0) depth= ReadCompressedInteger(Stream); //profundidad } //printf("\n"); // 3 bytes, tamaņo estandar de instrucion ReadCompressedInteger(Stream); // final de cadena ReadCompressedInteger(Stream); // final de cadena ReadCompressedInteger(Stream); // final de cadena } else{ ReadCompressedInteger(Stream); // final de cadena ReadCompressedInteger(Stream); // final de cadena } return(vcEvent_comand); }
[ "lobomon@2452c464-c253-f492-884b-b99f1bb2d923", "paulo_v@2452c464-c253-f492-884b-b99f1bb2d923" ]
[ [ [ 1, 1616 ], [ 1618, 2038 ], [ 2040, 2050 ] ], [ [ 1617, 1617 ], [ 2039, 2039 ] ] ]
e38bb46a97b22797c3702d8d6be27cd8558ee7d4
1db5ea1580dfa95512b8bfa211c63bafd3928ec5
/PlanAssigner.h
d917cfc045d750f47b6f4372867b5d7b0f0ffa21
[]
no_license
armontoubman/scbatbot
3b9dd4532fbb78406b41dd0d8f08926bd710ad7b
bee2b0bf0281b8c2bd6edc4c10a597041ea4be9b
refs/heads/master
2023-04-18T12:08:13.655631
2010-09-17T23:03:26
2010-09-17T23:03:26
361,411,133
0
0
null
null
null
null
UTF-8
C++
false
false
1,382
h
#pragma once #include <BWAPI.h> #include "HighCommand.h" #include "TaskManager.h" #include "EigenUnitGroupManager.h" #include "EnemyUnitDataManager.h" #include "MicroManager.h" #include "UnitGroup.h" #include "Task.h" #include <map> class HighCommand; class TaskManager; class EigenUnitGroupManager; class EnemyUnitDataManager; class MicroManager; class PlanAssigner { public: PlanAssigner(HighCommand* h, TaskManager* t, EigenUnitGroupManager* e, EnemyUnitDataManager* ed, MicroManager* m); HighCommand* hc; TaskManager* tm; EigenUnitGroupManager* eiugm; EnemyUnitDataManager* eudm; MicroManager* mm; std::map<UnitGroup*, Task> maakPlan(); int canAttack(UnitGroup* ug, Task t); int canAttack(Task t, UnitGroup* ug); Task mostAppropriate(UnitGroup* current, int tasktype, std::map<UnitGroup*, Task> currentPlan); Task mostAppropriate(UnitGroup* current, int tasktype, std::map<UnitGroup*, Task> currentPlan, bool nullwaarde); bool containsTask(std::map<UnitGroup*, Task> plan, Task t); double logicaldistance(UnitGroup* ug, BWAPI::Position pos); bool canReach(UnitGroup* ug, BWAPI::Position pos); std::map<UnitGroup*, Task> plan; void update(); Task vindTask(std::map<UnitGroup*, Task> lijst, UnitGroup* ug); std::list<Task> findTasksWithType(std::map<UnitGroup*, Task> lijst, int t); void logc(const char* msg); };
[ "armontoubman@a850bb65-3c1a-43af-a1ba-18f3eb5da290" ]
[ [ [ 1, 42 ] ] ]
1b272a863b0c989626cad2fb93f301f954f6f01c
9c62af23e0a1faea5aaa8dd328ba1d82688823a5
/rl/trunk/engine/ai/include/WalkPathBehaviour.h
dfd4c12f1e332fd9d1fe8bc06965897d76a03fd8
[ "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
2,818
h
/* This source file is part of Rastullahs Lockenpracht. * Copyright (C) 2003-2008 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 __RlAI_WalkPathBehaviour_H__ #define __RlAI_WalkPathBehaviour_H__ #include "AiPrerequisites.h" #include "AgentManager.h" #include "OpenSteer/PolylineSegmentedPathwaySingleRadius.h" //#include "AgentState.h" //#include "SteeringMachine.h" //#include "SteeringVehicle.h" //#include <stack> namespace rl { class Landmark; class LandmarkPath; class WayPointGraph; /** This behaviour lets an agent walk along a path while avoiding other "passengers" * which are known by the AgentManager */ class _RlAiExport WalkPathBehaviour : public SteeringBehaviour { public: /** Constructor by Creature object. * @param character Creature object */ WalkPathBehaviour(); /** explicit virtual destructor */ virtual ~WalkPathBehaviour(void); /** returns a string describing the type of fuzzy state. * function is abstract. * @returns type name string for fuzzy state. */ virtual CeGuiString getType(); /** should initialize the fuzzy state. * function is abstract. */ virtual void init(); /** should activate the fuzzy state. * function is abstract. */ virtual void activate(); /** deactivates fuzzy state. * function is abstract. */ virtual void deactivate(); /** tells the fuzzy state to update for the elapsed time. * @param elapsedtime gives the elapsed time as a float */ virtual void update(const float elapsedTime); /** calculates the activation value. * @returns float containing the calculated activation value. */ virtual float calculateActivation(); /** Calculates the path to a Landmark by applying the AStar search on * the given WayPointGraph. * The Path is used during the update-calls of the behaviour */ void calcPathToLandmark(Landmark* lm, const WayPointGraph* wps); void setLandmarkPath(LandmarkPath* lmp); private: Landmark* mLandmark; OpenSteer::PolylineSegmentedPathwaySingleRadius mPathway; int mPathDirection; }; } #endif
[ "iblis@4c79e8ff-cfd4-0310-af45-a38c79f83013" ]
[ [ [ 1, 88 ] ] ]
183129063ae32bb9702015a4e95105be2cab14cc
c5534a6df16a89e0ae8f53bcd49a6417e8d44409
/trunk/nGENE Framework/SettingsWindow.cpp
675ead595ff57bcb2fb03b042b856c0d290252be
[]
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
710
cpp
/* --------------------------------------------------------------------------- This source file is part of nGENE Tech. Copyright (c) 2006- Wojciech Toman This program is free software. File: SettingsWindow.cpp Version: 0.03 --------------------------------------------------------------------------- */ #include "PrecompiledHeaders.h" #include "SettingsWindow.h" namespace nGENE { namespace Application { SettingsWindow::SettingsWindow(): m_EngineInfo(new SEngineInfo()) { } //---------------------------------------------------------------------- SettingsWindow::~SettingsWindow() { } //---------------------------------------------------------------------- } }
[ "Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57" ]
[ [ [ 1, 33 ] ] ]
37044f1f2916d9b3cd36cac879180336e965afe2
ea12fed4c32e9c7992956419eb3e2bace91f063a
/zombie/code/zombie/nscene/src/nscene/ngeometrynode_main.cc
7bfc1f1dd34d246b95f199e90600b62f1f46fc2e
[]
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
9,716
cc
#include "precompiled/pchnscene.h" //------------------------------------------------------------------------------ // ngeometrynode_main.cc // (C) 2004 Conjurer Services, S.A. //------------------------------------------------------------------------------ #include "nscene/ngeometrynode.h" #include "nscene/nsurfacenode.h" #include "nscene/nscenegraph.h" #include "nscene/nsceneshader.h" #include "nscene/ncsceneclass.h" #include "gfx2/nmesh2.h" #include "gfx2/ngfxserver2.h" nNebulaScriptClass(nGeometryNode, "nabstractshadernode"); uint nGeometryNode::uniqueGeometryId = 0; //------------------------------------------------------------------------------ /** */ nGeometryNode::nGeometryNode() : worldCoord(false), streamIndex(-1) #ifndef NGAME ,wireframeShaderIndex(-1) #endif { this->geometryId = uniqueGeometryId++; this->streamId = this->geometryId; } //------------------------------------------------------------------------------ /** */ nGeometryNode::~nGeometryNode() { this->UnloadResources(); // unload stream resources if (this->refStreamGeometry.isvalid()) { this->refStreamGeometry->Release(); } // unload surface resources if (this->refSurfaceNode.isvalid()) { this->refSurfaceNode->Release(); } } //------------------------------------------------------------------------------ /** Load the resources needed by this object. */ bool nGeometryNode::LoadResources() { #ifndef NGAME this->wireframeShaderIndex = nSceneServer::Instance()->FindShader("wireframe"); #endif kernelServer->PushCwd(this); bool success = true; if (this->refStreamGeometry.isvalid()) { this->streamId = this->refStreamGeometry->GetStreamId(); success = this->refStreamGeometry->LoadResources(); if (success) { this->resourcesValid = true; this->CacheSurfacePassesByLevel(this->refStreamGeometry->GetSurfaceNode()); } } else { this->streamId = this->geometryId; success = nAbstractShaderNode::LoadResources(); if (success) { if (this->refSurfaceNode.isvalid()) { success = this->refSurfaceNode->LoadResources(); if (success) { this->CacheSurfacePassesByLevel(this->refSurfaceNode); } } } } kernelServer->PopCwd(); return success; } //------------------------------------------------------------------------------ /** Unload the resources if refcount has reached zero. */ void nGeometryNode::UnloadResources() { nAbstractShaderNode::UnloadResources(); if (this->refStreamGeometry.isvalid()) { //can't unload stream geometry resources, they could be shared //this->refStreamGeometry->Release(); this->passesByLevel.Clear(); } if (this->refSurfaceNode.isvalid()) { //FIXME ma.garcias- can't unload surface resources, they could be shared //this->refSurfaceNode->UnloadResources(); this->passesByLevel.Clear(); } } //------------------------------------------------------------------------------ /** get set of levels and passes, and cache this for fast attach */ void nGeometryNode::CacheSurfacePassesByLevel(nSurfaceNode* surfaceNode) { n_assert(surfaceNode); // get set of levels and passes this->passesByLevel.Reset(); int numLevels = surfaceNode->GetNumLevels(); int level; for (level = 0; level < numLevels; ++level) { nArray<int>& levelPasses = this->passesByLevel.PushBack(nArray<int>(4, 4)); int pass; for (pass = 0; pass < surfaceNode->GetNumLevelPasses(level); ++pass) { levelPasses.Append(surfaceNode->GetLevelPassIndex(level, pass)); } } } //------------------------------------------------------------------------------ /** */ void nGeometryNode::EntityCreated(nEntityObject* entityObject) { //create a cache entry for the entity //if the node is used more than once in the entity (decals) //all instances will share the same index (which is fine) nSceneNode::EntityCreated(entityObject); } //------------------------------------------------------------------------------ /** */ void nGeometryNode::EntityDestroyed(nEntityObject* entityObject) { nSceneNode::EntityDestroyed(entityObject); } //------------------------------------------------------------------------------ /** Attach shape to the scene graph, once for every render pass, which comes defined by its surface. */ void nGeometryNode::Attach(nSceneGraph* sceneGraph, nEntityObject* entityObject) { ncScene* renderContext = entityObject->GetComponent<ncScene>(); n_assert(renderContext); #if __NEBULA_STATS__ //sceneGraph->profAttachGeometry.StartAccum(); #endif // get max level as max from scenegraph and rendercontext, and maxlevels int numLevels = this->passesByLevel.Size(); int level = 0; if (numLevels > 1) { level = entityObject->GetComponent<ncScene>()->GetMaxMaterialLevel(); level = n_max(sceneGraph->GetMaxMaterialLevel(), level); level = n_min(level, numLevels - 1); } //n_assert(level < this->passesByLevel.Size()); nArray<int>& levelPasses = this->passesByLevel.At(level); int numPasses = levelPasses.Size(); int pass; for (pass = 0; pass < numPasses; ++pass) { int passIndex = levelPasses.At(pass); if (renderContext->GetPassEnabledFlags() & this->passEnabledFlags & (1<<passIndex)) { #if __NEBULA_STATS__ //sceneGraph->profAttachGeometry.StopAccum(); #endif sceneGraph->AddGroup(passIndex, this, entityObject); #if __NEBULA_STATS__ //sceneGraph->profAttachGeometry.StartAccum(); #endif } } #if __NEBULA_STATS__ //sceneGraph->profAttachGeometry.StopAccum(); #endif nSceneNode::Attach(sceneGraph, entityObject); } //------------------------------------------------------------------------------ /** Perform pre-instancing geometry rendering. */ bool nGeometryNode::Apply(nSceneGraph* sceneGraph) { #ifndef NGAME // do not use streaming to draw wireframe overlay (for now) if (sceneGraph->GetShaderIndex() != this->wireframeShaderIndex) #endif if (this->refStreamGeometry.isvalid()) { return this->refStreamGeometry->Apply(sceneGraph); } return nAbstractShaderNode::Apply(sceneGraph); } //------------------------------------------------------------------------------ /** Perform post-instancing geometry rendering. This is ensured to be called for any geometry node when the last instance of the node has been rendered, either because the shader or the surface is about to change, or because it was the last in the list. Override this method to perform specific post-instancing rendering, eg. end a streamed rendering operation, etc. */ bool nGeometryNode::Flush(nSceneGraph* sceneGraph) { #ifndef NGAME // do not use streaming to draw wireframe overlay (for now) if (sceneGraph->GetShaderIndex() != this->wireframeShaderIndex) #endif if (this->refStreamGeometry.isvalid()) { return this->refStreamGeometry->Flush(sceneGraph); } return true; } //------------------------------------------------------------------------------ /** Common behavior for all geometry nodes. nXXXNode::Render(sceneGraph, renderContext) { if( nGeometryNode::Render(sceneGraph, renderContext) ) { // ... } // ... } */ bool nGeometryNode::Render(nSceneGraph* sceneGraph, nEntityObject* entityObject) { #ifndef NGAME // do not use streaming to draw wireframe overlay (for now) if (sceneGraph->GetShaderIndex() != this->wireframeShaderIndex) #endif // delegate streamed rendering if (this->refStreamGeometry.isvalid()) { return this->refStreamGeometry->Render(sceneGraph, entityObject); } // animate shader parameters this->InvokeAnimators(entityObject); // set per-shape shader parameters nAbstractShaderNode::Render(sceneGraph, entityObject); // set shader overrides // (this is called last to allow overriding per-shape parameters) nShader2 *shader = nSceneServer::Instance()->GetShaderAt(sceneGraph->GetShaderIndex()).GetShaderObject(); ncScene *renderContext = entityObject->GetComponent<ncScene>(); shader->SetParams(renderContext->GetShaderOverrides()); return true; } #ifndef NGAME //------------------------------------------------------------------------------ /** */ void nGeometryNode::BindDirtyDependence(nObject* receiver) { nSceneNode::BindDirtyDependence(receiver); nSurfaceNode* surface = this->GetSurfaceNode(); if ( surface ) { surface->BindDirtyDependence(this); } } //------------------------------------------------------------------------------ /** */ void nGeometryNode::RecruseSetObjectDirty(bool dirty) { nSceneNode::RecruseSetObjectDirty(dirty); nSurfaceNode* surface = this->GetSurfaceNode(); if ( surface ) { surface->RecruseSetObjectDirty(dirty); } } #endif //!NGAME
[ "magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91" ]
[ [ [ 1, 336 ] ] ]
061addf7085798b5c0f061745e56459234128649
87cfed8101402f0991cd2b2412a5f69da90a955e
/daq/daq/src/mwnidaq/nid2a.h
e1814f9caacff9fbb3e761b19496e52810d15686
[]
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
6,821
h
// Copyright 1998-2003 The MathWorks, Inc. // $Revision: 1.3.4.6 $ $Date: 2003/12/22 00:48:14 $ // nid2a.h: Definition of the nid2a class // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_NID2A_H__D0C329D5_E0FF_11D1_A21F_00A024E7DC56__INCLUDED_) #define AFX_NID2A_H__D0C329D5_E0FF_11D1_A21F_00A024E7DC56__INCLUDED_ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 #pragma warning(disable:4996) // no warnings: CComModule::UpdateRegistryClass was declared deprecated #include "mwnidaq.h" #include "resource.h" // main symbols #include "daqtypes.h" #include "daqmex.h" //#include "evtmsg.h" #include "AdaptorKit.h" #include "nidisp.h" #include "cirbuf.h" #include "messagew.h" ///////////////////////////////////////////////////////////////////////////// // nid2a class ATL_NO_VTABLE Cnid2a : public CmwDevice, public ImwOutput, public CComCoClass<Cnid2a,&CLSID_Cnid2a>, public CniDisp { public: unsigned long _buffersDone; short * _chanList; double *_chanRange[2]; ShortProp _clockSrc; //ShortProp _whichClock; TRemoteProp<long> _timeBase; TRemoteProp<long> _interval; //ShortProp _delayMode; std::vector<double> _defaultValues; HWND _hWnd; long _nChannels; CEnumProp _outOfDataMode; IntProp _refSource; DoubleProp _refVoltage; bool _isConfig; bool _running; bool _underrun; TCachedProp<double> _sampleRate; __int64 _samplesOutput; __int64 _samplesPut; IntProp _timeOut; IntProp _triggerType; short _updateMode; DoubleProp _updateRate; ShortProp _waveformGroup; short * _polarityList; //short * _buffer; long _EngineBufferSamples; IntProp _xferMode; bool _LastBufferLoaded; long _ptsTfr; long _fifoSize; enum CHANPROPS { HWCHAN=1, OUTPUTRANGE, DEFAULT_VALUE }; CComPtr<IPropRoot> _defaultChannelValueIProp; static MessageWindow *_Nid2aWnd; long _triggersPosted; public: HRESULT SetNIDAQError(short status,const IID& iid = IID_ImwOutput) { return status!=0 ? Error(status,iid) : S_OK;}; Cnid2a(); ~Cnid2a(); int ReallocCGLists(); template <class PT> CComPtr<IProp> RegisterProperty(LPWSTR name, PT &prop) { return prop.Attach(_EnginePropRoot,name,USER_VAL(prop)); } void SetupChannels(); int SetWaveformGenMsgParams(int mode); short GetID() { return _id; } long Channels() { return _nChannels; } short *ChanList() { return _chanList; } void setRunning(bool running) { _running = running; } bool Running() { return _running; } long GetFifoSizePoints() {return _fifoSize;} __int64 SamplesOutput() { return _samplesOutput; } void UpdateSamplesOutput(unsigned long ItersDone,unsigned long PointsDone) { _samplesOutput=((__int64)((unsigned __int64)ItersDone*GetBufferSizePoints())+PointsDone-GetFifoSizePoints())/_nChannels; } void SamplesOutput(__int64 s) { _samplesOutput=s; } bool Underrun() { return _underrun; } long PointsPerSecond() { return (long)(_sampleRate*_nChannels);} void CleanUp(); HRESULT Initialize(); virtual HRESULT Configure(); int SetOutputRangeDefault(short polarity); int SetOutputRange( VARIANT*, short); int LoadOutputRanges(); void SetAllPolarities(short polarity); int SetXferMode(); int TriggerSetup(); long PtsTfr() { return _ptsTfr; } int SetDaqHwInfo(); virtual void LoadData()=0; // load/update data in the device buffer virtual void SyncAndLoadData()=0; // take care of all dynamic stuff HRESULT Open(IDaqEngine * Interface,int _ID,DevCaps* DeviceCaps); int SetConversionOffset(short polarity); BEGIN_COM_MAP(Cnid2a) COM_INTERFACE_ENTRY(ImwOutput) COM_INTERFACE_ENTRY(ImwDevice) COM_INTERFACE_ENTRY_CHAIN(CniDisp) END_COM_MAP() //DECLARE_NOT_AGGREGATABLE(nid2a) // Remove the comment from the line above if you don't want your object to // support aggregation. //DECLARE_REGISTRY_RESOURCEID(IDR_nid2a) DECLARE_REGISTRY( Cnid2a, "mwnidaq.output.1", "mwnidaq.output", IDS_NID2A_DESC, THREADFLAGS_BOTH ) HRESULT InternalStart(); // IOutput public: STDMETHOD(GetStatus)(hyper*, BOOL*); STDMETHOD(PutSingleValues)(VARIANT*); STDMETHOD(Start)(); STDMETHOD(Stop)(); STDMETHOD(Trigger)(); STDMETHOD(TranslateError)(VARIANT * eCode, VARIANT *retVal); STDMETHOD(SetChannelProperty)(long User,NESTABLEPROP * pChan, VARIANT * NewValue); STDMETHOD(SetProperty)(long User, VARIANT *newVal); STDMETHOD(ChildChange)(DWORD typeofchange, NESTABLEPROP *pChan); // functions that depend on the data type virtual void InitBuffering(int Points)=0; virtual long GetBufferSizePoints()=0; virtual void *GetBufferPtr()=0; virtual HRESULT DeviceSpecificSetup() { return S_OK; } private: }; template <typename NativeDataType> class ATL_NO_VTABLE Tnid2a :public Cnid2a { public: typedef TCircBuffer<NativeDataType> CIRCBUFFER; CIRCBUFFER _CircBuff; std::vector<NativeDataType> StoppedValue; void InitBuffering(int Points) { _CircBuff.Initialize(Points); StoppedValue.resize(_nChannels); } long GetBufferSizePoints() { return _CircBuff.GetBufferSize(); } void *GetBufferPtr() { return _CircBuff.GetPtr(); } virtual void LoadData(); // load/update data in the device buffer virtual void SyncAndLoadData(); // take care of all dynamic stuff }; //extern template class Tnid2a<short>; //extern template class Tnid2a<long>; class ATL_NO_VTABLE CESeriesOutput :public Tnid2a<short> { public: // STDMETHOD(Trigger)(); // virtual void ProcessSamples(int samples); }; class ATL_NO_VTABLE CDSAOutput :public Tnid2a<long> { public: // STDMETHOD(Trigger)(); // virtual void ProcessSamples(int samples); HRESULT DeviceSpecificSetup(); STDMETHOD(PutSingleValues)(VARIANT*) { return E_NOTIMPL;} STDMETHOD(SetProperty)(long User, VARIANT *newVal); }; #endif // !defined(AFX_NID2A_H__D0C329D5_E0FF_11D1_A21F_00A024E7DC56__INCLUDED_)
[ [ [ 1, 211 ] ] ]
e3d9c3f1e076ae554af9d032aa9628c1aa5df376
0f40e36dc65b58cc3c04022cf215c77ae31965a8
/src/apps/vis/writer/vis_writer_factory.cpp
f17a2d9662492c70428061ca51440dccfd7d2525
[ "MIT", "BSD-3-Clause" ]
permissive
venkatarajasekhar/shawn-1
08e6cd4cf9f39a8962c1514aa17b294565e849f8
d36c90dd88f8460e89731c873bb71fb97da85e82
refs/heads/master
2020-06-26T18:19:01.247491
2010-10-26T17:40:48
2010-10-26T17:40:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,323
cpp
/************************************************************************ ** This file is part of the network simulator Shawn. ** ** Copyright (C) 2004-2007 by the SwarmNet (www.swarmnet.de) project ** ** Shawn is free software; you can redistribute it and/or modify it ** ** under the terms of the BSD License. Refer to the shawn-licence.txt ** ** file in the root of the Shawn source tree for further details. ** ************************************************************************/ #include "../buildfiles/_apps_enable_cmake.h" #ifdef ENABLE_VIS #include "apps/vis/writer/vis_writer_factory.h" #include "apps/vis/writer/vis_writer_keeper.h" #include "apps/vis/writer/vis_png_writer.h" #include "apps/vis/writer/vis_pdf_writer.h" namespace vis { WriterFactory:: WriterFactory( void ) {} WriterFactory::~WriterFactory() {} // ---------------------------------------------------------------------- std::string WriterFactory:: name( void ) const throw() { return "vis_writer"; } // ---------------------------------------------------------------------- std::string WriterFactory:: description( void ) const throw() { return "Vis filewriter objects"; } } #endif
[ [ [ 1, 44 ] ] ]
3845d26dd4caa25b02d8da91dca5567855ab344b
c440e6c62e060ee70b82fc07dfb9a93e4cc13370
/src/gui2/guis/gadsr.h
a76f3eae50ebe666c9c77c0286082ed7a30e0c04
[]
no_license
BackupTheBerlios/pgrtsound-svn
2a3f2ae2afa4482f9eba906f932c30853c6fe771
d7cefe2129d20ec50a9e18943a850d0bb26852e1
refs/heads/master
2020-05-21T01:01:41.354611
2005-10-02T13:09:13
2005-10-02T13:09:13
40,748,578
0
0
null
null
null
null
UTF-8
C++
false
false
459
h
#ifndef GADSR_H #define GADSR_H #include "gui.h" #include "mygtkslider.h" #include "../../modules/madsrlinear.h" #include <gtkmm/box.h> /** * No description */ class GADSR : public Gui { public: GADSR( Module* mod ); ~GADSR(); virtual Gtk::Widget* GetGui(); REGISTER_GUI( MADSRLinear::GetTypeStatic(), GADSR ) protected: Gtk::VBox box; MyGtkSlider slAttack, slDecay, slSustain, slRelease; }; #endif // GADSR_H
[ "ad4m@fa088095-53e8-0310-8a07-f9518708c3e6" ]
[ [ [ 1, 26 ] ] ]