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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
825c9bc6633e98d9b063e417cb891977a65875c6 | bef7d0477a5cac485b4b3921a718394d5c2cf700 | /nanobots/src/demo/map/Collider.cpp | a7ba7a056201d4433ff16b7d38e838f378412def | [
"MIT"
] | permissive | TomLeeLive/aras-p-dingus | ed91127790a604e0813cd4704acba742d3485400 | 22ef90c2bf01afd53c0b5b045f4dd0b59fe83009 | refs/heads/master | 2023-04-19T20:45:14.410448 | 2011-10-04T10:51:13 | 2011-10-04T10:51:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,635 | cpp | #include "stdafx.h"
#include "Collider.h"
#include <opcode/Opcode.h>
// --------------------------------------------------------------------------
CCollisionMesh::CCollisionMesh( int nverts, int ntris, const SVector3* verts, int vertStride, const unsigned short* indices, bool indicesAreActuallyInts )
: mVertexCount(nverts),
mTriangleCount(ntris)
{
assert( nverts > 0 );
assert( ntris > 0 );
assert( verts );
assert( vertStride >= sizeof(SVector3) );
assert( indices );
//mMatrix.Identity();
//
// create vertices/indices
mIndices = new int[ ntris * 3 ];
assert( mIndices );
mVertices = new SVector3[ mVertexCount ];
assert( mVertices );
//
// copy data
int i;
for( i = 0; i < nverts; ++i ) {
mVertices[i] = *verts;
verts = (const SVector3*)( (char*)verts + vertStride );
}
if( !indicesAreActuallyInts ) {
for( i = 0; i < ntris*3; ++i )
mIndices[i] = indices[i];
} else {
const int* indices32 = (const int*)indices;
for( i = 0; i < ntris*3; ++i )
mIndices[i] = indices32[i];
}
//
// build OPCODE model
Opcode::OPCODECREATE opcc;
opcc.mIMesh = new Opcode::MeshInterface();
opcc.mIMesh->SetNbTriangles( mTriangleCount );
opcc.mIMesh->SetNbVertices( mVertexCount );
opcc.mIMesh->SetPointers( getOpcodeTriangles(), getOpcodeVertices() );
// Tree building settings
opcc.mSettings.mRules = Opcode::SPLIT_SPLATTER_POINTS | Opcode::SPLIT_GEOM_CENTER;
opcc.mNoLeaf = true;
opcc.mQuantized = false;
opcc.mKeepOriginal = false; // true for debug purposes
opcc.mCanRemap = true;
bool s = mModel.Build( opcc ); // build the model
assert( s );
}
CCollisionMesh::~CCollisionMesh()
{
assert( mModel.GetMeshInterface() );
delete mModel.GetMeshInterface();
assert( mVertices );
delete[] mVertices;
assert( mIndices );
delete[] mIndices;
}
// --------------------------------------------------------------------------
void CCollisionMesh::getTriangle( int triIdx, SVector3& v0, SVector3& v1, SVector3& v2, SVector3& normal ) const
{
const IndexedTriangle& tri = getOpcodeTriangles()[triIdx];
int i0 = tri.mVRef[0], i1 = tri.mVRef[1], i2 = tri.mVRef[2];
const SVector3& mv0 = getVertex( i0 );
const SVector3& mv1 = getVertex( i1 );
const SVector3& mv2 = getVertex( i2 );
v0 = mv0;
v1 = mv1;
v2 = mv2;
SVector3 v101 = v1 - v0;
SVector3 v102 = v2 - v0;
normal = v101.cross( v102 ).getNormalized();
}
// --------------------------------------------------------------------------
CCollisionRay::CCollisionRay( const SVector3& position, const SVector3& direction )
: mLength(MAX_FLOAT)
{
setPosition( position );
setDirection( direction );
}
void CCollisionRay::setDirection( const SVector3& direction )
{
SVector3 d = direction;
d.normalize();
mRay.mDir = convert( d );
}
// --------------------------------------------------------------------------
CCollisionSphere::CCollisionSphere( float radius )
: mSphere()
{
//mMatrix.Identity();
mSphere.SetRadius( radius );
mSphere.mCenter.x = 0;
mSphere.mCenter.y = 0;
mSphere.mCenter.z = 0;
}
// --------------------------------------------------------------------------
CMeshRayCollider::CMeshRayCollider()
{
mMeshRayCollider.SetFirstContact( false );
mMeshRayCollider.SetTemporalCoherence( false );
mMeshRayCollider.SetClosestHit( true );
mMeshRayCollider.SetCulling( false );
mMeshRayCollider.SetMaxDist();
}
bool CMeshRayCollider::perform( CCollisionMesh& mesh, CCollisionRay& ray, CCollisionResult& result )
{
mFaces.Reset();
mMeshRayCollider.SetDestination( &mFaces );
mMeshRayCollider.SetMaxDist( ray.getLength() );
mMeshRayCollider.SetFirstContact( false );
bool s = mMeshRayCollider.Collide( ray.getRay(), mesh.getOpcodeModel(), NULL, NULL );
assert( s );
if( mMeshRayCollider.GetContactStatus() ) {
assert( mFaces.GetNbFaces() == 1 );
const Opcode::CollisionFace& f = *mFaces.GetFaces();
int tri = f.mFaceID;
float t = f.mDistance;
result.mPosition = ray.getPosition() + ray.getDirection() * t;
SVector3 v1, v2, v3, vn;
mesh.getTriangle( f.mFaceID, v1, v2, v3, vn );
result.mDirection = vn;
result.mDistance = t;
return true;
} else
return false;
}
// --------------------------------------------------------------------------
CMeshSphereCollider2::CMeshSphereCollider2()
{
mSphereMeshCollider.SetFirstContact( false );
mSphereMeshCollider.SetTemporalCoherence( false );
mSphereMeshCollider2.SetFirstContact( true );
mSphereMeshCollider2.SetTemporalCoherence( false );
}
| [
"[email protected]"
] | [
[
[
1,
173
]
]
] |
9ddf30e36d3aaeda08301de6a6529bc3918f14be | 46b3500c9ab98883091eb9d4ca49a6854451d76b | /ghost/packed.h | 3199abcadd0e731be55aa553e7e186c9b87659d4 | [
"Apache-2.0"
] | permissive | kr4uzi/pyghost | 7baa511fa05ddaba57880d2c7483694d5c5816b7 | 35e5bdd838cb21ad57b3c686349251eb277d2e6a | refs/heads/master | 2020-04-25T21:05:20.995556 | 2010-11-21T13:57:49 | 2010-11-21T13:57:49 | 42,011,079 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,639 | h | /*
Copyright [2008] [Trevor Hogan]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
CODE PORTED FROM THE ORIGINAL GHOST PROJECT: http://ghost.pwner.org/
*/
#ifndef PACKED_H
#define PACKED_H
//
// CPacked
//
class CCRC32;
class CPacked
{
public:
CCRC32 *m_CRC;
protected:
bool m_Valid;
string m_Compressed;
string m_Decompressed;
uint32_t m_HeaderSize;
uint32_t m_CompressedSize;
uint32_t m_HeaderVersion;
uint32_t m_DecompressedSize;
uint32_t m_NumBlocks;
uint32_t m_War3Identifier;
uint32_t m_War3Version;
uint16_t m_BuildNumber;
uint16_t m_Flags;
uint32_t m_ReplayLength;
public:
CPacked( );
virtual ~CPacked( );
virtual bool GetValid( ) { return m_Valid; }
virtual uint32_t GetHeaderSize( ) { return m_HeaderSize; }
virtual uint32_t GetCompressedSize( ) { return m_CompressedSize; }
virtual uint32_t GetHeaderVersion( ) { return m_HeaderVersion; }
virtual uint32_t GetDecompressedSize( ) { return m_DecompressedSize; }
virtual uint32_t GetNumBlocks( ) { return m_NumBlocks; }
virtual uint32_t GetWar3Identifier( ) { return m_War3Identifier; }
virtual uint32_t GetWar3Version( ) { return m_War3Version; }
virtual uint16_t GetBuildNumber( ) { return m_BuildNumber; }
virtual uint16_t GetFlags( ) { return m_Flags; }
virtual uint32_t GetReplayLength( ) { return m_ReplayLength; }
virtual void SetWar3Version( uint32_t nWar3Version ) { m_War3Version = nWar3Version; }
virtual void SetBuildNumber( uint16_t nBuildNumber ) { m_BuildNumber = nBuildNumber; }
virtual void SetFlags( uint16_t nFlags ) { m_Flags = nFlags; }
virtual void SetReplayLength( uint32_t nReplayLength ) { m_ReplayLength = nReplayLength; }
virtual void Load( string fileName, bool allBlocks );
virtual bool Save( bool TFT, string fileName );
virtual bool Extract( string inFileName, string outFileName );
virtual bool Pack( bool TFT, string inFileName, string outFileName );
virtual void Decompress( bool allBlocks );
virtual void Compress( bool TFT );
public:
static void RegisterPythonClass( );
};
#endif
| [
"kr4uzi@88aed30e-2b04-91ce-7a47-0ae997e79d63"
] | [
[
[
1,
82
]
]
] |
faba86cbc34e7ec291789dddf43abac9badd3921 | 58b7b01fdb47eb6f05682f4f1fc26e69616a1c0b | /addons/ofxTriangle/src/ofxTriangle.cpp | 914bcb510eed84babd326bf308b176313fdf154c | [] | no_license | brolin/openFrameworks | 8942e3152ad5e89645782a9ba6447ed8865263ee | d97c18b3b02dba8d5d39adc4d2541960449e024f | refs/heads/master | 2020-12-30T18:38:57.092170 | 2010-11-17T15:01:57 | 2010-11-17T15:01:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,823 | cpp | #include "ofxTriangle.h"
void ofxTriangle::triangulate(ofxCvBlob &cvblob, int resolution, int rdmPoints)
{
blob = &cvblob;
int bSize = blob->pts.size();
float maxi = min(resolution, bSize);
Delaunay::Point tempP;
vector< Delaunay::Point > v;
int i;
for( i=0; i< maxi; i++)
{
int id = (int)( (float)i/maxi*bSize );
tempP[0] = blob->pts[id].x;
tempP[1] = blob->pts[id].y;
v.push_back(tempP);
}
delobject = new Delaunay(v);
delobject->Triangulate();
//triangles.clear();
//nTriangles = 0;
Delaunay::fIterator fit;
for ( fit = delobject->fbegin(); fit != delobject->fend(); ++fit )
{
int pta = delobject->Org(fit);
int ptb = delobject->Dest(fit);
int ptc = delobject->Apex(fit);
int pta_id = (int)( ((float)pta/resolution)*bSize );
int ptb_id = (int)( ((float)ptb/resolution)*bSize );
int ptc_id = (int)( ((float)ptc/resolution)*bSize );
ofPoint tr[3];
tr[0] = ofPoint(blob->pts[pta_id].x, blob->pts[pta_id].y);
tr[1] = ofPoint(blob->pts[ptb_id].x, blob->pts[ptb_id].y);
tr[2] = ofPoint(blob->pts[ptc_id].x, blob->pts[ptc_id].y);
if( isPointInsidePolygon(&blob->pts[0], blob->pts.size(), getTriangleCenter(tr) ) )
{
ofxTriangleData td;
td.a = ofPoint(tr[0].x, tr[0].y);
td.b = ofPoint(tr[1].x, tr[1].y);
td.c = ofPoint(tr[2].x, tr[2].y);
td.area = delobject->area(fit);
triangles.push_back(td);
nTriangles++;
}
}
delete delobject;
}
void ofxTriangle::clear()
{
triangles.clear();
nTriangles = 0;
}
void ofxTriangle::addRdmPoint(vector<Delaunay::Point> * v)
{
/*
Delaunay::Point tempP;
int px = ofRandom( blob->boundingRect.x, blob->boundingRect.width );
int py = ofRandom( blob->boundingRect.y, blob->boundingRect.height );
while ( !isPointInsidePolygon( &blob->pts[0], blob->pts.size(), ofPoint( px, py ) ) )
{
px = ofRandom( blob->boundingRect.x, blob->boundingRect.width );
py = ofRandom( blob->boundingRect.y, blob->boundingRect.height );
cout << px << " " << py << endl;
}
tempP[0] = px;
tempP[1] = py;
v->push_back(tempP);
*/
}
ofPoint ofxTriangle::getTriangleCenter(ofPoint *tr)
{
float c_x = (tr[0].x + tr[1].x + tr[2].x) / 3;
float c_y = (tr[0].y + tr[1].y + tr[2].y) / 3;
return ofPoint(c_x, c_y);
}
bool ofxTriangle::isPointInsidePolygon(ofPoint *polygon,int N, ofPoint p)
{
int counter = 0;
int i;
double xinters;
ofPoint p1,p2;
p1 = polygon[0];
for (i=1;i<=N;i++)
{
p2 = polygon[i % N];
if (p.y > MIN(p1.y,p2.y)) {
if (p.y <= MAX(p1.y,p2.y)) {
if (p.x <= MAX(p1.x,p2.x)) {
if (p1.y != p2.y) {
xinters = (p.y-p1.y)*(p2.x-p1.x)/(p2.y-p1.y)+p1.x;
if (p1.x == p2.x || p.x <= xinters)
counter++;
}
}
}
}
p1 = p2;
}
if (counter % 2 == 0)
return false;
else
return true;
}
void ofxTriangle::draw(float x, float y)
{
ofPushMatrix();
ofTranslate(x, y, 0);
draw();
ofPopMatrix();
}
void ofxTriangle::draw()
{
ofFill();
for (int i=0; i<nTriangles; i++)
{
ofSetColor(ofRandom(0, 0xffffff));
ofTriangle( triangles[i].a.x, triangles[i].a.y,
triangles[i].b.x, triangles[i].b.y,
triangles[i].c.x, triangles[i].c.y);
}
}
| [
"[email protected]"
] | [
[
[
1,
153
]
]
] |
b8e3c61b80840491d74c4587b8068c59a04e9a48 | f801d8f4c84d1b0ed0688b71d4f4badc06317533 | /ContextMenuHandler.h | 92869553afc0e2d57f8f5dd883763e4152e2e048 | [] | no_license | maranas/dosrunner | 03a762fbe70c41a3fdabc9998709c646d5339724 | 870dc0788c64c55179d5291c71e9311b33d06140 | refs/heads/master | 2020-06-05T11:04:07.198259 | 2010-11-11T16:11:48 | 2010-11-11T16:11:48 | 38,186,916 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,579 | h | // ContextMenuHandler.h : Declaration of CContextMenuHandler
#include "resource.h" // main symbols
#include "DOSRunnerShell.h"
class ATL_NO_VTABLE CContextMenuHandler :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CContextMenuHandler, &CLSID_ContextMenuHandler>,
public IDispatchImpl<IContextMenuHandler, &IID_IContextMenuHandler, &LIBID_DOSRunnerShellLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
public IShellExtInit,
public IContextMenu
{
public:
CContextMenuHandler() { }
DECLARE_REGISTRY_RESOURCEID(IDR_ContextMenuHandler)
BEGIN_COM_MAP(CContextMenuHandler)
COM_INTERFACE_ENTRY(IContextMenuHandler)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IShellExtInit)
COM_INTERFACE_ENTRY(IContextMenu)
END_COM_MAP()
public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
// IShellExtInit
STDMETHODIMP Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY);
// IContextMenu
STDMETHODIMP GetCommandString(UINT_PTR, UINT, UINT*, LPSTR, UINT);
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO);
STDMETHODIMP QueryContextMenu(HMENU, UINT, UINT, UINT, UINT);
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
protected:
typedef BOOL (WINAPI * SH_GIL_PROC)(HIMAGELIST *phLarge, HIMAGELIST *phSmall);
typedef BOOL (WINAPI * FII_PROC) (BOOL fFullInit);
wchar_t m_szFile [MAX_PATH];
BOOL m_bFolder;
FII_PROC FileIconInit;
HMODULE hShell32;
};
OBJECT_ENTRY_AUTO(__uuidof(ContextMenuHandler), CContextMenuHandler) | [
"[email protected]"
] | [
[
[
1,
54
]
]
] |
40f44cc0da5dd2119d6dc16e2605dcbc55728c16 | dadf8e6f3c1adef539a5ad409ce09726886182a7 | /airplay/h/TinyOpenEngine.ScreenSpace2D.h | abbbc8a392e3e72878c3a304d533af27931806c3 | [] | no_license | sarthakpandit/toe | 63f59ea09f2c1454c1270d55b3b4534feedc7ae3 | 196aa1e71e9f22f2ecfded1c3da141e7a75b5c2b | refs/heads/master | 2021-01-10T04:04:45.575806 | 2011-06-09T12:56:05 | 2011-06-09T12:56:05 | 53,861,788 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 113 | h | #pragma once
namespace TinyOpenEngine
{
void toeScreenSpace2DInit();
void toeScreenSpace2DTerminate();
} | [
"[email protected]"
] | [
[
[
1,
7
]
]
] |
1b73ea967cbbee0f88ac01c50f3e7510bad6098b | 05869e5d7a32845b306353bdf45d2eab70d5eddc | /soft/application/NetworkSimulator/Dialog/AsyncMessageDlg.h | 4664b4df59dda71f56b7c6ca76a97811b0154391 | [] | 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 | 1,319 | h | #if !defined(AFX_ASYNCMESSAGEDLG_H__7FCA4732_DF7D_4FF4_82D7_09C23AAA3A91__INCLUDED_)
#define AFX_ASYNCMESSAGEDLG_H__7FCA4732_DF7D_4FF4_82D7_09C23AAA3A91__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// AsyncMessageDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CAsyncMessageDlg dialog
class CAsyncMessageDlg : public CDialog
{
// Construction
public:
CAsyncMessageDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CAsyncMessageDlg)
enum { IDD = IDD_DLG_ASYNC_MESSAGE };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAsyncMessageDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CAsyncMessageDlg)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ASYNCMESSAGEDLG_H__7FCA4732_DF7D_4FF4_82D7_09C23AAA3A91__INCLUDED_)
| [
"windyin@2490691b-6763-96f4-2dba-14a298306784"
] | [
[
[
1,
46
]
]
] |
10e3d804b901515af3e436149ff5bab78c4a88e5 | 1bc72c361ded5d439bcf3cb3bebf143e7bf75257 | /NodoArbol.h | 69facde0acf8027069ea700cdb81aba9ccb8e4da | [] | no_license | escaleno/g11-algoii | d4831539fa353e77b0b0d13ac89e8fbb7c23416a | 521d1cc1aa49d6e46cf8dd58d8c6b35b7c9e6df7 | refs/heads/master | 2021-01-10T12:06:53.886726 | 2011-11-24T11:46:47 | 2011-11-24T11:46:47 | 36,740,239 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,762 | h | /*
* NodoArbol.h
*
* Created on: 11/11/2011
* Author: jlezcano
*/
/*NodoArbol modela cada nodo de un arbol n-ario, cada nodo esta formado por un puntero al primer hijo de la izquierda, un puntero al primer
* hermano mas a la derecha y un puntero al padre.
*
* REFERENCIAS:
* tag:es el nombre de una etiqueta leida de un archivo xml, no contiene espacios
* contenido:es una variable puntero a string en donde se guarda el contenido propiamente dicho
*/
#ifndef NODOARBOL_H_
#define NODOARBOL_H_
#include <fstream>
#include <iostream>
using namespace std;
class NodoArbol {
private:
string tag; //tag proveniente del xml
string* contenido; //contenido de la hoja
NodoArbol* hijoIzq; //puntero hijo izquierdo
NodoArbol* hermanoDer; //puntero hermano derecho
NodoArbol* padre; //puntero al padre
public:
/*************************************************************************************************/
/*POST:creal el nodo con el tag llamado "tag", y setea el contenido con el puntero "contenido"*/
NodoArbol(string tag);
/*************************************************************************************************/
/*POST:libera los recursos utilizados por la instancia*/
~NodoArbol();
/*************************************************************************************************/
/*POST:constructor de copia*/
NodoArbol(NodoArbol& otroNodo);
/*************************************************************************************************/
/*POST:asigna el valor "tag" al nodo*///NO CREO QUE QUE LO USEMOS YA QUE ESTA EL CONSTRUCTOR 1 QUE ASIGNA EL TAG
void setTag(string tag);
/*************************************************************************************************/
/*POST:retorna el valor del tag*/
string getTag();
/*************************************************************************************************/
/*PRE:asigna el puntero "contenido" al contenido del nodo*/
void setContenido(string* contenido);
/*************************************************************************************************/
/*POST:retorna un puntero al contenido*/
string* getContenido();
/*************************************************************************************************/
/*POST: asigna unNodo como hijo izquierdo*/
void setHijoIzq(NodoArbol* unNodo);
/*************************************************************************************************/
/*POST:retorna un puntero al hijo izquierdo*/
NodoArbol* getHijoIzq();
/*************************************************************************************************/
/*POST:asigna unNodo como hermano derecho*/
void setHermanoDer(NodoArbol* unNodo);
/*************************************************************************************************/
/*POST:retorna un puntero al hermano derecho*/
NodoArbol* getHermanoDer();
/*************************************************************************************************/
/*POST:asigna nuevoPadre como padre*/
void setPadre(NodoArbol* nuevoPadre);
/*************************************************************************************************/
/*POST:retorna un puntero al padre*/
NodoArbol* getPadre();
/*************************************************************************************************/
/*POST:retorna TRUE si el nodo es una hoja, FALSE de lo contrario*/
bool esHoja();
/*************************************************************************************************/
};
#endif /* NODOARBOL_H_ */
| [
"[email protected]",
"[email protected]",
"[email protected]"
] | [
[
[
1,
20
],
[
23,
34
],
[
36,
38
],
[
40,
47
],
[
49,
105
]
],
[
[
21,
22
],
[
39,
39
],
[
48,
48
]
],
[
[
35,
35
]
]
] |
5b0573a91497dad0d5093b2fa49f6c696b703c0b | c58f258a699cc866ce889dc81af046cf3bff6530 | /src/bloomberg/blb.cpp | 660719fff50b1949fb2e3c37c180fdc702eeaf0a | [] | no_license | KoWunnaKo/qmlib | db03e6227d4fff4ad90b19275cc03e35d6d10d0b | b874501b6f9e537035cabe3a19d61eed7196174c | refs/heads/master | 2021-05-27T21:59:56.698613 | 2010-02-18T08:27:51 | 2010-02-18T08:27:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 430 | cpp | //
//
//
#include <qmlib/python/pyconfig.hpp>
//#include <qmlib/python/converters.hpp>
#include <qmlib/bloomberg/blb.hpp>
QM_NAMESPACE2(python)
void blb_wrap();
QM_NAMESPACE_END2
#ifdef _DEBUG_
BOOST_PYTHON_MODULE(bloomberglibdebug) {
#else
BOOST_PYTHON_MODULE(bloomberglib) {
#endif _DEBUG_
QM_USING_NAMESPACE2(python);
boost::python::scope().attr("__doc__") = "Bloomber Python Library";
blb_wrap();
}
| [
"[email protected]"
] | [
[
[
1,
20
]
]
] |
797d85358e25b0fee50bd4f06690442fa1547b53 | a352572bc22d863f72020118d8f5b94c69521f3f | /cs4620/src/Color.cpp | 88eac6b09faf649ea873ebdd9b10a2da055299c1 | [] | no_license | mjs513/cs4620-1 | 63345a9a7774279d8d6ab63b1af64d65b14b0ae3 | 419da5df73c5a9c34387b3cd2f7f3c542e0a3c3e | refs/heads/master | 2021-01-10T06:45:47.809907 | 2010-12-10T20:59:46 | 2010-12-10T20:59:46 | 46,994,144 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,229 | cpp | /*
* Color.cpp
*
* Created on: 30/03/2010
* Author: user
*/
#include "Color.h"
Color::Color()
: r(0), g(0), b(0), a(1) { }
Color::Color(float r, float g, float b)
: r(r), g(g), b(b), a(1) { }
Color::Color(float r, float g, float b, float a)
: r(r), g(g), b(b), a(a) { }
const Color Color::black()
{
return Color();
}
const Color Color::white()
{
return Color(1,1,1);
}
const Color Color::gray()
{
return Color(0.5,0.5,0.5);
}
const Color Color::blue()
{
return Color(0,0,1);
}
const Color Color::red()
{
return Color(1,0,0);
}
const Color Color::green()
{
return Color(0,1,0);
}
const Color Color::yellow()
{
return Color(1,1,0);
}
const Color Color::brown()
{
return Color(0.5,0.3,0.1);
}
const Color Color::orange()
{
return Color(1,0.5,0);
}
const Color Color::magenta()
{
return Color(1,0,1);
}
const Color Color::cyan()
{
return Color(0,1,1);
}
const Color Color::clear()
{
return Color(0,0,0,0);
}
std::ostream& operator<<(std::ostream &out, const Color &c)
{
return out << "{ r=" << c.r << ",g=" << c.g << ",b=" << c.b << ",a=" << c.a << " }";
}
| [
"robertorfischer@ebbd4279-5267-bd07-7df5-4dafc36418f6"
] | [
[
[
1,
83
]
]
] |
044195daf3d9e7129ee479128395ef4bc5f79e30 | 3daaefb69e57941b3dee2a616f62121a3939455a | /mgllib/src/august/AugustScreen2.cpp | a3d64cf0cf686b5003c9f416ac3b406528dc8475 | [] | 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 | 11,091 | cpp | //////////////////////////////////////////////////////////
//
// AugustScreen2
// - MglGraphicManager レイヤークラス
//
//////////////////////////////////////////////////////////
#include "stdafx.h"
#include "AugustScreen2.h"
#include "MglGraphicManager.h"
#include "MyuFPS.h"
//#define _NO_CATCH_EXCEPTION // デバッグ作業中に、例外をキャッチさせたくない場合に有効にする
using namespace agh;
using namespace std;
#define THREAD_TIMEOUT (30*1000)
//////////////////////////////////////////////////
CAugustFpsManager::CAugustFpsManager()
{
m_pInternal = new CMyuFPS();
}
CAugustFpsManager::~CAugustFpsManager()
{
delete m_pInternal;
}
void CAugustFpsManager::SetFps(int nFps){
m_pInternal->SetFPS(nFps);
}
float CAugustFpsManager::GetAveFps(){
return m_pInternal->GetAveFps();
}
float CAugustFpsManager::GetFps(){
return m_pInternal->GetFps();
}
void CAugustFpsManager::DoWait(){
m_pInternal->Sleep();
}
//////////////////////////////////////////////////
#define m_hWnd (HWND)m_vphWnd
//構造化例外が発生すると、この関数が呼ばれる
void _MglAugust2_se_translator_function(unsigned int code, struct _EXCEPTION_POINTERS* ep)
{
throw ep; //標準C++の例外を発生させる
}
/* DLL化、ダメ!絶対!!
// コンストラクタ
CAugustScreen2::CAugustScreen2()
{
}
// デストラクタ
CAugustScreen2::~CAugustScreen2()
{
}
*/
///////////////////////////////////////////////////////
bool CAugustScreen2::ThreadFunc(int anyParam)
{
m_bEndFlg = false;
_set_se_translator(_MglAugust2_se_translator_function);
///////////////////////////////////////////
// 2009/05/17 分離
bool bRet = ThreadFuncMain();
///////////////////////////////////////////
m_grp.Release();
//m_bEndFlg = false; <- 違くない?
m_bEndFlg = true;
ExitWindow();
return bRet;
}
bool CAugustScreen2::ThreadFuncMain()
{
/*
m_bEndFlg = false;
_set_se_translator(_MglAugust2_se_translator_function);
*/
///////////////////////////////////////////////////////////
//__try{
{
#ifndef _NO_CATCH_EXCEPTION
try // 例外処理受け付け開始
#endif
{
if ( OnInit() == false )
return false;
if ( OnInitFirst() == false )
return false;
CMglStackInstance("CAugustEzGameFrame::PrivateMainMethod");
m_grp.Init();
// ユーザコールバック
//if ( OnGraphicInitEnded() == false )
if ( OnReady() == false )
return false;
/*
_MGL_DEBUGLOG("input.Init()..." );
input.Init( m_window.GetWindowHandle() );
_MGL_DEBUGLOG("input.Init() end." );
// 2008/11/29
if ( m_bEnabledAudio ){
_MGL_DEBUGLOG("audio.Init()..." );
InitAudio();
_MGL_DEBUGLOG("audio.Init() end." );
}
_MGL_DEBUGLOG("Create Debug/FPS Fonts..." );
//m_txtDebug.InitAndEzCreate( &grp, 14 );
//m_txtFps.InitAndEzCreate( &grp, 14 );
m_txtDebug.Init( &grp );
m_txtFps.Init( &grp );
m_txtDebug.Create( 14 );
m_txtFps.Create( 14 );
//fps.SetFPS(60); <- 勝手に上書きしちゃだめ!てかデフォルト60なってるし
//grp.Clear();
_MGL_DEBUGLOG("end." );
// 2009/01/23 CAugustWindow側のOnInit()呼び出し
_MGL_DEBUGLOG("EzFrame_OnInit()..." );
EzFrame_OnInit();
// MGL S3.1からは呼び出すだけにする(ループはこの中でやってもらう)- 2006/11/25
_MGL_DEBUGLOG("Call User MainMethod." );
m_userMainThread((void*)dwUserThreadParam);
//→ やっぱやめ -> ない!(どっちだよ:笑)
*/
// ユーザコールバック
if ( OnInited() == false )
return false;
MainLoop();
}
#ifndef _NO_CATCH_EXCEPTION
// 例外処理 V3.0
catch( MglException& exp )
{
char work[1024];
snprintf( work, sizeof(work),
"Myu Game Library Error :\r\n"
" Location : %s::%s() Error Code : 0x%08X\r\n"
"\r\n"
"%s",
exp.szClass, exp.szMethod, exp.nInternalCode, exp.szMsg );
::MessageBox( m_hWnd, work, NULL, MB_ICONERROR );
}
// 例外処理
catch( MyuCommonException& except )
{
char work[512];
//snprintf( work,sizeof(work), "ErrNo : 0x%08X\r\n%s", except.nErrCode, except.szErrMsg );
snprintf( work,sizeof(work),
"ErrNo : 0x%08X\r\n%s\r\n"
"\r\n"
"%s",
except.nErrCode, except.szErrMsg,
g_stackTrace.Dump().c_str() );
::MessageBox( m_hWnd, work, NULL, MB_ICONERROR );
}
// 例外処理
catch( AugustException& except )
{
char work[1024+200];
//snprintf( work,sizeof(work), "ErrNo : 0x%08X\r\n%s", except.nErrCode, except.szErrMsg );
snprintf( work,sizeof(work),
"ErrNo : 0x%08X\r\n"
"\r\n"
"%s",
except.nCode, except.szMsg );
::MessageBox( m_hWnd, work, NULL, MB_ICONERROR );
}
// 例外処理
catch( MglException2& e )
{
char work[2048+600];
//snprintf( work,sizeof(work), "ErrNo : 0x%08X\r\n%s", except.nErrCode, except.szErrMsg );
snprintf( work,sizeof(work),
"ErrNo : 0x%08X"
"\r\n\r\n"
"%s"
"\r\n\r\n"
"File(Line):\r\n"
"%s(%d)"
,
e.nErrCode, e.szErrMsg, e.szpFile, e.nLine );
::MessageBox( m_hWnd, work, NULL, MB_ICONERROR );
}
#ifndef _DEBUG
// VC++の例外か
catch(_EXCEPTION_POINTERS *ep)
{
//_EXCEPTION_POINTERS *ep = GetExceptionInformation();
PEXCEPTION_RECORD rec = ep->ExceptionRecord;
switch(rec->ExceptionCode){
case 0xc0000094:
::MessageBox( m_hWnd, "0 で除算されました。", NULL, MB_ICONERROR ); break;
}
char work[1024];
snprintf(work,sizeof(work), ("内部アクセス保護違反です。\r\n"
"code:%x flag:%x addr:%p params:%d\n"),
rec->ExceptionCode,
rec->ExceptionFlags,
rec->ExceptionAddress,
rec->NumberParameters
);
::MessageBox( m_hWnd, work, NULL, MB_ICONERROR );
}
// VC++の例外か
catch(...)
{
::MessageBox( m_hWnd, "fdssdff", NULL, MB_ICONERROR );
}
#endif//_DEBUG
#endif//_NO_CATCH_EXCEPTION
}
/*}
__except(_EXCEPTION_POINTERS *ep = GetExceptionInformation())
{
_EXCEPTION_POINTERS *ep = GetExceptionInformation();
PEXCEPTION_RECORD rec = ep->ExceptionRecord;
char work[1024];
snprintf(work,sizeof(work), ("内部アクセス保護違反です。\r\n"
"code:%x flag:%x addr:%p params:%d\n"),
rec->ExceptionCode,
rec->ExceptionFlags,
rec->ExceptionAddress,
rec->NumberParameters
);
::MessageBox( NULL, work, NULL, MB_ICONERROR );
}*/
// ↓try-catch内でなくていいのか…?
// ここで開放しとかないとスレッド外で開放されて落ちる
//if ( m_bEnabledAudio ) <- 別にInitしてないならしてないでReleaseしても問題ないんでね・・・?
/* audio.Release();
input.Release();
input.FinalRelease();
m_txtDebug.Release();*/
///////////////////////////////////////////////////////////
/*
m_grp.Release();
//m_bEndFlg = false; <- 違くない?
m_bEndFlg = true;
ExitWindow();
*/
PreWindowCloseRelease();
return true;
}
void CAugustScreen2::PreWindowCloseRelease()
{
for(int i=0; i<m_releaseList.size(); i++)
m_releaseList[i]->Release();
}
void CAugustScreen2::MainLoop()
{
for(;;)
{
if ( DoFrame() == false )
break;
// フレーム分待つよん
if ( DoFpsWait() == false )
break;
}
}
// 有効かどうか復帰します(FALSEになったら終了すること!)
bool CAugustScreen2::DoFpsWait()
{
// ウインドウが生きてるかのチェック
//if ( m_window.IsAlive() != TRUE )
if ( m_bEndFlg )
return false;
/*
// 抜ける?
if ( m_bBreak )
return FALSE;
*/
m_grp.FrameEnd();
// 待つよん
m_fps.DoWait();
// キーボード入力の更新
/*input.Update();
if ( m_bEscEnd ){
if ( input.GetOnKey(ASCII_ESC) )
return FALSE;
}*/
m_grp.FrameStart();
return true;
}
// 閉じるー
bool CAugustScreen2::OnClose()
{
m_bEndFlg = true;
return true;
}
// 2009/09/23 スレッドの終了を待つぜ!
void CAugustScreen2::OnClosedWindow()
{
WaitEndThread();
}
// 2009/09/23 スレッド終了待機
bool CAugustScreen2::WaitEndThread()
{
if ( _THREAD_BASE::ThreadWaitEnd( THREAD_TIMEOUT ) == false )
{
MessageBox( NULL, "CMyuEzWindow::StartWindow() スレッドからの応答がありません。強制的にスレッドを終了させます。\r\n"
"\r\n"
"プログラマさんへ:\r\n"
" CMyuEzWindow::IsAcrive() にて、ウインドウの活性状態をチェックし、FALSEだった場合、\r\n"
" スレッドを終了させるような処理を追加してください。(詳細はヘルプ参照)",
NULL, MB_ICONERROR );
// もう一度チェックしとく
if ( IsThreadEnded() == false )
return ThreadForceEnd();
}
return true;
}
// 描画ー
void CAugustScreen2::OnDraw()
{
// CAugustGraphicsManager は CControlBase を継承したクラスなのでDraw()では呼ばれない・・・
// ので CAugustScreen2::OnDraw() の中で呼んでやる事にしたらしい
m_grp.OnDraw();
}
// フレーム処理
bool CAugustScreen2::DoFrame()
{
_BASE::DoFrame();
Draw();
return true;
}
// 2009/10/25 ↑に簡素にしました。
#if 1 == 0
bool CAugustScreen2::DoFrame()
{
//m_grp.OnDraw(); // とりあえずー // 2009/05/17 コメントアウト
// キーボードのハンドル処理
/*if ( OnFrameKeyboardInput() != true )
return false;*/
// 2008/11/02 ユーザイベント処理
if ( OnFrameDoUser() != true )
return false;
// 各コントロールのフレーム処理
//for(int i=0; i<m_ctrlPtrAry.size(); i++)
//for(int i=0; i<m_ctrlPtrAry.size(); _vcpp(i))
for(citr it=cbegin(); it != cend(); it++)
//for(vector<CControlBase*>::iterator it=cbegin(); it != cend(); it++)
{
//if ( it->OnFrame() == false )
if ( it->DoFrame() == false )
return false;
//(*it)->OnFrame();
//((CControlBase*)it)->OnFrame();
//m_ctrlPtrAry[i]->OnFrame();
//GetVCtrlPtr(i)->Draw();
/* 2009/05/10 処理速度的にはアレだけど、OnFrame()が全て終わってからOnDraw()呼び出したほうがいいでしょう・・・
if ( it->IsVisual() )
((agh::CVisualControlBase*)it.get())->OnDraw();
//((agh::CVisualControlBase*)it.operator ->())->OnDraw();
*/
}
// 2009/10/03
Draw();
/*
this->OnDraw();
// 各コントロールのフレーム処理
//for(int i=0; i<m_ctrlPtrAry.size(); i++)
//for(int i=0; i<m_ctrlPtrAry.size(); _vcpp(i))
for(vcitr it2=vcbegin(); it2 != vcend(); it2++)
//for(vector<CControlBase*>::iterator it=cbegin(); it != cend(); it++)
{
it2->OnDraw();
}
*/
return true;
}
#endif
/*
// スレッド終了待ちするためのオーバーライド
void CAugustScreen2::Start()
{
_BASE::Start();
}
*/ | [
"myun2@6d62ff88-fa28-0410-b5a4-834eb811a934"
] | [
[
[
1,
462
]
]
] |
686de592800f1c36c966176c9bb96444555b1cb1 | 3cfa229d1d57ce69e0e83bc99c3ca1d005ae38ad | /glome/common/IFileSystem.hpp | 1e7b51de94491523b5d89727e2b2d530c474e0be | [] | no_license | chadaustin/sphere | 33fc2fe65acf2eb56e35ade3619643faaced7021 | 0d74cfb268c16d07ebb7cb2540b7b0697c2a127a | refs/heads/master | 2021-01-10T13:28:33.766988 | 2009-11-08T00:38:57 | 2009-11-08T00:38:57 | 36,419,098 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 254 | hpp | #ifndef I_FILE_SYSTEM_HPP
#define I_FILE_SYSTEM_HPP
#include "../common/IFile.hpp"
struct IFileSystem
{
// file open modes
enum { read = 0x1, write = 0x2 };
virtual IFile* Open(const char* filename, int mode) = 0;
};
#endif
| [
"surreality@c0eb2ce6-7f40-480a-a1e0-6c4aea08c2c2"
] | [
[
[
1,
17
]
]
] |
e0015aceaeb17809342f609791e2acb9e20d59e4 | 3ec03fa7bb038ea10801d09a685b9561f827928b | /js_wimg/stdafx.cpp | af228c4292254da09f4c227b0ecb8e18288de9d9 | [] | no_license | jbreams/njord | e2354f2013af0d86390ae7af99a419816ee417cb | ef7ff45fa4882fe8d2c6cabfa7691e2243fe8341 | refs/heads/master | 2021-01-24T17:56:32.048502 | 2009-12-15T18:57:32 | 2009-12-15T18:57:32 | 38,331,688 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 294 | cpp | // stdafx.cpp : source file that includes just the standard includes
// js_wimg.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
| [
"jreams@1c42f586-7543-11de-ba67-499d525147dd"
] | [
[
[
1,
8
]
]
] |
e924b7c2ed5d532bea5e3685e7d199df11528853 | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /Application/SysCAD/SLVSTATE.CPP | f0f2a712959658a45b99af461fca2573de7fc3f2 | [] | no_license | abcweizhuo/Test3 | 0f3379e528a543c0d43aad09489b2444a2e0f86d | 128a4edcf9a93d36a45e5585b70dee75e4502db4 | refs/heads/master | 2021-01-17T01:59:39.357645 | 2008-08-20T00:00:29 | 2008-08-20T00:00:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,591 | cpp | //================== SysCAD - Copyright Kenwalt (Pty) Ltd ===================
// $Nokeywords: $
//===========================================================================
#include "stdafx.h"
#include "resource.h"
#include "SlvState.h"
#include "scd_wm.h"
#include "project.h"
#include "accnode.h"
#include "mdlrunmngr.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
inline flag NotBusy() { return gs_pPrj && gs_pPrj->pPrjDoc && /*pExec &&*/ !gs_Exec.Busy(); };
const int MAXCOLUMNS=4;
/////////////////////////////////////////////////////////////////////////////
// CSolveState dialog
CSolveState::CSolveState(CSolveTool * SolveTool, CWnd* pParent /*=NULL*/)
: CDialog(CSolveState::IDD, pParent)
{
pSolveTool=SolveTool;
//{{AFX_DATA_INIT(CSolveState)
//}}AFX_DATA_INIT
if (!Create(CSolveState::IDD, pParent))//, WS_VISIBLE | WS_OVERLAPPEDWINDOW))
{
TRACE("Failed to create SolveState\n");
}
CRect WinRect, wr1, wr2, mwr;
GetWindowRect(&WinRect);
GetDlgItem(IDB_SLV_ADV)->GetWindowRect(&wr1);
GetDlgItem(IDC_WORSTERRS)->GetWindowRect(&wr2);
WndRightShift=wr2.right-wr1.right;
AfxGetMainWnd()->GetWindowRect(&mwr);
int dx=((mwr.right-mwr.left)-(WinRect.right-WinRect.left-WndRightShift))/2-WinRect.left;
int dy=((mwr.bottom-mwr.top)-(WinRect.bottom-WinRect.top))/2-WinRect.top;
//int dx=0, dy=0;
int x=gs_pPrj->m_Solver.m_iStateX;
int y=gs_pPrj->m_Solver.m_iStateY;
if (x>-10000)
{
int xw=WinRect.right-WinRect.left;
int yw=WinRect.bottom-WinRect.top;
WinRect.right =mwr.left+x+xw;
WinRect.left =mwr.left+x;
WinRect.bottom=mwr.top+y+yw;
WinRect.top =mwr.top+y;
}
else
{
WinRect.right+=dx;
WinRect.left+=dx;
WinRect.top+=dy;
WinRect.bottom+=dy;
}
RECT CR;
AfxGetMainWnd()->GetTopWindow()->GetClientRect(&CR);
int MaxX=CR.right-(2*GetSystemMetrics(SM_CXSIZE)+GetSystemMetrics(SM_CXSIZEFRAME));
int MaxY=CR.bottom-(GetSystemMetrics(SM_CYSIZE)+GetSystemMetrics(SM_CYSIZEFRAME));
if (WinRect.left>MaxX)
{
int dx=MaxX-WinRect.left;
WinRect.right+=dx;
WinRect.left+=dx;
}
if (WinRect.top>MaxY)
{
int dy=MaxY-WinRect.top;
WinRect.top+=dy;
WinRect.bottom+=dy;
}
MoveWindow(&WinRect, False);
//WndRightShift*=-1;
ToggleWindowWidth(False); // Always make it Narrow
if (gs_pPrj->m_Solver.m_fStateErrors) // Expand if neccessary
ToggleWindowWidth(False);
//ShowWindow(SW_SHOW);
CenterWindow();
}
// --------------------------------------------------------------------------
CSolveState::~CSolveState()
{
//ASSERT(pState==NULL || pState==this);
//pState = NULL;
}
// --------------------------------------------------------------------------
void CSolveState::ToggleWindowWidth(flag RePaint)
{
CRect WinRect;
GetWindowRect(&WinRect);
WndRightShift *= -1;
WinRect.right += WndRightShift;
MoveWindow(&WinRect, RePaint);
SetDlgItemText(IDB_SLV_ADV, WndRightShift < 0 ? "Errors >>" : "<< Basic");
gs_pPrj->m_Solver.m_fStateErrors=Sign(WndRightShift)>0;
gs_pPrj->m_Solver.m_iStateX=WinRect.left;
gs_pPrj->m_Solver.m_iStateY=WinRect.top;
iExtraInfoStyle = (WndRightShift<0 ? 0 : 1);
gs_EqnCB.SetCollectWorst(iExtraInfoStyle);
}
// --------------------------------------------------------------------------
void CSolveState::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSolveState)
DDX_Control(pDX, IDC_WORSTERRS, m_ErrList);
//}}AFX_DATA_MAP
if (pDX->m_bSaveAndValidate)
{
int xxx=0;
}
else
{
((CButton*)GetDlgItem(IDC_SLV_PINNED))->SetCheck(gs_pPrj->m_Solver.m_fStatePinned);
((CButton*)GetDlgItem(IDC_SLV_PINNED))->SetBitmap(gs_pPrj->m_Solver.m_fStatePinned ? (HBITMAP)PinnedDownBitmap : (HBITMAP)PinnedUpBitmap);
char Buff[80];
CString sBuff;
CProgressCtrl * pProg1 = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS1);
CProgressCtrl * pProg2 = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS2);
if (1)
{
const int nTears = gs_EqnCB.NUnknowns();
const int NBadError = gs_EqnCB.NBadError();
const int NBadLimit = gs_EqnCB.NBadLimit();
const int NIters = gs_EqnCB.NIters();
//const int Cnvrgd = gs_EqnCB.fConverged;
const int Decades = (int)(0.99+100.0*fabs(log10(Range(1.0e-9, gs_EqnCB.Cfg.m_EPS_Rel, 0.1))));
const int ErrXfrm = (int)(0.99+100.0*fabs(log10(Range(1.0e-9, gs_EqnCB.WorstErr(), 0.9))));
const int rel=(int)(0.99+fabs(log10(Range(1.0e-9, gs_EqnCB.Cfg.m_EPS_Rel, 0.1))));
XSW().m_swRun.MinSecDesc(sBuff);
if (NIters>0)
{
if (XStopping())
sprintf(Buff, "%i Stopping", NIters);
else
sprintf(Buff, "%i", NIters);
GetDlgItem(IDC_ITERATIONS)->SetWindowText(Buff);
GetDlgItem(IDC_SOLVETIME)->SetWindowText(XSW().m_swRun.MinSecDesc(sBuff));
}
else if (XStarting() || nTears==0)
{
GetDlgItem(IDC_ITERATIONS)->SetWindowText("Starting");
GetDlgItem(IDC_SOLVETIME)->SetWindowText("0:00");
}
else
{
GetDlgItem(IDC_ITERATIONS)->SetWindowText("0");
GetDlgItem(IDC_SOLVETIME)->SetWindowText(sBuff);
}
pProg1->SetPos(ErrXfrm);
pProg1->SetRange(0, Decades);
if (NBadLimit>0)
sprintf(Buff, NIters>0 ? "Limit" : "");
else if (NBadError>0)
{
if (NIters>0)
sprintf(Buff, "%*.*f %%", rel+2, rel-1, gs_EqnCB.WorstErr()*100.0);
else
Buff[0] = 0;
}
else
sprintf(Buff, NIters>1 ? "Solved" : "");
XStrTrim(Buff);
GetDlgItem(IDC_MAXERROR)->SetWindowText(Buff);
pStatusBar->UpdateIndicator(2, Buff, TRUE);
sprintf(Buff, "%i %s", NIters, sBuff);
pStatusBar->UpdateIndicator(1, Buff, TRUE);
if (nTears>0)
{
pProg2->SetRange(0, nTears);
if (NIters>0)
pProg2->SetPos(Max(0, (int)(nTears-(NBadError+NBadLimit))));
else
pProg2->SetPos(0);
}
else
{
pProg2->SetRange(0, 1);
pProg2->SetPos(0);
}
if (NIters>0)
sprintf(Buff, "%i of %i", Max(0, (int)(nTears-(NBadError+NBadLimit))), nTears);
else if (XStarting() || nTears==0)
Buff[0] = 0;
else
sprintf(Buff, "0 of %i", nTears);
GetDlgItem(IDC_CONVERGED)->SetWindowText(Buff);
pStatusBar->UpdateIndicator(3, Buff, TRUE);
}
if (iExtraInfoStyle)
{
CCustomListCtrl * pErrLst=(CCustomListCtrl *)GetDlgItem(IDC_WORSTERRS);
//COLORREF BKCOLOR=0x00c0c0c0;
//pErrLst->SetBkColor(BKCOLOR);
for (int i=0; i<Min(gs_EqnCB.NBadError()+gs_EqnCB.NBadLimit(), (long)MAX_EQNSLV_WORST); i++)
{
if (i>=pErrLst->GetItemCount())
pErrLst->InsertItem(i, " ");
char Buff[1024];
strcpy(Buff, gs_EqnCB.Worst[i].cStr);
char *p=Buff;
for (int j=0; j<MAXCOLUMNS; j++)
{
char *q=strchr(p, '\t');
if (q)
*q=0;
pErrLst->SetItemText(i, j, p);
if (!q)
break;
p=q+1;
}
}
for ( ; i<pErrLst->GetItemCount(); i++)
for (int j=0; j<MAXCOLUMNS; j++)
pErrLst->SetItemText(i, j, " ");
if (gs_EqnCB.NBadError()+gs_EqnCB.NBadLimit()==0)
{
//pErrLst->SetItemText(0, 0, ".....solved.....");
//pErrLst->SetItemText(0, 3, "Solved");
pErrLst->SetItemText(0, 0, ".....");
//pErrLst->SetItemText(2, 0, ".....");
i=1;
char Buff[1024];
strcpy(Buff, gs_EqnCB.WorstOther.cStr);
char *p=Buff;
for (int j=0; j<MAXCOLUMNS; j++)
{
char *q=strchr(p, '\t');
if (q)
*q=0;
pErrLst->SetItemText(i, j, p);
if (!q)
break;
p=q+1;
}
}
}
}
}
//---------------------------------------------------------------------------
BEGIN_MESSAGE_MAP(CSolveState, CDialog)
//{{AFX_MSG_MAP(CSolveState)
ON_BN_CLICKED(IDB_SLV_ADV, OnSlvAdv)
ON_BN_CLICKED(IDC_SLV_PINNED, OnSlvPinned)
ON_NOTIFY(NM_DBLCLK, IDC_WORSTERRS, OnDblclkWorsterrs)
ON_NOTIFY(NM_RCLICK, IDC_WORSTERRS, OnRclickWorsterrs)
ON_WM_PAINT()
//}}AFX_MSG_MAP
ON_MESSAGE(WMU_PB_UPDATEDATA, OnUpdateDataByMsg)
END_MESSAGE_MAP()
//---------------------------------------------------------------------------
LRESULT CSolveState::OnUpdateDataByMsg(WPARAM wParam, LPARAM lParam)
{
switch (wParam)
{
case 0:
ShowWindow(SW_RESTORE);
break;
case 1:
case 3:
if (wParam==3 || !gs_pPrj->m_Solver.m_fStatePinned)
{
ShowWindow(SW_HIDE);
ScdMainWnd()->PostMessage(WMU_UPDATEMAINWND, SUB_UPDMAIN_UPDATE, 0); //get main window thread to top
}
break;
case 2:
UpdateData(False);
//RedrawWindow();
break;
}
return 0;
}
//---------------------------------------------------------------------------
CSolveState* CSolveState::pState=NULL;
void CSolveState::Open(CSolveTool * SolveTool)
{
if (pState==NULL)
pState=new CSolveState(SolveTool, AfxGetMainWnd());
//pState->SendMessage(WMU_PB_UPDATEDATA, 1, 0);
}
void CSolveState::Close()
{
if (pState)
{
pState->DestroyWindow();
delete pState;
pState = NULL;
}
}
void CSolveState::Show()
{
if (pState)
{
if (gs_TheRunMngr.AutomationBusy())
pState->PostMessage(WMU_PB_UPDATEDATA, 0, 0);
else
pState->SendMessage(WMU_PB_UPDATEDATA, 0, 0);
}
};
void CSolveState::Hide(int ForceHide)
{
if (pState)
{
if (gs_TheRunMngr.AutomationBusy())
pState->PostMessage(WMU_PB_UPDATEDATA, ForceHide ? 3 : 1, 0);
else
pState->SendMessage(WMU_PB_UPDATEDATA, ForceHide ? 3 : 1, 0);
}
};
void CSolveState::Update()
{
if (pState)
{
if (gs_TheRunMngr.AutomationBusy())
pState->PostMessage(WMU_PB_UPDATEDATA, 2, 0);
else
pState->SendMessage(WMU_PB_UPDATEDATA, 2, 0);
}
};
//---------------------------------------------------------------------------
BOOL CSolveState::OnInitDialog()
{
CDialog::OnInitDialog();
PinnedUpBitmap.LoadMappedBitmap(IDB_PINNEDUP);
PinnedDownBitmap.LoadMappedBitmap(IDB_PINNEDDOWN);
CCustomListCtrl* pErrLst=(CCustomListCtrl *)GetDlgItem(IDC_WORSTERRS);
//COLORREF BKCOLOR=0x00c0c0c0;
//pErrLst->SetBkColor(BKCOLOR);
RECT Rect;
pErrLst->GetWindowRect(&Rect);
const int Width = Rect.right - Rect.left - 1;
pErrLst->InsertColumn(0, "Tolerance", LVCFMT_RIGHT, (int)(Width*0.13));
pErrLst->InsertColumn(1, "Value", LVCFMT_RIGHT, (int)(Width*0.14));
pErrLst->InsertColumn(2, "Damping", LVCFMT_RIGHT, (int)(Width*0.13));
pErrLst->InsertColumn(3, "Tag", LVCFMT_LEFT, (int)(Width*0.60));
ASSERT(MAXCOLUMNS==4);
//CImageList ImgList;
//CBitmap BM;
//BM.LoadBitmap(IDB_ACTPAGEIMGS);
//BOOL b=ImgList.Create(10, 10, FALSE, 0, 10);
//ImgList.Add(&BM, (CBitmap*)NULL);
//m_ActPageList.SetImageList(&ImgList , LVSIL_NORMAL);
//m_ActPageList.SetImageList(&ImgList , LVSIL_SMALL);
//m_ActPageList.SetImageList(&ImgList , LVSIL_STATE);
return TRUE;
}
//---------------------------------------------------------------------------
void CSolveState::OnSlvAdv()
{
ToggleWindowWidth();
}
//---------------------------------------------------------------------------
void CSolveState::OnSlvPinned()
{
gs_pPrj->m_Solver.m_fStatePinned=!gs_pPrj->m_Solver.m_fStatePinned;
((CButton*)GetDlgItem(IDC_SLV_PINNED))->SetBitmap(gs_pPrj->m_Solver.m_fStatePinned ? (HBITMAP)PinnedDownBitmap : (HBITMAP)PinnedUpBitmap);
}
//---------------------------------------------------------------------------
void CSolveState::OnCancel()
{
if (NotBusy())
CDialog::OnCancel();
}
//---------------------------------------------------------------------------
void CSolveState::OnDblclkWorsterrs(NMHDR* pNMHDR, LRESULT* pResult)
{
CCustomListCtrl* pErrLst=(CCustomListCtrl *)GetDlgItem(IDC_WORSTERRS);
CString sLastTag;
if (GetHitTag(*pErrLst, sLastTag)>=0)
{
if (AccessableTag(sLastTag)>=0)
gs_AccessWnds.AccessNode(-1, (char*)(const char*)sLastTag);
}
*pResult = 0;
}
//---------------------------------------------------------------------------
void CSolveState::OnRclickWorsterrs(NMHDR* pNMHDR, LRESULT* pResult)
{
CCustomListCtrl* pErrLst=(CCustomListCtrl *)GetDlgItem(IDC_WORSTERRS);
CString sLastTag;
if (GetHitTag(*pErrLst, sLastTag)>=0)
{
CRect Rect;
pErrLst->GetWindowRect(&Rect);
PopupMenuForTag(sLastTag, Rect.left + pErrLst->PrevDownPoint.x, Rect.top + pErrLst->PrevDownPoint.y);
}
*pResult = 0;
}
//---------------------------------------------------------------------------
int CSolveState::GetHitTag(CCustomListCtrl& Ctrl, CString& sTag)
{
sTag = "";
LV_HITTESTINFO HTI;
HTI.pt.y = Ctrl.PrevDownPoint.y;
HTI.pt.x = 10;
int iLastIndex = Ctrl.HitTest(&HTI);
if (gs_pPrj && gs_pPrj->pPrjDoc && iLastIndex>=0 && (HTI.flags & LVHT_ONITEM))
{
sTag = Ctrl.GetItemText(iLastIndex, 3);
if (sTag.GetLength()>0)
return iLastIndex;
}
return -1;
}
//---------------------------------------------------------------------------
BOOL CSolveState::AccessableTag(CString& sTag)
{
if (TaggedObject::TestValidTag((char*)(const char*)sTag)==0)
{
const int i = sTag.Find('.');
if (i>=0)
sTag = sTag.Left(i);
CXM_ObjectTag ObjTag((char*)(const char*)sTag, TABOpt_Exists);
CXM_ObjectData ObjData;
CXM_Route Route;
if (gs_pPrj->XReadTaggedItem(ObjTag, ObjData, Route))
return true;
}
return false;
}
//---------------------------------------------------------------------------
void CSolveState::PopupMenuForTag(CString& sTag, int x, int y)
{
CString sObjTag;
sObjTag = sTag;
BOOL TagOK = AccessableTag(sObjTag);
if (TagOK)
{
const int len = sObjTag.GetLength();
CString LeftTag,RightTag;
int index = sObjTag.Find("//", 1);
BOOL IsTearTag = (index>=0 && sObjTag[len-1]=='#');
if (IsTearTag)
{
LeftTag = sObjTag.Left(index);
IsTearTag = AccessableTag(LeftTag);
if (IsTearTag)
{
RightTag = sObjTag.Mid(index+2, len-index-3);
}
}
BOOL IsFlashTrnTag = (!IsTearTag && len>4 && sObjTag.Find("_FT#", 0)==len-4);
if (IsFlashTrnTag)
{
LeftTag = sObjTag.Left(len-4);
}
CMenu Menu;
Menu.CreatePopupMenu();
Strng s;
s.Set("&Access %s...", (const char*)sObjTag);
Menu.AppendMenu(MF_STRING, IDM_SLV_ACCESS, s());
Menu.AppendMenu(MF_STRING|(IsTearTag||IsFlashTrnTag?MF_GRAYED:0), IDM_SLV_FIND, "&Find...");
Menu.AppendMenu(MF_STRING, IDM_SLV_COPY, "&Copy tag");
Menu.AppendMenu(MF_STRING|(IsTearTag||IsFlashTrnTag?0:MF_GRAYED), IDM_SLV_COPYEXTRA, "Copy tag &Extra");
//Menu.AppendMenu(MF_STRING|MF_GRAYED, IDM_SLV_COPYALL, "Copy all &tags");
if (LeftTag.GetLength() || RightTag.GetLength())
{
Menu.AppendMenu(MF_SEPARATOR);
if (LeftTag.GetLength())
{
s.Set("Access %s...", (const char*)LeftTag);
Menu.AppendMenu(MF_STRING, IDM_SLV_ACCESSLEFT, s());
s.Set("Find %s...", (const char*)LeftTag);
Menu.AppendMenu(MF_STRING, IDM_SLV_FINDLEFT, s());
}
if (RightTag.GetLength())
{
s.Set("Access %s...", (const char*)RightTag);
Menu.AppendMenu(MF_STRING, IDM_SLV_ACCESSRIGHT, s());
s.Set("Find %s...", (const char*)RightTag);
Menu.AppendMenu(MF_STRING, IDM_SLV_FINDRIGHT, s());
}
}
int RetCd = Menu.TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, x, y, this);//Rect.left+Ctrl.PrevDownPoint.x, Rect.top+Ctrl.PrevDownPoint.y, pWnd);
Menu.DestroyMenu();
switch (RetCd)
{
case IDM_SLV_ACCESS:
gs_AccessWnds.AccessNode(-1, (char*)(const char*)sObjTag);
break;
case IDM_SLV_FIND:
gs_pPrj->FindTag((char*)(const char*)sObjTag, NULL, NULL, -1, FTO_MoveCursor|FTO_HighliteSlow);
break;
case IDM_SLV_ACCESSLEFT:
gs_AccessWnds.AccessNode(-1, (char*)(const char*)LeftTag);
break;
case IDM_SLV_FINDLEFT:
gs_pPrj->FindTag((char*)(const char*)LeftTag, NULL, NULL, -1, FTO_MoveCursor|FTO_HighliteSlow);
break;
case IDM_SLV_ACCESSRIGHT:
gs_AccessWnds.AccessNode(-1, (char*)(const char*)RightTag);
break;
case IDM_SLV_FINDRIGHT:
gs_pPrj->FindTag((char*)(const char*)RightTag, NULL, NULL, -1, FTO_MoveCursor|FTO_HighliteSlow);
break;
case IDM_SLV_COPY:
case IDM_SLV_COPYEXTRA:
{
Strng s;
if (IsTearTag || IsFlashTrnTag)
{
int index = sTag.Find(".", 1);
if (index>=0)
{
CString RTag = sTag.Mid(index+1);
if (RetCd==IDM_SLV_COPYEXTRA)
s.Set("%s.V.[%s].Meas\r\n%s.V.[%s].Error", (const char*)sObjTag, (const char*)RTag, (const char*)sObjTag, (const char*)RTag);//todo:add the cnvs....???
else
s.Set("%s.V.[%s].Meas", (const char*)sObjTag, (const char*)RTag);//todo:add the cnvs....???
}
else
s = (const char*)sTag;
}
else// if (IsControlTag)
{
s.Set("%s.Cfg.[???].Meas", (const char*)sObjTag);
//todo: for a PID control tag, we need to get to the required actual tag......
}
CopyTextToClipboard(this, s());
break;
}
case IDM_SLV_COPYALL:
{
Strng s;
for (int i=0; i<MAX_EQNSLV_WORST; i++)
{
//todo
}
CopyTextToClipboard(this, s());
break;
}
}
}
}
//---------------------------------------------------------------------------
| [
"[email protected]",
"[email protected]"
] | [
[
[
1,
46
],
[
49,
89
],
[
91,
115
],
[
119,
119
],
[
121,
138
],
[
141,
147
],
[
156,
184
],
[
186,
226
],
[
228,
231
],
[
233,
248
],
[
250,
256
],
[
258,
297
],
[
299,
300
],
[
302,
409
],
[
412,
550
],
[
552,
556
],
[
558,
562
],
[
564,
605
]
],
[
[
47,
48
],
[
90,
90
],
[
116,
118
],
[
120,
120
],
[
139,
140
],
[
148,
155
],
[
185,
185
],
[
227,
227
],
[
232,
232
],
[
249,
249
],
[
257,
257
],
[
298,
298
],
[
301,
301
],
[
410,
411
],
[
551,
551
],
[
557,
557
],
[
563,
563
]
]
] |
e56900c658dc55f8857e72b6b2abef7dbf9cabc5 | b7c505dcef43c0675fd89d428e45f3c2850b124f | /Src/SimulatorQt/Util/qt/Win32/include/Qt/qabstracteventdispatcher.h | fd50b8147c59064e8f2011b25e18486d874f67d6 | [
"BSD-2-Clause"
] | permissive | pranet/bhuman2009fork | 14e473bd6e5d30af9f1745311d689723bfc5cfdb | 82c1bd4485ae24043aa720a3aa7cb3e605b1a329 | refs/heads/master | 2021-01-15T17:55:37.058289 | 2010-02-28T13:52:56 | 2010-02-28T13:52:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,820 | 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 QABSTRACTEVENTDISPATCHER_H
#define QABSTRACTEVENTDISPATCHER_H
#include <QtCore/qobject.h>
#include <QtCore/qeventloop.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Core)
class QAbstractEventDispatcherPrivate;
class QSocketNotifier;
template <typename T1, typename T2> struct QPair;
class Q_CORE_EXPORT QAbstractEventDispatcher : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QAbstractEventDispatcher)
public:
typedef QPair<int, int> TimerInfo;
explicit QAbstractEventDispatcher(QObject *parent = 0);
~QAbstractEventDispatcher();
static QAbstractEventDispatcher *instance(QThread *thread = 0);
virtual bool processEvents(QEventLoop::ProcessEventsFlags flags) = 0;
virtual bool hasPendingEvents() = 0;
virtual void registerSocketNotifier(QSocketNotifier *notifier) = 0;
virtual void unregisterSocketNotifier(QSocketNotifier *notifier) = 0;
int registerTimer(int interval, QObject *object);
virtual void registerTimer(int timerId, int interval, QObject *object) = 0;
virtual bool unregisterTimer(int timerId) = 0;
virtual bool unregisterTimers(QObject *object) = 0;
virtual QList<TimerInfo> registeredTimers(QObject *object) const = 0;
virtual void wakeUp() = 0;
virtual void interrupt() = 0;
virtual void flush() = 0;
virtual void startingUp();
virtual void closingDown();
typedef bool(*EventFilter)(void *message);
EventFilter setEventFilter(EventFilter filter);
bool filterEvent(void *message);
Q_SIGNALS:
void aboutToBlock();
void awake();
protected:
QAbstractEventDispatcher(QAbstractEventDispatcherPrivate &,
QObject *parent);
};
QT_END_NAMESPACE
QT_END_HEADER
#endif // QABSTRACTEVENTDISPATCHER_H
| [
"alon@rogue.(none)"
] | [
[
[
1,
107
]
]
] |
40454f8885e65a1b95d2c41b6e8de2c368358c79 | 478570cde911b8e8e39046de62d3b5966b850384 | /apicompatanamdw/bcdrivers/mw/classicui/uifw/apps/S60_SDK3.0/bctestnote/src/bctestnotewrappercase.cpp | 9c2cc1db943801a72d11e00d1e712d69e54ba9d0 | [] | 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 | 16,091 | cpp | /*
* Copyright (c) 2006 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: Implements test bc for note wrapper testcase.
*
*/
#include <w32std.h>
#include <coecntrl.h>
#include <aknnotewrappers.h>
#include <bctestnote.rsg>
#include <eikdpobs.h>
#include <barsread.h>
#include "bctestnotewrappercase.h"
#include "bctestnotecontainer.h"
#include "bctestnote.hrh"
#include "autotestcommands.h"
// constant
const TInt KOne = 1;
const TInt KTwo = 2;
const TInt KThree = 3;
const TInt KFour = 4;
const TInt KFive = 5;
const TInt KTen = 15;
// constant for CAknWarningNote
_LIT( KWarningNoteCreateComment, "WarningNote created" );
_LIT( KWHandlePointerEventLComment,
"Warning Note's HandlePointerEventL() invoked" );
_LIT( KWarningNoteCreateOverComment, "WarningNote created(OverLoad)" );
_LIT( KWarningNote, "This is Warning note!" );
_LIT( KWExecuteLDComment,
"CAknResourceNoteDialog's ExecuteLD() invoked" );
_LIT( KWarningNoteCreateLoadComment, "pWarningNote created(overload)" );
// constant for CAknErrorNote
_LIT( KErrorNoteCreateComment, "ErrorNote created" );
_LIT( KEHandlePointerEventLComment,
"Error Note's HandlePointerEventL() invoked" );
_LIT( KErrorNoteCreateOverComment, "ErrorNote created(OverLoad)" );
_LIT( KErrorNote, "This is Error note!" );
_LIT( KEExecuteLDComment,
"CAknResourceNoteDialog's ExecuteLD() invoked" );
_LIT( KErrorNoteCreateLoadComment, "ErrorNote created(OverLoad again)" );
// constant for CAknInformationNote
_LIT( KInformationNoteCreateComment, "informationNote created" );
_LIT( KIHandlePointerEventLComment,
"information Note's HandlePointerEventL() invoked" );
_LIT( KInformationNoteCreateOverComment,
"informationNote created(OverLoad)" );
_LIT( KInforNote, "This is information note!" );
_LIT( KIExecuteLDComment,
"CAknResourceNoteDialog's ExecuteLD() invoked" );
_LIT( KInformationNoteCreateLoadComment,
"informationNote created(OverLoad again)" );
// constant for CAknConfirmationNote
_LIT( KConfirmationNoteCreateComment, "confirmationNote created" );
_LIT( KCHandlePointerEventLComment,
"confirmation Note's HandlePointerEventL() invoked" );
_LIT( KConfirmationNoteCreateOverComment,
"confirmationNote created(OverLoad)" );
_LIT( KCExecuteLDComment,
"CAknResourceNoteDialog's ExecuteLD() invoked" );
_LIT( KConfirmationNoteCreateLoadComment,
"confirmationNote created(OverLoad again)" );
// constant for CAknNoteWrapper
_LIT( KNoteWrapperCreateComment, "iNoteWrapper Created" );
_LIT( KNHandlePointerEventLComment,
"Note Wrapper's HandlePointerEventL() invoked" );
_LIT( KNHandleDialogPageEventLComment,
"Note Wrapper's HandleDialogPageEventL() invoked" );
_LIT( KNExecuteLDComment, "Note Wrapper's ExecuteLD() invoked" );
_LIT( KNoteWrapperCreateAgainComment, "iNoteWrapper Created" );
_LIT( KNoteWrapperCreateOverComment, "tmpNoteWrapper Created" );
_LIT( KPrompt, "Akn Note Wrapper OverLoad" );
_LIT( KNExecuteLDOverComment, "Note Wrapper's ExecuteLD() overload" );
// ======== MEMBER FUNCTIONS ========
// ---------------------------------------------------------------------------
// Symbian 2nd static Constructor
// ---------------------------------------------------------------------------
//
CBCTestNoteWrapperCase* CBCTestNoteWrapperCase::NewL(
CBCTestNoteContainer* aContainer )
{
CBCTestNoteWrapperCase* self = new( ELeave ) CBCTestNoteWrapperCase(
aContainer );
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop( self );
return self;
}
// ---------------------------------------------------------------------------
// C++ default constructor
// ---------------------------------------------------------------------------
//
CBCTestNoteWrapperCase::CBCTestNoteWrapperCase(
CBCTestNoteContainer* aContainer ) : iContainer( aContainer )
{
}
// ---------------------------------------------------------------------------
// Destructor
// ---------------------------------------------------------------------------
//
CBCTestNoteWrapperCase::~CBCTestNoteWrapperCase()
{
if ( iNoteWrapper )
{
delete iNoteWrapper;
iNoteWrapper = NULL;
}
}
// ---------------------------------------------------------------------------
// Symbian 2nd Constructor
// ---------------------------------------------------------------------------
//
void CBCTestNoteWrapperCase::ConstructL()
{
BuildScriptL();
}
// ---------------------------------------------------------------------------
// CBCTestNoteWrapperCase::BuildScriptL
// ---------------------------------------------------------------------------
//
void CBCTestNoteWrapperCase::BuildScriptL()
{
const TInt scripts[] =
{
//outline1
DELAY( KOne ),// delay between commands is 1*0.1 seconds = 0.1 seconds
LeftCBA,
LeftCBA,
LeftCBA,
WAIT( KTwo ),
LeftCBA,
//outline2
LeftCBA,
LeftCBA,
REP( Down, KOne ),
LeftCBA,
WAIT( KTwo ),
LeftCBA,
//outline3
LeftCBA,
LeftCBA,
REP( Down, KTwo ),
LeftCBA,
WAIT( KTwo ),
LeftCBA,
//outline4
LeftCBA,
LeftCBA,
REP( Down, KThree ),
LeftCBA,
WAIT( KTwo ),
LeftCBA,
//outline5
LeftCBA,
LeftCBA,
REP( Down, KFour ),
LeftCBA,
WAIT( KTen ),
//LeftCBA,
//outline6
LeftCBA,
LeftCBA,
REP( Down, KFive ),
LeftCBA,
WAIT( KTen ),
//LeftCBA
};
AddTestScriptL( scripts, sizeof( scripts ) / sizeof( TInt ) );
}
// ---------------------------------------------------------------------------
// CBCTestNoteWrapperCase::RunL
// ---------------------------------------------------------------------------
//
void CBCTestNoteWrapperCase::RunL( TInt aCmd )
{
if ( ( aCmd < EBCTestNoteCmdOutline01 )
|| ( aCmd > EBCTestNoteCmdOutline06 ) )
{
return;
}
switch ( aCmd )
{
case EBCTestNoteCmdOutline01:
TestWarningNoteL();
break;
case EBCTestNoteCmdOutline02:
TestErrorNoteL();
break;
case EBCTestNoteCmdOutline03:
TestInformationNoteL();
break;
case EBCTestNoteCmdOutline04:
TestConfirmationNoteL();
break;
case EBCTestNoteCmdOutline05:
TestNoteWrapperL();
break;
case EBCTestNoteCmdOutline06:
TestNoteWrapperOverLoadL();
break;
default:
break;
}
}
// ---------------------------------------------------------------------------
// CBCTestNoteWrapperCase::TestWarningNoteL
// ---------------------------------------------------------------------------
//
void CBCTestNoteWrapperCase::TestWarningNoteL()
{
iWarningNote = new( ELeave ) CAknWarningNote();
AssertNotNullL( iWarningNote, KWarningNoteCreateComment );
TPointerEvent tPointerEvent;
tPointerEvent.iType = TPointerEvent::EButton2Up;
iWarningNote->HandlePointerEventL( tPointerEvent );
AssertTrueL( ETrue, KWHandlePointerEventLComment );
CAknWarningNote* tWarningNote = new( ELeave ) CAknWarningNote( EFalse );
CleanupStack::PushL( tWarningNote );
AssertNotNullL( tWarningNote, KWarningNoteCreateOverComment );
CleanupStack::Pop( tWarningNote );
tWarningNote->ExecuteLD( KWarningNote );
AssertTrueL( ETrue, KWExecuteLDComment );
CAknWarningNote* pWarningNote = new( ELeave )
CAknWarningNote( &iWarningNote );
CleanupStack::PushL( pWarningNote );
AssertNotNullL( pWarningNote, KWarningNoteCreateLoadComment );
CleanupStack::Pop( pWarningNote );
delete iWarningNote;
iWarningNote = NULL;
delete pWarningNote;
}
// ---------------------------------------------------------------------------
// CBCTestNoteWrapperCase::TestErrorNoteL
// ---------------------------------------------------------------------------
//
void CBCTestNoteWrapperCase::TestErrorNoteL()
{
iErrorNote = new( ELeave ) CAknErrorNote();
AssertNotNullL( iErrorNote, KErrorNoteCreateComment );
TPointerEvent tPointerEvent;
tPointerEvent.iType = TPointerEvent::EButton2Up;
iErrorNote->HandlePointerEventL( tPointerEvent );
AssertTrueL( ETrue, KEHandlePointerEventLComment );
CAknErrorNote* tErrorNote = new( ELeave ) CAknErrorNote( EFalse );
CleanupStack::PushL( tErrorNote );
AssertNotNullL( tErrorNote, KErrorNoteCreateOverComment );
CleanupStack::Pop( tErrorNote );
tErrorNote->ExecuteLD( KErrorNote );
AssertTrueL( ETrue, KEExecuteLDComment );
CAknErrorNote* pErrorNote = new( ELeave ) CAknErrorNote( &iErrorNote );
CleanupStack::PushL( pErrorNote );
AssertNotNullL( pErrorNote, KErrorNoteCreateLoadComment );
CleanupStack::Pop( pErrorNote );
delete iErrorNote;
iErrorNote = NULL;
delete pErrorNote;
}
// ---------------------------------------------------------------------------
// CBCTestNoteWrapperCase::TestInformationNoteL
// ---------------------------------------------------------------------------
//
void CBCTestNoteWrapperCase::TestInformationNoteL()
{
iInforNote = new( ELeave ) CAknInformationNote();
AssertNotNullL( iInforNote, KInformationNoteCreateComment );
TPointerEvent tPointerEvent;
tPointerEvent.iType = TPointerEvent::EButton2Up;
iInforNote->HandlePointerEventL( tPointerEvent );
AssertTrueL( ETrue, KIHandlePointerEventLComment );
CAknInformationNote* tInforNote = new( ELeave )
CAknInformationNote( EFalse );
CleanupStack::PushL( tInforNote );
AssertNotNullL( tInforNote, KInformationNoteCreateOverComment );
CleanupStack::Pop( tInforNote );
tInforNote->ExecuteLD( KInforNote );
AssertTrueL( ETrue, KIExecuteLDComment );
CAknInformationNote* pInforNote = new( ELeave )
CAknInformationNote( &iInforNote );
CleanupStack::PushL( pInforNote );
AssertNotNullL( pInforNote, KInformationNoteCreateLoadComment );
CleanupStack::Pop( pInforNote );
delete iInforNote;
iInforNote = NULL;
delete pInforNote;
}
// ---------------------------------------------------------------------------
// CBCTestNoteWrapperCase::TestConfirmationNoteL
// ---------------------------------------------------------------------------
//
void CBCTestNoteWrapperCase::TestConfirmationNoteL()
{
iConfirmNote = new( ELeave ) CAknConfirmationNote();
AssertNotNullL( iConfirmNote, KConfirmationNoteCreateComment );
TPointerEvent tPointerEvent;
tPointerEvent.iType = TPointerEvent::EButton2Up;
iConfirmNote->HandlePointerEventL( tPointerEvent );
AssertTrueL( ETrue, KCHandlePointerEventLComment );
CAknConfirmationNote* tConfirmNote = new( ELeave )
CAknConfirmationNote( ETrue );
CleanupStack::PushL( tConfirmNote );
AssertNotNullL( tConfirmNote, KConfirmationNoteCreateOverComment );
CleanupStack::Pop( tConfirmNote );
tConfirmNote->ExecuteLD();
AssertTrueL( ETrue, KCExecuteLDComment );
CAknConfirmationNote* pConfirmNote = new( ELeave )
CAknConfirmationNote( &iConfirmNote );
CleanupStack::PushL( pConfirmNote );
AssertNotNullL( pConfirmNote, KConfirmationNoteCreateLoadComment );
CleanupStack::Pop( pConfirmNote );
delete iConfirmNote;
iConfirmNote = NULL;
delete pConfirmNote;
}
// ---------------------------------------------------------------------------
// CBCTestNoteWrapperCase::TestNoteWrapperL
// ---------------------------------------------------------------------------
//
void CBCTestNoteWrapperCase::TestNoteWrapperL()
{
COwnAknNoteWrapper* tmpNoteWrapper = new( ELeave ) COwnAknNoteWrapper();
CleanupStack::PushL( tmpNoteWrapper );
AssertNotNullL( tmpNoteWrapper, KNoteWrapperCreateComment );
TInt err;
TRAP( err, tmpNoteWrapper->ReadAndPrepareLC( R_BCTESTNOTE_WRAPPER ) );
TPointerEvent tPointerEvent;
tPointerEvent.iType = TPointerEvent::EButton3Up;
tmpNoteWrapper->HandlePointerEventL( tPointerEvent );
AssertTrueL( ETrue, KNHandlePointerEventLComment );
tmpNoteWrapper->HandleDialogPageEventL(
MEikDialogPageObserver::EDialogPageTapped );
AssertTrueL( ETrue, KNHandleDialogPageEventLComment );
//static delete tmpNoteWrapper in HandleDialogPageEventL().
CleanupStack::Pop( tmpNoteWrapper );
CAknNoteWrapper* otherTmpNoteWrapper = new( ELeave ) CAknNoteWrapper();
otherTmpNoteWrapper->ExecuteLD( R_BCTESTNOTE_WRAPPER );
AssertTrueL( ETrue, KNExecuteLDComment );
}
// ---------------------------------------------------------------------------
// CBCTestNoteWrapperCase::TestNoteWrapperOverLoadL
// ---------------------------------------------------------------------------
//
void CBCTestNoteWrapperCase::TestNoteWrapperOverLoadL()
{
iNoteWrapper = new( ELeave ) CAknNoteWrapper();
AssertNotNullL( iNoteWrapper, KNoteWrapperCreateAgainComment );
CAknNoteWrapper* tmpNoteWrapper = new( ELeave )
CAknNoteWrapper( &iNoteWrapper );
CleanupStack::PushL( tmpNoteWrapper );
AssertNotNullL( tmpNoteWrapper, KNoteWrapperCreateOverComment );
delete iNoteWrapper;
iNoteWrapper = NULL;
CleanupStack::PopAndDestroy( tmpNoteWrapper );
tmpNoteWrapper = NULL;
tmpNoteWrapper = new( ELeave ) CAknNoteWrapper();
tmpNoteWrapper->ExecuteLD( R_BCTESTNOTE_WRAPPER, KPrompt );
AssertTrueL( ETrue, KNExecuteLDOverComment );
}
// ---------------------------------------------------------------------------
// COwnAknNoteWrapper::ReadAndPrepareLC
// ---------------------------------------------------------------------------
//
void COwnAknNoteWrapper::ReadAndPrepareLC(TInt aResId)
{
TResourceReader resReader;
iCoeEnv->CreateResourceReaderLC(resReader, aResId);
TAknNoteResData resData;
resData.iResId = resReader.ReadInt32();
resData.iTimeout = STATIC_CAST(CAknNoteDialog::TTimeout, resReader.ReadInt32());
resData.iTone = STATIC_CAST(CAknNoteDialog::TTone, resReader.ReadInt16());
resData.iText = resReader.ReadTPtrC();
CleanupStack::PopAndDestroy(); // Resource reader
PrepareLC(resData.iResId);
CleanupStack::Pop();
}
// ---------------------------------------------------------------------------
// COwnAknNoteWrapper::COwnAknNoteWrapper
// ---------------------------------------------------------------------------
//
COwnAknNoteWrapper::COwnAknNoteWrapper()
{
}
// ---------------------------------------------------------------------------
// COwnAknNoteWrapper::~COwnAknNoteWrapper
// ---------------------------------------------------------------------------
//
COwnAknNoteWrapper::~COwnAknNoteWrapper()
{
}
| [
"none@none"
] | [
[
[
1,
459
]
]
] |
057bfbde0e97f8c453d6e8836e59b4cefb8fac59 | 6bdb3508ed5a220c0d11193df174d8c215eb1fce | /Codes/Halak/Particle.inl | b74c66f81a1f7566626afba1114d3ce21e8497b2 | [] | no_license | halak/halak-plusplus | d09ba78640c36c42c30343fb10572c37197cfa46 | fea02a5ae52c09ff9da1a491059082a34191cd64 | refs/heads/master | 2020-07-14T09:57:49.519431 | 2011-07-09T14:48:07 | 2011-07-09T14:48:07 | 66,716,624 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 776 | inl | namespace Halak
{
Particle::Particle()
: Age(0.0f),
Lifespan(0.0f),
Position(Vector3::Zero),
LinearVelocity(Vector3::Zero),
Tint(Color(255, 255, 255, 255))
{
}
Particle::Particle(float lifespan, Vector3 position)
: Age(0.0f),
Lifespan(lifespan),
Position(position),
LinearVelocity(Vector3::Zero),
Tint(Color(255, 255, 255, 255))
{
}
Particle::Particle(float lifespan, Vector3 position, Vector3 linearVelocity, Color tint)
: Age(0.0f),
Lifespan(lifespan),
Position(position),
LinearVelocity(linearVelocity),
Tint(tint)
{
}
Particle::~Particle()
{
}
} | [
"[email protected]"
] | [
[
[
1,
33
]
]
] |
afe58a4734ffefda6b8a7c8c492befe27e6d3596 | f7d5fcb47d370751163d253ac0d705d52bd3c5d5 | /trunk/Sources/source/hapticgraphclasses/HapticEffect.cpp | 0318af0200b1a06b96834dabfe0b648d19921bcc | [] | no_license | BackupTheBerlios/phantom-graphs-svn | b830eadf54c49ccecf2653e798e3a82af7e0e78d | 6a585ecde8432394c732a72e4860e136d68cc4b4 | refs/heads/master | 2021-01-02T09:21:18.231965 | 2006-02-06T08:44:57 | 2006-02-06T08:44:57 | 40,820,960 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 2,555 | cpp | //*******************************************************************************
/// @file HapticEffect.cpp
/// @author Katharina Greiner, Matr.-Nr. 943471
/// @date Erstellt am 03.01.2006
/// @date Letzte Änderung 30.01.2006
//*******************************************************************************
// Änderungen:
// 30.01.06 - startEffect() führt die HLAPI-Funktion nur dann aus, wenn der Effekt
// vorher noch nicht gestartet wurde, um HLAPI-Fehler zu vermeiden.
// - stopEffect() führt die HLAPI-Funktion nur dann aus, wenn der Effekt
// vorher gestartet wurde, um HLAPI-Fehler zu vermeiden.
#include "HapticEffect.h"
//*******************************************************************************
HapticEffect::HapticEffect(HLenum type)
: m_EffectID(hlGenEffects(1))
{
m_EffectType = type;
m_IsActive = false;
}
//*******************************************************************************
//*******************************************************************************
HapticEffect::~HapticEffect()
{
// Effekt freigeben
hlDeleteEffects(m_EffectID, 1);
}
//*******************************************************************************
//*******************************************************************************
void HapticEffect::startEffect()
{
if (m_IsActive)
{
return;
}
// Effekt mit den in der abstrakten Methode renderProperties() spezifizierten
// Eigenschaften starten
renderProperties();
hlStartEffect(m_EffectType, m_EffectID);
if (!(HL_NO_ERROR == hlGetError().errorCode))
{
// nur zum Debuggen benötigt
int bla = 1;
}
m_IsActive = true;
}
//*******************************************************************************
//*******************************************************************************
void HapticEffect::stopEffect()
{
if (m_IsActive)
{
hlStopEffect(m_EffectID);
if (HL_INVALID_OPERATION == hlGetError().errorCode)
{
// nur zum Debuggen benötigt
int bla = 1;
}
m_IsActive = false;
}
}
//*******************************************************************************
//*******************************************************************************
void HapticEffect::triggerEffect( double duration )
{
// Effekt für die Dauer duration (msec) anstoßen
renderProperties();
hlEffectd(HL_EFFECT_PROPERTY_DURATION, duration);
hlTriggerEffect(m_EffectType);
}
//*******************************************************************************
| [
"frosch@a1b688d3-ce07-0410-8a3f-c797401f78de"
] | [
[
[
1,
79
]
]
] |
9e3486f6e8eff0791380ac07f2d552344e7093d0 | ee2e06bda0a5a2c70a0b9bebdd4c45846f440208 | /word/CppUTest/src/Platforms/VisualCpp/UtestPlatform.cpp | 6d149ac4b6c2d487ece03282ffb11ef4a951c52c | [] | no_license | RobinLiu/Test | 0f53a376e6753ece70ba038573450f9c0fb053e5 | 360eca350691edd17744a2ea1b16c79e1a9ad117 | refs/heads/master | 2021-01-01T19:46:55.684640 | 2011-07-06T13:53:07 | 2011-07-06T13:53:07 | 1,617,721 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,685 | cpp |
#include "CppUTest/TestHarness.h"
#include <stdio.h>
#include <windows.h>
#include <mmsystem.h>
#include <stdarg.h>
void Utest::executePlatformSpecificTestBody()
{
testBody();
}
///////////// Time in millis
static long TimeInMillisImplementation()
{
return timeGetTime()/1000;
}
static long (*timeInMillisFp) () = TimeInMillisImplementation;
long GetPlatformSpecificTimeInMillis()
{
return timeInMillisFp();
}
void SetPlatformSpecificTimeInMillisMethod(long (*platformSpecific) ())
{
timeInMillisFp = (platformSpecific == 0) ? TimeInMillisImplementation : platformSpecific;
}
///////////// Time in String
static SimpleString TimeStringImplementation()
{
return "Windows time needs work";
}
static SimpleString (*timeStringFp) () = TimeStringImplementation;
SimpleString GetPlatformSpecificTimeString()
{
return timeStringFp();
}
void SetPlatformSpecificTimeStringMethod(SimpleString (*platformMethod) ())
{
timeStringFp = (platformMethod == 0) ? TimeStringImplementation : platformMethod;
}
void TestRegistry::platformSpecificRunOneTest(Utest* test, TestResult& result)
{
try {
runOneTest(test, result) ;
}
catch (int) {
//exiting test early
}
}
void PlatformSpecificExitCurrentTestImpl()
{
throw(1);
}
void FakePlatformSpecificExitCurrentTest()
{
}
void (*PlatformSpecificExitCurrentTest)() = PlatformSpecificExitCurrentTestImpl;
int cpputest_snprintf(char *str, size_t size, const char *format, ...)
{
va_list args;
va_start(args, format);
memset(str, 0, size);
return _vsnprintf( str, size-1, format, args);
}
| [
"RobinofChina@43938a50-64aa-11de-9867-89bd1bae666e"
] | [
[
[
1,
81
]
]
] |
17d76e867e203eb3caa61300dbfbb277b33864c6 | d609fb08e21c8583e5ad1453df04a70573fdd531 | /trunk/OpenXP/测试用例/ClientPlazaDlg.h | 845d58f0f256c4f88b05f0f513c0a55fd029b8f0 | [] | no_license | svn2github/openxp | d68b991301eaddb7582b8a5efd30bc40e87f2ac3 | 56db08136bcf6be6c4f199f4ac2a0850cd9c7327 | refs/heads/master | 2021-01-19T10:29:42.455818 | 2011-09-17T10:27:15 | 2011-09-17T10:27:15 | 21,675,919 | 0 | 1 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 1,708 | h | // ClientPlazaDlg.h
//
#pragma once
#include "afxcmn.h"
#include "HTreeCtrlEX.h"
// CClientPlazaDlg
class CClientPlazaDlg : public CDialog
{
public:
CClientPlazaDlg(CWnd* pParent = NULL);
enum { IDD = IDD_CLIENTPLAZA_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
HButton m_btnDefault,m_btnDL,m_btnUnDL;
HCheckBox m_cbDefault;
HSuperLink m_staticDefault;
HListCtrl m_listDefault;
HComboBox m_comboxDefault;
HEdit m_editDefault;
HEditWnd m_editWndDefault;
HSliderCtrl m_sliderDefault;
HTreeCtrlEX m_tcDefault;
HZipFile m_ZipFile;
HUnzipFile m_UnZipFile;
HMDFile m_mdFile;
HZlibComp m_zlibFile;
HMenu m_menuDefault;
HMenu m_menuDefaultSub;
HMenuData menuData [8];
HAnimationGif m_gifDefault;
HHtmlCtrl m_htmlDefault;
HFlashPlay m_flashDefault;
HAdoConnect m_adoDB;
HAPIHook m_hookKB;
SYSINFO m_ssiLook;
HNetCardInfo m_nciLook;
HAudioPlay m_adPlay;
int m_nLPos;
private:
CImage m_imgZip;//²âÊÔepkÎļþÖеÄpngͼÏñ
protected:
HRESULT OnUnBreakDownLoadNotify(WPARAM,LPARAM);
HICON m_hIcon;
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
afx_msg void OnTimer(UINT_PTR nIDEvent);
public:
afx_msg void OnClose();
afx_msg void OnBnClickedButtonDUn();
afx_msg void OnBnClickedButtonD();
afx_msg void OnBnClickedDrawItemButton();
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
};
| [
"[email protected]@f92b348d-55a1-4afa-8193-148a6675784b"
] | [
[
[
1,
70
]
]
] |
4866c1e999612a28728d25ebfdc83a13345db965 | 58ef4939342d5253f6fcb372c56513055d589eb8 | /ScheduleKiller/source/Views/inc/RuleScreenContainer.h | 9265828f6f02e9a050196c132793c457c4b37202 | [] | no_license | flaithbheartaigh/lemonplayer | 2d77869e4cf787acb0aef51341dc784b3cf626ba | ea22bc8679d4431460f714cd3476a32927c7080e | refs/heads/master | 2021-01-10T11:29:49.953139 | 2011-04-25T03:15:18 | 2011-04-25T03:15:18 | 50,263,327 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,870 | h | /*
============================================================================
Name : RuleScreenContainer.h
Author : zengcity
Version : 1.0
Copyright : Your copyright notice
Description : CRuleScreenContainer declaration
============================================================================
*/
#ifndef RULESCREENCONTAINER_H
#define RULESCREENCONTAINER_H
// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <coecntrl.h>
#include <eikclb.h>
#include <aknlists.h>
#include "Rule.h"
// CLASS DECLARATION
/**
* CRuleScreenContainer
*
*/
class CRuleScreenContainer : public CCoeControl, MCoeControlObserver
{
public:
// Constructors and destructor
/**
* Destructor.
*/
~CRuleScreenContainer();
/**
* Two-phased constructor.
*/
static CRuleScreenContainer* NewL(const TRect& aRect);
/**
* Two-phased constructor.
*/
static CRuleScreenContainer* NewLC(const TRect& aRect);
private:
/**
* Constructor for performing 1st stage construction
*/
CRuleScreenContainer();
/**
* EPOC default constructor for performing 2nd stage construction
*/
void ConstructL(const TRect& aRect);
public:
// Functions from base classes
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
TBool Select();
TBool Delete();
TBool LunchRun();
CRule* GetRule();
private:
// Functions from base classes
void SizeChanged();
TInt CountComponentControls() const;
CCoeControl* ComponentControl(TInt aIndex) const;
void Draw(const TRect& aRect) const;
void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
void HandleResourceChange( TInt aType );
void UpdateDisplay();
void SetIconsL();
private:
//data
CAknDoubleGraphicStyleListBox* iListBox;
};
#endif // RULESCREENCONTAINER_H
| [
"zengcity@415e30b0-1e86-11de-9c9a-2d325a3e6494"
] | [
[
[
1,
86
]
]
] |
73ff13d464ca373954e77e76aa2cf9272886b012 | 638c9b075ac3bfdf3b2d96f1dd786684d7989dcd | /spark/source/SpGlslVertexProgram.cpp | 9bebe8694939b50986ce2a721ad317730a0f820d | [] | no_license | cycle-zz/archives | 4682d6143b9057b21af9845ecbd42d7131750b1b | f92b677342e75e5cb7743a0d1550105058aff8f5 | refs/heads/master | 2021-05-27T21:07:16.240438 | 2010-03-18T08:01:46 | 2010-03-18T08:01:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,123 | cpp | #include "SpGlHeaders.h"
#include "SpGlslVertexProgram.h"
#include "SpResourcePath.h"
using namespace Spark;
//----------------------------------------------------------------------------
SpGlslVertexProgram::SpGlslVertexProgram (
const char* acSource)
: SpGpuProgram(GPU_GLSL_VERTEX_PROGRAM)
{
setSource(acSource);
}
//----------------------------------------------------------------------------
SpGlslVertexProgram::SpGlslVertexProgram ()
: SpGpuProgram(GPU_GLSL_VERTEX_PROGRAM)
{
// internal constructor, for use with load
}
//----------------------------------------------------------------------------
int SpGlslVertexProgram::getParameterRegister( const char* acName )
{
// get the current program handle, if there is one
GLuint uiUserData = 0;
getUserData(&uiUserData, sizeof(GLuint));
// return if program has not been compiled
if(!uiUserData)
return -1;
// request a uniform location to use as the register
int iRegister = -1;
iRegister = glGetUniformLocationARB( uiUserData, acName );
// return the register index
return iRegister;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter1i(
const char* acName, int iX)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform1iARB( iRegister, iX );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter2i(
const char* acName, int iX, int iY)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform2iARB( iRegister, iX, iY );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter3i(
const char* acName, int iX, int iY, int iZ)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform3iARB( iRegister, iX, iY, iZ );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter4i(
const char* acName, int iX, int iY, int iZ, int iW)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform4iARB( iRegister, iX, iY, iZ, iW );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter1iv(
const char* acName, const int *aiValues, int iCount)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform1ivARB( iRegister, iCount, aiValues );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter2iv(
const char* acName, const int *aiValues, int iCount)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform2ivARB( iRegister, iCount, aiValues );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter3iv(
const char* acName, const int *aiValues, int iCount)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform3ivARB( iRegister, iCount, aiValues );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter4iv(
const char* acName, const int *aiValues, int iCount)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform4ivARB( iRegister, iCount, aiValues );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter1f(
const char* acName, float fX)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform1fARB( iRegister, fX );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter2f(
const char* acName, float fX, float fY)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform2fARB( iRegister, fX, fY );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter3f(
const char* acName, float fX, float fY, float fZ)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform3fARB( iRegister, fX, fY, fZ );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter4f(
const char* acName, float fX, float fY, float fZ, float fW)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform4fARB( iRegister, fX, fY, fZ, fW );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter1fv(
const char* acName, const float *afValues, int iCount)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform1fvARB( iRegister, iCount, afValues );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter2fv(
const char* acName, const float *afValues, int iCount)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform2fvARB( iRegister, iCount, afValues );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter3fv(
const char* acName, const float *afValues, int iCount)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform3fvARB( iRegister, iCount, afValues );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setParameter4fv(
const char* acName, const float *afValues, int iCount)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniform4fvARB( iRegister, iCount, afValues );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setMatrixParameter2fv(
const char* acName, const float *afValues, int iCount)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniformMatrix2fvARB( iRegister, iCount, GL_FALSE, afValues );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setMatrixParameter3fv(
const char* acName, const float *afValues, int iCount)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniformMatrix3fvARB( iRegister, iCount, GL_FALSE, afValues );
return true;
}
//----------------------------------------------------------------------------
bool SpGlslVertexProgram::setMatrixParameter4fv(
const char* acName, const float *afValues, int iCount)
{
// get a register for the parameter
int iRegister = getParameterRegister( acName );
if(iRegister < 0) return false;
// assign the parameter to the given register
glUniformMatrix4fvARB( iRegister, iCount, GL_FALSE, afValues );
return true;
}
//----------------------------------------------------------------------------
| [
"[email protected]"
] | [
[
[
1,
266
]
]
] |
ec483c90ff7c78f8871007f8f04f2546e7be161e | 847cccd728e768dc801d541a2d1169ef562311cd | /src/ResourceSystem/ResourceMgr.h | 7c1bad6e5f1313e5ecb14a0c135ceab5ae4dbcf2 | [] | no_license | aadarshasubedi/Ocerus | 1bea105de9c78b741f3de445601f7dee07987b96 | 4920b99a89f52f991125c9ecfa7353925ea9603c | refs/heads/master | 2021-01-17T17:50:00.472657 | 2011-03-25T13:26:12 | 2011-03-25T13:26:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,055 | h | /// @file
/// Entry point to the ResourceSystem.
#ifndef _RESOURCEMGR_H_
#define _RESOURCEMGR_H_
#include "Base.h"
#include "Singleton.h"
#include "ResourceTypes.h"
/// Macro for easier use
#define gResourceMgr ResourceSystem::ResourceMgr::GetSingleton()
/// %Resource system manages all data which has to be loaded from files or other external storage media.
namespace ResourceSystem
{
/// This class manages all resources of the program. A resource is everything what is loaded from disk or any
/// other persistent medium (or even network stream).
/// Resources are coupled into groups for easier manipulation. Resources are unloaded and reloaded
/// as the system sees fit. There are different states a resource can be in. It can either not exist
/// in the system, or it can exist in the system but not loaded, or it can be loaded in the memory.
class ResourceMgr : public Singleton<ResourceMgr>
{
public:
static ResourceTypeMap NullResourceTypeMap;
/// Default constructor.
ResourceMgr(void);
/// Default destructor.
~ResourceMgr(void);
/// All resource types must be registered inside this ctor, so don't forget to add new types there!
/// @param systemPath Path to System directory where all System resources can be found if readed from disk.
void Init(const string& systemPath);
/// Assings resources in a directory to a group. In this case the resource types will be autodetected.
/// The regular expression use the syntax as defined here:
/// http://www.boost.org/doc/libs/1_40_0/libs/regex/doc/html/boost_regex/syntax/basic_extended.html
/// The matching is not case sensitive!
/// @param basePathType Type of base path to which is the "path" parameter related.
/// @param resourceType Type of resources in the directory.
bool AddResourceDirToGroup(const eBasePathType basePathType, const string& path, const StringKey& group,
const string& includeRegexp = ".*", const string& excludeRegexp = "", eResourceType resourceType =
RESTYPE_AUTODETECT, const ResourceTypeMap& resourceTypeMap = NullResourceTypeMap, bool recursive = true);
/// Assigns a resource to a group.
/// The resource type if autodetected if you don't specify it.
/// Returns true if the resource was successfully added.
bool AddResourceFileToGroup(const string& filepath, const StringKey& group, eResourceType type = RESTYPE_AUTODETECT, const eBasePathType basePathType = BPT_SYSTEM);
/// Assigns a resource to a group. Note that if you create the resource this way you must manually delete it later.
bool AddManualResourceToGroup(const StringKey& name, const StringKey& group, eResourceType type);
/// Refreshes given base path, resources are added to given group.
/// Return true if something was added.
bool RefreshBasePathToGroup(const eBasePathType basePathType, const StringKey& group);
/// Loads all resources in the specified group.
/// It doesn't need to be called, resources are loaded on-the-fly if someone needs them. But it's
/// always better to preload them.
void LoadResourcesInGroup(const StringKey& group);
/// Unloads all resources in the specified group, but they can be still reloaded.
/// @param allowManual If true, manually created resources will be unloaded as well. It is not recommended to do that!
void UnloadResourcesInGroup(const StringKey& group, bool allowManual = false);
/// Unloads and then deletes all resources in the specified group. They can't be reloaded.
void DeleteGroup(const StringKey& group);
/// Unloads and then deletes all resources in project. They can't be reloaded.
void DeleteProjectResources();
/// Unloads and deletes one specific resource. The resource can't be reloaded.
void DeleteResource(const StringKey& group, const StringKey& name);
/// Unloads all resources from all groups. Resources can be still reloaded.
void UnloadAllResources(void);
/// Deletes everything. Nothing can be reloaded.
void DeleteAllResources(void);
/// Makes sure all loaded resources are up to date.
/// Return true if some resource file has been deleted and thus resource unloaded and deleted.
bool RefreshAllResources(void);
/// Reloads all textures. Needed when recreating drawing context.
void RefreshAllTextures(void);
/// Renames the given resource. It renames the file on the disk as well if it belongs to the resource.
void RenameResource(ResourcePtr res, const string& newName, const string& newFilePath);
/// Performs a periodic test on resources to determine if they're up to date. The function is non-blocking.
/// The function is meant to be called each frame.
/// Returns true, if some resource was deleted.
bool CheckForResourcesUpdates(void);
/// Performs a periodic test on resource path to determine if some resource has been added.
/// The function is non-blocking. The function is meant to be called each frame.
/// Returns true, if something was added.
bool CheckForRefreshPath(void);
/// Loading listener receives callbacks from the manager when a resource is being loaded.
void SetLoadingListener(IResourceLoadingListener* listener);
/// Returns true if the resource exists in the manager.
bool ResourceExists(const StringKey& group, const StringKey& name);
/// Retrieves a resource from the manager. If the resource can't be found, null ResourcePtr is returned.
/// @param groupSlashName Full name of the resource including group name/resource's filename.
ResourcePtr GetResource(const char* groupSlashName);
/// Retrieves a resource from the manager. If the resource can't be found, null ResourcePtr is returned.
ResourcePtr GetResource(const StringKey& group, const StringKey& name);
/// Retrieves a specified group of resources from the manager.
/// If the group can't be found, empty vector is returned.
void GetResourceGroup(const StringKey& group, vector<ResourcePtr>& output);
/// Retrieves all resources in given path.
void GetResources(vector<ResourcePtr>& output, eBasePathType basePathType, const string& path = "", bool recursive = true);
/// Changes the type of the resource to a new one. Returns pointer to the new resource.
ResourcePtr ChangeResourceType(ResourcePtr resPointer, eResourceType newType);
/// Sets the memory limit the resource manager should try to keep.
/// The limit is given in bytes.
void SetMemoryLimit(const size_t newLimit);
/// Returns the current memory limit.
inline size_t GetMemoryLimit(void) const { return mMemoryLimit; }
/// Enables unloading of resources when they're over the memory limit.
void EnableMemoryLimitEnforcing(void);
/// Enables unloading of resources when they're over the memory limit.
inline void DisableMemoryLimitEnforcing(void) { mEnforceMemoryLimit = false; }
/// Gets base path of given type.
inline const string& GetBasePath(const eBasePathType pathType) const { return mBasePath[pathType]; }
/// Sets new base path of given type.
inline void SetBasePath(const eBasePathType newPathType, const string& newPath) { mBasePath[newPathType] = newPath; }
public:
/// Callback from a resource after it was loaded.
void _NotifyResourceLoaded(const Resource* loadedResource);
/// Callback from a resource after it was unloaded.
void _NotifyResourceUnloaded(const Resource* unloadedResource);
/// Callback from a resource before it was loaded.
void _NotifyResourceLoadingStarted(const Resource* loadingResource);
private:
typedef ResourcePtr (*ResourceCreationMethod)();
typedef map<StringKey, ResourcePtr> ResourceMap;
typedef map<StringKey, ResourceMap*> ResourceGroupMap;
typedef map<StringKey, eResourceType> ExtToTypeMap;
string mBasePath[NUM_BASEPATHTYPES];
ResourceGroupMap mResourceGroups;
ExtToTypeMap mExtToTypeMap;
IResourceLoadingListener* mListener;
ResourceCreationMethod mResourceCreationMethods[NUM_RESTYPES];
Utils::Timer mResourceUpdatesTimer;
uint64 mLastResourceRefreshTime;
uint64 mLastPathRefreshTime;
size_t mMemoryLimit;
size_t mMemoryUsage;
bool mEnforceMemoryLimit;
/// Adds a resource to a group given by iterator.
void AddResourceToGroup(const ResourceGroupMap::iterator& groupIt, const StringKey& name, const ResourcePtr res);
/// Adds a resource to a group given a resource pointer.
void AddResourceToGroup(const StringKey& group, const StringKey& name, const ResourcePtr res);
/// Refreshes given path, resources are added to given group.
/// Returns true if something was added.
bool RefreshPathToGroup(const string& path, const eBasePathType basePathType, const StringKey& group);
/// Checks if the memory usage is within limits. If not, some of the resources will be freed.
/// @param resourceToKeep This resource (if valid) will be preserved at any case.
void CheckMemoryUsage(const Resource* resourceToKeep = 0);
};
}
#endif
| [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
] | [
[
[
1,
13
],
[
15,
19
],
[
23,
26
],
[
29,
35
],
[
38,
42
],
[
48,
50
],
[
53,
56
],
[
61,
72
],
[
76,
83
],
[
85,
85
],
[
88,
88
],
[
90,
93
],
[
95,
96
],
[
104,
112
],
[
114,
120
],
[
125,
126
],
[
128,
140
],
[
147,
164
],
[
166,
170
],
[
173,
176
],
[
180,
182
],
[
187,
192
]
],
[
[
14,
14
],
[
36,
37
],
[
43,
43
],
[
51,
52
],
[
57,
60
],
[
73,
75
],
[
86,
87
],
[
89,
89
],
[
94,
94
],
[
97,
103
],
[
127,
127
],
[
144,
146
],
[
165,
165
],
[
171,
172
],
[
177,
179
],
[
183,
186
]
],
[
[
20,
22
],
[
122,
123
],
[
141,
143
]
],
[
[
27,
28
],
[
44,
47
],
[
113,
113
],
[
124,
124
],
[
193,
193
]
],
[
[
84,
84
]
],
[
[
121,
121
]
]
] |
044d884fd54549702e65226fb6e3cda2b3da43a0 | 2f77d5232a073a28266f5a5aa614160acba05ce6 | /01.DevelopLibrary/04.SmsCode/InfoCenterOfSmartPhone_shiyong/ContactorsWnd.cpp | e7fccba289ffcc253144e2592292e2fb9dcd01aa | [] | 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 | GB18030 | C++ | false | false | 10,072 | cpp | #include"stdafx.h"
#include"UiEditControl.h"
#include"ContactorsWnd.h"
bool MyCompareListItem(const ListItem & item1, const ListItem &item2)
{
if ( 0 > wcscmp(((MyListItemData *)item1.Data)->wcsNameLetter, ((MyListItemData *)item2.Data)->wcsNameLetter) ){
return true;
}else{
return false;
}
return false;
}
BOOL CContactorsWnd::OnInitDialog()
{
if(m_bInit)
{
return TRUE;
}
// 必须先调用基类的初始化
if (!CMzWndEx::OnInitDialog())
{
return FALSE;
}
//打开重力感应设备
m_accMsg = MzAccGetMessage();
// 初始化窗口中的控件
RECT rc = {0};
int height = 0;
int width = 0;
HWND hWnd = FindWindow(L"CTaskBar", 0);
if(hWnd != 0)
{
::GetWindowRect(hWnd, &rc);
height = rc.bottom - rc.top;
width = rc.right - rc.left;
}
if(width>480)
{
g_bH = TRUE;
long lWidth = GetWidth();
long lHeight = GetHeight();
RECT rc = MzGetWindowRect();
RECT rc2 = MzGetClientRect();
RECT rc3 = MzGetWorkArea();
SetWindowPos(m_hWnd, rc3.left, rc3.top,RECT_WIDTH(rc3), RECT_HEIGHT(rc3) );
lWidth = GetWidth();
lHeight = GetHeight();
m_List.SetPos(0,0,GetWidth(),GetHeight()-MZM_HEIGHT_TEXT_TOOLBAR_w720);
m_Toolbar.SetPos(0,GetHeight()-MZM_HEIGHT_TEXT_TOOLBAR_w720,GetWidth(),MZM_HEIGHT_TEXT_TOOLBAR_w720);
m_List.SetItemHeight(70);
m_AlpBar.SetPos(570,0,70,GetHeight() - MZM_HEIGHT_TEXT_TOOLBAR_w720);
}
else
{
g_bH = FALSE;
long lWidth = GetWidth();
long lHeight = GetHeight();
RECT rc = MzGetWindowRect();
RECT rc2 = MzGetClientRect();
RECT rc3 = MzGetWorkArea();
SetWindowPos(m_hWnd, rc3.left, rc3.top,RECT_WIDTH(rc3), RECT_HEIGHT(rc3) );
m_List.SetPos(0,0,GetWidth(),GetHeight()-MZM_HEIGHT_TEXT_TOOLBAR);
m_Toolbar.SetPos(0,GetHeight()-MZM_HEIGHT_TEXT_TOOLBAR,GetWidth(),MZM_HEIGHT_TEXT_TOOLBAR);
m_List.SetItemHeight(90);
m_AlpBar.SetPos(350,0,50,GetHeight()- MZM_HEIGHT_TEXT_TOOLBAR );
}
m_List.SetID(MZ_IDC_LIST);
m_List.EnableScrollBarV(true);
m_List.EnableNotifyMessage(true);
m_List.SetTextColor(RGB(255,0,0));
AddUiWin(&m_List);
m_AlpBar.SetID(MZ_IDC_ALPBAR);
m_AlpBar.EnableZoomAlphabet(true);
m_AlpBar.EnableNotifyMessage(true);
AddUiWin(&m_AlpBar);
m_Toolbar.SetButton(0, true, true, L"取消");
m_Toolbar.SetButton(2, true, true, L"确认");
m_Toolbar.SetID(MZ_IDC_TOOLBAR1);
AddUiWin(&m_Toolbar);
CSQL_sessionManager* pm =CSQL_sessionManager::GetInstance();
if( NULL == pm ) return RLH_FAIL;
CSQL_session* pSession = NULL;
HRESULT hr = pm->Session_Connect(L"contact", L".\\Documents and Settings\\", L"contacts.db", &pSession );
if(FAILED(hr) || pSession == NULL) return RLH_FAIL;
CSQL_query * pq = NULL;
int q_id = 0;
hr = pSession->Query_Create(&q_id, &pq );
if( FAILED(hr) || pq == NULL ) return RLH_FAIL;
CSQL_query * pQFirstLetter = NULL;
int lQFirstLetterID = 0;
hr = pSession->Query_Create(&lQFirstLetterID, &pQFirstLetter );
if( FAILED(hr) || pQFirstLetter== NULL ) return RLH_FAIL;
hr = pQFirstLetter->Prepare(SQL_GET_FIRSTLETER);
if( FAILED(hr) ) return RLH_FAIL;
hr = pq->Prepare(SQL_GET_CONTACTS);
if( FAILED(hr) ) return RLH_FAIL;
hr = pq->Step();
ListItem li;
int i = 0;
while ( hr != E_FAIL && hr != S_OK && i<10 )
{
wchar_t* PName = NULL;
pq->GetField(1, &PName);
long lPID = 0;
pq->GetField(0, &lPID);
wchar_t* pNumber = NULL;
pq->GetField(4, &pNumber); CMzString strTitle(256);
CMzString strDescription(256);
wsprintf(strTitle.C_Str(), PName, i);
wsprintf(strDescription.C_Str(), pNumber, i);
wchar_t awcsNameLetter[10] = L"";
wchar_t awcsFirstLetter[2] = L"";
MakeLetters(awcsNameLetter, awcsFirstLetter, pQFirstLetter, lPID);
// 设置列表项的自定义数据
MyListItemData *pmlid = new MyListItemData;
pmlid->StringTitle = strTitle;
pmlid->StringDescription = strDescription;
pmlid->Selected = false;
pmlid->lPID = lPID;
pmlid->wcsfirstLetter[0] = awcsFirstLetter[0];
wcsncpy(pmlid->wcsNameLetter, awcsNameLetter, wcslen(awcsNameLetter));
UpdateItem(pmlid);
// 列表项的自定义数据指针设置到ListItem::Data
li.Data = pmlid;
m_List.AddItem(li);
hr = pq->Step();
i++;
}
m_List.SortItems(MyCompareListItem, 0, m_List.GetItemCount());
bool DisConect = false;
pq->Finalize();
pQFirstLetter->Finalize();
pSession->Query_Delete(q_id);
pSession->Query_Delete(lQFirstLetterID);
pm->ReleaseInstance();
m_bInit = TRUE;
return TRUE;
}
// 重载 MZFC 的消息处理函数
LRESULT CContactorsWnd::MzDefWndProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case MZ_WM_MOUSE_NOTIFY:
{
int nID = LOWORD(wParam);
int nNotify = HIWORD(wParam);
int x = LOWORD(lParam);
int y = HIWORD(lParam);
// 处理列表控件的鼠标按下通知
if (nID==MZ_IDC_LIST && nNotify==MZ_MN_LBUTTONDOWN)
{
if (!m_List.IsMouseDownAtScrolling() && !m_List.IsMouseMoved())
{
int nIndex = m_List.CalcIndexOfPos(x, y);
m_List.SetSelectedIndex(nIndex);
m_List.Invalidate();
m_List.Update();
}
return 0;
}
// 处理列表控件的鼠标移动通知
if (nID==MZ_IDC_LIST && nNotify==MZ_MN_MOUSEMOVE)
{
if(m_List.GetSelectedIndex()!=-1)
{
m_List.SetSelectedIndex(-1);
m_List.Invalidate();
m_List.Update();
}
return 0;
}
}
default:
{
if (message == m_accMsg)
{
// 转屏
switch(wParam)
{
case SCREEN_PORTRAIT_P:
{
MzChangeDisplaySettingsEx(DMDO_90);
g_bH = TRUE;
}
break;
case SCREEN_PORTRAIT_N:
{
//MzChangeDisplaySettingsEx(DMDO_270);
g_bH = FALSE;
}
break;
case SCREEN_LANDSCAPE_N:
{
MzChangeDisplaySettingsEx(DMDO_180);
g_bH = TRUE;
}
break;
case SCREEN_LANDSCAPE_P:
{
MzChangeDisplaySettingsEx(DMDO_0);
g_bH = FALSE;
}
break;
}
}
}
break;
}
return CMzWndEx::MzDefWndProc(message,wParam,lParam);
}
// 重载 MZFC 的命令消息处理函数
void CContactorsWnd::OnMzCommand(WPARAM wParam, LPARAM lParam)
{
UINT_PTR id = LOWORD(wParam);
switch(id)
{
case MZ_IDC_TOOLBAR1:
{
int nIndex = lParam;
if (nIndex==0)
{
m_pParent->UpdateData(0);
DestroyWindow();
g_bContactShow = FALSE;
return;
}
if (nIndex==2)
{
g_ReciversList.Clear();
long lCount = m_List.GetItemCount();
for(int i = 0; i < lCount; i++)
{
ListItem* pItem = m_List.GetItem(i);
if(pItem)
{
MyListItemData* mlid = (MyListItemData*)pItem->Data;
if(mlid)
{
if(mlid->Selected)
{
g_ReciversList.AppendItem(mlid);
}
}
}
}
m_pParent->UpdateData(1);
DestroyWindow();
g_bContactShow = FALSE;
return;
}
}
break;
case MZ_IDC_ALPBAR:
{
if(m_AlpBar.GetCurLetter())
{
for (int i=0;i<m_List.GetItemCount();i++)
{
MyListItemData* itemData = (MyListItemData*)m_List.GetItem(i)->Data;
wchar_t* fLetter = itemData->wcsfirstLetter;
//将找到的列表项显示在屏幕顶端。
if (wcscmp(m_AlpBar.GetCurLetter(),fLetter) == 0)
{
int topPos = m_List.CalcItemTopPos(i);
m_List.SetTopPos(m_List.GetTopPos()-topPos);
m_List.Invalidate();
m_List.Update();
break;
}
}
}
}
break;
default:
break;
}
}
// 转屏后如果需要调整窗口的位置,重载此函数响应 WM_SETTINGCHANGE 消息
void CContactorsWnd::OnSettingChange(DWORD wFlag, LPCTSTR pszSectionName)
{
//设置新的屏幕方向的窗口大小及控件位置
DEVMODE devMode;
memset(&devMode, 0, sizeof(DEVMODE));
devMode.dmSize = sizeof(DEVMODE);
devMode.dmFields = DM_DISPLAYORIENTATION;
ChangeDisplaySettingsEx(NULL, &devMode, NULL, CDS_TEST, NULL);
if (devMode.dmDisplayOrientation == DMDO_180 || devMode.dmDisplayOrientation == DMDO_0)
{
g_bH = TRUE;
RECT rc = MzGetWorkArea();
//modify by zhaodsh begin at 2010/03/21 12:45
//SetWindowPos(m_hWnd, rc.left, rc.top,RECT_HEIGHT(rc)+rc.top, RECT_WIDTH(rc) );
SetWindowPos(m_hWnd, rc.left, rc.top,RECT_WIDTH(rc), RECT_HEIGHT(rc) );
//modify by zhaodsh end at 2010/03/21 12:45
m_List.SetPos(0,0,GetWidth(),GetHeight()-MZM_HEIGHT_TEXT_TOOLBAR_w720);
m_List.SetItemHeight(70);
m_Toolbar.SetPos(0,GetHeight()-MZM_HEIGHT_TEXT_TOOLBAR_w720,GetWidth(),MZM_HEIGHT_TEXT_TOOLBAR_w720);
m_AlpBar.SetPos(570,0,70,GetHeight() - MZM_HEIGHT_TEXT_TOOLBAR_w720 );
}
if (devMode.dmDisplayOrientation == DMDO_90 || devMode.dmDisplayOrientation == DMDO_270)
{
g_bH = FALSE;
RECT rc = MzGetWorkArea();
SetWindowPos(m_hWnd, rc.left, rc.top,RECT_WIDTH(rc), RECT_HEIGHT(rc) );
m_List.SetPos(0,0,GetWidth(),GetHeight()-MZM_HEIGHT_TEXT_TOOLBAR);
m_List.SetItemHeight(90);
m_Toolbar.SetPos(0,GetHeight()-MZM_HEIGHT_TEXT_TOOLBAR,GetWidth(),MZM_HEIGHT_TEXT_TOOLBAR);
m_AlpBar.SetPos(350,0,50,GetHeight()- MZM_HEIGHT_TEXT_TOOLBAR );
}
if(g_bContactShow)
{
SetWindowPos(HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE| SWP_NOSIZE);
}
}
void CContactorsWnd::UpdateItem(MyListItemData* pmlid)
{
long lCount = g_ReciversList.GetItemCount();
for(int i = 0; i < lCount; i++)
{
BOOL b = pmlid->Compare(g_ReciversList.GetItem(i));
if(b)
{
pmlid->Selected = g_ReciversList.GetItem(i)->Selected;
}
}
}
void CContactorsWnd::MakeLetters(wchar_t* pwcsNameLetters, wchar_t* pwcsFirstLetter, CSQL_query* pQFirstLetter, long lPID )
{
pQFirstLetter->Reset();
pQFirstLetter->Bind(1, lPID);
pQFirstLetter->Step();
pQFirstLetter->Step();
wchar_t* pTemp = NULL;
pQFirstLetter->GetField(0,&pTemp);
pwcsFirstLetter[0] = pTemp[0];
wcsncpy( pwcsNameLetters, pTemp, wcslen(pTemp) );
} | [
"[email protected]"
] | [
[
[
1,
392
]
]
] |
15d0ad5909e9b372734ca976cd90aad1ae8ffcd5 | 463c3b62132d215e245a097a921859ecb498f723 | /lib/dlib/sockets/sockets_kernel_2.h | f93dca0772c47475ea1633708ed2beef5932ac43 | [
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0"
] | 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 | 10,631 | h | // Copyright (C) 2003 Davis E. King ([email protected])
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_SOCKETS_KERNEl_2_
#define DLIB_SOCKETS_KERNEl_2_
#ifdef DLIB_ISO_CPP_ONLY
#error "DLIB_ISO_CPP_ONLY is defined so you can't use this OS dependent code. Turn DLIB_ISO_CPP_ONLY off if you want to use it."
#endif
#include "../platform.h"
#include "sockets_kernel_abstract.h"
#define _BSD_SOCKLEN_T_
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <ctime>
#ifndef HPUX
#include <sys/select.h>
#endif
#include <arpa/inet.h>
#include <signal.h>
#include <inttypes.h>
#include <netdb.h>
#include <unistd.h>
#include <sys/param.h>
#include <string>
#include <netinet/in.h>
#include "../threads.h"
#include "../algs.h"
#include "../smart_pointers.h"
namespace dlib
{
// ----------------------------------------------------------------------------------------
// forward declarations
class socket_factory;
class listener;
// ----------------------------------------------------------------------------------------
// lookup functions
int
get_local_hostname (
std::string& hostname
);
// -----------------
int
hostname_to_ip (
const std::string& hostname,
std::string& ip,
int n = 0
);
// -----------------
int
ip_to_hostname (
const std::string& ip,
std::string& hostname
);
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// connection object
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class connection
{
/*!
INITIAL_VALUE
sd == false
sdo == false
sdr == 0
CONVENTION
connection_socket == the socket handle for this connection.
connection_foreign_port == the port that foreign host is using for
this connection
connection_foreign_ip == a string containing the IP address of the
foreign host
connection_local_port == the port that the local host is using for
this connection
connection_local_ip == a string containing the IP address of the
local interface being used by this connection
sd == if shutdown() has been called then true
else false
sdo == if shutdown_outgoing() has been called then true
else false
sdr == the return value of shutdown() if it has been
called. if it hasn't been called then 0
!*/
friend class listener; // make listener a friend of connection
// make create_connection a friend of connection
friend int create_connection (
connection*& new_connection,
unsigned short foreign_port,
const std::string& foreign_ip,
unsigned short local_port = 0,
const std::string& local_ip = ""
);
public:
~connection();
void* user_data;
long write (
const char* buf,
long num
);
long read (
char* buf,
long num
);
int get_local_port (
) const { return connection_local_port; }
int get_foreign_port (
) const { return connection_foreign_port; }
const std::string& get_local_ip (
) const { return connection_local_ip; }
const std::string& get_foreign_ip (
) const { return connection_foreign_ip; }
int shutdown_outgoing (
)
{
sd_mutex.lock();
if (sdo || sd)
{
sd_mutex.unlock();
return sdr;
}
sdo = true;
sdr = ::shutdown(connection_socket,SHUT_WR);
int temp = sdr;
sd_mutex.unlock();
return temp;
}
int shutdown (
)
{
sd_mutex.lock();
if (sd)
{
sd_mutex.unlock();
return sdr;
}
sd = true;
sdr = ::shutdown(connection_socket,SHUT_RDWR);
int temp = sdr;
sd_mutex.unlock();
return temp;
}
private:
bool sd_called (
)const
/*!
ensures
- returns true if shutdown() has been called else
- returns false
!*/
{
sd_mutex.lock();
bool temp = sd;
sd_mutex.unlock();
return temp;
}
bool sdo_called (
)const
/*!
ensures
- returns true if shutdown_outgoing() or shutdown() has been called
else returns false
!*/
{
sd_mutex.lock();
bool temp = false;
if (sdo || sd)
temp = true;
sd_mutex.unlock();
return temp;
}
// data members
int connection_socket;
const int connection_foreign_port;
const std::string connection_foreign_ip;
const int connection_local_port;
const std::string connection_local_ip;
bool sd; // called shutdown
bool sdo; // called shutdown_outgoing
int sdr; // return value for shutdown
mutex sd_mutex; // a lock for the three above vars
connection(
int sock,
int foreign_port,
const std::string& foreign_ip,
int local_port,
const std::string& local_ip
);
/*!
requires
- sock is a socket handle
- sock is the handle for the connection between foreign_ip:foreign_port
and local_ip:local_port
ensures
- *this is initialized correctly with the above parameters
!*/
// restricted functions
connection();
connection(connection&); // copy constructor
connection& operator=(connection&); // assignement opertor
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// listener object
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class listener
{
/*!
CONVENTION
if (inaddr_any == false)
{
listening_ip == a string containing the address the listener is
listening on
}
else
{
the listener is listening on all interfaces
}
listening_port == the port the listener is listening on
listening_socket == the listening socket handle for this object
!*/
// make the create_listener a friend of listener
friend int create_listener (
listener*& new_listener,
unsigned short port,
const std::string& ip = ""
);
public:
~listener();
int accept (
connection*& new_connection,
unsigned long timeout = 0
);
int accept (
scoped_ptr<connection>& new_connection,
unsigned long timeout = 0
);
int get_listening_port (
) const { return listening_port; }
const std::string& get_listening_ip (
) const { return listening_ip; }
private:
// data members
int listening_socket;
const int listening_port;
const std::string listening_ip;
const bool inaddr_any;
listener(
int sock,
int port,
const std::string& ip
);
/*!
requires
- sock is a socket handle
- sock is listening on the port and ip(may be "") indicated in the above
parameters
ensures
- *this is initialized correctly with the above parameters
!*/
// restricted functions
listener();
listener(listener&); // copy constructor
listener& operator=(listener&); // assignement opertor
};
// ----------------------------------------------------------------------------------------
int create_listener (
listener*& new_listener,
unsigned short port,
const std::string& ip
);
int create_connection (
connection*& new_connection,
unsigned short foreign_port,
const std::string& foreign_ip,
unsigned short local_port,
const std::string& local_ip
);
int create_listener (
scoped_ptr<listener>& new_listener,
unsigned short port,
const std::string& ip = ""
);
int create_connection (
scoped_ptr<connection>& new_connection,
unsigned short foreign_port,
const std::string& foreign_ip,
unsigned short local_port = 0,
const std::string& local_ip = ""
);
// ----------------------------------------------------------------------------------------
}
#ifdef NO_MAKEFILE
#include "sockets_kernel_2.cpp"
#endif
#endif // DLIB_SOCKETS_KERNEl_2_
| [
"jimmy@DGJ3X3B1.(none)"
] | [
[
[
1,
368
]
]
] |
8a1147a8e8bd7d3e23849bb8f4a2a169ac56d5e6 | b5ad65ebe6a1148716115e1faab31b5f0de1b493 | /src/AranMath/ArnConsts.cpp | 4d56e5a39efff8c6a8ea1a70d34f1de90546c2f9 | [] | 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 | 2,271 | cpp | #include "AranMathPCH.h"
#include "LinearR3.h"
#include "ArnVec3.h"
#include "ArnVec4.h"
#include "ArnQuat.h"
#include "ArnMatrix.h"
#include "ArnColorValue4f.h"
#include "ArnConsts.h"
const RST_DATA ArnConsts::RST_DATA_IDENTITY = { 0, 0, 0, 1.0f, 1.0f, 1.0f, 1.0f, 0, 0, 0 };
const ArnVec3 ArnConsts::ARNVEC3_ZERO = ArnVec3(0, 0, 0);
const ArnVec3 ArnConsts::ARNVEC3_ONE = ArnVec3(1.0f, 1.0f, 1.0f);
const ArnVec3 ArnConsts::ARNVEC3_X = ArnVec3(1.0f, 0, 0);
const ArnVec3 ArnConsts::ARNVEC3_Y = ArnVec3(0, 1.0f, 0);
const ArnVec3 ArnConsts::ARNVEC3_Z = ArnVec3(0, 0, 1.0f);
const ArnVec4 ArnConsts::ARNVEC4_ZERO = ArnVec4(0, 0, 0, 0);
const ArnQuat ArnConsts::ARNQUAT_IDENTITY = ArnQuat(0, 0, 0, 1.0f);
const ArnMatrix ArnConsts::ARNMAT_IDENTITY = ArnMatrix(1.0f,0,0,0,0,1.0f,0,0,0,0,1.0f,0,0,0,0,1.0f);
const ArnColorValue4f ArnConsts::ARNCOLOR_BLACK = ArnColorValue4f( 0.0f, 0.0f, 0.0f, 1.0f );
const ArnColorValue4f ArnConsts::ARNCOLOR_RED = ArnColorValue4f( 1.0f, 0.0f, 0.0f, 1.0f );
const ArnColorValue4f ArnConsts::ARNCOLOR_GREEN = ArnColorValue4f( 0.0f, 1.0f, 0.0f, 1.0f );
const ArnColorValue4f ArnConsts::ARNCOLOR_BLUE = ArnColorValue4f( 0.0f, 0.0f, 1.0f, 1.0f );
const ArnColorValue4f ArnConsts::ARNCOLOR_YELLOW = ArnColorValue4f( 1.0f, 1.0f, 0.0f, 1.0f );
const ArnColorValue4f ArnConsts::ARNCOLOR_MAGENTA = ArnColorValue4f( 1.0f, 0.0f, 1.0f, 1.0f );
const ArnColorValue4f ArnConsts::ARNCOLOR_CYAN = ArnColorValue4f( 0.0f, 1.0f, 1.0f, 1.0f );
const ArnColorValue4f ArnConsts::ARNCOLOR_WHITE = ArnColorValue4f( 1.0f, 1.0f, 1.0f, 1.0f );
const ArnColorValue4f ArnConsts::ARNCOLOR_ORANGE = ArnColorValue4f( 1.0f, 0.5f, 0.2f, 1.0f );
const ArnMaterialData ArnConsts::ARNMTRLDATA_RED = { ArnConsts::ARNCOLOR_RED, ArnConsts::ARNCOLOR_RED, ArnConsts::ARNCOLOR_RED, ArnConsts::ARNCOLOR_RED, 1.0f };
const ArnMaterialData ArnConsts::ARNMTRLDATA_WHITE = { ArnConsts::ARNCOLOR_WHITE, ArnConsts::ARNCOLOR_WHITE, ArnConsts::ARNCOLOR_WHITE, ArnConsts::ARNCOLOR_WHITE, 1.0f };
const ArnMaterialData ArnConsts::ARNMTRLDATA_MAGENTA = { ArnConsts::ARNCOLOR_MAGENTA, ArnConsts::ARNCOLOR_MAGENTA, ArnConsts::ARNCOLOR_MAGENTA, ArnConsts::ARNCOLOR_MAGENTA, 1.0f };
| [
"[email protected]"
] | [
[
[
1,
30
]
]
] |
a2e4364a2e9989ff5c145c0838b99ada26bf1e9b | 857b85d77dfcf9d82c445ad44fedf5c83b902b7c | /source/Source/ChooseCourtState.cpp | 2ec86a046fdd800ddaeca4674959e05893da7d68 | [] | no_license | TheProjecter/nintendo-ds-homebrew-framework | 7ecf88ef5b02a0b1fddc8939011adde9eabf9430 | 8ab54265516e20b69fbcbb250677557d009091d9 | refs/heads/master | 2021-01-10T15:13:28.188530 | 2011-05-19T12:24:39 | 2011-05-19T12:24:39 | 43,224,572 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,780 | cpp | #include <nds.h>
#include "ChooseCourtState.h"
#include "PlayState.h"
#include "Game.h"
#include "Sprite.h"
ChooseCourtState ChooseCourtState::m_ChooseCourtState;
ChooseCourtState::ChooseCourtState() : m_mainBack(NULL),
m_subBack(NULL)
{
}
bool ChooseCourtState::Init()
{
/*
Set up the video modes.
MODE_5_2D allows for 4 2D backgrounds.
Both screens are set up to use this mode.
*/
videoSetMode(MODE_5_2D);
videoSetModeSub(MODE_5_2D);
/*
Map the required banks for the backgrounds.
This state uses a 16bit BMP for the top screen
and a 16bit BMP for the bottom screen. A 16bit
BMP takes up 128kb in memory, Bank A has 128kb
and Bank C also has 128kb. They both need to be
activated to use the backgrounds in this state.
*/
vramSetBankA(VRAM_A_MAIN_BG);
vramSetBankC(VRAM_C_SUB_BG);
// Set the colour of the bottom screens background
setBackdropColor(RGB15(31,31,0));
setBackdropColorSub(RGB15(31,31,0));
// Create the backgrounds and draw them directly into VRAM (see IBackground.h)
m_mainBack = new Background16B();
m_subBack = new Background16B();
m_mainBack->CreateFromImageFile("top", BgSize_B16_256x256, "assets/toplogo_16.bin");
m_mainBack->Draw();
m_subBack->CreateFromImageFile("bottom", BgSize_B16_256x256, "assets/choosecourt_16.bin");
m_subBack->Draw();
return true;
}
// delete the backgrounds
void ChooseCourtState::Clean()
{
delete m_mainBack;
delete m_subBack;
}
// Pause this state
void ChooseCourtState::Pause()
{
}
// Resume this state
void ChooseCourtState::Resume()
{
}
void ChooseCourtState::Update(float gameSpeed)
{
// Check if the stylus touched the Play button
if(TheGame::Instance()->KeyPressed(KEY_TOUCH))
{
// choose the beach stage
if(TheGame::Instance()->GetStylusX() > 18.0f && TheGame::Instance()->GetStylusX() < 243.0f
&& TheGame::Instance()->GetStylusY() > 49.0f && TheGame::Instance()->GetStylusY() < 85.0f)
{
TheGame::Instance()->SetPlayStateResourceFile("assets/beachstage_resources.txt");
TheGame::Instance()->SetPlayStateObjectFile("assets/objects.txt");
TheGame::Instance()->ChangeState(PlayState::Instance());
}
// choose the underwater stage
if(TheGame::Instance()->GetStylusX() > 18.0f && TheGame::Instance()->GetStylusX() < 243.0f
&& TheGame::Instance()->GetStylusY() > 100.0f && TheGame::Instance()->GetStylusY() < 136.0f)
{
TheGame::Instance()->SetPlayStateResourceFile("assets/underwaterstage_resources.txt");
TheGame::Instance()->SetPlayStateObjectFile("assets/objects.txt");
TheGame::Instance()->ChangeState(PlayState::Instance());
}
}
}
void ChooseCourtState::Draw(IGraphicsRenderer* renderer)
{
swiWaitForVBlank();
}
| [
"[email protected]"
] | [
[
[
1,
99
]
]
] |
d568685aec4dffaa3b6f3406be4a78185b81f897 | 6b75de27b75015e5622bfcedbee0bf65e1c6755d | /stack/表达式求值useful/表达式求值-book.cpp | 54bbaa9a676b13e1383336ebcec1fe4c1d6280b9 | [] | no_license | xhbang/data_structure | 6e4ac9170715c0e45b78f8a1b66c838f4031a638 | df2ff9994c2d7969788f53d90291608ac5b1ef2b | refs/heads/master | 2020-04-04T02:07:18.620014 | 2011-12-05T09:39:34 | 2011-12-05T09:39:34 | 2,393,408 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 5,369 | cpp | /* 此程序的功能是求出用户输入的整形表达式的值20-10-07 17:43*/
/*输入的表达式请用#结尾,比如:2+3+5,应输入:2+3+5#。*/
#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 16
typedef struct{
int data[MAXSIZE];
int top;
int base;
}seqstack; /* 顺序栈的定义*/
/*以下为函数声明*/
void InitStack(seqstack *);
int Empty(seqstack *);
void Push(seqstack *, int );
int Pop(seqstack *);
int GetTop(seqstack *);
int Operate(int ,char ,int );
char Proceed(char ,char );
int In(char );
int EvalExpres(void);
/* 定义两个栈分别存放运算符和操作数*/
seqstack StackR,StackD;
/*主函数*/
int main()
{
int v;
char ch;
while(1)
{
printf("@@@@@@@@本程序的功能为:用顺序栈实现整型算术表达式的求值@@@@@@@@\n");
v = EvalExpres();
printf("The result is:%d",v);
/*以下为程序控制*/
printf("\nInput 'q' to quit and ENTER run again:");
do{
scanf("%c",&ch);
if(ch == 'q' || ch == 'Q')
exit(0);
}while(ch!='\n');
system("cls");
}
return 0;
}
void InitStack(seqstack *s)
{ s->top = 0;
s->base = 0;
} /* 初始化栈*/
int Empty(seqstack *s)
{ if(s->top == s->base)
return 1;
else
return 0;
} /* 判断栈是否为空*/
void Push(seqstack *s, int x)
{
if(s->top == MAXSIZE)
{
printf("OVER FLOW!\n");
exit(0);
}
else
{ s->data[s->top] = x;
s->top++;
}
} /* 进栈 */
int Pop(seqstack *s)
{ int e;
if(Empty(s))
{ printf("Under flow!\n");
return 0;
} /* 下溢*/
else
{ s->top--;
e = s->data[s->top];
return e;
}
} /* 出栈*/
int GetTop(seqstack *s) /*取栈顶元素*/
{
if(Empty(s))
{ printf("Under flow!\n");
return 0;
}
else
return s->data[s->top-1];
}
int EvalExpres(void) /* 表达式求解函数*/
{
int a,b,i=0,s=0;
char c[80],r;
InitStack(&StackR);
Push(&StackR,'#');
InitStack(&StackD);
printf(" 请输入表达式并以‘#’结束:");
gets(c);
while(c[i]!='#' || GetTop(&StackR)!='#')
{
if(!In(c[i])) /* 判断读入的字符不是运算符 是则进栈*/
{ if(c[i] >= '0' && c[i] <= '9')
{
s += c[i]-'0';
while(!In(c[++i])) /*此处实现的功能为当输入的数字为多位数时*/
{ s*=10;
s += c[i]-'0';
}
Push(&StackD,s+'0');
s = 0;
}
else
{
printf("你输入的表达式有误!\n");
return 0;
}
}
else
switch(Proceed(GetTop(&StackR),c[i])) /* 此函数用来比较读取的运算符和栈顶运算符的优先级*/
{
case '<': /* 栈顶的元素优先级高*/
Push(&StackR,c[i]);
i++;
break;
case '=': /* 遇到匹配的小括号时则去掉他*/
Pop(&StackR);
i++;
break;
case '>': /* 栈顶的优先级低则出栈并将结果写入栈内*/
r = Pop(&StackR);
a = Pop(&StackD)-'0';
b = Pop(&StackD)-'0';
Push(&StackD,Operate(a,r,b)) ;
break;
}
}
return (GetTop(&StackD)-'0'); /* 返回运算结果*/
}
int In(char c) /*问题2:解决In函数问题:判断C是否为运算符是返回1否则返回0*/
{
char ch[7]={'+','-','*','/','#','(',')'};
int i;
for(i = 0; i < 7; i++)
if(c == ch[i])
return 1;
return 0;
}
char Proceed(char op,char c) /*op为栈顶元素,c为当前读入的运算符,比较二者的优先级*/
{ /*问题1:解决Proceed函数*/
char ch;
if(op=='(' && c==')' || op=='#' && c=='#' )
ch = '=';
else
if(op=='+' || op=='-') /*栈顶元素为‘+’或‘-’的时候*/
switch(c)
{
case '+':
case '-':
case ')':
case '#': ch = '>'; break;
case '*':
case '/':
case '(': ch = '<';
}
else
if(op=='*' || op=='/') /*栈顶元素为‘*’或‘/’的时候*/
switch(c)
{
case '+':
case '-':
case '*':
case '/':
case ')':
case '#': ch = '>'; break;
case '(': ch = '<';
}
else
if(op=='(') /*栈顶元素为‘(’的时候*/
switch(c)
{
case '+':
case '-':
case '*':
case '/':
case '(': ch = '<'; break;
case '#': printf("Error!\n"); exit(0);
}
else
if(op==')') /*栈顶元素为‘)’的时候*/
switch(c)
{
case '+':
case '-':
case '*':
case '/':
case '#': ch = '>'; break;
case '(': printf("Error!\n"); exit(0);
}
else
if(op=='#') /*栈顶元素为‘#’的时候*/
switch(c)
{
case '+':
case '-':
case '*':
case '/':
case '(': ch = '<'; break;
case ')': printf("Error!\n"); exit(0);
}
return ch;
}
/* 问题3:解决Operate函数*/
int Operate(int a,char r,int b) /*返回由aRb的值 */
{
int s;
int d1 = a;
int d2 = b; /*把字符ab变为对应数字*/
switch(r)
{
case '+': s = d1+d2; break;
case '-': s = d2-d1; break;
case '*': s = d1*d2; break;
case '/': s = d2/d1;
}
return (s+'0');
} | [
"[email protected]"
] | [
[
[
1,
236
]
]
] |
82f3d60be1a1a9ca36e6c51a70e58375c6244981 | 21da454a8f032d6ad63ca9460656c1e04440310e | /src/wcpp/lang/helper/wscObjectRootBase.cpp | 0cf187ef35c8930d457774f7910aff3470e0d937 | [] | no_license | merezhang/wcpp | d9879ffb103513a6b58560102ec565b9dc5855dd | e22eb48ea2dd9eda5cd437960dd95074774b70b0 | refs/heads/master | 2021-01-10T06:29:42.908096 | 2009-08-31T09:20:31 | 2009-08-31T09:20:31 | 46,339,619 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 4,303 | cpp | // wscObjectRootBase.cpp
#include "wscObjectRootEx.h"
#include <wcpp/wspr/wspr.h>
#include <wcpp/lang/wscClass.h>
#include <wcpp/lang/wscThrowable.h>
#include "ws_ptr.h"
#include "ws_runtime.h"
ws_result wscObjectRootBase::InternalGetClass(wsiClass ** ret, const ws_char * const name)
{
return NewObj<wscClass>(ret,name);
}
void wscObjectRootBase::ThrowUnsupported(const ws_char * const msg, const ws_char * const file, ws_int line)
{
throw wseUnsupportedOperationException::Throw( msg , file , line );
}
void wscObjectRootBase::ThrowNullPointer(const ws_char * const msg, const ws_char * const file, ws_int line)
{
throw wseNullPointerException::Throw( msg , file , line );
}
void wscObjectRootBase::ThrowIllegalState(const ws_char * const msg, const ws_char * const file, ws_int line)
{
throw wseIllegalStateException::Throw( msg , file , line );
}
#define OBJCNT_BASE_VALUE 1000000
ws_int wscObjectRootBase::s_objcnt = OBJCNT_BASE_VALUE;
wscObjectRootBase::wscObjectRootBase(void)
{
ws_runtime::getRuntime()->IncrementRefcnt( & s_objcnt );
}
wscObjectRootBase::~wscObjectRootBase(void)
{
ws_int rlt = ws_runtime::getRuntime()->DecrementRefcnt( & s_objcnt );
/*
if (rlt == OBJCNT_BASE_VALUE) {
WS_ASSERT( 0 ); // 发生这个断言表示所有的对象已在退出程序之前析构
}
*/
}
void wscObjectRootBase::FinalConstruct()
{
m_dbg_ep.SelectTarget( this );
}
void wscObjectRootBase::FinalRelease()
{
}
// static functions
ws_result wscObjectRootBase::InternalQueryInterface(void * pThis, const WS_INTMAP_ENTRY * pEntries, const ws_iid & iid, void ** pp)
{
if (pEntries==WS_NULL) {
WS_THROW( wseNullPointerException , "QueryInterface with a null entries table ." );
}
if (pp==WS_NULL) {
WS_THROW( wseNullPointerException , "QueryInterface with a null ptr-to-ptr ." );
}
if (*pp) {
WS_THROW( wseNullPointerException , "QueryInterface with a ptr-to-ptr which is holding something ." );
}
while ( pEntries->type ) {
if (pEntries->piid[0]==iid) {
((wsiInterface*)pThis)->AddRef();
*pp =(void*) (((ws_long)pThis) + pEntries->offset);
return ws_result( WS_RLT_SUCCESS );
}
pEntries++;
}
if (wsiObject::sIID == iid) {
((wsiInterface*)pThis)->AddRef();
*pp = pThis;
return ws_result( WS_RLT_SUCCESS );
}
WS_THROW( wseClassCastException , "QueryInterface on the object which unsupport the required interface . " );
return ws_result( WS_RLT_CLASS_CAST );
}
void wscObjectRootBase::ObjectMain(ws_boolean bStarting)
{
WS_THROW( wseUnsupportedOperationException , "" );
}
ws_boolean wscObjectRootBase::InternalEquals(wsiObject * obj) // method
{
if (obj==WS_NULL) {
return WS_FALSE;
}
else {
ws_ptr<wsiObject> p1,p2;
obj->QueryInterface( wsiObject::sIID , (void**)(&p2) );
this->QueryInterface( wsiObject::sIID , (void**)(&p1) );
return (p1==p2);
}
}
/*
ws_result wscObjectRootBase::InternalGetClass(wsiClass ** rClass) // method
{
WS_TRY {
return InternalGetClass(rClass);
} WS_CATCH();
}
*/
ws_int wscObjectRootBase::InternalHashCode(void) // method
{
return ((ws_int)((((ws_long)this) ^ 0x12345678) & 0xffffffff));
}
ws_result wscObjectRootBase::InternalNotify(void) // method
{
return ws_result( WS_RLT_UNSUPPORTED_OPERATION );
}
ws_result wscObjectRootBase::InternalNotifyAll(void) // method
{
return WS_RLT_UNSUPPORTED_OPERATION;
}
ws_result wscObjectRootBase::InternalToString(wsiString ** rString) // method
{
ws_ptr<wsiClass> cls;
this->GetClass( &cls );
return cls->GetName( rString );
}
ws_result wscObjectRootBase::InternalWait(void) // method
{
return WS_RLT_UNSUPPORTED_OPERATION;
}
ws_result wscObjectRootBase::InternalWait(ws_long timeout) // method
{
return WS_RLT_UNSUPPORTED_OPERATION;
}
ws_result wscObjectRootBase::InternalWait(ws_long timeout, ws_int nanos) // method
{
return WS_RLT_UNSUPPORTED_OPERATION;
}
| [
"xukun0217@98f29a9a-77f1-11de-91f8-ab615253d9e8"
] | [
[
[
1,
179
]
]
] |
bd1bc57d8b974357f8dc66b085957d15f8f5ac80 | cbdc078b00041668dd740917e1e781f74b6ea9f4 | /GiftFactoryCuda/src/Object.hpp | d0ceefc1493c247ddbf7df350dae98764a55e95d | [] | no_license | mireidril/gift-factory | f30d8075575af6a00a42d54bfdd4ad4c953f1936 | 4888b59b1ee25a107715742d0495e40b81752051 | refs/heads/master | 2020-04-13T07:19:09.351853 | 2011-12-16T11:36:05 | 2011-12-16T11:36:05 | 32,514,347 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,402 | hpp | #ifndef __OBJECT_HPP__
#define __OBJECT_HPP__
#include "Utils.hpp"
#include "model_obj.h"
#include <SDL/SDL_image.h>
class ShaderManager;
class Scene;
class Spline;
typedef std::map<std::string, GLuint> ModelTextures;
class Object
{
public :
Object(Scene * scene, const char* filename, bool enableTextures = true);
~Object();
void init();
void copy(Object * sameObj);
void draw(GLfloat* view);
GLuint LoadTexture(const char *pszFilename);
inline float * getTransformMat(){ return m_transformMat; };
inline void setTransformMat( float * transformMat ){ m_transformMat = transformMat; };
void setSpline(Spline* spline);
void move();
private :
//Scene
Scene * m_parentScene;
// Mesh Datas
const char* objFileName;
ModelOBJ * g_model;
ModelTextures g_modelTextures;
//Textures
bool g_enableTextures;
unsigned int m_uiNbTextures;
GLuint m_iTextureIds;
std::string m_texFileName;
//Shader
const char* m_sShaderName;
GLhandleARB m_uiShaderId;
//ShaderManager
ShaderManager* m_shaderManager;
//Counter
unsigned int m_counter;
int m_period;
//Transformation matrix
float * m_transformMat;
//Light parameters
GLfloat m_diffuse[4];
GLfloat m_ambient[4];
GLfloat m_specular[4];
GLfloat m_shininess;
Spline* m_spline;
bool m_splineEnded;
};
#endif
| [
"celine.cogny@369dbe5e-add6-1733-379f-dc396ee97aaa",
"marjory.gaillot@369dbe5e-add6-1733-379f-dc396ee97aaa"
] | [
[
[
1,
9
],
[
11,
27
],
[
32,
65
],
[
69,
71
]
],
[
[
10,
10
],
[
28,
31
],
[
66,
68
]
]
] |
60fbb9d6b84c64df4aec7ed7462b79b0014dce5b | 969987a50394a9ebab0f8cce0ff22f6e2cfd7fb2 | /devel/traydict/gecko_display.cpp | 27852d6a2b64262f78358a80bfe01860ee7ca3f4 | [] | no_license | jeeb/aegisub-historical | 67bd9cf24e05926f1979942594e04d6b1ffce40c | b81be20fd953bd61be80bfe4c8944f1757605995 | refs/heads/master | 2021-05-28T03:49:26.880613 | 2011-09-02T00:03:40 | 2011-09-02T00:03:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,987 | cpp | // Copyright (c) 2007, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the TrayDict Group 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.
//
// -----------------------------------------------------------------------------
//
// TRAYDICT
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:[email protected]
//
///////////
// Headers
#include "gecko_display.h"
#include "gecko_controller.h"
#include "main.h"
///////////////
// Constructor
GeckoDisplay::GeckoDisplay(wxWindow *parent)
: wxPanel(parent)
{
controller = NULL;
controller = new GeckoController(this,TrayDict::folderName);
controller->AddRef();
}
//////////////
// Destructor
GeckoDisplay::~GeckoDisplay()
{
controller->Release();
//delete controller;
}
////////////////////
// Initialize gecko
void GeckoDisplay::InitGecko()
{
}
///////////////
// Append text
void GeckoDisplay::AppendText(wxString text)
{
}
////////////
// Set text
void GeckoDisplay::SetText(wxString text)
{
}
///////////////
// Event table
BEGIN_EVENT_TABLE(GeckoDisplay,wxPanel)
EVT_SIZE(GeckoDisplay::OnSize)
EVT_SET_FOCUS(GeckoDisplay::OnSetFocus)
EVT_KILL_FOCUS(GeckoDisplay::OnKillFocus)
END_EVENT_TABLE()
////////
// Size
void GeckoDisplay::OnSize(wxSizeEvent &event)
{
if (controller) controller->SetSize(event.GetSize());
}
/////////
// Focus
void GeckoDisplay::OnSetFocus(wxFocusEvent &event)
{
}
void GeckoDisplay::OnKillFocus(wxFocusEvent &event)
{
}
| [
"archmagezeratul@93549f3f-7f0a-0410-a4b3-e966c9c94f04"
] | [
[
[
1,
112
]
]
] |
d406ac004e2b567c0c4fb8f84320366c9bcf35e6 | ab41c2c63e554350ca5b93e41d7321ca127d8d3a | /glm/gtx/matrix_projection.hpp | 2f12a35090688410c9dcea61743153d380527dc7 | [] | no_license | burner/e3rt | 2dc3bac2b7face3b1606ee1430e7ecfd4523bf2e | 775470cc9b912a8c1199dd1069d7e7d4fc997a52 | refs/heads/master | 2021-01-11T08:08:00.665300 | 2010-04-26T11:42:42 | 2010-04-26T11:42:42 | 337,021 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,353 | hpp | ///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2005-12-21
// Updated : 2009-04-29
// Licence : This source is under MIT License
// File : glm/gtx/matrix_projection.h
///////////////////////////////////////////////////////////////////////////////////////////////////
// Dependency:
// - GLM core
// - GLM_GTC_matrix_projection
///////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef glm_gtx_matrix_projection
#define glm_gtx_matrix_projection
// Dependency:
#include "../glm.hpp"
#include "../gtc/matrix_projection.hpp"
namespace glm
{
namespace test{
void main_gtx_matrix_projection();
}//namespace test
namespace gtx{
//! GLM_GTX_matrix_projection: Varius ways to build and operate on projection matrices
namespace matrix_projection
{
//! Builds a perspective projection matrix based on a field of view
//! From GLM_GTX_matrix_projection extension.
template <typename valType>
detail::tmat4x4<valType> perspectiveFov(
valType const & fov,
valType const & width,
valType const & height,
valType const & zNear,
valType const & zFar);
//! Creates a matrix for a symmetric perspective-view frustum with far plane at infinite .
//! From GLM_GTX_matrix_projection extension.
template <typename T>
detail::tmat4x4<T> infinitePerspective(
T fovy, T aspect, T zNear);
//! Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
//! From GLM_GTX_matrix_projection extension.
template <typename T>
detail::tmat4x4<T> tweakedInfinitePerspective(
T fovy, T aspect, T zNear);
}//namespace matrix_projection
}//namespace gtx
}//namespace glm
#define GLM_GTX_matrix_projection namespace gtc::matrix_projection; using namespace gtx::matrix_projection
#ifndef GLM_GTX_GLOBAL
namespace glm {using GLM_GTX_matrix_projection;}
#endif//GLM_GTX_GLOBAL
#include "matrix_projection.inl"
#endif//glm_gtx_matrix_projection
| [
"[email protected]"
] | [
[
[
1,
64
]
]
] |
149f8943bfeb9c2312a49f2e6e768051c3be68f3 | ad195eb05955ffbbbf14073bec424e6952be048e | /src/network/errors.cpp | 56b2afb7cb3320b31ce499aa886fe66ca58856e1 | [] | no_license | mvan/4985Final | 761c99c3b59c077c6ba0700a8c7ed179e5e71d68 | 00f43f5cffb2329ffd782aefc9763ba61debdb3f | refs/heads/master | 2020-05-18T10:30:36.884438 | 2011-04-06T15:12:06 | 2011-04-06T15:12:06 | 1,431,979 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 51 | cpp |
void WSAError(int error) {
exit(error);
}
| [
"Admin@.(none)",
"[email protected]"
] | [
[
[
1,
1
],
[
4,
4
]
],
[
[
2,
3
]
]
] |
00146aa1d774de7e002a24d9372b2c84b562e8f3 | e02fa80eef98834bf8a042a09d7cb7fe6bf768ba | /TEST_MyGUI_Source/MyGUIEngine/include/MyGUI_LayoutManager.h | c2a08c988f8e94c36a17941837884696201c45fc | [] | no_license | MyGUI/mygui-historical | fcd3edede9f6cb694c544b402149abb68c538673 | 4886073fd4813de80c22eded0b2033a5ba7f425f | refs/heads/master | 2021-01-23T16:40:19.477150 | 2008-03-06T22:19:12 | 2008-03-06T22:19:12 | 22,805,225 | 2 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 1,083 | h | /*!
@file
@author Albert Semenov
@date 11/2007
@module
*/
#ifndef __MYGUI_LAYOUT_MANAGER_H__
#define __MYGUI_LAYOUT_MANAGER_H__
#include "MyGUI_Prerequest.h"
#include "MyGUI_Instance.h"
#include "MyGUI_XmlDocument.h"
#include "MyGUI_WidgetDefines.h"
namespace MyGUI
{
//std::
class _MyGUIExport LayoutManager
{
INSTANCE_HEADER(LayoutManager);
public:
void initialise();
void shutdown();
VectorWidgetPtr load(const std::string & _file, const std::string & _group = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
void _load(xml::xmlNodePtr _node, const std::string & _file);
//void unload(const std::string & _file);
private:
void parseLayout(VectorWidgetPtr & _widgets, xml::xmlNodePtr _root);
void parseWidget(VectorWidgetPtr & _widgets, xml::xmlNodeIterator & _widget, WidgetPtr _parent);
private:
// для возврата последней загрузки
VectorWidgetPtr mVectorWidgetPtr;
}; // class LayoutManager
} // namespace MyGUI
#endif // __MYGUI_LAYOUT_MANAGER_H__
| [
"[email protected]"
] | [
[
[
1,
45
]
]
] |
137bb3814fe56003a838169ea25ae1dd561369fc | ad80c85f09a98b1bfc47191c0e99f3d4559b10d4 | /code/src/odetests/nodetest_main.cc | af455722d8c342575cdbbfe84a1281db012c3f04 | [] | no_license | DSPNerd/m-nebula | 76a4578f5504f6902e054ddd365b42672024de6d | 52a32902773c10cf1c6bc3dabefd2fd1587d83b3 | refs/heads/master | 2021-12-07T18:23:07.272880 | 2009-07-07T09:47:09 | 2009-07-07T09:47:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,941 | cc | #define N_IMPLEMENTS nOdeTest
//------------------------------------------------------------------------------
// (C) 2003 Vadim Macagon
//------------------------------------------------------------------------------
#include "odetests/nodetest.h"
nNebulaScriptClass(nOdeTest, "nroot");
#include "kernel/ntimeserver.h"
#include "kernel/nscriptserver.h"
#include "kernel/nremoteserver.h"
#include "gfx/ngfxserver.h"
#include "input/ninputserver.h"
#include "gfx/nchannelserver.h"
#include "gfx/nscenegraph2.h"
#include "misc/nconserver.h"
#include "misc/nspecialfxserver.h"
#include "odephysics/odephysics.h"
#include "gfx/nprimitiveserver.h"
#include "odetests/nodecar.h"
#include "odetests/nodeground.h"
#include "odetests/nodecamera.h"
#include "odetests/nodehingetest.h"
#include "odetests/nodemeshtest.h"
//------------------------------------------------------------------------------
/**
*/
nOdeTest::nOdeTest()
: ref_GfxServer( kernelServer, this ), ref_OdeServer( kernelServer, this ),
ref_InputServer( kernelServer, this ), ref_SceneGraph( kernelServer, this ),
ref_ConServer( kernelServer, this ), ref_SfxServer( kernelServer, this ),
ref_ChanServer( kernelServer, this ), ref_ScriptServer( kernelServer, this ),
ref_PrimitiveServer( kernelServer, this ), ref_CollSpace( kernelServer, this ),
ref_Lights( kernelServer, this ), grid( false ), stopRequested( false ),
timeChannel( -1 ), lastTime( 0.0 ), testNum( ODE_TEST_NONE ),
ground( 0 ), car( 0 ), hingeTest( 0 ), meshTest( 0 )
{
this->ref_GfxServer = "/sys/servers/gfx";
this->ref_InputServer = "/sys/servers/input";
this->ref_SceneGraph = "/sys/servers/sgraph2";
this->ref_SfxServer = "/sys/servers/specialfx";
this->ref_ConServer = "/sys/servers/console";
this->ref_ChanServer = "/sys/servers/channel";
this->ref_ScriptServer = "/sys/servers/script";
this->ref_OdeServer = "/sys/servers/ode";
this->ref_CollSpace = "/sys/servers/ode/spaces/root";
this->ref_PrimitiveServer = "/sys/servers/primitive";
this->ref_Lights = "/lights";
this->camera = new nOdeCamera();
this->camera->SetAngularSpeed( 500 );
this->camera->SetLinearSpeed( 5 );
this->kernelServer->GetRemoteServer()->Open("gfxserv");
}
//------------------------------------------------------------------------------
/**
*/
nOdeTest::~nOdeTest()
{
delete this->camera;
if ( this->meshTest )
delete this->meshTest;
if ( this->car )
delete this->car;
if ( this->ground )
delete this->ground;
if ( this->hingeTest )
delete this->hingeTest;
this->Cleanup();
}
//-------------------------------------------------------------------
/**
@brief Starts the game.
This method returns when one of the following happens:
- The rendering window is closed.
- The 'exit' script command is executed.
- The 'Stop' method on nOdeTest is called.
- 22-Mar-03 Vadim Macagon created
*/
//-------------------------------------------------------------------
void nOdeTest::Start()
{
this->kernelServer->ts->EnableFrameTime();
this->kernelServer->ts->ResetTime();
n_assert( this->ref_ChanServer.isvalid() );
this->timeChannel = this->ref_ChanServer->GenChannel( "time" );
this->lastTime = this->kernelServer->ts->GetFrameTime();
while ( this->Trigger() );
this->stopRequested = false;
n_printf( "Test Stopped!" );
}
//-------------------------------------------------------------------
/**
@brief Stops the game.
*/
void nOdeTest::Stop()
{
this->stopRequested = true;
this->kernelServer->ts->DisableFrameTime();
n_printf( "Requested test to stop" );
this->Cleanup();
}
//-------------------------------------------------------------------
/**
@brief Cleans up the component lists.
*/
void nOdeTest::Cleanup()
{
}
//-------------------------------------------------------------------
/**
Triggers the following servers:
- GFX Server
- Script Server
- Kernel Server
- Time Server
- Input Server
And then renders a frame.
- 22-Mar-03 Vadim created
*/
//-------------------------------------------------------------------
bool nOdeTest::Trigger()
{
if ( this->stopRequested )
{
n_printf( "obeying stop request" );
return false;
}
if ( !this->ref_GfxServer->Trigger() )
return false;
if ( !this->ref_ScriptServer->Trigger() )
return false;
this->kernelServer->Trigger();
// trigger the time server
this->kernelServer->ts->Trigger();
double time = kernelServer->ts->GetFrameTime();
float deltaT = float( time - this->lastTime );
this->lastTime = time;
this->ref_InputServer->Trigger( time );
this->HandleInput();
this->kernelServer->GetRemoteServer()->Trigger();
// handle other input
nInputServer* input = this->ref_InputServer.get();
this->camera->HandleInput( input, deltaT );
this->SetCameraTransform( this->camera->GetTransform() );
switch ( this->testNum )
{
case ODE_TEST_HINGE:
this->hingeTest->HandleInput( input );
this->hingeTest->Update();
break;
case ODE_TEST_BUGGY:
this->car->HandleInput( input );
this->car->Update();
break;
case ODE_TEST_MESH:
this->meshTest->HandleInput( input );
this->meshTest->Update();
break;
}
//nOdeCollideContext* collContext = ref_OdeServer->GetDefaultCollideContext();
nOdePhysicsContext* physContext = ref_OdeServer->GetDefaultPhysicsContext();
int numCollisions = this->ref_CollSpace->Collide();
if ( numCollisions > 0 )
{
switch ( this->testNum )
{
case ODE_TEST_BUGGY:
this->car->Collide();
break;
case ODE_TEST_MESH:
this->meshTest->Collide();
break;
}
}
physContext->Step( 0.05f );
this->ref_ChanServer->SetChannel1f( this->timeChannel, (float)time );
// finally render the frame
this->RenderFrame( (float)time );
// flush input events
this->ref_InputServer->FlushEvents();
if ( this->sleepTime > 0.0f )
n_sleep( this->sleepTime );
return true;
}
//-------------------------------------------------------------------
/**
*/
void nOdeTest::HandleInput()
{
nInputServer* input = this->ref_InputServer.get();
int newTestNum = ODE_TEST_NONE;
if ( input->GetButton( "test_hinge" ) )
{
newTestNum = ODE_TEST_HINGE;
}
else if ( input->GetButton( "test_buggy" ) )
{
newTestNum = ODE_TEST_BUGGY;
}
else if ( input->GetButton( "test_mesh" ) )
{
newTestNum = ODE_TEST_MESH;
}
if ( (newTestNum != ODE_TEST_NONE) && (newTestNum != this->testNum) )
{
if ( this->testNum != ODE_TEST_NONE )
{
// cleanup old test
switch( this->testNum )
{
case ODE_TEST_HINGE:
delete this->hingeTest;
this->hingeTest = 0;
break;
case ODE_TEST_BUGGY:
delete this->car;
this->car = 0;
delete this->ground;
this->ground = 0;
break;
case ODE_TEST_MESH:
delete this->meshTest;
this->meshTest = 0;
break;
}
}
// setup new test
switch( newTestNum )
{
case ODE_TEST_HINGE:
this->ref_OdeServer->GetDefaultPhysicsContext()->
SetGravity( vector3(0, 0, 0) );
this->hingeTest = new nOdeHingeTest( this->kernelServer );
break;
case ODE_TEST_BUGGY:
this->ref_OdeServer->GetDefaultPhysicsContext()->
SetGravity( vector3(0, -9.81f, 0) );
this->car = new nOdeCar( this->kernelServer );
this->ground = new nOdeGround( this->kernelServer );
break;
case ODE_TEST_MESH:
this->ref_OdeServer->GetDefaultPhysicsContext()->
SetGravity( vector3(0, -0.1, 0) );
this->meshTest = new nOdeMeshTest( this->kernelServer );
break;
}
this->testNum = newTestNum;
}
}
//-------------------------------------------------------------------
/**
@brief Render a single frame.
@param time Current time.
- 22-Mar-03 Vadim created
*/
//-------------------------------------------------------------------
void nOdeTest::RenderFrame( float time )
{
n_assert( this->ref_GfxServer.isvalid() );
nGfxServer* gs = this->ref_GfxServer.get();
n_assert( this->ref_ConServer.isvalid() );
nConServer* con = this->ref_ConServer.get();
// Render
if ( gs->BeginScene() )
{
// trigger particle server (needs timestamp)
/*
if ( this->ref_ParticleServer.isvalid() )
{
this->ref_ParticleServer->Trigger();
}
*/
gs->SetMatrix( N_MXM_VIEWER, this->cameraTransform );
nSpecialFxServer* fx = 0;
if ( this->ref_SfxServer.isvalid() )
fx = this->ref_SfxServer.get();
n_assert( this->ref_SceneGraph.isvalid() );
nSceneGraph2* sg = this->ref_SceneGraph.get();
if ( sg->BeginScene( this->viewTransform ) )
{
// trigger specialfx server
if ( fx )
fx->Begin();
// attach the world lights
if ( this->ref_Lights.isvalid() )
{
nVisNode* node = 0;
node = (nVisNode*)this->ref_Lights->GetHead();
for( ; node; node = (nVisNode*)node->GetSucc() )
{
sg->Attach( node , 0 );
}
}
if ( fx )
fx->End( sg );
// render the scene
sg->EndScene( true );
}
if ( this->grid )
this->RenderGrid( gs, this->viewTransform );
// render collision shapes
//this->ref_OdeServer->GetDefaultCollideContext()->Visualize( gs );
nPrimitiveServer* prim = this->ref_PrimitiveServer.get();
switch ( this->testNum )
{
case ODE_TEST_HINGE:
this->hingeTest->Visualize( gs, prim );
break;
case ODE_TEST_BUGGY:
this->ground->Visualize( gs, prim );
this->car->Visualize( gs, prim );
break;
case ODE_TEST_MESH:
this->meshTest->Visualize( gs, prim );
break;
}
// test primitive server
gs->SetMatrix( N_MXM_MODELVIEW, this->viewTransform );
this->ref_GfxServer->Rgba( 1.0f, 0.0f, 0.0f, 1.0f );
//prim->WireCone( 1.0f, 2.0f, true, 16, 1 );
//prim->WireCone( 1.0f, 2.0f, false, 16, 3 );
//prim->SolidCone( 1.0f, 2.0f, true, 16, 3 );
//prim->WireCylinder( 1.0f, 2.0f, true, 16, 3 );
//prim->SolidCylinder( 1.0f, 2.0f, true, 16, 3 );
//prim->WireCube( 1.0f );
//prim->WireBox( 1.0f, 2.0f, 0.5f );
//prim->WireSphere( 1.0f, 16, 16 );
//prim->SolidSphere( 2.0f, 16, 16 );
//prim->SolidCapsule( 0.5f, 1.0f, 16, 8 );
con->Render();
gs->EndScene();
}
}
//-------------------------------------------------------------------
/**
@brief Render the grid. (OpenGL only for now)
@param gs Pointer to gfx server.
@param ivwr Current inverse viewer matrix.
- 18-Sep-02 Vadim ripped from nObserver
*/
//-------------------------------------------------------------------
void nOdeTest::RenderGrid( nGfxServer* gs, matrix44& ivwr )
{
gs->SetMatrix( N_MXM_MODELVIEW, ivwr );
nPrimitiveServer* ps = this->ref_PrimitiveServer.get();
ps->SetColor( 0.5f, 0.5f, 1.0f, 1.0f );
ps->EnableLighting( false );
ps->WirePlane( 25.0f, 1.0f );
}
| [
"plushe@411252de-2431-11de-b186-ef1da62b6547"
] | [
[
[
1,
405
]
]
] |
3236bd29db963f68a28018e9d4e13cdb62ec4f7d | ef23e388061a637f82b815d32f7af8cb60c5bb1f | /src/mame/includes/simpsons.h | ae0e8957b2349784520f3a845738de4e9e939dee | [] | 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 | 1,428 | h |
class simpsons_state : public driver_device
{
public:
simpsons_state(running_machine &machine, const driver_device_config_base &config)
: driver_device(machine, config) { }
/* memory pointers */
UINT8 * m_ram;
UINT8 * m_xtraram;
UINT16 * m_spriteram;
// UINT8 * m_paletteram; // currently this uses generic palette handling
/* video-related */
int m_sprite_colorbase;
int m_layer_colorbase[3];
int m_layerpri[3];
/* misc */
int m_firq_enabled;
int m_video_bank;
//int m_nmi_enabled;
/* devices */
device_t *m_maincpu;
device_t *m_audiocpu;
device_t *m_k053260;
device_t *m_k052109;
device_t *m_k053246;
device_t *m_k053251;
};
/*----------- defined in machine/simpsons.c -----------*/
WRITE8_HANDLER( simpsons_eeprom_w );
WRITE8_HANDLER( simpsons_coin_counter_w );
READ8_HANDLER( simpsons_sound_interrupt_r );
READ8_DEVICE_HANDLER( simpsons_sound_r );
MACHINE_RESET( simpsons );
MACHINE_START( simpsons );
/*----------- defined in video/simpsons.c -----------*/
void simpsons_video_banking( running_machine &machine, int select );
SCREEN_UPDATE( simpsons );
extern void simpsons_tile_callback(running_machine &machine, int layer,int bank,int *code,int *color,int *flags,int *priority);
extern void simpsons_sprite_callback(running_machine &machine, int *code,int *color,int *priority_mask);
| [
"Mike@localhost"
] | [
[
[
1,
48
]
]
] |
8541dfb06b785a47ba048a9b1f7ee7f27bb74c5b | b5ad65ebe6a1148716115e1faab31b5f0de1b493 | /src/AranIk_Test/BwPlaybackSlider.cpp | 9bdfb252f7b8b1913f40ac00841ca0bc3b433225 | [] | 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 | 1,505 | cpp | #include "BwPch.h"
#include "BwPlaybackSlider.h"
#include "BwAppContext.h"
#include "BwOpenGlWindow.h"
static void cb(Fl_Widget *o, void *p)
{
PlaybackSlider* ps = (PlaybackSlider*)p;
BwAppContext& ac = ps->getAppContext();
const int frame = (int)ps->value();
ac.frames = min(frame, ps->getAvailableFrames());
sprintf(ac.frameStr, "%d", ac.frames);
ac.frameLabel->redraw_label();
ac.simulateButton->value(0);
ac.bSimulate = false;
if (!ac.bSimulate)
{
if (ac.simWorldHistory[frame].generalBodyState.size())
{
ac.swPtr->setSimWorldState( ac.simWorldHistory[frame] );
ac.glWindow->redraw();
}
}
}
PlaybackSlider::PlaybackSlider( int x, int y, int w, int h, const char* c, BwAppContext& ac )
: Fl_Hor_Slider(x, y, w, h, c)
, m_availableFrames(0)
, m_ac(ac)
{
callback(cb, this);
}
PlaybackSlider::~PlaybackSlider(void)
{
}
void PlaybackSlider::draw()
{
Fl_Hor_Slider::draw();
Fl_Color c = fl_rgb_color(255, 0, 0);
fl_rect(x(), y() + h()/2 - 5, w()/10000.0 * m_availableFrames, 10, c);
}
int PlaybackSlider::handle( int eventType )
{
if (eventType == FL_MOVE || eventType == FL_KEYDOWN || eventType == FL_KEYUP)
{
if (value() > m_availableFrames)
{
value(m_availableFrames);
return 1;
}
}
return Fl_Hor_Slider::handle(eventType);
}
void PlaybackSlider::setAvailableFrames( int frames )
{
m_availableFrames = frames;
}
BwAppContext& PlaybackSlider::getAppContext()
{
return m_ac;
} | [
"[email protected]"
] | [
[
[
1,
69
]
]
] |
979a23d614726369d500e024717054be52bb0d53 | 96fefafdfbb413a56e0a2444fcc1a7056afef757 | /MQ2DataStructures/ISXEQDataStructures.h | bbc35caca31916807078db245504056c692a15fa | [] | no_license | kevrgithub/peqtgc-mq2-sod | ffc105aedbfef16060769bb7a6fa6609d775b1fa | d0b7ec010bc64c3f0ac9dc32129a62277b8d42c0 | refs/heads/master | 2021-01-18T18:57:16.627137 | 2011-03-06T13:05:41 | 2011-03-06T13:05:41 | 32,849,784 | 1 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 1,752 | h | #pragma once
#include <isxdk.h>
class ISXEQDataStructures :
public ISXInterface
{
public:
virtual bool Initialize(ISInterface *p_ISInterface);
virtual void Shutdown();
void LoadSettings();
void ConnectServices();
void RegisterCommands();
void RegisterAliases();
void RegisterDataTypes();
void RegisterTopLevelObjects();
void RegisterServices();
void DisconnectServices();
void UnRegisterCommands();
void UnRegisterAliases();
void UnRegisterDataTypes();
void UnRegisterTopLevelObjects();
void UnRegisterServices();
};
extern ISInterface *pISInterface;
extern HISXSERVICE hPulseService;
extern HISXSERVICE hMemoryService;
extern HISXSERVICE hServicesService;
extern HISXSERVICE hEQChatService;
extern HISXSERVICE hEQUIService;
extern HISXSERVICE hEQGamestateService;
extern HISXSERVICE hEQSpawnService;
extern HISXSERVICE hEQZoneService;
extern ISXEQDataStructures *pExtension;
#define printf pISInterface->Printf
#define EzDetour(Address, Detour, Trampoline) IS_Detour(pExtension,pISInterface,hMemoryService,(unsigned int)Address,Detour,Trampoline)
#define EzUnDetour(Address) IS_UnDetour(pExtension,pISInterface,hMemoryService,(unsigned int)Address)
#define EzModify(Address,NewData,Length,Reverse) Memory_Modify(pExtension,pISInterface,hMemoryService,(unsigned int)Address,NewData,Length,Reverse)
#define EzUnModify(Address) Memory_UnModify(pExtension,pISInterface,hMemoryService,(unsigned int)Address)
#define EzHttpRequest(_URL_,_pData_) IS_HttpRequest(pExtension,pISInterface,hHTTPService,_URL_,_pData_)
extern LSType *pStringType;
extern LSType *pIntType;
extern LSType *pBoolType;
extern LSType *pFloatType;
extern LSType *pTimeType;
extern LSType *pByteType;
| [
"[email protected]@39408780-f958-9dab-a28b-4b240efc9052"
] | [
[
[
1,
57
]
]
] |
9148329d8d5695cf23d1d6703a088c13909e4981 | c1a2953285f2a6ac7d903059b7ea6480a7e2228e | /deitel/ch15/Fig15_04/Fig15_04.cpp | bbad89ac1c8ab7e2df7f0f0cd8282c257b97812e | [] | no_license | tecmilenio/computacion2 | 728ac47299c1a4066b6140cebc9668bf1121053a | a1387e0f7f11c767574fcba608d94e5d61b7f36c | refs/heads/master | 2016-09-06T19:17:29.842053 | 2008-09-28T04:27:56 | 2008-09-28T04:27:56 | 50,540 | 4 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 1,820 | cpp | // Fig. 15.4: Fig15_04.cpp
// Using member functions get, put and eof.
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
int character; // use int, because char cannot represent EOF
// prompt user to enter line of text
cout << "Before input, cin.eof() is " << cin.eof() << endl
<< "Enter a sentence followed by end-of-file:" << endl;
// use get to read each character; use put to display it
while ( ( character = cin.get() ) != EOF )
cout.put( character );
// display end-of-file character
cout << "\nEOF in this system is: " << character << endl;
cout << "After input of EOF, cin.eof() is " << cin.eof() << endl;
return 0;
} // end main
/**************************************************************************
* (C) Copyright 1992-2008 by Deitel & Associates, Inc. and *
* Pearson Education, Inc. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
**************************************************************************/
| [
"[email protected]"
] | [
[
[
1,
39
]
]
] |
bc72b03905eea55ddcc8b70e76bd4762683335c7 | d411188fd286604be7670b61a3c4c373345f1013 | /zomgame/ZGame/display.cpp | e9d13c8dba8631f8d90c9e490bca388f0c63d301 | [] | no_license | kjchiu/zomgame | 5af3e45caea6128e6ac41a7e3774584e0ca7a10f | 1f62e569da4c01ecab21a709a4a3f335dff18f74 | refs/heads/master | 2021-01-13T13:16:58.843499 | 2008-09-13T05:11:16 | 2008-09-13T05:11:16 | 1,560,000 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 17,124 | cpp | #include "display.h"
#include "keycodes.h"
#include <deque>
using namespace std;
Display::Display(Game* game) {
init();
this->game = game;
}
void Display::init() {
resize_term(50,80);
playWin = newwin(35,55,0,0); //height, width, starty, startx
msgWin = newwin(15,80,35,0);
menuWin = newwin(35,25,0,55);
invWin = newwin(11,80,35,0); //displays the inventory
popupWin = new PopupWin(10, 30, 20, 20);
showItemDetail = false;
groundSelection = -1;
dState = new DisplayState();
dState->init();
popupSelection = 0;
leftInv = new ScrollableList();
rightInv = new ScrollableList();
camera = new Camera();
camera->setViewableArea(33, 53); //height - 2, width - 2;
start_color();
// TODO: we really need to move colour palette stuff somewhere else
if (can_change_color())
init_color(15, 0, 1000, 1000);
init_pair(WHITE_BLACK, COLOR_WHITE, COLOR_BLACK);
init_pair(GREEN_BLACK, COLOR_GREEN, COLOR_BLACK);
init_pair(RED_BLACK, COLOR_RED, COLOR_BLACK);
init_pair(CYAN_BLACK, COLOR_CYAN, COLOR_BLACK);
init_pair(YELLOW_BLACK, COLOR_YELLOW, COLOR_BLACK);
init_pair(MAGENTA_BLACK, COLOR_MAGENTA, COLOR_BLACK);
init_pair(6, 15, COLOR_BLACK);
#define TARGET_COLOR COLOR_RED
#define TARGET_PAIR 6
}
/* Puts the selections within correct boundaries */
void Display::cleanSelections(){
int invSize = game->getPlayer()->getInventory()->getSize();
if (inventorySelection < 0){ inventorySelection += invSize; }
if (invSize == 0){ inventorySelection = 0; }
else { inventorySelection %= invSize; }
if (inventorySelection > maxIndex){
minIndex += inventorySelection - maxIndex;
maxIndex += inventorySelection - maxIndex;
} else if (inventorySelection < minIndex){
maxIndex -= minIndex - inventorySelection;
minIndex -= minIndex - inventorySelection;
}
//same for the groundSelection
int groundSize = static_cast<int>(game->getMap()->getBlockAt(game->getPlayer()->getLoc())->getItems()->size());
if (groundSelection < 0){ groundSelection += groundSize; }
if (groundSize == 0){ groundSelection = 0; }
else {groundSelection %= groundSize; }
if (groundSelection > maxGIndex){
minGIndex += groundSelection - maxGIndex;
maxGIndex += groundSelection - maxGIndex;
} else if (groundSelection < minGIndex){
maxGIndex -= minGIndex - groundSelection;
minGIndex -= minGIndex - groundSelection;
}
}
// pulls down necessary data from game to draw
void Display::draw() {
if (dState->attrIsToggled()){
drawCharacterInfo();
} else {
this->draw(game->getMap());
}
this->draw(game->getMessages());
if (invIsToggled()){
this->draw(game->getPlayer()->getInventoryStrings());
}
draw(game->getPlayer(), game->getMap()->getBlockAt(game->getTarget()));
}
void Display::draw(Map* map) {
//VISIBLE WORLD -- Kyle did you just make a lolcat reference? Oh my.
box(playWin, 0,0);
wclear(playWin);
int height, width;
getmaxyx(playWin,height,width);
height -= 2;
width -= 2;
chtype* view = camera->getViewableArea(map, getCenter());
Coord transTarget = camera->getLocalCoordinates(target, getCenter());
Coord p = camera->getLocalCoordinates(game->getPlayer()->getLoc(), getCenter());
for (int x=0; x<width; x++){
for (int y=0; y<height; y++){
int index = x + (y * width);
// if on targeted block
// and target is no underneath player
if (x == transTarget.getX() && y == transTarget.getY()
&& !target->equals(getCenter()->getLoc())) {
short fg, bg;
// grab foreground colour of block
pair_content(map->getBlockAt(target)->getColor(), &fg, &bg);
// generate new pair using block fg + red bg
init_pair(TARGET_PAIR, fg, TARGET_COLOR);
wattron(playWin, COLOR_PAIR(TARGET_PAIR));
mvwaddch(playWin, y+1, x+1, (char)view[index]);
wattroff(playWin, COLOR_PAIR(TARGET_PAIR));
} else {
mvwaddch(playWin, y+1, x+1, view[index]);
}
}
}
//the line of aiming if 'target' has been moved
vector<Coord>* ray = game->getRay(game->getPlayer()->getLoc(), game->getTarget());
if (ray) {
Coord c;
for (unsigned int i = 0; i < ray->size(); i++) {
c = ray->at(i);
c = camera->getLocalCoordinates(&c, getCenter());
short fg, bg;
// grab foreground colour of block
pair_content(map->getBlockAt(&c)->getColor(), &fg, &bg);
// generate new pair using block fg + red bg
init_pair(TARGET_PAIR, fg, TARGET_COLOR);
wattron(playWin, COLOR_PAIR(TARGET_PAIR));
mvwaddch(playWin, c.getY()+1, c.getX()+1, (char)view[c.getX() + c.getY() * width]);
wattroff(playWin, COLOR_PAIR(TARGET_PAIR));
}
}
//now display it in the play window (playWin)
wrefresh(playWin);
}
void Display::draw(deque<Message> msgs) {
wclear(msgWin);
unsigned int height, width, offset = 1;
getmaxyx(msgWin,height,width);
for (unsigned int i=0; i<height-2 && i<msgs.size();i++){
string text = *(msgs.at(i)).getMsg(); //remove the pointer to avoid modifying the original message
unsigned int cutoff = width; //preserving the value of windowLength
mvwprintw(msgWin, i+offset, 1, "> %s\n", text.c_str());
offset += msgs.at(i).getNumLines();
}
//then draw the box and refresh the window
box(msgWin, 0,0);
mvwprintw(msgWin, 0, 3, "MESSAGE LOG");
wrefresh(msgWin);
}
void Display::draw(vector<string*>* inventoryStrings){
wclear(invWin);
leftInv->setList(inventoryStrings);
int height, width;
getmaxyx(invWin, height, width);
//vector<Item*>* groundInv = &(game->getMap()->getBlockAt(game->getPlayer()->getLoc())->getItems());
vector<string*>* groundInvStrings = this->getItemStrings(game->getRightInvList());
//I need to set rightInv elsewhere, for shizzle.
rightInv->setList(groundInvStrings);
if (groundInvStrings->empty()){
dState->invSide = true;
}
if (inventoryStrings->size() == 0){
dState->invSide = false;
}
if (showItemDetail && (inventoryStrings->size() > 0 || groundInvStrings->size() > 0 )){ //if the user wants to see the details of an item
if (dState->invIsHighlighted() && dState->invSide) { //check the inventory selection
drawItemDetails(game->getPlayer()->getInventory()->getItemAt(leftInv->getSelectedIndex()), height, width);
} else { //check the ground selection
drawItemDetails(game->getMap()->getBlockAt(game->getPlayer()->getLoc())->getItemAt(rightInv->getSelectedIndex()), height, width);
}
} else { //otherwise, draw the full inventory
for (int i=1; i<height-1; i++){ //draw the center column
mvwprintw(invWin, i, width/2, "|");
}
drawInventoryList(leftInv, 3, dState->invIsHighlighted());
drawInventoryList(rightInv, width/2 + 4, !dState->invIsHighlighted());
}
//draw the skills popup if necessary
if (popupIsToggled()) {
popupWin->draw();
}
box(invWin, 0,0);
mvwprintw(invWin, 0, 3, "POSSESSIONS");
mvwprintw(invWin, 0, width/2+3, "GROUND");
wrefresh(invWin);
}
void Display::draw(Player* player, MapBlock* block){
wclear(menuWin); //first clear the window
string condition = "Healthy";
//player = game->getPlayer();
int curHealth = player->getAttribute("Health")->getCurValue(),
maxHealth = player->getAttribute("Health")->getMaxValue();
if (curHealth < maxHealth/1){condition = "Slightly Wounded";}
if (curHealth < maxHealth/2){condition = "Wounded";}
if (curHealth < maxHealth/3){condition = "Badly Wounded";}
if (curHealth < maxHealth/4){condition = "Critical";}
if (curHealth < maxHealth/5){condition = "Near Death";}
mvwprintw(menuWin, 1, 2, "%s", game->getPlayer()->getName().c_str());
mvwprintw(menuWin, 2, 2, "Condition: %d/%d", curHealth, maxHealth);
mvwprintw(menuWin, 3, 2, "Weapon: %s", player->getEquippedWeapon()->getName().c_str());
mvwprintw(menuWin, 4, 2, "RngWeapon: %s", player->getEqRngWeapon() ? player->getEqRngWeapon()->getName().c_str() : "nothing");
mvwprintw(menuWin, 5, 2, "Strength: %d", player->getAttribute("Strength")->getCurValue());
mvwprintw(menuWin, 6, 2, "WeapDur: %d/%d", player->getEquippedWeapon()->getDurability()->getCurValue(),
player->getEquippedWeapon()->getDurability()->getMaxValue());
Time t = game->getTime();
mvwprintw(menuWin, getmaxy(menuWin) / 2 - 2, 2, "Time: %d:%d:%2.1f", t.hour, t.minute, t.second);
mvwprintw(menuWin, getmaxy(menuWin) / 2 - 1, 2, "TickCount: %d", game->getTickcount());
mvwprintw(menuWin, 8, 2, "EventListSize: %d", game->getEventList()->getSize());
//draw the mapblock info
int halfway = getmaxy(menuWin)/2;
if (block->hasEntities()){
mvwprintw(menuWin, halfway+1, 2, "Entity: %s", block->getTopEntity()->getName().c_str());
mvwprintw(menuWin, halfway+2, 3, "Health: %d", block->getTopEntity()->getAttribute("Health")->getCurValue());
}
if (block->hasProps()){
mvwprintw(menuWin, halfway+4, 2, "Prop: %s", block->getTopProp()->getName().c_str());
mvwprintw(menuWin, halfway+5, 3, "Durability: %d", block->getTopProp()->getHealth()->getCurValue());
}
if (block->getItems()->size() > 0){
mvwprintw(menuWin, halfway+7, 2, "Items");
for (unsigned int i = 0; i < block->getItems()->size(); i++){
mvwprintw(menuWin, i+halfway+8, 3, "%s", block->getItemAt(i)->getListName().c_str());
}
}
//draw the box + dividing line
box(menuWin, 0,0);
mvwprintw(menuWin, 0, 3, "PLAYER");
mvwaddch(menuWin, halfway, 0, ACS_LTEE);
for (int i = 1; i< getmaxx(menuWin) - 1; i++){
mvwaddch(menuWin, halfway, i, ACS_HLINE);
}
mvwaddch(menuWin, halfway, getmaxx(menuWin) - 1, ACS_RTEE);
mvwprintw(menuWin, halfway, 2, "INFO");
wrefresh(menuWin);
}
void Display::drawCharacterInfo(){
wclear(playWin);
int height, width;
getmaxyx(playWin, height, width);
Player* p = game->getPlayer();
//character name, equipped weapons, skills
mvwprintw(playWin, 2,2, "Name: %s", p->getName().c_str());
mvwprintw(playWin, 4,2, "ATTRIBUTES");
vector<Attribute*>* attributeList = p->getAttributes();
for (unsigned int j = 0; j < attributeList->size(); j++){
mvwprintw(playWin, j+5,2, "%s: %d/%d", attributeList->at(j)->getName().c_str(), attributeList->at(j)->getCurValue(), attributeList->at(j)->getMaxValue());
}
mvwprintw(playWin, 1, width-20, "SKILLS");
for (unsigned int i = 0; i < p->getSkills()->size(); i++){
if (skill_list.getSkill(i)->getType() != INHERENT){
mvwprintw(playWin, i+2, width-20, "%-12s - %d", skill_list.getSkill(i)->getName().c_str(), p->getSkillValue(i));
}
}
box(playWin, 0,0);
mvwprintw(playWin, 0, 3, "CHARACTER INFO");
wrefresh(playWin);
}
void Display::drawInventoryList(ScrollableList* inv, int xPos, bool highlight){
int height, width, offset;
string* itemName;
Item* item;
getmaxyx(invWin, height, width);
offset = inv->getDisplayOffset(height-2, 0);
for (int i=0; i<9;i++){
itemName = inv->getStringForPosition(i, 9);
item = game->getPlayer()->getInventory()->getItemAt(i+offset);
if (i + offset == inv->getSelectedIndex() && highlight) { //if the item is highlighted
wattron(invWin, COLOR_PAIR(YELLOW_BLACK));
*itemName = "-" + *itemName + "-";
} else {
*itemName = " " + *itemName;
}
if (item != NULL && xPos < width/2) { //if this is on the left side
if (item == game->getPlayer()->getEquippedWeapon() || //and the weapon is equipped
item == game->getPlayer()->getEqRngWeapon()){
*itemName = "E " + *itemName;
} else {
*itemName = " " + *itemName;
}
}
mvwprintw(invWin,i+1,xPos, "%s", itemName->c_str());
wattroff(invWin, COLOR_PAIR(YELLOW_BLACK));
}
}
void Display::drawItemDetails(Item* item, int height, int width){
mvwprintw(invWin, 2, 3, item->getName().c_str());
mvwprintw(invWin, 4, 5, item->getDescription().c_str());
mvwprintw(invWin, height-2, 4, "Weight: %d lbs", item->getWeight());
mvwprintw(invWin, height-2, width-20, "Bulk: %d", item->getBulk());
mvwprintw(invWin, height-2, 40, "Type: %s", item->getTypeString().c_str());
if (item->getTypeString().compare("Weapon") == 0) { //display weapon stats if its a weapon
Weapon* weapon = (Weapon*)item;
mvwprintw(invWin, 2, width-30, "Weapon Class: %s", weapon->getWTypeString().c_str());
mvwprintw(invWin, 3, width-30, "Durability: %d/%d", weapon->getDurability()->getCurValue(), weapon->getDurability()->getMaxValue());
mvwprintw(invWin, 4, width-30, "Base Damage: %d", weapon->getDamage());
}
}
void Display::drawPopup(Item* item){
popupWin->draw();
}
/* Says whether or not the game should be ticking */
bool Display::gameIsActive(){
return dState->mapIsToggled();
}
Entity* Display::getCenter() {
return center;
}
vector<string*>* Display::getItemStrings(vector<Item*>* itemList){
vector<string*>* stringList = new vector<string*>();
for (unsigned int i = 0; i < itemList->size(); i++){
stringList->push_back(new string(itemList->at(i)->getName()));
}
return stringList;
}
bool Display::invIsToggled(){
return dState->invIsToggled();
}
bool Display::popupIsToggled(){
return dState->popupIsToggled();
}
/* Decides what context to process the key in. Returns false if no context */
int Display::processKey(int input){
if (input == WIN_KEY_ESC) {
if (dState->popupIsToggled()) {
togglePopup();
showItemDetail = false;
} else if (dState->invIsToggled()) {
toggleInventory(true);
} else if (dState->attrIsToggled()) {
toggleAttributes();
}
} else if (popupIsToggled()){
return this->processKeyUseItem(input);
} else if (invIsToggled()){
return this->processKeyInventory(input);
} else if (dState->attrIsToggled()){
return processKeyAttributes(input);
}
return 0;
}
int Display::processKeyAttributes(int input){
if (input == 'u'){
dState->toggleAttr();
}
return 0;
}
int Display::processKeyInventory(int input){
wclear(invWin);
if (input == 'i'){
leftInv->resetIndex();
rightInv->resetIndex();
showItemDetail = false;
this->toggleInventory(true);
return 5;
} else if (input == WIN_KEY_DOWN) { //down
if (dState->invIsHighlighted()){ leftInv->incIndex(); }
else {rightInv->incIndex();}
} else if (input == WIN_KEY_UP) { //up
if (dState->invIsHighlighted()){ leftInv->decIndex(); }
else {rightInv->decIndex();} }
else if (input == WIN_KEY_LEFT) { //left
dState->switchInvSelect();
} else if (input == WIN_KEY_RIGHT) { //right
dState->switchInvSelect();
} else if (input == 'g'){
if (!dState->invIsHighlighted()){
game->addEvent(EventFactory::createGetItemEvent(game->getPlayer(), game->getPlayer()->getLoc(), rightInv->getSelectedIndex(), 0));
rightInv->decIndex();
return 5;
} //pick up the item
} else if (input == WIN_KEY_ENTER) { //enter key
Item* item = NULL;
if (dState->invIsHighlighted()){
item = game->getPlayer()->getInventory()->getItemAt(leftInv->getSelectedIndex());
}
if (item) {
this->setUpSkillWindow(item);
togglePopup();
showItemDetail = !showItemDetail;
}
}
return 0;
}
int Display::processKeyUseItem(int input){
if (input == 'u'){
togglePopup();
} else if (input == WIN_KEY_DOWN) {
popupWin->incrementSelection();
} else if (input == WIN_KEY_UP) {
popupWin->decrementSelection();
} else if (input == WIN_KEY_ENTER) {
togglePopup();
showItemDetail = !showItemDetail;
Item* item = game->getPlayer()->getInventory()->getItemAt(leftInv->getSelectedIndex());
if (popupWin->getListItemAt(popupWin->getSelectedIndex()) == "Drop"){
game->addEvent(EventFactory::createDropItemEvent(game->getPlayer(), leftInv->getSelectedIndex(), 0));
return 5;
}
//use the selected skill
game->addEvent(EventFactory::createSkillEvent(game->getPlayer(), skill_list.getSkill(item->getSkills()->at(popupWin->getSelectedIndex())), item, 0));
return 5;
}
return 0;
}
void Display::setCenter(Entity* newCenter){
center = newCenter;
}
void Display::setTarget(Coord* newTarget) {
target = newTarget;
}
void Display::setUpSkillWindow(Item* item){
popupWin->clear();
vector<string>* skillNames = new vector<string>();
for (unsigned int i = 0; i < item->getSkills()->size(); i++){
skillNames->push_back(skill_list.getSkill(item->getSkills()->at(i))->getName());
}
skillNames->push_back("Drop"); //every item can be dropped
popupWin->setHeader(item->getName());
popupWin->setList(skillNames);
}
void Display::toggleInventory(bool selectedSide){
dState->toggleInv();
if (dState->invIsToggled()){
if (!selectedSide){ dState->switchInvSelect(); }
minIndex = 0, maxIndex = 8;
minGIndex = 0, maxGIndex = 8;
leftInv->resetIndex();
rightInv->resetIndex();
wresize(msgWin, 4, 80);
mvwin(msgWin, 46,0);
} else {
wresize(msgWin, 15, 80);
mvwin(msgWin, 35,0);
}
}
void Display::toggleAttributes(){
dState->toggleAttr();
}
void Display::togglePopup(){
if (dState->invIsHighlighted() || dState->popupIsToggled()){ //can only use items you've picked up
dState->togglePopup();
popupSelection = 0;
}
}
| [
"nicholasbale@9b66597e-bb4a-0410-bce4-15c857dd0990",
"krypes@9b66597e-bb4a-0410-bce4-15c857dd0990",
"reaperunreal@9b66597e-bb4a-0410-bce4-15c857dd0990",
"Krypes@9b66597e-bb4a-0410-bce4-15c857dd0990"
] | [
[
[
1,
6
],
[
8,
8
],
[
10,
12
],
[
14,
34
],
[
40,
45
],
[
49,
65
],
[
67,
78
],
[
81,
92
],
[
95,
103
],
[
107,
109
],
[
126,
127
],
[
129,
130
],
[
147,
151
],
[
154,
157
],
[
159,
161
],
[
163,
167
],
[
170,
187
],
[
189,
227
],
[
231,
231
],
[
235,
245
],
[
247,
247
],
[
249,
249
],
[
251,
257
],
[
259,
260
],
[
262,
279
],
[
281,
367
],
[
378,
418
],
[
420,
422
],
[
428,
440
],
[
443,
448
],
[
451,
452
],
[
457,
458
],
[
461,
467
],
[
470,
502
]
],
[
[
7,
7
],
[
9,
9
],
[
13,
13
],
[
35,
39
],
[
46,
48
],
[
66,
66
],
[
79,
80
],
[
93,
94
],
[
104,
106
],
[
110,
125
],
[
128,
128
],
[
131,
133
],
[
135,
146
],
[
152,
153
],
[
158,
158
],
[
162,
162
],
[
169,
169
],
[
188,
188
],
[
228,
230
],
[
232,
234
],
[
246,
246
],
[
248,
248
],
[
250,
250
],
[
368,
377
],
[
419,
419
],
[
423,
427
],
[
441,
442
],
[
449,
450
],
[
453,
456
],
[
459,
460
],
[
469,
469
]
],
[
[
134,
134
],
[
258,
258
],
[
261,
261
],
[
280,
280
],
[
468,
468
]
],
[
[
168,
168
],
[
503,
503
]
]
] |
fc4b40030242450dddc5736f459585c1ab423cfa | 77aa13a51685597585abf89b5ad30f9ef4011bde | /dep/src/boost/boost/functional/hash/hash.hpp | 138b399929deb06835d14e7c9f6843fb8af3b2b7 | [] | no_license | Zic/Xeon-MMORPG-Emulator | 2f195d04bfd0988a9165a52b7a3756c04b3f146c | 4473a22e6dd4ec3c9b867d60915841731869a050 | refs/heads/master | 2021-01-01T16:19:35.213330 | 2009-05-13T18:12:36 | 2009-05-14T03:10:17 | 200,849 | 8 | 10 | null | null | null | null | UTF-8 | C++ | false | false | 14,876 | hpp |
// Copyright 2005-2008 Daniel James.
// 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)
// Based on Peter Dimov's proposal
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
// issue 6.18.
#if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP)
#define BOOST_FUNCTIONAL_HASH_HASH_HPP
#include <boost/functional/hash_fwd.hpp>
#include <functional>
#include <boost/functional/detail/hash_float.hpp>
#include <boost/functional/detail/container_fwd.hpp>
#include <string>
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
#include <boost/type_traits/is_pointer.hpp>
#endif
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
#include <boost/type_traits/is_array.hpp>
#endif
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
#include <boost/type_traits/is_const.hpp>
#endif
namespace boost
{
std::size_t hash_value(bool);
std::size_t hash_value(char);
std::size_t hash_value(unsigned char);
std::size_t hash_value(signed char);
std::size_t hash_value(short);
std::size_t hash_value(unsigned short);
std::size_t hash_value(int);
std::size_t hash_value(unsigned int);
std::size_t hash_value(long);
std::size_t hash_value(unsigned long);
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
std::size_t hash_value(wchar_t);
#endif
#if defined(BOOST_HAS_LONG_LONG)
std::size_t hash_value(boost::long_long_type);
std::size_t hash_value(boost::ulong_long_type);
#endif
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
template <class T> std::size_t hash_value(T* const&);
#else
template <class T> std::size_t hash_value(T*);
#endif
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
template< class T, unsigned N >
std::size_t hash_value(const T (&array)[N]);
template< class T, unsigned N >
std::size_t hash_value(T (&array)[N]);
#endif
std::size_t hash_value(float v);
std::size_t hash_value(double v);
std::size_t hash_value(long double v);
template <class Ch, class A>
std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
template <class A, class B>
std::size_t hash_value(std::pair<A, B> const&);
template <class T, class A>
std::size_t hash_value(std::vector<T, A> const&);
template <class T, class A>
std::size_t hash_value(std::list<T, A> const& v);
template <class T, class A>
std::size_t hash_value(std::deque<T, A> const& v);
template <class K, class C, class A>
std::size_t hash_value(std::set<K, C, A> const& v);
template <class K, class C, class A>
std::size_t hash_value(std::multiset<K, C, A> const& v);
template <class K, class T, class C, class A>
std::size_t hash_value(std::map<K, T, C, A> const& v);
template <class K, class T, class C, class A>
std::size_t hash_value(std::multimap<K, T, C, A> const& v);
template <class T>
std::size_t hash_value(std::complex<T> const&);
// Implementation
namespace hash_detail
{
template <class T>
inline std::size_t hash_value_signed(T val)
{
const int size_t_bits = std::numeric_limits<std::size_t>::digits;
// ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1
const int length = (std::numeric_limits<T>::digits - 1)
/ size_t_bits;
std::size_t seed = 0;
T positive = val < 0 ? -1 - val : val;
// Hopefully, this loop can be unrolled.
for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
{
seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2);
}
seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
return seed;
}
template <class T>
inline std::size_t hash_value_unsigned(T val)
{
const int size_t_bits = std::numeric_limits<std::size_t>::digits;
// ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1
const int length = (std::numeric_limits<T>::digits - 1)
/ size_t_bits;
std::size_t seed = 0;
// Hopefully, this loop can be unrolled.
for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
{
seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2);
}
seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
return seed;
}
}
inline std::size_t hash_value(bool v)
{
return static_cast<std::size_t>(v);
}
inline std::size_t hash_value(char v)
{
return static_cast<std::size_t>(v);
}
inline std::size_t hash_value(unsigned char v)
{
return static_cast<std::size_t>(v);
}
inline std::size_t hash_value(signed char v)
{
return static_cast<std::size_t>(v);
}
inline std::size_t hash_value(short v)
{
return static_cast<std::size_t>(v);
}
inline std::size_t hash_value(unsigned short v)
{
return static_cast<std::size_t>(v);
}
inline std::size_t hash_value(int v)
{
return static_cast<std::size_t>(v);
}
inline std::size_t hash_value(unsigned int v)
{
return static_cast<std::size_t>(v);
}
inline std::size_t hash_value(long v)
{
return static_cast<std::size_t>(v);
}
inline std::size_t hash_value(unsigned long v)
{
return static_cast<std::size_t>(v);
}
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
inline std::size_t hash_value(wchar_t v)
{
return static_cast<std::size_t>(v);
}
#endif
#if defined(BOOST_HAS_LONG_LONG)
inline std::size_t hash_value(boost::long_long_type v)
{
return hash_detail::hash_value_signed(v);
}
inline std::size_t hash_value(boost::ulong_long_type v)
{
return hash_detail::hash_value_unsigned(v);
}
#endif
// Implementation by Alberto Barbati and Dave Harris.
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
template <class T> std::size_t hash_value(T* const& v)
#else
template <class T> std::size_t hash_value(T* v)
#endif
{
std::size_t x = static_cast<std::size_t>(
reinterpret_cast<std::ptrdiff_t>(v));
return x + (x >> 3);
}
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <class T>
inline void hash_combine(std::size_t& seed, T& v)
#else
template <class T>
inline void hash_combine(std::size_t& seed, T const& v)
#endif
{
boost::hash<T> hasher;
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
template <class It>
inline std::size_t hash_range(It first, It last)
{
std::size_t seed = 0;
for(; first != last; ++first)
{
hash_combine(seed, *first);
}
return seed;
}
template <class It>
inline void hash_range(std::size_t& seed, It first, It last)
{
for(; first != last; ++first)
{
hash_combine(seed, *first);
}
}
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
template <class T>
inline std::size_t hash_range(T* first, T* last)
{
std::size_t seed = 0;
for(; first != last; ++first)
{
boost::hash<T> hasher;
seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
return seed;
}
template <class T>
inline void hash_range(std::size_t& seed, T* first, T* last)
{
for(; first != last; ++first)
{
boost::hash<T> hasher;
seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
}
#endif
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
template< class T, unsigned N >
inline std::size_t hash_value(const T (&array)[N])
{
return hash_range(array, array + N);
}
template< class T, unsigned N >
inline std::size_t hash_value(T (&array)[N])
{
return hash_range(array, array + N);
}
#endif
template <class Ch, class A>
inline std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
{
return hash_range(v.begin(), v.end());
}
inline std::size_t hash_value(float v)
{
return boost::hash_detail::float_hash_value(v);
}
inline std::size_t hash_value(double v)
{
return boost::hash_detail::float_hash_value(v);
}
inline std::size_t hash_value(long double v)
{
return boost::hash_detail::float_hash_value(v);
}
template <class A, class B>
std::size_t hash_value(std::pair<A, B> const& v)
{
std::size_t seed = 0;
hash_combine(seed, v.first);
hash_combine(seed, v.second);
return seed;
}
template <class T, class A>
std::size_t hash_value(std::vector<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class T, class A>
std::size_t hash_value(std::list<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class T, class A>
std::size_t hash_value(std::deque<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class C, class A>
std::size_t hash_value(std::set<K, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class C, class A>
std::size_t hash_value(std::multiset<K, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class T, class C, class A>
std::size_t hash_value(std::map<K, T, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class T, class C, class A>
std::size_t hash_value(std::multimap<K, T, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class T>
std::size_t hash_value(std::complex<T> const& v)
{
boost::hash<T> hasher;
std::size_t seed = hasher(v.imag());
seed ^= hasher(v.real()) + (seed<<6) + (seed>>2);
return seed;
}
//
// boost::hash
//
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
#define BOOST_HASH_SPECIALIZE(type) \
template <> struct hash<type> \
: public std::unary_function<type, std::size_t> \
{ \
std::size_t operator()(type v) const \
{ \
return boost::hash_value(v); \
} \
};
#define BOOST_HASH_SPECIALIZE_REF(type) \
template <> struct hash<type> \
: public std::unary_function<type, std::size_t> \
{ \
std::size_t operator()(type const& v) const \
{ \
return boost::hash_value(v); \
} \
};
#else
#define BOOST_HASH_SPECIALIZE(type) \
template <> struct hash<type> \
: public std::unary_function<type, std::size_t> \
{ \
std::size_t operator()(type v) const \
{ \
return boost::hash_value(v); \
} \
}; \
\
template <> struct hash<const type> \
: public std::unary_function<const type, std::size_t> \
{ \
std::size_t operator()(const type v) const \
{ \
return boost::hash_value(v); \
} \
};
#define BOOST_HASH_SPECIALIZE_REF(type) \
template <> struct hash<type> \
: public std::unary_function<type, std::size_t> \
{ \
std::size_t operator()(type const& v) const \
{ \
return boost::hash_value(v); \
} \
}; \
\
template <> struct hash<const type> \
: public std::unary_function<const type, std::size_t> \
{ \
std::size_t operator()(type const& v) const \
{ \
return boost::hash_value(v); \
} \
};
#endif
BOOST_HASH_SPECIALIZE(bool)
BOOST_HASH_SPECIALIZE(char)
BOOST_HASH_SPECIALIZE(signed char)
BOOST_HASH_SPECIALIZE(unsigned char)
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
BOOST_HASH_SPECIALIZE(wchar_t)
#endif
BOOST_HASH_SPECIALIZE(short)
BOOST_HASH_SPECIALIZE(unsigned short)
BOOST_HASH_SPECIALIZE(int)
BOOST_HASH_SPECIALIZE(unsigned int)
BOOST_HASH_SPECIALIZE(long)
BOOST_HASH_SPECIALIZE(unsigned long)
BOOST_HASH_SPECIALIZE(float)
BOOST_HASH_SPECIALIZE(double)
BOOST_HASH_SPECIALIZE(long double)
BOOST_HASH_SPECIALIZE_REF(std::string)
#if !defined(BOOST_NO_STD_WSTRING)
BOOST_HASH_SPECIALIZE_REF(std::wstring)
#endif
#undef BOOST_HASH_SPECIALIZE
#undef BOOST_HASH_SPECIALIZE_REF
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template <class T>
struct hash<T*>
: public std::unary_function<T*, std::size_t>
{
std::size_t operator()(T* v) const
{
#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
return boost::hash_value(v);
#else
std::size_t x = static_cast<std::size_t>(
reinterpret_cast<std::ptrdiff_t>(v));
return x + (x >> 3);
#endif
}
};
#else
namespace hash_detail
{
template <bool IsPointer>
struct hash_impl;
template <>
struct hash_impl<true>
{
template <class T>
struct inner
: public std::unary_function<T, std::size_t>
{
std::size_t operator()(T val) const
{
#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590)
return boost::hash_value(val);
#else
std::size_t x = static_cast<std::size_t>(
reinterpret_cast<std::ptrdiff_t>(val));
return x + (x >> 3);
#endif
}
};
};
}
template <class T> struct hash
: public boost::hash_detail::hash_impl<boost::is_pointer<T>::value>
::BOOST_NESTED_TEMPLATE inner<T>
{
};
#endif
}
#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP
// Include this outside of the include guards in case the file is included
// twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it
// undefined.
#if !defined(BOOST_HASH_NO_EXTENSIONS) \
&& !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)
#include <boost/functional/hash/extensions.hpp>
#endif
| [
"pepsi1x1@a6a5f009-272a-4b40-a74d-5f9816a51f88"
] | [
[
[
1,
529
]
]
] |
20d1a99636cb52744fdecc23699512811d738b0a | a1eac09a5875f2fc592ad19d31c41f890ca3b794 | /upwatch/libdbi/mswindows/MonitorService/SystemInformation.h | a577e52d38f0cc723a552d53e1e986b2ecb078ad | [] | no_license | BackupTheBerlios/upwatch-svn | 2193d9bb0c4fd0ae50118fc1093b94b13f9a0cf4 | 34e516b88652f8794e8efdeab72867224c1370e6 | refs/heads/master | 2021-01-23T09:52:58.396599 | 2011-12-29T10:08:12 | 2011-12-29T10:08:12 | 40,775,864 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,074 | h | #pragma once
#pragma comment(lib, "Wbemuuid.lib")
#define _WIN32_DCOM
#include <Wbemidl.h>
#include <atlbase.h>
#include <vector>
#include <string>
class CSystemInformation
{
public:
//Load and get the WMI service pointer for retrieving WMI information
static HRESULT GetSystemInformation(CSystemInformation** ppSysInfo);
//Shutdown WMI connection
void Shutdown();
//Refresh WMI Instance for performance update
HRESULT RefreshInstances();
//Clear the current performance data
void ClearInstances();
//Get the current peroformance data
HRESULT GetResult(ULONG ulType, ULONG ulIndex, LPCWSTR wszName, std::vector<CComVariant> &strProperties);
HRESULT GetStatus() { return m_hrStatus; }
//Add a query into the database to retrieve the required WMI information
ULONG AddQuery(const BSTR strQuery);
//Add a performance monitor to the WMI to retrieve the required performance data
ULONG AddPerfMon(LPCWSTR wszClassName);
//Refresh only non-perfmon WMI queries
HRESULT RefreshClassesInstances();
//Refresh only WMI performance data
HRESULT RefreshPerfMonInstances();
HRESULT Query(LPCWSTR wszQuery, std::vector<std::vector<CComVariant> >& strPropertyCollections);
HRESULT GetResult(LPCWSTR wszName, std::vector<CComVariant> &strProperties);
private:
CSystemInformation();
~CSystemInformation();
private:
CComPtr<IWbemLocator> m_pWbemLocator;
CComPtr<IWbemServices> m_pWbemServices;
CComPtr<IWbemRefresher> m_pWbemRefresher;
CComPtr<IWbemConfigureRefresher> m_pWbemConfigureRefresher;
HRESULT m_hrStatus;
BOOL m_bInstanceCreated;
std::vector<CComPtr<IWbemHiPerfEnum> > m_ppWbemHiPerfEnum;
std::vector<std::vector<CComPtr<IWbemClassObject> > > m_ppClassObject;
std::vector<std::vector<CComPtr<IWbemObjectAccess> > > m_ppObjectAccess;
std::vector<CComPtr<IWbemClassObject> > m_ppAdhocClassObject;
std::vector<std::wstring> m_bstrQueries[2];
std::vector<long> m_lId;
private:
static CSystemInformation* _SystemInformation;
};
| [
"raarts@73f66349-c5de-0310-a4b6-8e58e6f7812f"
] | [
[
[
1,
63
]
]
] |
c50705f6b0d4a5be80af986a5e518dd93527b739 | dadae22098e24c412a8d8d4133c8f009a8a529c9 | /tp1/src/ode_euler.h | 32d9f41ab94954b52b8a2ec7bf22a3c13e3988e6 | [] | no_license | maoueh/PHS4700 | 9fe2bdf96576975b0d81e816c242a8f9d9975fbc | 2c2710fcc5dbe4cd496f7329379ac28af33dc44d | refs/heads/master | 2021-01-22T22:44:17.232771 | 2009-10-06T18:49:30 | 2009-10-06T18:49:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 922 | h | #ifndef ODE_EULER_H
#define ODE_EULER_H
#include "ode_solver.h"
/// Explicit Euler's Method
/// Y0 = Y0 + h * F(T0, Y0)
/// Yi+1 = Yi + h * F(Ti, Yi)
/// where
/// Y0 = initialValue (from constructor)
/// Yi = mLastValue
/// h = mStepSize
/// F(T, Y) = mFunction(mCurrentStep, mLastValue);
template <class Real>
class OdeEuler : public OdeSolver<Real>
{
public:
OdeEuler(Real* initialValue, INT dimension, typename OdeSolver<Real>::Function function,
Real stepSize, Real startStep = 0.0f);
virtual ~OdeEuler();
virtual Real* step();
protected:
using OdeSolver<Real>::mLastValue;
using OdeSolver<Real>::mDimension;
using OdeSolver<Real>::mStepSize;
using OdeSolver<Real>::mCurrentStep;
using OdeSolver<Real>::mFunction;
};
typedef OdeEuler<FLOAT> OdeEulerf;
typedef OdeEuler<DOUBLE> OdeEulerd;
#endif
| [
"[email protected]"
] | [
[
[
1,
36
]
]
] |
f70e401d2b48488bdb7d14ba9283392506313131 | de75637338706776f8770c9cd169761cec128579 | /Out-Of-Date/Source/CGUISlotWindow.cpp | 357e12e0363213e97833d7fb147151c58b92e4ee | [] | no_license | huytd/fosengine | e018957abb7b2ea2c4908167ec83cb459c3de716 | 1cebb1bec49720a8e9ecae1c3d0c92e8d16c27c5 | refs/heads/master | 2021-01-18T23:47:32.402023 | 2008-07-12T07:20:10 | 2008-07-12T07:20:10 | 38,933,821 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,242 | cpp | #include "CGUISlotWindow.h"
#include "CGUIBringUpSlotWindowButton.h"
#include "CGUIIconSlot.h"
namespace irr
{
namespace gui
{
//! constructor
CGUISlotWindow::CGUISlotWindow(IrrlichtDevice* device, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIWindow(device->getGUIEnvironment(), parent, id, rectangle), Dragging(false), Device(device)
{
#ifdef _DEBUG
setDebugName("CGUISlotWindow");
#endif
IGUISkin* skin = 0;
if (Environment)
skin = Environment->getSkin();
IGUISpriteBank* sprites = 0;
video::SColor color(255,255,255,255);
s32 buttonw = 15;
if (skin)
{
buttonw = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH);
sprites = skin->getSpriteBank();
color = skin->getColor(EGDC_WINDOW_SYMBOL);
}
s32 posx = RelativeRect.getWidth() - buttonw - 4;
CloseButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close" );
CloseButton->setSubElement(true);
CloseButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
if (sprites)
{
CloseButton->setSpriteBank(sprites);
CloseButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_CLOSE), color);
CloseButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_CLOSE), color);
}
posx -= buttonw + 2;
RestoreButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
L"", skin ? skin->getDefaultText(EGDT_WINDOW_RESTORE) : L"Restore" );
RestoreButton->setVisible(false);
RestoreButton->setSubElement(true);
RestoreButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
if (sprites)
{
RestoreButton->setSpriteBank(sprites);
RestoreButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_RESTORE), color);
RestoreButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_RESTORE), color);
}
posx -= buttonw + 2;
MinButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
L"", skin ? skin->getDefaultText(EGDT_WINDOW_MINIMIZE) : L"Minimize" );
MinButton->setVisible(false);
MinButton->setSubElement(true);
MinButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
if (sprites)
{
MinButton->setSpriteBank(sprites);
MinButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_MINIMIZE), color);
MinButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_MINIMIZE), color);
}
MinButton->grab();
RestoreButton->grab();
CloseButton->grab();
}
//! destructor
CGUISlotWindow::~CGUISlotWindow()
{
if (MinButton)
MinButton->drop();
if (RestoreButton)
RestoreButton->drop();
if (CloseButton)
CloseButton->drop();
}
//! called if an event happened.
bool CGUISlotWindow::OnEvent(const SEvent& event)
{
switch(event.EventType)
{
case EET_GUI_EVENT:
if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST)
{
if (event.GUIEvent.Caller == (IGUIElement*)this)
Dragging = false;
return true;
}
else
if (event.GUIEvent.EventType == EGET_BUTTON_CLICKED)
{
if (event.GUIEvent.Caller == CloseButton)
{
setVisible(false);
setEnabled(false);
return true;
}
}
break;
case EET_MOUSE_INPUT_EVENT:
switch(event.MouseInput.Event)
{
case EMIE_LMOUSE_PRESSED_DOWN:
DragStart.X = event.MouseInput.X;
DragStart.Y = event.MouseInput.Y;
if (!Environment->hasFocus(this))
{
Dragging = true;
Environment->setFocus(this);
if (Parent)
Parent->bringToFront(this);
}
return true;
case EMIE_LMOUSE_LEFT_UP:
Dragging = false;
Environment->removeFocus(this);
return true;
case EMIE_MOUSE_MOVED:
if (Dragging)
{
// gui window should not be dragged outside its parent
if (Parent)
if (event.MouseInput.X < Parent->getAbsolutePosition().UpperLeftCorner.X +1 ||
event.MouseInput.Y < Parent->getAbsolutePosition().UpperLeftCorner.Y +1 ||
event.MouseInput.X > Parent->getAbsolutePosition().LowerRightCorner.X -1 ||
event.MouseInput.Y > Parent->getAbsolutePosition().LowerRightCorner.Y -1)
return true;
move(core::position2d<s32>(event.MouseInput.X - DragStart.X, event.MouseInput.Y - DragStart.Y));
DragStart.X = event.MouseInput.X;
DragStart.Y = event.MouseInput.Y;
return true;
}
break;
//just to keep the compiler from posting warnings
default:{}
}
//just to keep the compiler from posting warnings
default:{}
}
return Parent ? Parent->OnEvent(event) : false;
}
//! Updates the absolute position.
void CGUISlotWindow::updateAbsolutePosition()
{
IGUIElement::updateAbsolutePosition();
}
//! draws the element and its children
void CGUISlotWindow::draw()
{
if (!IsVisible)
return;
IGUISkin* skin = Environment->getSkin();
core::rect<s32> rect = AbsoluteRect;
core::rect<s32> *cl = &AbsoluteClippingRect;
// draw body fast
rect = skin->draw3DWindowBackground(this, true, skin->getColor(EGDC_ACTIVE_BORDER),
AbsoluteRect, &AbsoluteClippingRect);
if (Text.size())
{
rect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X);
rect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y);
rect.LowerRightCorner.X -= skin->getSize(EGDS_WINDOW_BUTTON_WIDTH) + 5;
IGUIFont* font = skin->getFont(EGDF_WINDOW);
if (font)
font->draw(Text.c_str(), rect, skin->getColor(EGDC_ACTIVE_CAPTION), false, true, cl);
}
IGUIElement::draw();
}
//! Returns pointer to the close button
IGUIButton* CGUISlotWindow::getCloseButton() const
{
return CloseButton;
}
//! Returns pointer to the minimize button
IGUIButton* CGUISlotWindow::getMinimizeButton() const
{
return MinButton;
}
//! Returns pointer to the maximize button
IGUIButton* CGUISlotWindow::getMaximizeButton() const
{
return RestoreButton;
}
//! adds a bring-up button
CGUIBringUpSlotWindowButton* CGUISlotWindow::createBringUpButton(core::rect<s32> rectangle, IGUIElement* parent,
s32 id, const wchar_t* text,
const wchar_t* tooltip)
{
if(!parent)
parent = Environment->getRootGUIElement();
CGUIBringUpSlotWindowButton* button = new CGUIBringUpSlotWindowButton(Device, parent, id, rectangle, this);
if(text)
button->setText(text);
if(tooltip)
button->setToolTipText(tooltip);
return button;
}
//! adds a slot array to the window
core::array<IGUIElement*> CGUISlotWindow::addSlotArray(core::rect<s32> slotRect, video::ITexture* texture,
IGUIElement* parent, s32 id ,
core::position2d<s32> relPos,
core::dimension2d<s32> arrayDim,
core::dimension2d<s32> spacing)
{
if(!parent)
parent = this;
//create the array
core::array<IGUIElement*> slotArray;
for(s32 x = 0; x < arrayDim.Width; x++)
{
for(s32 y = 0; y < arrayDim.Height; y++)
{
CGUIIconSlot* slot = new CGUIIconSlot(Environment, parent, id, slotRect);
slot->setImage(texture);
slot->setRelativePosition(core::rect<s32>(relPos.X + x*(spacing.Width + slotRect.LowerRightCorner.X),
relPos.Y + y*(spacing.Height + slotRect.LowerRightCorner.Y),
slotRect.LowerRightCorner.X + (relPos.X + x*(spacing.Width + slotRect.LowerRightCorner.X)),
slotRect.LowerRightCorner.Y +(relPos.Y + y*(spacing.Height + slotRect.LowerRightCorner.Y))));
slotArray.push_back(slot);
slot->drop();
}
}
return slotArray;
}
}//end namespace gui
}//end namespace irr
| [
"kingbazoka@52f955dd-904d-0410-b1ed-9fe3d3cbfe06"
] | [
[
[
1,
275
]
]
] |
a7888c6949140fe3941660fb39116a5dc7bb4b4c | 535a6f04c1fc92f3e7ad722ae5e82ca76605880e | /src/openreroc_gyrosensor.cpp | 5a56b19bbb36a1ac9452fb4e5ef3fa72ff494756 | [
"BSD-3-Clause"
] | permissive | Kumikomi/openreroc_gyrosensor | 59c9ff374191a22d89842b033e8cae7f7f41e741 | 76efaf060c051dbde4d5c76dbb9f7897f094f0ee | refs/heads/master | 2021-01-10T16:48:31.774051 | 1970-01-01T07:17:26 | 1970-01-01T07:17:26 | 49,869,849 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,138 | cpp | #include "ros/ros.h"
#include "gyro_sensor.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
typedef struct GyroSensor_Data
{
int gx;
int gy;
int gz;
} gyrosensor_data;
int main(int argc, char **argv)
{
int fd_32;
int rc;
int gyro_x;
int gyro_y;
int gyro_z;
int gyro_x_signed;
int gyro_y_signed;
int gyro_z_signed;
float real_gx;
float real_gy;
float real_gz;
fd_32 = open("/dev/xillybus_read_32", O_RDONLY);
ros::init(argc, argv, "openreroc_gyrosensor");
ros::NodeHandle n;
ros::Publisher pub_openreroc_gyrosensor = n.advertise<openreroc_gyrosensor::gyro_sensor>("gyro_sensor_value", 1000);
// ros::Rate loop_rate(1);
openreroc_gyrosensor::gyro_sensor msg;
gyrosensor_data cur;
while (ros::ok())
{
rc = read(fd_32, &gyro_x, sizeof(gyro_x));
rc = read(fd_32, &gyro_y, sizeof(gyro_y));
rc = read(fd_32, &gyro_z, sizeof(gyro_z));
if(cur.gx != gyro_x && cur.gy != gyro_y && cur.gz != gyro_z){
//msg.gx = gyro_x;
//msg.gy = gyro_y;
//msg.gz = gyro_z;
gyro_x_signed = (gyro_x > 32768)? (gyro_x-65535) : gyro_x;
gyro_y_signed = (gyro_y > 32768)? (gyro_y-65535) : gyro_y;
gyro_z_signed = (gyro_z > 32768)? (gyro_z-65535) : gyro_z;
/* if(gyro_y > 32768)
{
gyro_y_signed = (gyro_y-65535);//~gyro_x + 1;
}
if(gyro_y > 32768)
{
gyro_z_signed = (gyro_z-65535);//~gyro_x + 1;
}
*/
msg.real_gx = gyro_x_signed / 131.0;
msg.real_gy = gyro_y_signed / 131.0;
msg.real_gz = gyro_z_signed / 131.0;
//printf("x:%d\n",msg.gx);
//printf("y:%d\n",msg.gy);
//printf("z:%d\n",msg.gz);
printf("rawx:%d\n",gyro_x);
printf("rawy:%d\n",gyro_y);
printf("rawz:%d\n",gyro_z);
pub_openreroc_gyrosensor.publish(msg);
}
cur.gx = gyro_x;
cur.gy = gyro_y;
cur.gz = gyro_z;
ros::spinOnce();
// loop_rate.sleep();
}
close(fd_32);
return 0;
}
| [
"[email protected]",
"[email protected]"
] | [
[
[
1,
24
],
[
31,
49
],
[
56,
56
],
[
78,
91
]
],
[
[
25,
30
],
[
50,
55
],
[
57,
77
],
[
92,
92
]
]
] |
0015327fece42fc4e1c78ef0e3d05952370be96a | 105cc69f4207a288be06fd7af7633787c3f3efb5 | /demos/NetworkingZoidCom/NetworkingZoidCom/SampleServer.h | 916a67820a292d4b065893a4b34e50064b591a49 | [] | no_license | allenjacksonmaxplayio/uhasseltaacgua | 330a6f2751e1d6675d1cf484ea2db0a923c9cdd0 | ad54e9aa3ad841b8fc30682bd281c790a997478d | refs/heads/master | 2020-12-24T21:21:28.075897 | 2010-06-09T18:05:23 | 2010-06-09T18:05:23 | 56,725,792 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,646 | h | #pragma once
#include "NetworkEntity.h"
#include "NetworkServer.h"
#include <vector>
using HovUni::NetworkEntity;
using std::vector;
class SampleServer: public HovUni::NetworkServer
{
public:
/**
* Constructor
*/
SampleServer();
/**
* Destructor
*/
~SampleServer();
/**
* Process incoming and outgoing packets
*/
virtual void process();
/**
* Register classes with this server
*/
virtual void registerClasses();
/**
* Add entity to the container
*
* @param entity the entity
*/
void addEntity(NetworkEntity* entity);
private:
vector<NetworkEntity*> mEntities;
//
// ZCom_Control callbacks
//
public:
/**
* Connection has been closed and is about to be deleted (Server, Client).
*
* @param id The connection's ID
* @param reason Reason code. If reason is eZCom_ClosedDisconnect, then reasondata might contain more info.
* @param reasondata The reason of the disconnector.
*/
void ZCom_cbConnectionClosed(ZCom_ConnID id, eZCom_CloseReason reason, ZCom_BitStream& reasondata);
/**
* Direct data has been received (Server, Client).
*
* @param id The connection's ID
* @param data The data received
*/
void ZCom_cbDataReceived(ZCom_ConnID id, ZCom_BitStream& data);
/**
* Incoming connection (Server).
*
* @param id The connection's ID
* @param request The request given by the requester
* @param reply Data you want to transmit to the requester additionally to the yes/no reply
* @param true to accept the connection, false otherwise.
*/
bool ZCom_cbConnectionRequest(ZCom_ConnID id, ZCom_BitStream& request, ZCom_BitStream& reply);
/**
* A granted, incoming connection has been fully set up (Server).
*
* @param id The connection's ID
*/
void ZCom_cbConnectionSpawned(ZCom_ConnID id);
/**
* A client requests to enter a specified ZoidLevel (Server).
*
* @param id The connection's ID
* @param requested_level Level the client wants to enter
* @param reason When returning false, this is returned as the reason why.
* @return True to accept the request, false otherwise.
*/
bool ZCom_cbZoidRequest(ZCom_ConnID id, zU8 requested_level, ZCom_BitStream& reason);
/**
* ZoidLevel migration process finished (Server, Client).
*
* @param id The connection's ID
* @param result Result of the migration process
* @param new_level New ZoidLevel of the connection
* @param reason Additional data passed by the server
*/
void ZCom_cbZoidResult(ZCom_ConnID id, eZCom_ZoidResult result, zU8 new_level, ZCom_BitStream& reason);
};
| [
"berghmans.olivier@2d55a33c-0a8f-11df-aac0-2d4c26e34a4c"
] | [
[
[
1,
100
]
]
] |
6f45e2aa5aec1091dbc720a79010a1c18b414799 | 51e1cf5dc3b99e8eecffcf5790ada07b2f03f39c | /FileAssistant++/Source/CWindowItem.cpp | fefe680d3eb09ffbbc8d3fb8310dbf4e9e00ad46 | [] | no_license | jdek/jim-pspware | c3e043b59a69cf5c28daf62dc9d8dca5daf87589 | fd779e1148caac2da4c590844db7235357b47f7e | refs/heads/master | 2021-05-31T06:45:03.953631 | 2007-06-25T22:45:26 | 2007-06-25T22:45:26 | 56,973,047 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,278 | cpp | /***********************************************************************************
Module : CWindowItem.cpp
Description :
Last Modified $Date: $
$Revision: $
Copyright (C) 03 August 2005 T Swann
***********************************************************************************/
//**********************************************************************************
// Include Files
//**********************************************************************************
#include "CWindowItem.h"
#include "CWindow.h"
#include "CGfx.h"
#include "CFrameWork.h"
#include "CSkinManager.h"
//**********************************************************************************
// Local Macros
//**********************************************************************************
//**********************************************************************************
// Local Constants
//**********************************************************************************
//**********************************************************************************
// Static Prototypes
//**********************************************************************************
//**********************************************************************************
// Global Variables
//**********************************************************************************
//**********************************************************************************
// Static Variables
//**********************************************************************************
//**********************************************************************************
// Class Definition
//**********************************************************************************
//*************************************************************************************
//
//*************************************************************************************
CWindowItem::CWindowItem()
: m_pParent( NULL )
, m_bInFocus( false )
{
}
//*************************************************************************************
//
//*************************************************************************************
CWindowItem::~CWindowItem()
{
m_pParent->RemoveItem( this );
}
//*************************************************************************************
//
//*************************************************************************************
void CWindowItem::Render()
{
CGfx::DrawQuad( GetScreenPos(), GetSize(), 0xff808080 );
}
//*************************************************************************************
//
//*************************************************************************************
void CWindowItem::Process()
{
}
//*************************************************************************************
//
//*************************************************************************************
void CWindowItem::ProcessInput()
{
}
//**********************************************************************************
//
//**********************************************************************************
CWindow * CWindowItem::GetParent() const
{
return m_pParent;
}
//*************************************************************************************
//
//*************************************************************************************
void CWindowItem::SetParent( CWindow * const p_parent )
{
m_pParent = p_parent;
}
//*************************************************************************************
//
//*************************************************************************************
bool CWindowItem::HasFocus() const
{
return m_bInFocus;
}
//*************************************************************************************
//
//*************************************************************************************
void CWindowItem::SetFocus( bool focus )
{
m_bInFocus = focus;
}
//*************************************************************************************
//
//*************************************************************************************
V2 CWindowItem::GetScreenPos() const
{
V2 pos( GetPos() * GetScale() );
if ( m_pParent != NULL )
{
pos += m_pParent->GetScreenPos();
}
return pos;
}
//**********************************************************************************
//
//**********************************************************************************
float CWindowItem::GetScale() const
{
float scale( m_fScale );
if ( m_pParent != NULL )
{
scale *= m_pParent->GetScale();
}
return scale;
}
//**********************************************************************************
//
//**********************************************************************************
ARGB CWindowItem::GetColor() const
{
if ( HasFocus() == true )
{
return CSkinManager::GetColor( "window_item", "text_color_on", 0xffffffff );
}
else
{
return CSkinManager::GetColor( "window_item", "text_color_off", 0x80ffffff );
}
}
//******************************* END OF FILE ************************************
| [
"71m@ff2c0c17-07fa-0310-a4bd-d48831021cb5"
] | [
[
[
1,
164
]
]
] |
810acd155170e49b17bc11b2d4ea345f03d01ed5 | d115cf7a1b374d857f6b094d4b4ccd8e9b1ac189 | /tags/pyplusplus_dev_0.9.5/unittests/data/member_variables_to_be_exported.hpp | b16fa648527bdfb2abf71c4f7e9dad1402202b5c | [
"BSL-1.0"
] | permissive | gatoatigrado/pyplusplusclone | 30af9065fb6ac3dcce527c79ed5151aade6a742f | a64dc9aeeb718b2f30bd6a5ff8dcd8bfb1cd2ede | refs/heads/master | 2016-09-05T23:32:08.595261 | 2010-05-16T10:53:45 | 2010-05-16T10:53:45 | 700,369 | 4 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,815 | hpp | // Copyright 2004-2008 Roman Yakovenko.
// 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)
#ifndef __member_variables_to_be_exported_hpp__
#define __member_variables_to_be_exported_hpp__
#include <memory>
#include <string>
#include <iostream>
namespace member_variables{
struct point{
enum color{ red, green, blue };
point()
: prefered_color( blue )
, x( -1 )
, y( 2 )
{++instance_count;}
point( const point& other )
: prefered_color( other.prefered_color )
, x( other.x )
, y( other.y )
{}
~point()
{ --instance_count; }
int x;
int y;
const color prefered_color;
static int instance_count;
static const color default_color;
};
struct bit_fields_t{
bit_fields_t()
: b(28){}
unsigned int a : 1;
unsigned int : 0;
const unsigned int b : 11;
};
unsigned int get_a(const bit_fields_t& inst);
void set_a( bit_fields_t& inst, unsigned int new_value );
unsigned int get_b(const bit_fields_t& inst);
struct array_t{
array_t(){
for( int i = 0; i < 10; ++i ){
ivars[i] = -i;
}
}
struct variable_t{
variable_t() : value(-9){}
int value;
};
int get_ivars_item( int index ){
return ivars[index];
}
const variable_t vars[3];
int ivars[10];
int ivars2[10];
};
namespace pointers{
struct data_t{
data_t() : value( 201 ) {}
int value;
static char* reserved;
};
struct tree_node_t{
data_t *data;
tree_node_t *left;
tree_node_t *right;
const tree_node_t *parent;
tree_node_t(const tree_node_t* parent=0)
: data(0)
, left( 0 )
, right( 0 )
, parent( parent )
{}
~tree_node_t(){
std::cout << "\n~tree_node_t";
}
};
std::auto_ptr<tree_node_t> create_tree();
}
namespace reference{
enum EFruit{ apple, orange };
struct fundamental_t{
fundamental_t( EFruit& fruit, const int& i )
: m_fruit( fruit ), m_i( i )
{}
EFruit& m_fruit;
const int& m_i;
};
struct A{};
struct B {
B( A& a_ ): a( a_ ){}
A& a;
};
struct C {
C( A& a_ ): a( a_ ){}
const A& a;
};
}
namespace statics{
struct mem_var_str_t{
static std::string class_name;
std::string identity(std::string x){ return x; }
};
}
namespace bugs{
struct allocator_ {
void * (*alloc) (unsigned);
void (*dispose) (void *p);
};
typedef struct allocator_ *allocator_t;
struct faulty {
allocator_t allocator;
};
}
}
#endif//__member_variables_to_be_exported_hpp__
| [
"roman_yakovenko@dc5859f9-2512-0410-ae5c-dd123cda1f76"
] | [
[
[
1,
155
]
]
] |
c240ec643e6aeae8982fcbed2b16b950ed8c102f | 27c6eed99799f8398fe4c30df2088f30ae317aff | /TableViewBuddy/tag/tvb-1.1.0/tableviewbuddy.cpp | e11dfbea0bde99dbfddbf470b020b3f4d6a09b03 | [] | no_license | lit-uriy/ysoft | ae67cd174861e610f7e1519236e94ffb4d350249 | 6c3f077ff00c8332b162b4e82229879475fc8f97 | refs/heads/master | 2021-01-10T08:16:45.115964 | 2009-07-16T00:27:01 | 2009-07-16T00:27:01 | 51,699,806 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,902 | cpp | /** \file tableviewbuddy.cpp
* \brief Класс-партнёр для табличного представления (Qt4).
* \author Литкевич Юрий ([email protected]).
* Этот класс задуман для расширения возможностей табличного представления
* наиболее распространёнными функциями. Такими как копирование, форматирование таблицы и др.
**********************************************
* EN:
* Class-buddy for table view (Qt4).
* Author: Yuriy Litkevich ([email protected]).
* This class is conceived for the extension of possibilities of a table view
* by the most used functions. Such as copying, formatting of the table view, etc.
*/
#include <QTableView>
#include <QtDebug>
#include <QAction>
#include <QApplication>
#include <QClipboard>
#include "tableviewbuddy.h"
inline void initMyResource(){ Q_INIT_RESOURCE(tableviewbuddy); }
TableViewBuddy::TableViewBuddy(QTableView *tv): QObject(tv)
{
view = tv;
// RU: !!!!!!!!! Меняет политику контекстного меню представления !!!!!!!!!!!
// EN: !!!!!!!!! Changes context menu policy policy of the table view !!!!!!!!!!!
view->setContextMenuPolicy(Qt::ActionsContextMenu);
initMyResource();
actionCopy = new QAction(this);
actionCopy->setIcon (QIcon(":/images/edit_copy.png"));
actionCopy->setText(tr("&Copy"));
actionCopy->setShortcut(tr("Ctrl+C"));
actionCopy->setStatusTip(tr("Copy selected cells"));
connect(actionCopy, SIGNAL(triggered()),
this, SLOT(slotCopy()));
view->addAction(actionCopy);
}
void TableViewBuddy::slotCopy()
{
QApplication::clipboard()->setText(copy());
}
QString TableViewBuddy::copy()
{
QModelIndex index;
unsigned int minrow, mincolumn;
unsigned int maxrow, maxcolumn;
unsigned int i, j;
QString str;
// Ищем минимумы и максимумы
const QItemSelection ranges = view->selectionModel()->selection();
// используем только первую выделенную область
minrow = ranges.at(0).top();
mincolumn = ranges.at(0).left();
maxrow = ranges.at(0).bottom();
maxcolumn = ranges.at(0).right();
qDebug() << "Copy, FROM" << QString("(%1,%2)").arg(minrow).arg(mincolumn)
<< "TO" << QString("(%1,%2)").arg(maxrow).arg(maxcolumn);
// Само копирование
for (i=minrow; i <= maxrow; ++i)
{
if (i>minrow)
str += "\n";
for (j=mincolumn; j <= maxcolumn; ++j)
{
if (j>mincolumn)
str += "\t";
index = view->model()->index(i, j, QModelIndex());
QString t = view->model()->data(index).toString();
str += t;
}
}
qDebug() << "Copy:\n" << str;
return str;
//QApplication::clipboard()->setText(str);
}
| [
"lit-uriy@d7ba3245-3e7b-42d0-9cd4-356c8b94b330"
] | [
[
[
1,
88
]
]
] |
96795f199df0f3c8e541f80e175f7c785fb92fe0 | ab2777854d7040cc4029edcd1eccc6d48ca55b29 | /Algorithm/KiriKiri/KirikiriOptionDlg.cpp | 698d85f5069434530964929fd1a5867af3d95301 | [] | no_license | adrix89/araltrans03 | f9c79f8e5e62a23bbbd41f1cdbcaf43b3124719b | 6aa944d1829006a59d0f7e4cf2fef83e3f256481 | refs/heads/master | 2021-01-10T19:56:34.730964 | 2009-12-21T16:21:45 | 2009-12-21T16:21:45 | 38,417,581 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 2,831 | cpp | // KirikiriOptionDlg.cpp : 구현 파일입니다.
//
#include "stdafx.h"
#include "Kirikiri.h"
#include "KirikiriOptionDlg.h"
extern CKirikiriApp theApp;
// CKirikiriOptionDlg 대화 상자입니다.
IMPLEMENT_DYNAMIC(CKirikiriOptionDlg, CDialog)
CKirikiriOptionDlg::CKirikiriOptionDlg(CWnd* pParent /*=NULL*/)
: CDialog(CKirikiriOptionDlg::IDD, pParent)
, m_nCacheMode(0)
, m_bAlsoSrc(FALSE)
, m_bUseCP2(FALSE)
, m_nCP2Type(0)
{
}
CKirikiriOptionDlg::~CKirikiriOptionDlg()
{
}
void CKirikiriOptionDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Radio(pDX, IDC_RADIO1, m_nCacheMode);
DDX_Check(pDX, IDC_CHECK_ALSO_SRC, m_bAlsoSrc);
DDX_Check(pDX, IDC_CHECK_USE_CODEPOINT2, m_bUseCP2);
DDX_Control(pDX, IDC_COMBO_CODEPOINTTYPE, m_comboCP2Type);
}
BEGIN_MESSAGE_MAP(CKirikiriOptionDlg, CDialog)
ON_BN_CLICKED(IDC_BTN_CLEAR_CACHE, &CKirikiriOptionDlg::OnBnClickedBtnClearCache)
ON_BN_CLICKED(IDC_CHECK_USE_CODEPOINT2, &CKirikiriOptionDlg::OnBnClickedCheckUseCodepoint2)
ON_CBN_SELCHANGE(IDC_COMBO_CODEPOINTTYPE, &CKirikiriOptionDlg::OnCbnSelchangeComboCodepointtype)
ON_BN_CLICKED(IDOK, &CKirikiriOptionDlg::OnBnClickedOk)
END_MESSAGE_MAP()
// CKirikiriOptionDlg 메시지 처리기입니다.
void CKirikiriOptionDlg::OnBnClickedBtnClearCache()
{
int nMsgRes = this->MessageBox(_T("지금까지 누적된 스크립트들(ZIP 파일, 텍스트 파일)을 \r\n모두 지우고 초기화 하시겠습니까?"), _T("Warning!"), MB_YESNO | MB_ICONWARNING);
if(IDYES == nMsgRes)
{
if(theApp.ClearCache()) this->MessageBox(_T("캐시 저장소가 초기화되었습니다."), _T("Aral Trans"));
else this->MessageBox(_T("캐시 초기화에 실패했습니다."), _T("Aral Trans"));
}
}
void CKirikiriOptionDlg::OnBnClickedCheckUseCodepoint2()
{
UpdateData();
if (m_bUseCP2)
{
m_comboCP2Type.EnableWindow(TRUE);
}
else
{
m_nCP2Type=0;
m_comboCP2Type.SetCurSel(0);
m_comboCP2Type.EnableWindow(FALSE);
}
}
BOOL CKirikiriOptionDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_comboCP2Type.InsertString(0, _T("번역안함"));
m_comboCP2Type.InsertString(1, _T("일반"));
m_comboCP2Type.InsertString(2, _T("SilverHawk"));
m_comboCP2Type.SetCurSel(m_nCP2Type);
if (m_bUseCP2)
m_comboCP2Type.EnableWindow(TRUE);
else
m_comboCP2Type.EnableWindow(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// 예외: OCX 속성 페이지는 FALSE를 반환해야 합니다.
}
void CKirikiriOptionDlg::OnCbnSelchangeComboCodepointtype()
{
UpdateData();
m_nCP2Type = m_comboCP2Type.GetCurSel();
}
void CKirikiriOptionDlg::OnBnClickedOk()
{
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
OnOK();
}
| [
"arallab3@883913d8-bf2b-11de-8cd0-f941f5a20a08"
] | [
[
[
1,
104
]
]
] |
6897561684970e50641ae3a91b1079f43234e114 | 33f59b1ba6b12c2dd3080b24830331c37bba9fe2 | /Depend/Foundation/Distance/Wm4DistTriangle3Rectangle3.h | 00665661de7210fbbe3ed59713417105ae0159e1 | [] | 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 | 1,737 | h | // 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.
#ifndef WM4DISTTRIANGLE3RECTANGLE3_H
#define WM4DISTTRIANGLE3RECTANGLE3_H
#include "Wm4FoundationLIB.h"
#include "Wm4Distance.h"
#include "Wm4Triangle3.h"
#include "Wm4Rectangle3.h"
namespace Wm4
{
template <class Real>
class WM4_FOUNDATION_ITEM DistTriangle3Rectangle3
: public Distance<Real,Vector3<Real> >
{
public:
DistTriangle3Rectangle3 (const Triangle3<Real>& rkTriangle,
const Rectangle3<Real>& rkRectangle);
// object access
const Triangle3<Real>& GetTriangle () const;
const Rectangle3<Real>& GetRectangle () const;
// static distance queries
virtual Real Get ();
virtual Real GetSquared ();
// function calculations for dynamic distance queries
virtual Real Get (Real fT, const Vector3<Real>& rkVelocity0,
const Vector3<Real>& rkVelocity1);
virtual Real GetSquared (Real fT, const Vector3<Real>& rkVelocity0,
const Vector3<Real>& rkVelocity1);
private:
using Distance<Real,Vector3<Real> >::m_kClosestPoint0;
using Distance<Real,Vector3<Real> >::m_kClosestPoint1;
const Triangle3<Real>& m_rkTriangle;
const Rectangle3<Real>& m_rkRectangle;
};
typedef DistTriangle3Rectangle3<float> DistTriangle3Rectangle3f;
typedef DistTriangle3Rectangle3<double> DistTriangle3Rectangle3d;
}
#endif
| [
"yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa"
] | [
[
[
1,
57
]
]
] |
3f8023dd1180e173278f92c7c90cc0454311b15d | 89d2197ed4531892f005d7ee3804774202b1cb8d | /GWEN/src/Controls/DockedTabControl.cpp | 81b1776dfd49c9c12f9fd0d1c437c96b8d0f407f | [
"MIT",
"Zlib"
] | permissive | hpidcock/gbsfml | ef8172b6c62b1c17d71d59aec9a7ff2da0131d23 | e3aa990dff8c6b95aef92bab3e94affb978409f2 | refs/heads/master | 2020-05-30T15:01:19.182234 | 2010-09-29T06:53:53 | 2010-09-29T06:53:53 | 35,650,825 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,021 | cpp | /*
GWEN
Copyright (c) 2010 Facepunch Studios
See license in Gwen.h
*/
#include "stdafx.h"
#include "Gwen/Gwen.h"
#include "Gwen/Skin.h"
#include "Gwen/Controls/DockedTabControl.h"
#include "Gwen/Controls/Highlight.h"
#include "Gwen/DragAndDrop.h"
#include "Gwen/Controls/WindowControl.h"
using namespace Gwen;
using namespace Gwen::Controls;
GWEN_CONTROL_CONSTRUCTOR( DockedTabControl )
{
m_WindowControl = NULL;
Dock( Pos::Fill );
m_pTitleBar = new TabTitleBar( this );
m_pTitleBar->Dock( Pos::Top );
m_pTitleBar->SetHidden( true );
}
void DockedTabControl::Layout( Skin::Base* skin )
{
GetTabStrip()->SetHidden( TabCount() <= 1 );
UpdateTitleBar();
BaseClass::Layout( skin );
}
void DockedTabControl::UpdateTitleBar()
{
if ( !GetCurrentButton() ) return;
m_pTitleBar->UpdateFromTab( GetCurrentButton() );
}
void DockedTabControl::DragAndDrop_StartDragging( Gwen::DragAndDrop::Package* pPackage, int x, int y )
{
BaseClass::DragAndDrop_StartDragging( pPackage, x, y );
SetHidden( true );
// This hiding our parent thing is kind of lousy.
GetParent()->SetHidden( true );
}
void DockedTabControl::DragAndDrop_EndDragging( bool bSuccess, int x, int y )
{
SetHidden( false );
if ( !bSuccess )
{
GetParent()->SetHidden( false );
}
/*
if ( !bSuccess )
{
// Create our window control
if ( !m_WindowControl )
{
m_WindowControl = new WindowControl( GetCanvas() );
m_WindowControl->SetBounds( x, y, Width(), Height() );
}
m_WindowControl->SetPosition( x, y );
SetParent( m_WindowControl );
SetPosition( 0, 0 );
Dock( Pos::Fill );
}
*/
}
void DockedTabControl::MoveTabsTo( DockedTabControl* pTarget )
{
Base::List Children = GetTabStrip()->Children;
for (Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter)
{
TabButton* pButton = dynamic_cast<TabButton*>(*iter);
if ( !pButton ) continue;
pTarget->AddPage( pButton );
}
Invalidate();
} | [
"haza55@5bf3a77f-ad06-ad18-b9fb-7d0f6dabd793"
] | [
[
[
1,
92
]
]
] |
1967196cc19e5f01ddae873e52be76bc05c9de2a | e9944cc3f8c362cd0314a2d7a01291ed21de19ee | / xcommon/自由拼音输入法IME/source/HZmodeu.cpp | 0ea7fde33b5aba9e718b09a07ce0a311f524dec4 | [] | no_license | wermanhme1990/xcommon | 49d7185a28316d46992ad9311ae9cdfe220cb586 | c9b1567da1f11e7a606c6ed638a9fde1f6ece577 | refs/heads/master | 2016-09-06T12:43:43.593776 | 2008-12-05T04:24:11 | 2008-12-05T04:24:11 | 39,864,906 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,776 | cpp | /*
* Copyright (C) 1999.4 Li ZhenChun
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License; or
* (at your option) any later version.
*
* This program is distributed in the hope that is will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, M A 02139, USA.
*
* Author: Li ZhenChun email: [email protected] or [email protected]
*
*/
#include "stdafx.h"
#include "freepy.h"
BOOL CharHandleU( HIMC hIMC,WORD wParam,LONG lParam)
{
LPINPUTCONTEXT lpIMC;
LPCANDIDATEINFO lpCandInfo;
LPCANDIDATELIST lpCandList;
LPCOMPOSITIONSTRING lpCompStr;
WORD wHead;
lpIMC = ImmLockIMC(hIMC);
lpCandInfo = (LPCANDIDATEINFO)ImmLockIMCC(lpIMC->hCandInfo);
lpCandList = (LPCANDIDATELIST)((LPSTR)lpCandInfo + lpCandInfo->dwOffset[0]);
lpCompStr = (LPCOMPOSITIONSTRING)ImmLockIMCC(lpIMC->hCompStr);
if( !lpCandList->dwCount )
{
int i;
wHead = wParam - _T('!');
for( i = 0; _tcslen(aPunct[wHead][i]); i ++)
{
_tcscpy(GETLPCANDSTR(lpCandList, i + 2), aPunct[wHead][i]);
}
if( i == 0)
{
MessageBeep(0xFFFFFFFF );
}
else if( i == 1 )
{
LPTSTR lpConvStr;
lpConvStr = ((LPMYCOMPSTR)lpCompStr)->FreePYComp.szConvCompStr;
_tcscpy(lpConvStr,aPunct[wHead][0]);
MakeResultString(hIMC,TRUE);
}
else
{
LPTSTR lpStr;
WORD wStrLen;
lpStr = GETLPCOMPSTR(lpCompStr);
wStrLen = _tcslen(lpStr);
*(lpStr + wStrLen) = (TCHAR)wParam;
*(lpStr + wStrLen +1) = _T('\0');
lpStr = ((LPMYCOMPSTR)lpCompStr)->FreePYComp.szPaintCompStr;
wStrLen = _tcslen(lpStr);
*(lpStr + wStrLen) = (TCHAR)wParam;
*(lpStr + wStrLen +1) = _T('\0');
lpCandList->dwSelection = 0;
lpCandList->dwCount = i;
lpCandList->dwPageStart = 2;
lpCandList->dwPageSize = 0;
SelectForwardFromCand(hIMC,lpCandList);
}
}
else
{
if( wParam == _T('=') || wParam == _T('.') || wParam == _T('>'))
{
SelectForwardFromCand(hIMC,lpCandList);
}
else if( wParam == _T('-') || wParam == _T(',') || wParam == _T('<'))
{
SelectBackwardFromCand(hIMC,lpCandList);
}
else if( wParam >= _T('0') && wParam <= _T('9') )
{
SelectCandFromCandlist(hIMC, wParam);
}
}
ImmUnlockIMCC(lpIMC->hCompStr);
ImmUnlockIMCC(lpIMC->hCandInfo);
ImmUnlockIMC(hIMC);
return TRUE;
}
| [
"[email protected]"
] | [
[
[
1,
101
]
]
] |
a091c8299383fefe7bf14375d66dda8962577e80 | f9d55548d2d1044dc344bb9685393f6e820d44df | /src/bullet/btCapsuleShape.cpp | b884f3e2776bb32f5258e6f74560cd0debc67433 | [] | no_license | schweikm/3DJoust | 5709bed8e6ad5299faef576d4d754e8f15004fdb | d662b9379cd1afc8204535254343df42ff438b9d | refs/heads/master | 2020-12-24T05:24:09.774415 | 2011-10-08T03:47:29 | 2011-10-08T03:47:29 | 61,953,068 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,252 | cpp | /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "btCapsuleShape.h"
#include "btCollisionMargin.h"
#include "btQuaternion.h"
btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInternalShape ()
{
m_shapeType = CAPSULE_SHAPE_PROXYTYPE;
m_upAxis = 1;
m_implicitShapeDimensions.setValue(radius,0.5f*height,radius);
}
btVector3 btCapsuleShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
{
btVector3 supVec(0,0,0);
btScalar maxDot(btScalar(-1e30));
btVector3 vec = vec0;
btScalar lenSqr = vec.length2();
if (lenSqr < btScalar(0.0001))
{
vec.setValue(1,0,0);
} else
{
btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
vec *= rlen;
}
btVector3 vtx;
btScalar newDot;
btScalar radius = getRadius();
{
btVector3 pos(0,0,0);
pos[getUpAxis()] = getHalfHeight();
vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
newDot = vec.dot(vtx);
if (newDot > maxDot)
{
maxDot = newDot;
supVec = vtx;
}
}
{
btVector3 pos(0,0,0);
pos[getUpAxis()] = -getHalfHeight();
vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
newDot = vec.dot(vtx);
if (newDot > maxDot)
{
maxDot = newDot;
supVec = vtx;
}
}
return supVec;
}
void btCapsuleShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
{
btScalar radius = getRadius();
for (int j=0;j<numVectors;j++)
{
btScalar maxDot(btScalar(-1e30));
const btVector3& vec = vectors[j];
btVector3 vtx;
btScalar newDot;
{
btVector3 pos(0,0,0);
pos[getUpAxis()] = getHalfHeight();
vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
newDot = vec.dot(vtx);
if (newDot > maxDot)
{
maxDot = newDot;
supportVerticesOut[j] = vtx;
}
}
{
btVector3 pos(0,0,0);
pos[getUpAxis()] = -getHalfHeight();
vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
newDot = vec.dot(vtx);
if (newDot > maxDot)
{
maxDot = newDot;
supportVerticesOut[j] = vtx;
}
}
}
}
void btCapsuleShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
{
//as an approximation, take the inertia of the box that bounds the spheres
btTransform ident;
ident.setIdentity();
btScalar radius = getRadius();
btVector3 halfExtents(radius,radius,radius);
halfExtents[getUpAxis()]+=getHalfHeight();
btScalar margin = CONVEX_DISTANCE_MARGIN;
btScalar lx=btScalar(2.)*(halfExtents[0]+margin);
btScalar ly=btScalar(2.)*(halfExtents[1]+margin);
btScalar lz=btScalar(2.)*(halfExtents[2]+margin);
const btScalar x2 = lx*lx;
const btScalar y2 = ly*ly;
const btScalar z2 = lz*lz;
const btScalar scaledmass = mass * btScalar(.08333333);
inertia[0] = scaledmass * (y2+z2);
inertia[1] = scaledmass * (x2+z2);
inertia[2] = scaledmass * (x2+y2);
}
btCapsuleShapeX::btCapsuleShapeX(btScalar radius,btScalar height)
{
m_upAxis = 0;
m_implicitShapeDimensions.setValue(0.5f*height, radius,radius);
}
btCapsuleShapeZ::btCapsuleShapeZ(btScalar radius,btScalar height)
{
m_upAxis = 2;
m_implicitShapeDimensions.setValue(radius,radius,0.5f*height);
}
| [
"[email protected]"
] | [
[
[
1,
171
]
]
] |
91f5298c4c30f3651b36dea2238baf1b6e2cd269 | de2b54a7b68b8fa5d9bdc85bc392ef97dadc4668 | /Tracker/Filters/FilterHandler.h | a58c22a8972f7416440faa02467842f8731bbf6b | [] | no_license | kumarasn/tracker | 8c7c5b828ff93179078cea4db71f6894a404f223 | a3e5d30a3518fe3836f007a81050720cef695345 | refs/heads/master | 2021-01-10T07:57:09.306936 | 2009-04-17T15:02:16 | 2009-04-17T15:02:16 | 55,039,695 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,497 | h | /*
* FilterHandler.h
*
* Created on: 05-feb-2009
* Author: Timpa
*/
#ifndef FILTERHANDLER_H_
#define FILTERHANDLER_H_
#include "cv.h"
#include "ImageFilter.h"
#include "GrayFilter.h"
#include "DownSamplingFilter.h"
#include "SkinFilter.h"
#include "FIRfilter.h"
#include "..\Logger\LogHandler.h"
class FilterHandler {
public:
FilterHandler(LogHandler*);
virtual ~FilterHandler();
IplImage* runPreFilters(IplImage*);
int getSkinCount(){return skinCount;};
void runLowPassFilter(int Xin,int Yin,int &Xout,int &Yout);
void runAverageSmoothing (int Xin,int Yin,int &Xout,int &Yout);
int getSkinThreshold() const{return skinThreshold;}
void setSkinThreshold(int skinThreshold){this->skinThreshold = skinThreshold;}
IplImage* getSkinImage(IplImage*);
void setSkinMaskFile(std::string SkinMaskFile){this->SkinMaskFile = SkinMaskFile;};
void init();
int getSkinDelta() const{return SkinDelta;}
void setSkinDelta(int SkinDelta){this->SkinDelta = SkinDelta;}
private:
ImageFilter *prefilters;
IplImage* filteredImages;
int filters_count;
GrayFilter *gf;
DownSamplingFilter *dsf;
SkinFilter *sf;
FIRfilter *ff;
IplImage* first_filter;
IplImage* second_filter;
IplImage* third_filter;
int skinCount;
int skinThreshold;
LogHandler* logger;
std::string SkinMaskFile;
int SkinDelta;
std::string componentName;
};
#endif /* FILTERHANDLER_H_ */
| [
"latesisdegrado@048d8772-f3ab-11dd-a8e2-f7cb3c35fcff"
] | [
[
[
1,
80
]
]
] |
d896e2d88593b33e19018697fe2d0b16f056cbc7 | b5ad65ebe6a1148716115e1faab31b5f0de1b493 | /src/AranPhy/GeneralBody.h | 03e66ba8b54861a4b9cadf78a80d3f052db8c1f7 | [] | 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 | 8,057 | h | /*!
* @file GeneralBody.h
* @author Geoyeob Kim
* @date 2009
*/
#ifndef GENERALBODY_H
#define GENERALBODY_H
#include "ArnObject.h"
class ArnXformable;
class ArnPlane;
class ArnSkeleton;
struct OdeSpaceContext;
struct GeneralBodyState
{
ArnVec3 pos;
ArnQuat quat;
ArnVec3 linVel;
ArnVec3 angVel;
};
TYPEDEF_SHARED_PTR(GeneralBody)
TYPEDEF_SHARED_PTR(SimWorld)
/*!
* @brief ODE 강체 관련 함수에 대한 래퍼 최상위 클래스
*/
class ARANPHY_API GeneralBody : public ArnObject
{
public:
virtual ~GeneralBody();
const char* getName() const { return m_name.c_str(); }
void setName(const char* val) { m_name = val; }
/*! @name 강체의 모양과 크기
* 모든 강체마다 아래의 값이 정의되어야 합니다.
* - 충돌 체크를 위한 Bounding volume의 모양과 크기
* - 질량 분포를 위한 모양과 크기
*
* 충돌 체크를 위한 모양과 질량 분포를 위한 모양이 반드시 같아야 할 필요는 없습니다.
* 두 경우 모두 크기는 ArnVec3 형태를 사용하는데, 모양에 따라 값의 의미가 다릅니다.
* 반드시 형태를 먼저 설정 한 후 크기를 설정해야 합니다.
*
* - 상자 모양: 크기의 X, Y, Z 성분이 각각 가로, 세로, 높이 값이 됩니다.
* - 캡슐 모양: 크기의 X, Y 성분이 각각 캡슐의 반지름, 높이 값이 됩니다. Z 성분은 반드시 0이어야 합니다.
*/
//@{
void setBoundingBoxType(ArnBoundingBoxType abbt) { m_abbt = abbt; }
ArnBoundingBoxType getBoundingBoxType() const { return m_abbt; }
void setBoundingBoxSize(const ArnVec3& size);
const ArnVec3& getBoundingBoxSize() const { return m_boundingSize; }
void getGeomSize(dVector3 out) const;
void setMassDistributionType(ArnMassDistributionType amdt) { m_amdt = amdt; }
ArnMassDistributionType getMassDistributionType() const { return m_amdt; }
void setMassDistributionSize(const ArnVec3& size);
const ArnVec3& getMassDistributionSize() const { return m_massDistSize; }
//@}
/*!
* @brief 강체의 질량을 설정
* @param kg 질량
*/
void setMass(float kg) { m_mass = kg; }
float getMass() const { return m_mass; }
/*!
* @name 위치
* 강체의 위치를 COM 기준으로 설정하거나 읽어올 수 있습니다.
* 위치를 명시적으로 설정하는 것은 물리적으로 봤을 때 물체가 순간이동 하는 것이기
* 때문에 초기화하거나 재설정하는 목적 이외에는 쓰지 않는 것이 좋습니다.
*/
//@{
void setBodyPosition(const ArnVec3& comPos);
ArnVec3* getPosition(ArnVec3* pos) const;
const dReal* getPosition() const { return dBodyGetPosition(m_body); }
/*!
* @brief 이 강체를 포함해 관절로 연결된 모든 강체를 하나의 강체로 봤을 때의 COM 반환
*/
void calculateLumpedComAndMass(ArnVec3* com, float* mass) const;
void calculateLumpedIntersection(std::vector<ArnVec3>& isects, const ArnPlane& plane) const;
void calculateLumpedGroundIntersection(std::vector<ArnVec3>& isects) const;
float calculateLumpedVerticalIntersection(std::vector<ArnVec3>& isects, std::vector<std::vector<float> >& massMap, const float cx, const float cy, const float deviation, const int resolution) const;
/*!
* @brief 강체와 관절로 연결된 모델로부터 ArnSkeleton을 생성
*
* 현재 GeneralBody 를 중심으로 하여 관절로 연결되어있는 GeneralBody 를
* 따라가며 ArnSkeleton 을 생성합니다. 각 관절의 위치가 ArnBone의 tail이 됩니다.
*/
ArnSkeleton* createLumpedArnSkeleton(SimWorldPtr swPtr) const;
//@}
/*! @name 회전
* 강체의 회전 상태를 Euler 각도, 사원수 혹은 행렬 형태로 설정하거나 읽어올 수 있습니다.
* 회전 상태를 명시적으로 설정하는 것은 물리적으로 봤을 때 물체가 순간이동 하는 것이기
* 때문에 초기화하거나 재설정하는 목적 이외에는 쓰지 않는 것이 좋습니다.
*/
//@{
ArnVec3 getRotationEuler() const;
ArnMatrix* getRotationMatrix(ArnMatrix* rotMat) const;
const dReal* getRotationMatrix() const { return dBodyGetRotation(m_body); }
ArnQuat* getQuaternion(ArnQuat* q) const;
const dReal* getQuaternion() const { return dBodyGetQuaternion(m_body); }
void setInitialQuaternion(const ArnQuat& q) { m_quat0 = q; }
//@}
/*! @name 각속도와 선속도
* 강체의 각속도와 선속도를 읽어오거나 설정할 수 있습니다.
* Kinematic 물체에 대해서 선속도나 각속도를 설정하는 것은 문제가 없을 수 있으나
* dynamics 물체에 대해 이러한 값을 시뮬레이션 도중에 직접 설정하는 것은 불안정성을 높입니다.
*/
//@{
ArnVec3* getLinearVel(ArnVec3* linVel) const;
const dReal* getLinearVel() const { return dBodyGetLinearVel(m_body); }
void setLinearVel(float x, float y, float z);
ArnVec3* getAngularVel(ArnVec3* angVel) const;
const dReal* getAngularVel() const { return dBodyGetAngularVel(m_body); }
//@}
/*! @name 상태
*강체의 물리적인 상태를 나타내는 값을 한꺼번에 읽어오거나 설정할 수 있습니다.
*/
//@{
void getState(GeneralBodyState& gbs) const;
void setState(const GeneralBodyState& gbs, const bool notifyAlso);
//@}
/*!
* @brief 모든 물리적 상태를 초기화
* 선속도, 각속도, 회전 상태, 위치, 작용하는 힘, 토크 값을 초기화시킵니다.
*/
virtual void reset();
/*!
* @brief ODE 컨텍스트를 이용해 강체의 ODE 인스턴스를 생성
* @param osc ODE 컨텍스트
* @remarks 호출하는 전에 ODE 컨텍스트가 \c NULL 로 설정되어 있어야 합니다.
* \c NULL 이 아닌 경우는 이미 객체의 ODE 인스턴스가 생성되었다는 뜻입니다.
*/
void configureOdeContext(const OdeSpaceContext* osc);
/*!
* @brief ArnXformable의 위치와 회전 값을 갱신
*/
void notify() const;
void setXformableTarget(ArnXformable* xformable) { m_xformable = xformable; }
void addExternalForceOnCom(double x, double y, double z);
bool isContactGround() const;
void setContactGround(bool b) { m_isContactGround = b; }
void setBodyData(void* data);
void render();
void setGeomData(void* data);
void* getGeomData() const;
/*!
* @internalonly
*/
//@{
dGeomID getGeomID() const { return m_geom; }
dBodyID getBodyId() const { return m_body; }
//@}
bool isFixed() const { return m_bFixed; }
protected:
GeneralBody(const OdeSpaceContext* osc);
void setInitialCom(const ArnVec3& com0) { m_com0 = com0; }
void setFixed(bool b) { m_bFixed = b; }
private:
void createGeomBox(const ArnVec3& dim);
void createGeomCapsule(double radius, double height);
std::string m_name; ///< 이름
const OdeSpaceContext* m_osc; ///< ODE 컨텍스트
dBodyID m_body; ///< ODE Body ID
dGeomID m_geom; ///< ODE Geom ID
bool m_isContactGround; ///< 바닥과 접촉 여부
float m_mass; ///< 질량 (kg)
ArnVec3 m_com; ///< 현재 COM(center of mass) 위치
ArnVec3 m_com0; ///< 초기 COM 위치
ArnQuat m_quat0; ///< 초기 회전 상태
ArnVec3 m_boundingSize; ///< 충돌 확인 모형의 크기
ArnVec3 m_massDistSize; ///< 질량 분포 모형의 크기
ArnBoundingBoxType m_abbt; ///< bounding volume의 종류
ArnMassDistributionType m_amdt; ///< 질량 분포 종류
ArnXformable* m_xformable; ///< 강체 시뮬레이션 결과를 적용받을 인스턴스
bool m_bFixed; ///< 강체의 고정 여부
};
#endif // GENERALBODY_H
| [
"[email protected]"
] | [
[
[
1,
181
]
]
] |
bfaeb523035186cb96157ac8581f1707fd5d06e2 | 93176e72508a8b04769ee55bece71095d814ec38 | /Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_writer_settings.hpp | f3401de6723b09924fd8c6e3c73900612ff4013c | [
"MIT",
"BSL-1.0"
] | permissive | inglada/OTB | a0171a19be1428c0f3654c48fe5c35442934cf13 | 8b6d8a7df9d54c2b13189e00ba8fcb070e78e916 | refs/heads/master | 2021-01-19T09:23:47.919676 | 2011-06-29T17:29:21 | 2011-06-29T17:29:21 | 1,982,100 | 4 | 5 | null | null | null | null | UTF-8 | C++ | false | false | 2,320 | hpp | // ----------------------------------------------------------------------------
// Copyright (C) 2002-2007 Marcin Kalicinski
// Copyright (C) 2007 Alexey Baskakov
//
// 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)
//
// For more information, see www.boost.org
// ----------------------------------------------------------------------------
#ifndef BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_WRITER_SETTINGS_HPP_INCLUDED
#define BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_WRITER_SETTINGS_HPP_INCLUDED
#include <string>
#include <liblas/external/property_tree/detail/ptree_utils.hpp>
namespace liblas { namespace property_tree { namespace xml_parser
{
// Naively convert narrow string to another character type
template<class Ch>
std::basic_string<Ch> widen(const char *text)
{
std::basic_string<Ch> result;
while (*text)
{
result += Ch(*text);
++text;
}
return result;
}
//! Xml writer settings. The default settings lead to no pretty printing.
template<class Ch>
class xml_writer_settings
{
public:
xml_writer_settings(Ch inchar = Ch(' '),
typename std::basic_string<Ch>::size_type incount = 0,
const std::basic_string<Ch> &enc = widen<Ch>("utf-8"))
: indent_char(inchar)
, indent_count(incount)
, encoding(enc)
{
}
const Ch indent_char;
const typename std::basic_string<Ch>::size_type indent_count;
const std::basic_string<Ch> encoding;
// private:
// // <mloskot>
// // noncopyable
// xml_writer_settings(xml_writer_settings const& other);
// xml_writer_settings& operator=(xml_writer_settings const& other);
// // </mloskot>
};
template <class Ch>
xml_writer_settings<Ch> xml_writer_make_settings(Ch indent_char = Ch(' '),
typename std::basic_string<Ch>::size_type indent_count = 0,
const std::basic_string<Ch> &encoding = widen<Ch>("utf-8"))
{
return xml_writer_settings<Ch>(indent_char, indent_count, encoding);
}
} } }
#endif
| [
"[email protected]"
] | [
[
[
1,
68
]
]
] |
1a2e6b450c514c9bae73f96d95d3a42996f5c322 | 9a9ceceae6dd3b046a03686f7ff2b9f5bc2f5c54 | /Tads_vector_pila_lista/tpilaporo/tad01.cpp | fbd5816b369579d49d1e51c9ad2328b7eda6ff91 | [] | no_license | quico14/arboles-de-isa | 0a01eb283ebb853596c18d21df150e6ce3545499 | 3a2f9a00572cf3a15b5bba686bd3745de7a7552d | refs/heads/master | 2021-01-15T15:04:03.580894 | 2010-06-28T17:13:35 | 2010-06-28T17:13:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,478 | cpp | #include <iostream>
using namespace std;
#include "tpilaporo.h"
int
main(void)
{
TPilaPoro a, b, c;
cout << "No hace nada" << endl;
//-------------------------------------->>>>>>>>>>tad2
TPilaPoro p;
cout << p << endl;
//--------------------------------------->>>>>>>>>>>>>>>tad3
TPilaPoro p;
TPoro a(1, 2, 3, "rojo");
p.Apilar(a);
cout << p << endl;
//------------------------------------->>>>>>>>>>>tad4
/*TPilaPoro p;
TPoro a(1, 2, 3, "rojo"), b(4, 5, 6, "azul");
p.Apilar(a);
p.Apilar(b);
cout << p << endl;
//------------------------------------>>>>>>>>>>>>>>>>tad5
TPilaPoro p;
TPoro a(1, 2, 3, "rojo"), b(4, 5, 6, "azul");
TPoro c(9, 8, 7, "verde"), d(6, 5, 4, "amarillo");
p.Apilar(a);
p.Apilar(b);
p.Apilar(c);
p.Apilar(d);
cout << p << endl;
//------------------------------------->>>>>>>>>>>>>>>tad7
TPilaPoro p;
TPoro a(1, 2, 3, "rojo");
cout << p.Longitud() << endl;
p.Apilar(a);
if(a == p.Cima())
cout << "SI" << endl;
else
cout << "NO" << endl;
cout << p.Longitud() << endl;
//-------------------------------->>>>>>>>>>>>>>>>>>>>>>>tad8
TPilaPoro p;
TPoro a, b(1, 2, 3), c(4, 5, 6, "rojo");
p.Apilar(c);
p.Apilar(b);
p.Apilar(a);
cout << p.Cima() << endl;
p.Desapilar();
cout << p.Cima() << endl;
p.Desapilar();
cout << p.Cima() << endl;
p.Desapilar();
cout << p.Cima() << endl;
//------------------------------------->>>>>>>>>>>>>>>>>>>>tad9
TPilaPoro p;
TPoro a;
if(p.EsVacia())
cout << "VACIO" << endl;
else
cout << "NO VACIO" << endl;
p.Apilar(a);
if(p.EsVacia())
cout << "VACIO" << endl;
else
cout << "NO VACIO" << endl;
p.Desapilar();
if(p.EsVacia())
cout << "VACIO" << endl;
else
cout << "NO VACIO" << endl;
p.Apilar(a);
if(p.EsVacia())
cout << "VACIO" << endl;
else
cout << "NO VACIO" << endl;
p.~TPilaPoro();
if(p.EsVacia())
cout << "VACIO" << endl;
else
cout << "NO VACIO" << endl;
//----------------------------------->>>>>>>>>>>>>>>>>>>>>>ad10
TPilaPoro p, q;
TPoro a(1, 2, 3, "rojo");
if(p == q)
cout << "SI" << endl;
else
cout << "NO" << endl;
p.Apilar(a);
if(p == q)
cout << "SI" << endl;
else
cout << "NO" << endl;
q = p;
if(p == q)
cout << "SI" << endl;
else
cout << "NO" << endl;*/
}
| [
"ArkarianG@aa5a7d10-d4f9-11de-901b-a378632c6355"
] | [
[
[
1,
142
]
]
] |
676ac10bdfab58526d2353646ba4aa0983203ac6 | 7a310d01d1a4361fd06b40a74a2afc8ddc23b4d3 | /src/PromptService.cpp | 69c680281e9e697c73ed12f1ebeb12407c67e90c | [] | no_license | plus7/DonutG | b6fec6111d25b60f9a9ae5798e0ab21bb2fa28f6 | 2d204c36f366d6162eaf02f4b2e1b8bc7b403f6b | refs/heads/master | 2020-06-01T15:30:31.747022 | 2010-08-21T18:51:01 | 2010-08-21T18:51:01 | 767,753 | 1 | 2 | null | null | null | null | SHIFT_JIS | C++ | false | false | 7,938 | cpp | #include "stdafx.h"
#include "PromptService.h"
#include "GeckoPromptDialog.h"
#include "GeckoSelectDialog.h"
#include "nsIWebBrowserChrome.h"
#include "nsIWindowWatcher.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIAuthInformation.h"
CPromptService::CPromptService(void)
{
}
CPromptService::~CPromptService(void)
{
}
NS_IMPL_ISUPPORTS2(CPromptService, nsIPromptService, nsIPromptService2)
NS_IMPL_ISUPPORTS1(CPromptServiceFactory, nsIFactory);
HWND CPromptService::GetHwndForWindow(nsIDOMWindow *win)
{
nsCOMPtr<nsIWindowWatcher> ww = do_GetService("@mozilla.org/embedcomp/window-watcher;1");
if(!ww) return NULL;
nsCOMPtr<nsIWebBrowserChrome> chrome;
ww->GetChromeForWindow(win, getter_AddRefs(chrome));
if(!chrome) return NULL;
nsCOMPtr<nsIEmbeddingSiteWindow> siteWindow = do_QueryInterface(chrome);
if(!siteWindow) return NULL;
HWND *hWnd;
siteWindow->GetSiteWindow((void**)&hWnd);
return *hWnd;
}
NS_IMETHODIMP
CPromptService::Alert(nsIDOMWindow* aParent, const PRUnichar* aDialogTitle,
const PRUnichar* aDialogText)
{
::MessageBox(GetHwndForWindow(aParent), aDialogText, aDialogTitle, MB_OK | MB_ICONWARNING);
return NS_OK;
}
NS_IMETHODIMP
CPromptService::AlertCheck(nsIDOMWindow* aParent,
const PRUnichar* aDialogTitle,
const PRUnichar* aDialogText,
const PRUnichar* aCheckMsg, PRBool* aCheckValue)
{
NS_ENSURE_ARG_POINTER(aCheckValue);
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CPromptService::Confirm(nsIDOMWindow* aParent,
const PRUnichar* aDialogTitle,
const PRUnichar* aDialogText, PRBool* aConfirm)
{
NS_ENSURE_ARG_POINTER(aConfirm);
int rv = ::MessageBox(GetHwndForWindow(aParent), aDialogText, aDialogTitle, MB_OKCANCEL);
if(rv == IDOK){
*aConfirm = PR_TRUE;
}else{
*aConfirm = PR_FALSE;
}
return NS_OK;
}
NS_IMETHODIMP
CPromptService::ConfirmCheck(nsIDOMWindow* aParent,
const PRUnichar* aDialogTitle,
const PRUnichar* aDialogText,
const PRUnichar* aCheckMsg,
PRBool* aCheckValue, PRBool* aConfirm)
{
NS_ENSURE_ARG_POINTER(aCheckValue);
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CPromptService::ConfirmEx(nsIDOMWindow* aParent,
const PRUnichar* aDialogTitle,
const PRUnichar* aDialogText,
PRUint32 aButtonFlags,
const PRUnichar* aButton0Title,
const PRUnichar* aButton1Title,
const PRUnichar* aButton2Title,
const PRUnichar* aCheckMsg, PRBool* aCheckValue,
PRInt32* aRetVal)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CPromptService::Prompt(nsIDOMWindow* aParent, const PRUnichar* aDialogTitle,
const PRUnichar* aDialogText, PRUnichar** aValue,
const PRUnichar* aCheckMsg, PRBool* aCheckValue,
PRBool* aConfirm)
{
CGeckoPromptDlg dlg;
dlg.m_strTitle = CString(aDialogTitle);
dlg.m_strMsg = CString(aDialogText);
dlg.m_strEdit = CString(*aValue);
dlg.m_showCheck = (aCheckMsg != NULL) && (aCheckValue != NULL);
dlg.m_showPwd = false;
if(dlg.m_showCheck){
dlg.m_strCheck = CString( aCheckMsg );
dlg.m_isChecked = (*aCheckValue == PR_TRUE);
}
if ( dlg.DoModal() == IDOK ) {
NS_Free(*aValue);
*aValue = (PRUnichar*)NS_Alloc(sizeof(PRUnichar) * (dlg.m_strEdit.GetLength() + 1));
wcscpy(*aValue, dlg.m_strEdit);
if(aCheckValue) *aCheckValue = dlg.m_isChecked;
if(aConfirm) *aConfirm = PR_TRUE;
}else{
if(aConfirm) *aConfirm = PR_FALSE;
}
return NS_OK;
}
NS_IMETHODIMP
CPromptService::PromptUsernameAndPassword(nsIDOMWindow* aParent,
const PRUnichar* aDialogTitle,
const PRUnichar* aDialogText,
PRUnichar** aUsername,
PRUnichar** aPassword,
const PRUnichar* aCheckMsg,
PRBool* aCheckValue,
PRBool* aConfirm)
{
CGeckoPromptDlg dlg;
dlg.m_strTitle = CString(aDialogTitle);
dlg.m_strMsg = CString(aDialogText);
dlg.m_strEdit = CString(*aUsername);
dlg.m_strPwd = CString(*aPassword);
dlg.m_showCheck = (aCheckMsg != NULL) && (aCheckValue != NULL);
dlg.m_showPwd = true;
if(dlg.m_showCheck){
dlg.m_strCheck = CString( aCheckMsg );
dlg.m_isChecked = (*aCheckValue == PR_TRUE);
}
if ( dlg.DoModal() == IDOK ) {
NS_Free(*aUsername);
*aUsername = (PRUnichar*)NS_Alloc(sizeof(PRUnichar) * (dlg.m_strEdit.GetLength() + 1));
wcscpy(*aUsername, dlg.m_strEdit);
NS_Free(*aPassword);
*aPassword = (PRUnichar*)NS_Alloc(sizeof(PRUnichar) * (dlg.m_strPwd.GetLength() + 1));
wcscpy(*aPassword, dlg.m_strPwd);
if(aCheckValue) *aCheckValue = dlg.m_isChecked;
if(aConfirm) *aConfirm = PR_TRUE;
}else{
if(aConfirm) *aConfirm = PR_FALSE;
}
return NS_OK;
}
NS_IMETHODIMP
CPromptService::PromptPassword(nsIDOMWindow* aParent,
const PRUnichar* aDialogTitle,
const PRUnichar* aDialogText,
PRUnichar** aPassword,
const PRUnichar* aCheckMsg,
PRBool* aCheckValue, PRBool* aConfirm)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CPromptService::Select(nsIDOMWindow* aParent, const PRUnichar* aDialogTitle,
const PRUnichar* aDialogText, PRUint32 aCount,
const PRUnichar** aSelectList, PRInt32* outSelection,
PRBool* aConfirm)
{
CGeckoSelectDlg dlg;
dlg.m_strTitle = CString(aDialogTitle);
dlg.m_strMsg = CString(aDialogText);
for(unsigned int i=0;i<aCount;i++){
dlg.m_strList.Add(CString(aSelectList[i]));
}
if ( dlg.DoModal() == IDOK ) {
if(outSelection) *outSelection = dlg.m_selection;
if(aConfirm) *aConfirm = PR_TRUE;
}else{
if(aConfirm) *aConfirm = PR_FALSE;
}
return NS_OK;
}
/* boolean promptAuth (in nsIDOMWindow aParent, in nsIChannel aChannel, in PRUint32 level, in nsIAuthInformation authInfo, in wstring checkboxLabel, inout boolean checkValue); */
NS_IMETHODIMP CPromptService::PromptAuth(nsIDOMWindow *aParent,
nsIChannel *aChannel,
PRUint32 level,
nsIAuthInformation *aAuthInfo,
const PRUnichar *aCheckMsg,
PRBool *aCheckValue NS_INOUTPARAM,
PRBool *aConfirm NS_OUTPARAM)
{
nsEmbedString realm,username,password,domain;
aAuthInfo->GetDomain(domain);
aAuthInfo->GetRealm(realm);
aAuthInfo->GetPassword(password);
aAuthInfo->GetUsername(username);
CGeckoPromptDlg dlg;
dlg.m_strTitle = CString(_T("ユーザー名とパスワードを入力してください"));
dlg.m_strMsg = /*TODO: CString(domain.get()) +*/ _T("\"") + CString(realm.get()) + _T("\"に対するユーザー名とパスワードを入力してください");
dlg.m_strEdit = CString(username.get());
dlg.m_strPwd = CString(password.get());
dlg.m_showCheck = (aCheckMsg != NULL) && (aCheckValue != NULL);
dlg.m_showPwd = true;
if(dlg.m_showCheck){
dlg.m_strCheck = CString( aCheckMsg );
dlg.m_isChecked = (*aCheckValue == PR_TRUE);
}
if ( dlg.DoModal() == IDOK ) {
aAuthInfo->SetUsername(nsEmbedString(dlg.m_strEdit));
aAuthInfo->SetPassword(nsEmbedString(dlg.m_strPwd));
if(aCheckValue) *aCheckValue = dlg.m_isChecked;
if(aConfirm) *aConfirm = PR_TRUE;
}else{
if(aConfirm) *aConfirm = PR_FALSE;
}
return NS_OK;
}
/* nsICancelable asyncPromptAuth (in nsIDOMWindow aParent, in nsIChannel aChannel, in nsIAuthPromptCallback aCallback, in nsISupports aContext, in PRUint32 level, in nsIAuthInformation authInfo, in wstring checkboxLabel, inout boolean checkValue); */
NS_IMETHODIMP CPromptService::AsyncPromptAuth(nsIDOMWindow *aParent, nsIChannel *aChannel, nsIAuthPromptCallback *aCallback, nsISupports *aContext, PRUint32 level, nsIAuthInformation *authInfo, const PRUnichar *checkboxLabel, PRBool *checkValue NS_INOUTPARAM, nsICancelable **_retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
| [
"[email protected]"
] | [
[
[
1,
243
]
]
] |
07159e53aa7f1dadc51a0c11a9016d693d8624e3 | 36809be8f4e66fa2a3794776772584273853fede | /STCStyle.cpp | af2f1aa251263869845b7360dc6baa146681d4b9 | [] | no_license | ktd2004/mygdb | dbaa0ebd0a3e6958dec8e80248cb8e12a92548bd | 016405acfe3d548d9333155b316f4d16cb3baebc | refs/heads/master | 2020-04-29T00:31:39.201731 | 2010-11-16T03:18:50 | 2010-11-16T03:18:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,961 | cpp | // vim: set fdm=marker ts=4 sw=4:
#pragma warning(disable: 4819)
#include <MyGDB.h>
STCStyle::STCStyle()
{
m_keyWords = wxT("");
}
STCStyle::~STCStyle()
{
}
bool STCStyle::Scan (wxString baseDir)
{
#ifdef __MINGW32__
wxString SLASH = wxT("\\");
#else
wxString SLASH = wxT("/");
#endif
m_styleNames.Clear();
if (baseDir[baseDir.length()-1] != SLASH) {
baseDir += SLASH;
}
if(!wxDir::Exists(baseDir)) {
return false;
}
wxDir dir(baseDir);
wxString fileName;
bool bla = dir.GetFirst(&fileName);
if (bla) {
do {
if ( fileName.Lower().Matches(wxT("*.mygdb")) )
{
wxXmlDocument *xml = new wxXmlDocument();
if ( !xml->Load(baseDir + fileName) )
{
delete xml;
return false;
}
root = xml->GetRoot();
wxString value = GetProperty(wxT("NAME"), wxT("value"));
m_styleNames.Add(value);
m_styleNames.Add(baseDir + fileName);
delete xml;
}
}
while (dir.GetNext(&fileName) );
}
return true;
}
wxArrayString STCStyle::GetStyleNames()
{
wxArrayString names;
for(unsigned int i=0; i < m_styleNames.Count(); i+=2)
{
names.Add(m_styleNames[i]);
}
return names;
}
wxString STCStyle::GetStyleFile(wxString styleName)
{
for(unsigned int i=0; i < m_styleNames.Count(); i+=2)
{
if ( m_styleNames[i] == styleName )
return m_styleNames[i+1];
}
return wxT("");
}
void STCStyle::GetInfo(wxString nodePath, wxString *fg, wxString *bg,
wxString *face, long *size, bool *bold, bool *italic, bool *underline)
{
*fg = GetProperty(nodePath, wxT("fg"));
*bg = GetProperty(nodePath, wxT("bg"));
*face = GetProperty(nodePath, wxT("face"));
*size = GetPropertyInt(nodePath, wxT("size"));
*bold = GetPropertyBool(nodePath, wxT("bold"));
*italic = GetPropertyBool(nodePath, wxT("italic"));
*underline = GetPropertyBool(nodePath, wxT("underline"));
}
wxXmlDocument *STCStyle::OpenStyle(wxString styleName)
{
wxString fileName = GetStyleFile(styleName);
wxXmlDocument *xml = new wxXmlDocument();
if ( !xml->Load(fileName) )
{
return false;
}
root = xml->GetRoot();
return xml;
}
void STCStyle::CloseStyle(wxXmlDocument *xml)
{
delete xml;
}
bool STCStyle::ApplyEditorStyle(wxStyledTextCtrl *stc)
{
wxString fg, bg, face;
bool bold, italic, underline;
long size;
GetInfo(wxT("EDITOR/SELECTION"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
if ( fg.Len() > 0 ) stc->SetSelForeground(1, fg);
if ( bg.Len() > 0 ) stc->SetSelBackground(1, bg);
GetInfo(wxT("EDITOR/CARETLINE"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
if ( fg.Len() > 0 ) stc->SetCaretForeground(fg); // cursor color
if ( bg.Len() > 0 ) stc->SetCaretLineBackground(bg);
GetInfo(wxT("EDITOR/EDGE"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
if ( fg.Len() > 0 ) stc->SetEdgeColour(fg);
GetInfo(wxT("EDITOR/FOLDMARGIN"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
if ( fg.Len() > 0 )
{
stc->SetFoldMarginColour(true, wxColour(fg));
stc->SetFoldMarginHiColour(true, wxColour(fg));
}
stc->MarkerSetForeground(wxSTC_MARKNUM_FOLDEROPEN, wxColour(fg));
stc->MarkerSetBackground(wxSTC_MARKNUM_FOLDEROPEN, wxColour(bg));
stc->MarkerSetForeground(wxSTC_MARKNUM_FOLDER, wxColour(fg));
stc->MarkerSetBackground(wxSTC_MARKNUM_FOLDER, wxColour(bg));
stc->MarkerSetForeground(wxSTC_MARKNUM_FOLDERSUB, wxColour(fg));
stc->MarkerSetBackground(wxSTC_MARKNUM_FOLDERSUB, wxColour(bg));
stc->MarkerSetForeground(wxSTC_MARKNUM_FOLDERTAIL, wxColour(fg));
stc->MarkerSetBackground(wxSTC_MARKNUM_FOLDERTAIL, wxColour(bg));
stc->MarkerSetForeground(wxSTC_MARKNUM_FOLDEREND, wxColour(fg));
stc->MarkerSetBackground(wxSTC_MARKNUM_FOLDEREND, wxColour(bg));
stc->MarkerSetForeground(wxSTC_MARKNUM_FOLDEROPENMID, wxColour(fg));
stc->MarkerSetBackground(wxSTC_MARKNUM_FOLDEROPENMID, wxColour(bg));
stc->MarkerSetForeground(wxSTC_MARKNUM_FOLDERMIDTAIL, wxColour(fg));
stc->MarkerSetBackground(wxSTC_MARKNUM_FOLDERMIDTAIL, wxColour(bg));
GetInfo(wxT("EDITOR/DEFAULT"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_STYLE_DEFAULT,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetSpec(wxSTC_C_DEFAULT,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetSize(wxSTC_C_DEFAULT, size);
GetInfo(wxT("EDITOR/IDENTIFIER"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_C_IDENTIFIER,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_IDENTIFIER, bold);
stc->StyleSetItalic(wxSTC_C_IDENTIFIER, italic);
stc->StyleSetUnderline(wxSTC_C_IDENTIFIER, underline);
stc->StyleSetSize(wxSTC_C_IDENTIFIER, size);
GetInfo(wxT("EDITOR/COMMENT"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_C_COMMENT,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_COMMENT, bold);
stc->StyleSetItalic(wxSTC_C_COMMENT, italic);
stc->StyleSetUnderline(wxSTC_C_COMMENT, underline);
stc->StyleSetSize(wxSTC_C_COMMENT, size);
stc->StyleSetSpec(wxSTC_C_COMMENTDOC,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_COMMENTDOC, bold);
stc->StyleSetItalic(wxSTC_C_COMMENTDOC, italic);
stc->StyleSetUnderline(wxSTC_C_COMMENTDOC, underline);
stc->StyleSetSize(wxSTC_C_COMMENTDOC, size);
stc->StyleSetSpec(wxSTC_C_COMMENTLINE,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_COMMENTLINE, bold);
stc->StyleSetItalic(wxSTC_C_COMMENTLINE, italic);
stc->StyleSetUnderline(wxSTC_C_COMMENTLINE, underline);
stc->StyleSetSize(wxSTC_C_COMMENTLINE, size);
// ------- new
GetInfo(wxT("EDITOR/STRING"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_C_STRING,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_STRING, bold);
stc->StyleSetItalic(wxSTC_C_STRING, italic);
stc->StyleSetUnderline(wxSTC_C_STRING, underline);
stc->StyleSetSize(wxSTC_C_STRING, size);
stc->StyleSetSpec(wxSTC_C_STRINGEOL,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_STRINGEOL, bold);
stc->StyleSetItalic(wxSTC_C_STRINGEOL, italic);
stc->StyleSetUnderline(wxSTC_C_STRINGEOL, underline);
stc->StyleSetSize(wxSTC_C_STRINGEOL, size);
// ------- new
GetInfo(wxT("EDITOR/CHARACTER"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_C_CHARACTER,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_CHARACTER, bold);
stc->StyleSetItalic(wxSTC_C_CHARACTER, italic);
stc->StyleSetUnderline(wxSTC_C_CHARACTER, underline);
stc->StyleSetSize(wxSTC_C_CHARACTER, size);
GetInfo(wxT("EDITOR/NUMBER"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_C_NUMBER,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_NUMBER, bold);
stc->StyleSetItalic(wxSTC_C_NUMBER, italic);
stc->StyleSetUnderline(wxSTC_C_NUMBER, underline);
stc->StyleSetSize(wxSTC_C_NUMBER, size);
GetInfo(wxT("EDITOR/OPERATOR"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_C_OPERATOR,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_OPERATOR, bold);
stc->StyleSetItalic(wxSTC_C_OPERATOR, italic);
stc->StyleSetUnderline(wxSTC_C_OPERATOR, underline);
stc->StyleSetSize(wxSTC_C_OPERATOR, size);
// ---------- new
GetInfo(wxT("EDITOR/PREPROCESSOR"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_C_PREPROCESSOR,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_PREPROCESSOR, bold);
stc->StyleSetItalic(wxSTC_C_PREPROCESSOR, italic);
stc->StyleSetUnderline(wxSTC_C_PREPROCESSOR, underline);
stc->StyleSetSize(wxSTC_C_PREPROCESSOR, size);
GetInfo(wxT("EDITOR/WORD"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_C_WORD,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_WORD, bold);
stc->StyleSetItalic(wxSTC_C_WORD, italic);
stc->StyleSetUnderline(wxSTC_C_WORD, underline);
stc->StyleSetSize(wxSTC_C_WORD, size);
GetInfo(wxT("EDITOR/WORD"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_C_WORD2,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_C_WORD2, bold);
stc->StyleSetItalic(wxSTC_C_WORD2, italic);
stc->StyleSetUnderline(wxSTC_C_WORD2, underline);
stc->StyleSetSize(wxSTC_C_WORD2, size);
GetInfo(wxT("EDITOR/LINENUMBERMARGIN"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_STYLE_LINENUMBER,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(wxSTC_STYLE_LINENUMBER, bold);
stc->StyleSetItalic(wxSTC_STYLE_LINENUMBER, italic);
stc->StyleSetUnderline(wxSTC_STYLE_LINENUMBER, underline);
stc->StyleSetSize(wxSTC_STYLE_LINENUMBER, size);
stc->SetWordChars(wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"));
stc->SetKeyWords(0, m_keyWords);
return true;
}
bool STCStyle::ApplyConsoleStyle(wxStyledTextCtrl *stc)
{
wxString fg, bg, face;
bool bold, italic, underline;
long size;
GetInfo(wxT("CONSOLE/SELECTION"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
if ( fg.Len() > 0 ) stc->SetSelForeground(1, fg);
if ( bg.Len() > 0 ) stc->SetSelBackground(1, bg);
GetInfo(wxT("CONSOLE/CARETLINE"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
if ( fg.Len() > 0 ) stc->SetCaretForeground(fg); // cursor color
if ( bg.Len() > 0 ) stc->SetCaretLineBackground(bg);
GetInfo(wxT("CONSOLE/EDGE"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
if ( fg.Len() > 0 ) stc->SetEdgeColour(fg);
GetInfo(wxT("CONSOLE/DEFAULT"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_STYLE_DEFAULT,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetSpec(wxSTC_C_DEFAULT,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetSize(wxSTC_C_DEFAULT, size);
GetInfo(wxT("CONSOLE/INPUT"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(wxSTC_C_DEFAULT,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetSize(wxSTC_C_DEFAULT, size);
GetInfo(wxT("CONSOLE/ERROR"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(4,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetSpec(4,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(4, bold);
stc->StyleSetItalic(4, italic);
stc->StyleSetUnderline(4, underline);
stc->StyleSetSize(4, size);
GetInfo(wxT("CONSOLE/NORMAL"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(5,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetSpec(5,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(5, bold);
stc->StyleSetItalic(5, italic);
stc->StyleSetUnderline(5, underline);
stc->StyleSetSize(5, size);
GetInfo(wxT("CONSOLE/PROMPT"),
&fg, &bg, &face, &size, &bold, &italic, &underline);
stc->StyleSetSpec(6,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetSpec(6,
wxString::Format(wxT("back:%s,fore:%s,face:%s"),
bg.c_str(), fg.c_str(), face.c_str()));
stc->StyleSetBold(6, bold);
stc->StyleSetItalic(6, italic);
stc->StyleSetUnderline(6, underline);
stc->StyleSetSize(6, size);
return true;
}
void STCStyle::SetKeyWords(wxString words)
{
m_keyWords = words;
}
wxXmlNode* STCStyle::SetNode(wxString nodePath)
{
wxXmlNode* pNode = root; // parent node
wxStringTokenizer tkz(nodePath, wxT("/"));
while ( tkz.HasMoreTokens() )
{
wxString token = tkz.GetNextToken();
wxXmlNode* node = pNode->GetChildren();
int exist = false;
while (node)
{
if ( node->GetName() == token )
{
pNode = node;
exist = true;
break;
}
node = node->GetNext();
}
if ( exist == false )
{
wxXmlNode *childNode = new wxXmlNode (wxXML_ELEMENT_NODE, token);
pNode->AddChild(childNode);
pNode = childNode;
}
}
return pNode;
}
bool STCStyle::SetProperty(
wxString nodePath, wxString property, wxString value)
{
wxXmlNode *node = SetNode(nodePath);
wxXmlProperty* prop = node->GetProperties();
bool exist=false;
while (prop)
{
if ( prop->GetName() == property )
{
prop->SetValue(value);
exist=true;
}
prop = prop->GetNext();
}
if (exist==false)
{
node->AddProperty(property, value);
}
return true;
}
bool STCStyle::GetPropertyBool(wxString nodePath, wxString property)
{
wxString value = GetProperty(nodePath, property);
if ( value == wxT("true") )
return true;
else
return false;
}
long STCStyle::GetPropertyInt(wxString nodePath, wxString property)
{
long v;
wxString value = GetProperty(nodePath, property);
value.ToLong(&v);
return v;
}
wxString STCStyle::GetProperty(wxString nodePath, wxString property)
{
wxXmlNode *node = SetNode(nodePath);
wxXmlProperty* prop = node->GetProperties();
while (prop)
{
if ( prop->GetName() == property )
return prop->GetValue();
prop = prop->GetNext();
}
// return default value
if ( property == wxT("bold") ) return wxT("false");
if ( property == wxT("italic") ) return wxT("false");
if ( property == wxT("underline") ) return wxT("false");
if ( property == wxT("size") ) return wxT("-1");
return wxEmptyString;
}
| [
"[email protected]"
] | [
[
[
1,
481
]
]
] |
3fd9827cd6e6b36b342fdf4220dbcc34f360e642 | 48fb654a62d18f183583ffdecb8e6f8c47bcbcdb | /include/symboltable/SymbolTable.h | 3fde7a5dea5094728358d00d00d74fae53499b9d | [] | no_license | hashier/cbp | 41f912f34055551913f921a3e25cc479b86d53c8 | 2ce071643c292f2416d3e7477a3f456a82d3e5a0 | refs/heads/master | 2021-01-19T21:39:30.341807 | 2011-02-09T07:47:44 | 2011-02-09T07:47:44 | 1,084,586 | 2 | 0 | null | 2020-01-23T17:51:53 | 2010-11-16T08:54:33 | C++ | UTF-8 | C++ | false | false | 2,129 | h | #ifndef SYMBOLTABLE_H_INCLUDED
#define SYMBOLTABLE_H_INCLUDED
#include<list>
#include<sstream>
#include "Scope.h"
class Declaration;
namespace SymbolTable
{
class SymbolTable
{
public:
SymbolTable();
~SymbolTable();
/// Enters a new scope. Should be called every time something like '{' is encountered
void enterNewScope();
/// Leaves the current scope. Should be called every time something like '}' is encountered.
/// Currently all information about the left scope is lost of leaving! TODO: change that?
void leaveCurrentScope();
/// Inserts a new Definition into the current scope.
/// @throws DefinitionAlreadyExistsException if there is already a definition with that identifier
void insertDefinition(Declaration *definition);
/// Inserts a new Definition into the top level (global) scope.
/// @throws DefinitionAlreadyExistsException if there is already a definition with that identifier
void insertGlobalDefinition(Declaration *definition);
/// Returns the definition with given identifier. Starts the search in the current scope and continues
/// the search in the parent scope(s)
/// Throws a DefinitionNotFoundException if definition is not found
Declaration *getDefinition(const std::string &identifier);
private:
std::list<Scope> scopes;
};
class DefinitionNotFoundException : public std::exception
{
public:
virtual const char* what() const throw()
{
return "Definition not found";
}
};
class DefinitionAlreadyExistsException : public std::exception
{
public:
DefinitionAlreadyExistsException(const std::string &identifier, int lineDefined)
{
std::ostringstream ss;
ss << "The identifier '" << identifier << "' was already defined in line " << lineDefined << ".";
err = ss.str();
}
virtual const char* what() const throw()
{
return err.c_str();
}
~DefinitionAlreadyExistsException() throw() { };
private:
std::string err;
};
}
#endif // SYMBOLTABLE_H_INCLUDED
| [
"cbp10_kluth@a60ba226-48e3-df11-83e3-000476a39db3",
"cbp10_breitmoser@a60ba226-48e3-df11-83e3-000476a39db3",
"cbp10_rodermund@a60ba226-48e3-df11-83e3-000476a39db3"
] | [
[
[
1,
32
],
[
34,
46
],
[
48,
55
],
[
57,
75
]
],
[
[
33,
33
]
],
[
[
47,
47
],
[
56,
56
]
]
] |
5456af483f1020bdb6ef820a1e2b8d68a4d9f97e | bef7d0477a5cac485b4b3921a718394d5c2cf700 | /dingus/dingus/gfx/geometry/VBChunkLock.h | d904e52207c72abd2b5b9f24ad4c068f499cf51f | [
"MIT"
] | permissive | TomLeeLive/aras-p-dingus | ed91127790a604e0813cd4704acba742d3485400 | 22ef90c2bf01afd53c0b5b045f4dd0b59fe83009 | refs/heads/master | 2023-04-19T20:45:14.410448 | 2011-10-04T10:51:13 | 2011-10-04T10:51:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,616 | h | // --------------------------------------------------------------------------
// Dingus project - a collection of subsystems for game/graphics applications
// --------------------------------------------------------------------------
#ifndef __VB_CHUNK_LOCK_H
#define __VB_CHUNK_LOCK_H
#include "VBChunkHelper.h"
namespace dingus {
/**
* VB chunk lock object.
*
* Locks the chunk in constructor, unlocks in destructor.
*/
class CVBChunkLock {
public:
CVBChunkLock( CVBChunkHelper& vbChunk, int vertexCount )
: mChunkHelper(&vbChunk), mRawData(NULL), mVertexCount(vertexCount), mStride(0), mTouchedVertices(0)
{
mRawData = vbChunk.lock( vertexCount );
assert( vbChunk.getChunk().get() );
mStride = vbChunk.getChunk()->getStride();
}
~CVBChunkLock()
{
// TBD: possible exception in destructor
mChunkHelper.unlock( mTouchedVertices );
}
void setTouchedRegion( int touchedVertices ) {
assert( touchedVertices >= 0 && touchedVertices <= mVertexCount );
mTouchedVertices = touchedVertices;
}
byte* getRawData() const { return mRawData; }
int getVertexCount() const { return mVertexCount; }
int getStride() const { return mStride; }
int getTouchedRegion() const { return mTouchedVertices; }
private:
// disable copy
CVBChunkLock( CVBChunkLock const& rhs );
CVBChunkLock const& operator= ( CVBChunkLock const& rhs );
private:
CVBChunkHelper* mChunkHelper;
byte* mRawData;
int mVertexCount;
int mStride;
int mTouchedVertices;
};
template <class VERTEX>
class CVBBaseIterator {
public:
CVBBaseIterator( CVBChunkHelper& vbChunk, int vertexCount ) : mLockedChunk( vbChunk, vertexCount ) { }
void setTouchedRegion( int touchedVertices ) { mLockedChunk.setTouchedRegion( touchedVertices ); }
int getTouchedRegion() const { return mLockedChunk.getTouchedRegion(); }
protected:
CVBChunkLock mLockedChunk;
};
template <class VERTEX>
class CVBChunkRawIterator : public CVBBaseIterator<VERTEX> {
public:
CVBChunkRawIterator( CVBChunkHelper& vbChunk, int vertexCount )
: CVBBaseIterator<VERTEX>( vbChunk, vertexCount )
{
assert( sizeof( VERTEX ) == mLockedChunk.getStride() );
mData = reinterpret_cast<VERTEX*>( mLockedChunk.getRawData() );
}
operator VERTEX* const& () const { return mData; }
operator VERTEX*& () { return mData; }
private:
// disable copy
CVBChunkRawIterator( CVBChunkRawIterator const& source );
CVBChunkRawIterator& operator= ( CVBChunkRawIterator const& rhs );
private:
VERTEX* mData;
};
}; // namespace
#endif
| [
"[email protected]"
] | [
[
[
1,
101
]
]
] |
1592130c55d27821a6e4dde0b7a192a351a9c5fe | dcd98d0a6f194aebcfcea02461e59bf62146a454 | /rcsimengine/inc/chatcontactmanagerimpl_sym.h | 6f8fde1c658b5f47bafc7e0e296319adf1573457 | [] | no_license | lcsouzamenezes/oss.FCL.sf.incubator.rcschat | 736afc3b76e74baab4fd96dc4b59aed59e2b5eec | c353084f4328e7e3cce4d6d16800aae51d75ad6c | refs/heads/master | 2021-06-05T03:33:21.262762 | 2010-10-11T06:36:54 | 2010-10-11T06:36:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,023 | h | /*
* Copyright (c) 2009-2010 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:
* RCS IM Library - Initial version
*
*/
#ifndef __CHATCONTACT_MANAGER_IMPL_SYM_H__
#define __CHATCONTACT_MANAGER_IMPL_SYM_H__
#include <QObject>
#include <QList>
#include "chatinterfaces.h"
#include "qmobilityglobal.h"
#include "qcontactfilter.h"
#include "qcontactdetailfilter.h"
#include "qtcontactsglobal.h"
//SIP and MCE Specific Headers
#include <e32base.h>
#include <e32std.h>
#include <e32math.h>
#include <s32mem.h>
#include <in_sock.h>
#include <badesca.h>
#include <e32cmn.h>
#include <mcesessionobserver.h>
#include <mcemanager.h>
#include <mcetransactiondatacontainer.h>
#include <mcemessagestream.h>
#include <mceexternalsource.h>
#include <mceexternalsink.h>
#include <mcemessagesink.h>
#include <mcemessagesource.h>
#include <mcemsrpsource.h>
#include <mcemsrpsink.h>
#include <mceoutsession.h>
#include <mceinsessionobserver.h>
#include <mceinsession.h>
#include <mceDataSinkObserver.h>
#include <qcontactmanager.h>
//Profile agent, SIP stack inclusions
#include <sipprofileregistryobserver.h>
#include <sipprofile.h>
#include <sip.h>
#include <sipobserver.h>
//#include "rcschatengine_globals.h"
class TMsrpChatSession;
class CContactItem;
class ChatContactManager;
class ContactView;
QTM_BEGIN_NAMESPACE
class QContact;
class QContactDetailFilterPrivate;
QTM_END_NAMESPACE
QTM_USE_NAMESPACE
const TInt KGranularity = 12;
const TInt KAcceptSize = 24;
/* Interface implementation of MChatContactIntf */
class ChatContactManagerImpl: public QObject,
public MMceSessionObserver,
public MSIPProfileRegistryObserver, // for CSIPProfileRegistry
public MSIPObserver, // for CSIP
public MMceInSessionObserver, // for incoming sessions from MCE
public MMceDataSinkObserver
{
public:
ChatContactManagerImpl(ChatContactManager *apCntManager);
~ChatContactManagerImpl();
/* Setup MCE Manager */
RcsIMLib::RcsChatId createChatSession(QContactLocalId contactId, QString initMsg);
void closeSession(RcsIMLib::RcsChatId sessID);
void acceptIncomingSession(RcsIMLib::RcsChatId sessID);
// From MMceSessionObserver
void SessionStateChanged(CMceSession& aSession, TMceTransactionDataContainer* aContainer);
void SessionConnectionStateChanged(CMceSession& aSession, TBool aActive );
void Failed( CMceSession& aSession, TInt aError );
void UpdateFailed(CMceSession& aSession, TMceTransactionDataContainer* aContainer );
// From MSIPProfileAgentObserver
void ProfileRegistryEventOccurred(TUint32 aProfileId, TEvent aEvent);
void ProfileRegistryErrorOccurred(TUint32 aProfileId, TInt aError);
// From MSIPObserver
void IncomingRequest(TUint32 aIapId, CSIPServerTransaction* aTransaction);
void TimedOut(CSIPServerTransaction& aTransaction);
// From MMceInSessionObserver
void IncomingSession(CMceInSession* aSession, TMceTransactionDataContainer* aContainer );
void IncomingUpdate(CMceSession& aOrigSession, CMceInSession* aUpdatedSession, TMceTransactionDataContainer* aContainer );
void DataReceived(CMceMediaStream& aStream,CMceMediaSink& aSink, const TDesC8& aData);
private:
void setupMceManagerL();
RcsIMLib::RcsChatId createChatSessionL(QContactLocalId contactId, QString initMsg);
void GetStreams(CMceSession& aSession, CMceMessageStream*& aUplinkStr, CMceMessageStream*& aDownlinkStr );
private:
//Variables here
QContactManager *mManager;
ChatContactManager *mParent;
//SYM Specific Headers
CMceManager *mMceMgr;
CSIP *mSip;
CSIPProfileRegistry *mProfileReg;
CSIPProfile *mProfile;
RPointerArray<CMceSession> mMceSessions;
RPointerArray<TMsrpChatSession> mChatSessionArray;
TMceTransactionDataContainer mDataContainer;
RPointerArray<CSIPProfile> mAllprofiles;
//QList<QContact> mAllContacts;
//QList<QContact> mAllSIPContacts;
//QContactLocalId mMyID;
//QContactLocalId mMyBuddyID;
//QString mMyFirstName;
//QContactDetailFilter mFilter;
HBufC8 *mOriginatorUri;
};
#endif //__CHATCONTACT_MANAGER_IMPL_SYM_H__
| [
"none@none"
] | [
[
[
1,
148
]
]
] |
b44cdd67560b56db5b30c4421d0ee147947ac62e | 6caf1a340711c6c818efc7075cc953b2f1387c04 | /client/DlgAddProject.cpp | c3d122b6586ec25456c2f8cadb1eb3aee9c50669 | [] | no_license | lbrucher/timelis | 35c68061bea68cc31ce1c68e3adbc23cb7f930b1 | 0fa9f8f5ef28fe02ca620c441783a1ff3fc17bde | refs/heads/master | 2021-01-01T18:18:37.988944 | 2011-08-18T19:39:19 | 2011-08-18T19:39:19 | 2,229,915 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,184 | cpp | // $Id: DlgAddProject.cpp,v 1.1 2005/01/11 14:42:25 lbrucher Exp $
//
#include "stdafx.h"
#include "DlgAddProject.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgAddProject dialog
CDlgAddProject::CDlgAddProject(CWnd* pParent /*=NULL*/)
: CDialog(CDlgAddProject::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgAddProject)
m_sName = _T("");
//}}AFX_DATA_INIT
}
void CDlgAddProject::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgAddProject)
DDX_Text(pDX, IDC_NAME, m_sName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgAddProject, CDialog)
//{{AFX_MSG_MAP(CDlgAddProject)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgAddProject message handlers
BOOL CDlgAddProject::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText(m_sTitle);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
| [
"[email protected]"
] | [
[
[
1,
50
]
]
] |
996b5817d4c834e99ca7df605d0734d5ee738e5d | 6b83c731acb331c4f7ddd167ab5bb562b450d0f2 | /my_inc2/readFile.cpp | b7d09382d4f2467d4c6bfff024293579cc9a5913 | [] | no_license | weimingtom/toheart2p | fbfb96f6ca8d3102b462ba53d3c9cff16ca509e7 | 560e99c42fdff23e65f16df6d14df9a9f1868d8e | refs/heads/master | 2021-01-10T01:36:31.515707 | 2007-12-20T15:13:51 | 2007-12-20T15:13:51 | 44,464,730 | 2 | 0 | null | null | null | null | GB18030 | C++ | false | false | 14,797 | cpp |
#include "ClCommon.h"
#include <mbstring.h>
ClReadFile *readFile = NULL;
inline BOOL CopyMemOffset(void *dst, char **src, size_t size)
{
CopyMemory(dst, *src, size);
(*src) += size;
return TRUE;
}
//-------------------------------------------------------------------------
int my_strcmpi(BYTE *str1, BYTE *str2)
{
int i, len1, len2, min, diff, c[2];
min = len1 = lstrlen((LPCSTR)str1);
len2 = lstrlen((LPCSTR)str2);
if (len2 < min)
{
min = len2;
}
for (i = 0; i < min; i++)
{
c[0] = str1[i];
if (c[0] >= 0x41 && c[0] <= 0x5A)
{
c[0] += 0x20;
}
c[1] = str2[i];
if (c[1] >= 0x41 && c[1] <= 0x5A)
{
c[1] += 0x20;
}
diff = c[0] - c[1];
if (0 == diff)
{
continue;
}
return (diff);
}
return (len1 - len2);
}
//-------------------------------------------------------------------------
struct LACHEAD
{
char head[4];
int fileCnt;
};
#define Ns 4096
#define Fs 18
int ClReadFile::OpenPackFile(LPCSTR packName, int packNum)
{
int i, j;
LACHEAD head;
HANDLE handle;
DWORD rsize;
char filename[MAX_PATH];
arc_file_info arcFileInfo;
wsprintf(filename, "%s.PAK", packName);
handle = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0L, NULL);
if (INVALID_HANDLE_VALUE == handle)
{
return - 1;
}
arcFileInfo.handle = handle;
lstrcpy(arcFileInfo.dirName, packName);
ReadFile(handle, &head, sizeof(LACHEAD), &rsize, NULL);
arcFileInfo.fileCount = head.fileCnt;
arcFileInfo.pack_file = new file_info[head.fileCnt];
if (( - 1) == packNum || packNum >= openFileNum)
{
ArcFile.push_back(arcFileInfo);
}
else
{
my_deletes(ArcFile[packNum].pack_file);
ArcFile[packNum] = arcFileInfo;
}
ReadFile(handle, arcFileInfo.pack_file, sizeof(file_info) *head.fileCnt, &rsize, NULL);
for (i = 0; i < arcFileInfo.fileCount; i++)
{
for (j = 0; j < int(lstrlen(arcFileInfo.pack_file[i].fname)); j++)
{
arcFileInfo.pack_file[i].fname[j] = ~(arcFileInfo.pack_file[i].fname[j]);
}
}
if (packNum != ( - 1) && packNum < openFileNum)
{
return packNum;
}
openFileNum++;
return (openFileNum - 1);
}
//-------------------------------------------------------------------------
int ClReadFile::ReadPackFile(int arcFileNum, LPCSTR decFile, char **fileBuf)
{
int i;
#ifdef _WINDOWS
HANDLE hFile;
DWORD rsize;
int out_size;
char filename[MAX_PATH];
wsprintf(filename, "%s\\%s", ArcFile[arcFileNum].dirName, decFile);
if (GetFileAttributes(filename) == FILE_ATTRIBUTE_ARCHIVE)
{
hFile = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | MY_FILE_SCAN, NULL);
out_size = GetFileSize(hFile, NULL);
*fileBuf = (char*)cl_malloc(out_size + 1);
ReadFile(hFile, *fileBuf, out_size, &rsize, NULL);
(*fileBuf)[out_size] = '\0';
CloseHandle(hFile);
return (out_size);
}
#endif
i = SearchFile(arcFileNum, decFile, TRUE);
if (( - 1) == i)
{
return 0;
}
return (ReadPackFileNum(arcFileNum, i, fileBuf));
}
//-------------------------------------------------------------------------
//函数名: DecodePackFile
//功能: 解压缩,解码PAK文件中的源文件
//
//输入参数:
// 类型 参数名 意义
// int read_size 已读压缩加密数据大小
// BYTE* readFile 已读压缩加密数据文件指针
// char **fileBuf(输出) 解码后的文件数据
//返回值:
// int out_size 返回解压后文件大小(解压后)
int ClReadFile::DecodePackFile(int read_size, BYTE *readFile, char **fileBuf)
{
int i, j, k, r, c;
unsigned int flags;
int out_size, write_size;
unsigned char *rfP, *ofP;
unsigned char text[Ns + Fs - 1];
out_size = *(int*)readFile;
rfP = readFile + 4;
*fileBuf = (char*)cl_malloc(out_size + 1);
if (*fileBuf == NULL)
{
return 0;
}
ofP = (unsigned char*) * fileBuf;
write_size = 0;
ZeroMemory(text, Ns - Fs);
r = Ns - Fs;
flags = 0;
//解码数据
for (;;)
{
if (((flags >>= 1) &256) == 0)
{
c = *(rfP++);
read_size--;
if (read_size < 0)
{
break;
}
flags = c | 0xff00;
}
if (flags &1)
{
c = *(rfP++);
read_size--;
if (read_size < 0)
{
break;
}
*(ofP++) = c;
write_size++;
if (write_size > out_size)
{
cl_free(readFile);
cl_free(*fileBuf);
return 0;
}
text[r++] = c;
r &= (Ns - 1);
}
else
{
i = *(rfP++);
read_size--;
if (read_size < 0)
{
break;
}
j = *(rfP++);
read_size--;
if (read_size < 0)
{
break;
}
i |= ((j &0xf0) << 4);
j = (j &0x0f) + 2;
for (k = 0; k <= j; k++)
{
c = text[(i + k) &(Ns - 1)];
*(ofP++) = c;
write_size++;
if (write_size > out_size)
{
cl_free(readFile);
cl_free(*fileBuf);
return 0;
}
text[r++] = c;
r &= (Ns - 1);
}
}
}
(*fileBuf)[out_size] = 0;
return (out_size);
}
//-------------------------------------------------------------------------
//函数名: ReadPackFileNum
//功能: 根据ArcFile文件列表,用ARC文件索引号,读取文件
//
//输入参数:
// 类型 参数名 意义
// int arcFileNum arc文件号
// int num ARC的文件数(检查合法性)
// char **fileBuf(输出) 读出的文件数据
//返回值:
// int out_size 返回读出文件大小(解压后)
int ClReadFile::ReadPackFileNum(int arcFileNum, int num, char **fileBuf)
{
DWORD rsize;
int out_size;
unsigned char *readFile;
if (ArcFile[arcFileNum].fileCount <= num)
{
return 0;
}
//根据seekPoint移动文件指针
SetFilePointer(ArcFile[arcFileNum].handle, ArcFile[arcFileNum].pack_file[num].seekPoint, NULL, FILE_BEGIN);
//是否压缩过
if (ArcFile[arcFileNum].pack_file[num].bCompress == FALSE)
{
//取得要读文件的大小
out_size = ArcFile[arcFileNum].pack_file[num].pack_size;
//分配堆空间
*fileBuf = (char*)cl_malloc(out_size + 1);
//读文件
ReadFile(ArcFile[arcFileNum].handle, *fileBuf, out_size, &rsize, NULL);
(*fileBuf)[out_size] = 0;
return (out_size);
}
//处理压缩过的文件
readFile = (unsigned char*)cl_malloc(ArcFile[arcFileNum].pack_file[num].pack_size + 1);
if (readFile == NULL)
{
return 0;
}
//读取压缩文件数据到内存
ReadFile(ArcFile[arcFileNum].handle, readFile, ArcFile[arcFileNum].pack_file[num].pack_size, &rsize, NULL);
readFile[ArcFile[arcFileNum].pack_file[num].pack_size] = 0;
//解压缩文件数据
out_size = DecodePackFile(ArcFile[arcFileNum].pack_file[num].pack_size - 4, readFile, fileBuf);
cl_free(readFile);
return out_size;
}
//-------------------------------------------------------------------------
int ClReadFile::StreamOpenFile(int arcFileNum, LPCSTR decFile, int &size)
{
int i;
i = SearchFile(arcFileNum, decFile);
if (( - 1) == i)
{
return - 1;
}
return (StreamOpenFileNum(arcFileNum, i, size));
}
//-------------------------------------------------------------------------
int ClReadFile::StreamOpenFileNum(int arcFileNum, int num, int &size)
{
int stNum;
if (num >= ArcFile[arcFileNum].fileCount)
{
return - 1;
}
if (ArcFile[arcFileNum].pack_file[num].bCompress)
{
return - 1;
}
for (stNum = 0; stNum < ArcFile[arcFileNum].streamMax; stNum++)
{
if (0 > ArcFile[arcFileNum].streamInfo[stNum].num)
{
ArcFile[arcFileNum].streamInfo[stNum].num = num;
ArcFile[arcFileNum].streamInfo[stNum].seekPoint = ArcFile[arcFileNum].pack_file[num].seekPoint;
break;
}
}
if (stNum == ArcFile[arcFileNum].streamMax)
{
stream_info streamInfo;
streamInfo.num = num;
streamInfo.seekPoint = ArcFile[arcFileNum].pack_file[num].seekPoint;
ArcFile[arcFileNum].streamInfo.push_back(streamInfo);
ArcFile[arcFileNum].streamMax++;
}
size = ArcFile[arcFileNum].pack_file[num].pack_size;
return stNum;
}
//-------------------------------------------------------------------------
ClResult ClReadFile::StreamCloseFile(int arcFileNum, int streamNum)
{
if (streamNum >= ArcFile[arcFileNum].streamMax || 0 == ArcFile[arcFileNum].streamMax)
{
return Cl_FILE_NOTFOUND;
}
if (streamNum == (ArcFile[arcFileNum].streamMax - 1))
{
ArcFile[arcFileNum].streamInfo.pop_back();
ArcFile[arcFileNum].streamMax--;
}
else
{
ArcFile[arcFileNum].streamInfo[streamNum].num = - 1;
}
return Cl_OK;
}
//-------------------------------------------------------------------------
int ClReadFile::StreamReadFile(int arcFileNum, int streamNum, char *read_buf, int size)
{
DWORD rsize;
int fileEnd;
if (streamNum >= ArcFile[arcFileNum].streamMax || 0 > ArcFile[arcFileNum].streamInfo[streamNum].num)
{
return 0;
}
if (Cl_FILE_SEEK_ERROR == StreamSeekFile(arcFileNum, streamNum, 0, FILE_CURRENT))
{
return 0;
}
fileEnd = ArcFile[arcFileNum].pack_file[ArcFile[arcFileNum].streamInfo[streamNum].num].seekPoint +
ArcFile[arcFileNum].pack_file[ArcFile[arcFileNum].streamInfo[streamNum].num].pack_size;
if ((ArcFile[arcFileNum].streamInfo[streamNum].seekPoint + size) > fileEnd)
{
size = fileEnd - ArcFile[arcFileNum].streamInfo[streamNum].seekPoint;
}
ReadFile(ArcFile[arcFileNum].handle, read_buf, size, &rsize, NULL);
ArcFile[arcFileNum].streamInfo[streamNum].seekPoint += rsize;
return rsize;
}
//-------------------------------------------------------------------------
ClResult ClReadFile::StreamSeekFile(int arcFileNum, int streamNum, int seekSize, int moveMethod)
{
DWORD ret, seekPoint;
switch (moveMethod)
{
case (FILE_CURRENT): seekPoint = ArcFile[arcFileNum].streamInfo[streamNum].seekPoint + seekSize;
break;
case (FILE_BEGIN): seekPoint = ArcFile[arcFileNum].pack_file[ArcFile[arcFileNum].streamInfo[streamNum].num].seekPoint
+ seekSize;
break;
case (FILE_END): seekPoint = ArcFile[arcFileNum].pack_file[ArcFile[arcFileNum].streamInfo[streamNum].num].seekPoint +
ArcFile[arcFileNum].pack_file[ArcFile[arcFileNum].streamInfo[streamNum].num].pack_size + seekSize;
break;
}
ret = SetFilePointer(ArcFile[arcFileNum].handle, seekPoint, NULL, FILE_BEGIN);
if (ret == 0xffffffff)
{
return Cl_FILE_SEEK_ERROR;
}
ArcFile[arcFileNum].streamInfo[streamNum].seekPoint = seekPoint;
return Cl_OK;
}
//-------------------------------------------------------------------------
ClResult ClReadFile::ExtractFile(int arcFileNum, LPCSTR decFile, LPCSTR newFile)
{
char *fileBuf;
DWORD Size, wSize;
Size = ReadPackFile(arcFileNum, decFile, &fileBuf);
if (0 == Size)
{
return Cl_FILE_NOTFOUND;
}
HANDLE fh = CreateFile(newFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, NULL);
if (INVALID_HANDLE_VALUE == fh)
{
return Cl_CANNOT_CREATFILE;
}
WriteFile(fh, fileBuf, Size, &wSize, NULL);
CloseHandle(fh);
cl_free(fileBuf);
return Cl_OK;
}
//-------------------------------------------------------------------------
char *ClReadFile::GetFileName(int arcFileNum, int num)
{
if (num >= ArcFile[arcFileNum].fileCount)
{
return NULL;
}
return (ArcFile[arcFileNum].pack_file[num].fname);
}
//-------------------------------------------------------------------------
ClReadFile::ClReadFile()
{
int i;
ArcFile.reserve(15);
for (i = 0; i < 15; i++)
{
ArcFile[i].handle = NULL;
ArcFile[i].fileCount = 0;
ArcFile[i].pack_file = NULL;
}
openFileNum = 0;
}
//-------------------------------------------------------------------------
ClReadFile::~ClReadFile()
{
int i;
for (i = 0; i < openFileNum; i++)
{
CloseHandle(ArcFile[i].handle);
delete ArcFile[i].pack_file;
}
}
//-------------------------------------------------------------------------
//函数名: SearchFile
//功能: 查找音乐文件
//
//输入参数:
// 类型 参数名 意义
// int arcFileNum 文件索引号
// LPCSTR decFile 在PAK文件中要查找的文件名
// BOOL errCheck 是否Debug
//返回值:
// 无
int ClReadFile::SearchFile(int arcFileNum, LPCSTR decFile, BOOL errCheck)
{
int i, j;
int min, max;
i = ArcFile[arcFileNum].fileCount / 2;
min = 0;
max = ArcFile[arcFileNum].fileCount;
while (0 != (j = my_strcmpi((BYTE*)ArcFile[arcFileNum].pack_file[i].fname, (BYTE*)decFile)))
{
if (j < 0)
{
if (min == i)
{
i = - 1;
break;
}
min = i;
}
else
{
if (max == i)
{
i = - 1;
break;
}
max = i;
}
i = (max + min) / 2;
}
if (( - 1) == i)
{
#ifdef _DEBUG
if (errCheck)
{
MessageBox(NULL, decFile, "ファイルオープンエラー", MB_OK | MB_ICONERROR);
}
#endif _DEBUG
}
return i;
}
//-------------------------------------------------------------------------
int ClReadFile::SequentialSearchFile(int arcFileNum, LPCSTR decFile)
{
for (int i = 0; i < ArcFile[arcFileNum].fileCount; i++)
{
if (_stricmp(ArcFile[arcFileNum].pack_file[i].fname, decFile) == 0)
{
break;
}
}
if (i == ArcFile[arcFileNum].fileCount)
{
return - 1;
}
return i;
}
//-------------------------------------------------------------------------
int ReadPackFileFromMem(char *decFile, char *packMem, char **fileBuf)
{
int i, j, min, max, out_size = 0;
LACHEAD head;
file_info *pack_file;
char *tmpMem = packMem;
CopyMemOffset(&head, &tmpMem, sizeof(LACHEAD));
pack_file = new file_info[head.fileCnt];
CopyMemOffset(pack_file, &tmpMem, sizeof(file_info) *head.fileCnt);
for (i = 0; i < head.fileCnt; i++)
{
for (j = 0; j < int(lstrlen(pack_file[i].fname)); j++)
{
pack_file[i].fname[j] = ~(pack_file[i].fname[j]);
}
}
i = head.fileCnt / 2;
min = 0;
max = head.fileCnt;
while (0 != (j = _stricmp(pack_file[i].fname, decFile)))
{
if (j < 0)
{
if (min == i)
{
i = - 1;
break;
}
min = i;
}
else
{
if (max == i)
{
i = - 1;
break;
}
max = i;
}
i = (max + min) / 2;
}
if (( - 1) == i){
}
else
{
tmpMem = packMem + pack_file[i].seekPoint;
if (0 == pack_file[i].bCompress)
{
out_size = pack_file[i].pack_size;
*fileBuf = (char*)cl_malloc(out_size + 1);
CopyMemory(*fileBuf, tmpMem, out_size);
(*fileBuf)[out_size] = 0;
}
else
{
out_size = readFile->DecodePackFile(pack_file[i].pack_size - 4, (LPBYTE)tmpMem, fileBuf);
}
}
delete [] pack_file;
return out_size;
}
| [
"pspbter@13f3a943-b841-0410-bae6-1b2c8ac2799f"
] | [
[
[
1,
642
]
]
] |
bd5f6be716acaeaf3dd74dc7f7c079c151140dd0 | 33d2272f0af4d08cb3b20e81f2ece571b2c7e131 | /PeopleCoutning/PeopleCoutning/HeadDetect.h | 4fe535d84f33dfbb1722a8f133828bf5cd69385b | [] | no_license | mscreolo/huy-khanh-people-counting | 776b66e44b7881d1dc9a24b0d4b9361e99aa30ca | 5875d54e28eb86b8f127e1fc94c61cb7795c7bdf | refs/heads/master | 2016-09-15T20:43:32.200996 | 2011-10-26T03:07:40 | 2011-10-26T03:07:40 | 33,321,132 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,547 | h |
#pragma once
#include <stdio.h>
#include <tchar.h>
#include <cv.h>
#include <highgui.h>
#include <math.h>
#include <iostream>
#include <string.h>
#include <vector>
#include "Gauss.h"
class HeadDetect
{
public:
CvRect rect;
IplImage* image;
IplImage* res;
//CvContour* seqContour;
CvSeq * contours;
HeadDetect(CvRect Rect, IplImage* Image)
{
rect = Rect;
image = Image;
}
HeadDetect(IplImage* Image)
{
image = Image;
}
HeadDetect()
{
}
~HeadDetect()
{
}
int getHairColor( CvRect rect);
int getContour(CvRect rect);
void convertImage();
};
int HeadDetect::getHairColor(CvRect rect)
{
Gauss* g = new Gauss();
g->LoadData("GaussModel.txt");
//IplImage* tpl = cvLoadImage("2.jpg",CV_LOAD_IMAGE_COLOR);
int img_width, img_height;;
int tpl_width, tpl_height;
int res_width, res_height;
if( image == 0 ) {
fprintf( stderr, "Cannot load file %s!\n");
//return 1;
}
//res = cvCreateImage( cvSize(image->width, image->height), IPL_DEPTH_32F, 1 );
//cvMatchTemplate( image, tpl, res, CV_TM_SQDIFF_NORMED );
IplImage* temp = cvLoadImage("1.jpg",1);
//res = g.Detect(image);
res = g->Classify(image, -6.5);
cvShowImage("res sau khi classify",res);
int number = getContour(rect);
return number;
};
int HeadDetect::getContour(CvRect rect)
{
CvMemStorage* storage;
storage = cvCreateMemStorage(0);
if((rect.height > res->height)&&(rect.width > res->width))
{
return 0;
}
cvSetImageROI(res, rect);
//cvShowImage("res ban dau`",res);
IplImage* cropRes = cvCreateImage(cvGetSize(res),res->depth,res->nChannels);
cvCopy(res,cropRes,NULL);
//cvShowImage("cropRes", cropRes);
IplImage* res2 = cvCreateImage( cvGetSize(res), 8, 1 );
cvThreshold(cropRes,cropRes,0.5,1,CV_THRESH_BINARY_INV);
//cvShowImage("res sau",res);
cvConvertScale(cropRes,res2);
CvContourScanner scanner = cvStartFindContours(res2,storage,sizeof(CvContour), CV_RETR_EXTERNAL);
contours = cvFindNextContour(scanner);
int numb = cvFindContours(res2,storage,&contours,sizeof(CvContour),CV_RETR_EXTERNAL,CV_CHAIN_APPROX_NONE);
contours = cvFindNextContour(scanner);
IplImage* cc = cvCreateImage(cvGetSize(res),res->depth,res->nChannels);
contours = cvEndFindContours(&scanner);
cvDrawContours(cc, contours, CV_RGB(255,0,0), CV_RGB(0,255,0),1,1,CV_AA, cvPoint(0,0) );
cvShowImage("drawImage",cc);
cvResetImageROI(res);
cvReleaseMemStorage(&storage);
return numb;
}
| [
"[email protected]@ead409af-2641-a09c-7308-cf4d77c96f99",
"[email protected]@ead409af-2641-a09c-7308-cf4d77c96f99"
] | [
[
[
1,
1
],
[
13,
13
],
[
15,
16
],
[
25,
25
],
[
35,
35
],
[
38,
38
],
[
42,
44
],
[
46,
46
],
[
49,
49
],
[
51,
56
],
[
60,
70
],
[
72,
72
],
[
77,
77
],
[
80,
88
],
[
93,
93
],
[
95,
97
],
[
99,
100
],
[
103,
104
],
[
106,
113
],
[
118,
123
]
],
[
[
2,
12
],
[
14,
14
],
[
17,
24
],
[
26,
34
],
[
36,
37
],
[
39,
41
],
[
45,
45
],
[
47,
48
],
[
50,
50
],
[
57,
59
],
[
71,
71
],
[
73,
76
],
[
78,
79
],
[
89,
92
],
[
94,
94
],
[
98,
98
],
[
101,
102
],
[
105,
105
],
[
114,
117
]
]
] |
0641aace09e68e394b52f9310dae840b5317b488 | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /Common/Models/SEPAR1/CNTRFG1.H | 01cba95d73c03b2468a1fdaf7ae75129c7430443 | [] | no_license | abcweizhuo/Test3 | 0f3379e528a543c0d43aad09489b2444a2e0f86d | 128a4edcf9a93d36a45e5585b70dee75e4502db4 | refs/heads/master | 2021-01-17T01:59:39.357645 | 2008-08-20T00:00:29 | 2008-08-20T00:00:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,376 | h | //================== SysCAD - Copyright Kenwalt (Pty) Ltd ===================
// $Nokeywords: $
//===========================================================================
// SysCAD Copyright Kenwalt (Pty) Ltd 1992 - 1996
#ifndef __CNTRFG1_H
#define __CNTRFG1_H
#ifndef __SC_DEFS_H
#include "sc_defs.h"
#endif
#ifndef __M_SURGE_H
#include "m_surge.h"
#endif
#ifndef __GSMODEL_H
#include "gsmodel.h"
#endif
#ifdef __CNTRFG1_CPP
#define DllImportExport DllExport
#else
#define DllImportExport
#endif
// ==========================================================================
//XID xidCntrfugeSpill = ModelXID(1000);
XID xidMoistAnal = ModelXID(1001);
const byte CSF_SolRec = 0x01;
const byte CSF_CentConc = 0x02;
const byte CSF_SolidAnal = 0x04;
const byte CSF_MoistAnal = 0x08;
//const byte CSF_SolidConc = 0x10;
DEFINE_TAGOBJ(Centrifuge1);
class DllImportExport Centrifuge1 : public MN_Surge
{
public:
byte iMeth;
//byte iSolCalc;
//byte iUFCalc;
double Reqd_SolConc; // Solids flow solids at 25 dC
double Reqd_SolMFrac; // Solids flow mass fraction
double Reqd_SolRec; // Fraction of solids reporting to Solids;
double Reqd_CenConc; // Centrate solids at 25 dC
//double Reqd_UQVol; // Underflow Volumetric Flowrate
double SolFlwFrac; // Ratio of actual solids flow to solids flow capacity
double CenFlwFrac; // Ratio of actual solids flow to centrate flow capacity
double ActCakeSolids;
double ActCentrateSolids;
double ActCakeSolConc;
double ActCentrateSolConc;
flag bTrackStatus;
Centrifuge1(pTagObjClass pClass_, pchar TagIn, pTaggedObject pAttach, TagObjAttachment eAttach);
virtual ~Centrifuge1();
virtual void BuildDataDefn(DataDefnBlk & DDB);
virtual flag DataXchg(DataChangeBlk & DCB);
virtual flag ValidateData(ValidateDataBlk & VDB);
virtual void EvalJoinPressures(long JoinMask);
virtual void EvalProducts(CNodeEvalIndex & NEI);
DEFINE_CI(Centrifuge1, MN_Surge, 4);
private:
};
//===========================================================================
#undef DllImportExport
#endif
| [
"[email protected]",
"[email protected]"
] | [
[
[
1,
62
],
[
64,
74
]
],
[
[
63,
63
]
]
] |
7a1bb6068c8be5779e1c291e74dedfd8c25725e1 | f6529b63d418f7d0563d33e817c4c3f6ec6c618d | /source/menu/menu_configsnd.cpp | ce162d1a3c605a756ee5a5d31041ed1f186cf49e | [] | no_license | Captnoord/Wodeflow | b087659303bc4e6d7360714357167701a2f1e8da | 5c8d6cf837aee74dc4265e3ea971a335ba41a47c | refs/heads/master | 2020-12-24T14:45:43.854896 | 2011-07-25T14:15:53 | 2011-07-25T14:15:53 | 2,096,630 | 1 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 11,783 | cpp |
#include "menu.hpp"
#include "oggplayer.h"
#include <wiiuse/wpad.h>
#include <mp3player.h>
using namespace std;
static const int g_curPage = 4;
void CMenu::_hideConfigSnd(bool instant)
{
m_btnMgr.hide(m_configLblTitle, instant);
m_btnMgr.hide(m_configBtnBack, instant);
m_btnMgr.hide(m_configLblPage, instant);
m_btnMgr.hide(m_configBtnPageM, instant);
m_btnMgr.hide(m_configBtnPageP, instant);
//
m_btnMgr.hide(m_configSndLblBnrVol, instant);
m_btnMgr.hide(m_configSndLblBnrVolVal, instant);
m_btnMgr.hide(m_configSndBtnBnrVolP, instant);
m_btnMgr.hide(m_configSndBtnBnrVolM, instant);
m_btnMgr.hide(m_configSndLblMusicVol, instant);
m_btnMgr.hide(m_configSndLblMusicVolVal, instant);
m_btnMgr.hide(m_configSndBtnMusicVolP, instant);
m_btnMgr.hide(m_configSndBtnMusicVolM, instant);
m_btnMgr.hide(m_configSndLblGuiVol, instant);
m_btnMgr.hide(m_configSndLblGuiVolVal, instant);
m_btnMgr.hide(m_configSndBtnGuiVolP, instant);
m_btnMgr.hide(m_configSndBtnGuiVolM, instant);
m_btnMgr.hide(m_configSndLblCFVol, instant);
m_btnMgr.hide(m_configSndLblCFVolVal, instant);
m_btnMgr.hide(m_configSndBtnCFVolP, instant);
m_btnMgr.hide(m_configSndBtnCFVolM, instant);
for (u32 i = 0; i < ARRAY_SIZE(m_configSndLblUser); ++i)
if (m_configSndLblUser[i] != -1u)
m_btnMgr.hide(m_configSndLblUser[i], instant);
}
void CMenu::_showConfigSnd(void)
{
_setBg(m_configSndBg, m_configSndBg);
m_btnMgr.show(m_configLblTitle);
m_btnMgr.show(m_configBtnBack);
m_btnMgr.show(m_configLblPage);
m_btnMgr.show(m_configBtnPageM);
m_btnMgr.show(m_configBtnPageP);
//
m_btnMgr.show(m_configSndLblBnrVol);
m_btnMgr.show(m_configSndLblBnrVolVal);
m_btnMgr.show(m_configSndBtnBnrVolP);
m_btnMgr.show(m_configSndBtnBnrVolM);
m_btnMgr.show(m_configSndLblMusicVol);
m_btnMgr.show(m_configSndLblMusicVolVal);
m_btnMgr.show(m_configSndBtnMusicVolP);
m_btnMgr.show(m_configSndBtnMusicVolM);
m_btnMgr.show(m_configSndLblGuiVol);
m_btnMgr.show(m_configSndLblGuiVolVal);
m_btnMgr.show(m_configSndBtnGuiVolP);
m_btnMgr.show(m_configSndBtnGuiVolM);
m_btnMgr.show(m_configSndLblCFVol);
m_btnMgr.show(m_configSndLblCFVolVal);
m_btnMgr.show(m_configSndBtnCFVolP);
m_btnMgr.show(m_configSndBtnCFVolM);
for (u32 i = 0; i < ARRAY_SIZE(m_configSndLblUser); ++i)
if (m_configSndLblUser[i] != -1u)
m_btnMgr.show(m_configSndLblUser[i]);
//
m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", g_curPage, m_locked ? g_curPage : CMenu::_nbCfgPages));
m_btnMgr.setText(m_configSndLblGuiVolVal, wfmt(L"%i", m_cfg.getInt(" GENERAL", "sound_volume_gui", 255)));
m_btnMgr.setText(m_configSndLblCFVolVal, wfmt(L"%i", m_cfg.getInt(" GENERAL", "sound_volume_coverflow", 255)));
m_btnMgr.setText(m_configSndLblMusicVolVal, wfmt(L"%i", m_cfg.getInt(" GENERAL", "sound_volume_music", 255)));
m_btnMgr.setText(m_configSndLblBnrVolVal, wfmt(L"%i", m_cfg.getInt(" GENERAL", "sound_volume_bnr", 255)));
}
int CMenu::_configSnd(void)
{
s32 padsState;
WPADData *wd;
u32 btn;
int nextPage = 0;
int repeatButton = 0;
u32 buttonHeld = (u32)-1;
bool repeat;
int step = 1;
_showConfigSnd();
while (true)
{
WPAD_ScanPads();
padsState = WPAD_ButtonsDown(0);
wd = WPAD_Data(0);
btn = _btnRepeat(wd->btns_h);
if ((padsState & (WPAD_BUTTON_HOME | WPAD_BUTTON_B)) != 0)
break;
if (wd->ir.valid)
m_btnMgr.mouse(wd->ir.x - m_cur.width() / 2, wd->ir.y - m_cur.height() / 2);
else if ((padsState & WPAD_BUTTON_UP) != 0)
m_btnMgr.up();
else if ((padsState & WPAD_BUTTON_DOWN) != 0)
m_btnMgr.down();
++repeatButton;
if ((wd->btns_h & WPAD_BUTTON_A) == 0)
{
buttonHeld = (u32)-1;
step = 1;
}
else if (buttonHeld != (u32)-1 && buttonHeld == m_btnMgr.selected() && repeatButton >= 16 && (repeatButton % 2 == 0))
padsState |= WPAD_BUTTON_A;
if ((padsState & WPAD_BUTTON_MINUS) != 0 || ((padsState & WPAD_BUTTON_A) != 0 && m_btnMgr.selected() == m_configBtnPageM))
{
nextPage = max(1, m_locked ? 1 : g_curPage - 1);
m_btnMgr.click(m_configBtnPageM);
break;
}
if (!m_locked && ((padsState & WPAD_BUTTON_PLUS) != 0 || ((padsState & WPAD_BUTTON_A) != 0 && m_btnMgr.selected() == m_configBtnPageP)))
{
nextPage = min(g_curPage + 1, CMenu::_nbCfgPages);
m_btnMgr.click(m_configBtnPageP);
break;
}
repeat = false;
if ((padsState & WPAD_BUTTON_A) != 0)
{
m_btnMgr.click();
if (m_btnMgr.selected() == m_configBtnBack)
break;
else if (m_btnMgr.selected() == m_configSndBtnBnrVolP)
{
m_cfg.setInt(" GENERAL", "sound_volume_bnr", min(m_cfg.getInt(" GENERAL", "sound_volume_bnr", 255) + step, 255));
_showConfigSnd();
m_bnrSndVol = m_cfg.getInt(" GENERAL", "sound_volume_bnr", 255);
repeat = true;
}
else if (m_btnMgr.selected() == m_configSndBtnBnrVolM)
{
m_cfg.setInt(" GENERAL", "sound_volume_bnr", max(m_cfg.getInt(" GENERAL", "sound_volume_bnr", 255) - step, 0));
_showConfigSnd();
m_bnrSndVol = m_cfg.getInt(" GENERAL", "sound_volume_bnr", 255);
repeat = true;
}
else if (m_btnMgr.selected() == m_configSndBtnGuiVolP)
{
m_cfg.setInt(" GENERAL", "sound_volume_gui", min(m_cfg.getInt(" GENERAL", "sound_volume_gui", 255) + step, 255));
_showConfigSnd();
m_btnMgr.setSoundVolume(m_cfg.getInt(" GENERAL", "sound_volume_gui", 255));
repeat = true;
}
else if (m_btnMgr.selected() == m_configSndBtnGuiVolM)
{
m_cfg.setInt(" GENERAL", "sound_volume_gui", max(m_cfg.getInt(" GENERAL", "sound_volume_gui", 255) - step, 0));
_showConfigSnd();
m_btnMgr.setSoundVolume(m_cfg.getInt(" GENERAL", "sound_volume_gui", 255));
repeat = true;
}
else if (m_btnMgr.selected() == m_configSndBtnMusicVolP)
{
m_cfg.setInt(" GENERAL", "sound_volume_music", min(m_cfg.getInt(" GENERAL", "sound_volume_music", 255) + step, 255));
_showConfigSnd();
SetVolumeOgg(m_cfg.getInt(" GENERAL", "sound_volume_music", 255));
MP3Player_Volume(m_cfg.getInt(" GENERAL", "sound_volume_music", 255));
repeat = true;
}
else if (m_btnMgr.selected() == m_configSndBtnMusicVolM)
{
m_cfg.setInt(" GENERAL", "sound_volume_music", max(m_cfg.getInt(" GENERAL", "sound_volume_music", 255) - step, 0));
_showConfigSnd();
SetVolumeOgg(m_cfg.getInt(" GENERAL", "sound_volume_music", 255));
MP3Player_Volume(m_cfg.getInt(" GENERAL", "sound_volume_music", 255));
repeat = true;
}
else if (m_btnMgr.selected() == m_configSndBtnCFVolP)
{
m_cfg.setInt(" GENERAL", "sound_volume_coverflow", min(m_cfg.getInt(" GENERAL", "sound_volume_coverflow", 255) + step, 255));
_showConfigSnd();
m_cf.setSoundVolume(m_cfg.getInt(" GENERAL", "sound_volume_coverflow", 255));
repeat = true;
}
else if (m_btnMgr.selected() == m_configSndBtnCFVolM)
{
m_cfg.setInt(" GENERAL", "sound_volume_coverflow", max(m_cfg.getInt(" GENERAL", "sound_volume_coverflow", 255) - step, 0));
_showConfigSnd();
m_cf.setSoundVolume(m_cfg.getInt(" GENERAL", "sound_volume_coverflow", 255));
repeat = true;
}
if (repeat && m_btnMgr.selected() != buttonHeld)
{
repeatButton = 0;
buttonHeld = m_btnMgr.selected();
step = 8;
}
}
_mainLoopCommon(wd);
}
_hideConfigSnd();
return nextPage;
}
void CMenu::_initConfigSndMenu(CMenu::SThemeData &theme)
{
_addUserLabels(theme, m_configSndLblUser, ARRAY_SIZE(m_configSndLblUser), "CONFIGSND");
m_configSndBg = _texture(theme.texSet, "CONFIGSND/BG", "texture", theme.bg);
m_configSndLblMusicVol = _addLabel(theme, "CONFIGSND/MUSIC_VOL", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblMusicVolVal = _addLabel(theme, "CONFIGSND/MUSIC_VOL_BTN", theme.btnFont, L"", 426, 130, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnMusicVolM = _addPicButton(theme, "CONFIGSND/MUSIC_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 130, 56, 56);
m_configSndBtnMusicVolP = _addPicButton(theme, "CONFIGSND/MUSIC_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_configSndLblGuiVol = _addLabel(theme, "CONFIGSND/GUI_VOL", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblGuiVolVal = _addLabel(theme, "CONFIGSND/GUI_VOL_BTN", theme.btnFont, L"", 426, 190, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnGuiVolM = _addPicButton(theme, "CONFIGSND/GUI_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 190, 56, 56);
m_configSndBtnGuiVolP = _addPicButton(theme, "CONFIGSND/GUI_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_configSndLblCFVol = _addLabel(theme, "CONFIGSND/CF_VOL", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblCFVolVal = _addLabel(theme, "CONFIGSND/CF_VOL_BTN", theme.btnFont, L"", 426, 250, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnCFVolM = _addPicButton(theme, "CONFIGSND/CF_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 250, 56, 56);
m_configSndBtnCFVolP = _addPicButton(theme, "CONFIGSND/CF_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_configSndLblBnrVol = _addLabel(theme, "CONFIGSND/BNR_VOL", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblBnrVolVal = _addLabel(theme, "CONFIGSND/BNR_VOL_BTN", theme.btnFont, L"", 426, 310, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnBnrVolM = _addPicButton(theme, "CONFIGSND/BNR_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 310, 56, 56);
m_configSndBtnBnrVolP = _addPicButton(theme, "CONFIGSND/BNR_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
//
_setHideAnim(m_configSndLblMusicVol, "CONFIGSND/MUSIC_VOL", 100, 0, -2.f, 0.f);
_setHideAnim(m_configSndLblMusicVolVal, "CONFIGSND/MUSIC_VOL_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_configSndBtnMusicVolM, "CONFIGSND/MUSIC_VOL_MINUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_configSndBtnMusicVolP, "CONFIGSND/MUSIC_VOL_PLUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_configSndLblGuiVol, "CONFIGSND/GUI_VOL", 100, 0, -2.f, 0.f);
_setHideAnim(m_configSndLblGuiVolVal, "CONFIGSND/GUI_VOL_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_configSndBtnGuiVolM, "CONFIGSND/GUI_VOL_MINUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_configSndBtnGuiVolP, "CONFIGSND/GUI_VOL_PLUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_configSndLblCFVol, "CONFIGSND/CF_VOL", 100, 0, -2.f, 0.f);
_setHideAnim(m_configSndLblCFVolVal, "CONFIGSND/CF_VOL_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_configSndBtnCFVolM, "CONFIGSND/CF_VOL_MINUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_configSndBtnCFVolP, "CONFIGSND/CF_VOL_PLUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_configSndLblBnrVol, "CONFIGSND/BNR_VOL", 100, 0, -2.f, 0.f);
_setHideAnim(m_configSndLblBnrVolVal, "CONFIGSND/BNR_VOL_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_configSndBtnBnrVolM, "CONFIGSND/BNR_VOL_MINUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_configSndBtnBnrVolP, "CONFIGSND/BNR_VOL_PLUS", 0, 0, 1.f, -1.f);
_hideConfigSnd(true);
_textConfigSnd();
}
void CMenu::_textConfigSnd(void)
{
m_btnMgr.setText(m_configSndLblMusicVol, _t("cfgs1", L"Music volume"));
m_btnMgr.setText(m_configSndLblGuiVol, _t("cfgs2", L"GUI sound volume"));
m_btnMgr.setText(m_configSndLblCFVol, _t("cfgs3", L"Coverflow sound volume"));
m_btnMgr.setText(m_configSndLblBnrVol, _t("cfgs4", L"Game sound volume"));
}
| [
"[email protected]@a6d911d2-2a6f-2b2f-592f-0469abc2858f"
] | [
[
[
1,
247
]
]
] |
c8411abc3a4635289db2c3c0cd5214a2c9d10a86 | 15fc90dea35740998f511319027d9971bae9251c | /UnINI/cPatchINI/cPatchINI.cpp | 0bb793f965880545da3ac12abd18f2173e71bf38 | [] | no_license | ECToo/switch-soft | c35020249be233cf1e35dc18b5c097894d5efdb4 | 5edf2cc907259fb0a0905fc2c321f46e234e6263 | refs/heads/master | 2020-04-02T10:15:53.067883 | 2009-05-29T15:13:23 | 2009-05-29T15:13:23 | 32,216,312 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,091 | cpp | // ============================================================================
// cPatcIINI.cpp : Defines the entry point for the console application.
// ============================================================================
#include "stdafx.h"
#include "PatchINI\PatchINIStatic.h"
// ============================================================================
// main
// ============================================================================
int main(int argc, const char* argv[])
{
if( argc < 4 || argc > 5 )
{
cout << "usage: <merge file> <base file> <result file> <optional flags>" << endl;
return 1;
}
int result = 1;
int flags = 0;
char errorstr[1024];
if( argc == 5 )
flags = atoi(argv[4]);
result = PatchINIMerge(argv[1], argv[2], argv[3], flags, errorstr, sizeof(errorstr));
if( result != 0 )
cout << errorstr << endl;
return result;
}
// ============================================================================
// EOF
// ============================================================================ | [
"roman.dzieciol@e6f6c67e-47ec-11de-80ae-c1ff141340a0"
] | [
[
[
1,
37
]
]
] |
75c951e8bdb4b92ff5aec4dcc3442505102502aa | e354a51eef332858855eac4c369024a7af5ff804 | /buffer.cpp | 6007fdb47f05b97091d7eea71858e00d6fce4e49 | [] | no_license | cjus/msgCourierLite | 0f9c1e05b71abf820c55f74a913555eec2267bb4 | 9efc1d54737ba47620a03686707b31b1eeb61586 | refs/heads/master | 2020-04-05T22:41:39.141740 | 2010-09-05T18:43:12 | 2010-09-05T18:43:12 | 887,172 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,553 | cpp | /* buffer.cpp
Copyright (C) 2002 Carlos Justiniano
buffer.cpp 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.
buffer.cpp was developed by Carlos Justiniano for use on the
ChessBrain Project (http://www.chessbrain.net) and is now 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 buffer.cpp; if not, write to the Free Software Foundation, Inc.,
675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
The cBuffer class provides memory buffer and string handling
functionality
@file buffer.cpp
@brief Memory buffer class
@author Carlos Justiniano
@attention Copyright (C) 2002 Carlos Justiniano, GNU GPL Licence.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include <memory.h>
#define MEMALLOC "Unable to allocate memory"
#define THROW(reason)\
{ char _bufferException[1024];\
sprintf(_bufferException, "%s in %s:%d", reason, (char*)__FILE__, __LINE__);\
throw _bufferException; }
#include "buffer.h"
cBuffer::cBuffer()
: m_pBuffer(0)
, m_iBufferSize(0)
, m_iTail(0)
{
m_minAlloc = 32;
m_midAlloc = 256;
}
cBuffer::~cBuffer()
{
Flush();
}
void cBuffer::SetMemAlgo(int minAlloc, int midAlloc)
{
m_minAlloc = minAlloc;
m_midAlloc = midAlloc;
}
/**
* Sets the size of the internal buffer
* @param iSize size of new buffer in bytes
* @return BUFFER_NO_ERROR
* @throw MEMALLOC memory allocation error
*/
int cBuffer::SetBufferSize(int iSize)
{
int iRet = BUFFER_NO_ERROR;
// if buffer already exist
if (m_pBuffer != NULL)
{
// and if buffer is smaller then size of new buffer
if (iSize >= m_iBufferSize)
{
// create a new buffer and copy the contents of the old
// buffer into it.
iSize = AdjustSize(iSize);
char *pBuffer = (char*)malloc(iSize);
if (pBuffer != NULL)
{
//printf("malloc called for size of %d in cBuffer.cpp\n",
// iSize);
memcpy(pBuffer, m_pBuffer, m_iBufferSize);
free(m_pBuffer);
// When done , remap internal buffer pointer (m_pBuffer)
// to newly created buffer.
m_pBuffer = pBuffer;
m_iBufferSize = iSize;
}
else
{
THROW(MEMALLOC);
}
}
}
else
{
// buffer doesn't already exist so let's create it
iSize = AdjustSize(iSize);
m_pBuffer = (char*)malloc(iSize);
if (m_pBuffer == NULL)
{
THROW(MEMALLOC);
}
else
{
//printf("malloc called for size of %d in cBuffer.cpp\n",
// iSize);
m_iBufferSize = iSize;
m_iTail = 0;
}
}
return iRet;
}
/**
* Limits (truncates) the size of the internal buffer
* @param iSize new size of buffer
* @return BUFFER_NO_ERROR
* @throw MEMALLOC memory allocation error
* @note calls SetBufferSize()
*/
int cBuffer::SetBufferLength(int iSize)
{
int iRet;
iRet = SetBufferSize(iSize);
if (iRet == BUFFER_NO_ERROR)
m_iTail = iSize;
return iRet;
}
/**
* Retrieve the buffer size
* @return buffer size in bytes
*/
int cBuffer::GetBufferSize()
{
return m_iBufferSize;
}
/**
* Retrieve the true internal buffer size
* @return buffer size in bytes
*/
int cBuffer::GetBufferCount()
{
return m_iTail;
}
/**
* Deletes the internal buffer.
* @note This function is automatically called
* on object destruction.
*/
void cBuffer::Flush()
{
if (m_pBuffer != NULL)
{
free(m_pBuffer);
m_pBuffer = NULL;
}
m_iBufferSize = 0;
m_iTail = 0;
}
/**
* Resets the length of the buffer to zero without deleting the memory
* block.
*/
void cBuffer::Reset()
{
m_iTail = 0;
}
/**
* Returns a null terminated string pointer based on the length of the
* buffer.
* @return a null terminated point to the internal buffer
* @warning The buffer may already have nulls inside of it
* because this class represents memory buffers.
*/
cBuffer::operator char*()
{
if (m_pBuffer == 0)
return 0;
m_pBuffer[m_iTail] = 0;
return m_pBuffer;
}
/**
* Returns a null terminated string const pointer based on the length
* of the buffer.
* @return a null terminated const string
* @warning The buffer may already have nulls inside of it
* because this class represents memory buffers.
*/
cBuffer::operator const char*()
{
if (m_pBuffer == 0)
return 0;
m_pBuffer[m_iTail] = 0;
return m_pBuffer;
}
/**
* Returns a null terminated string pointer based on the length
* of the buffer.
* @return a null terminated point to the internal buffer
* @warning The buffer may already have nulls inside of it
* because this class represents memory buffers.
*/
char *cBuffer::cstr()
{
if (m_pBuffer == 0)
return 0;
m_pBuffer[m_iTail] = 0;
return m_pBuffer;
}
const char *cBuffer::c_str()
{
if (m_pBuffer == 0)
return 0;
m_pBuffer[m_iTail] = 0;
return m_pBuffer;
}
/**
* Returns a null terminated string pointer based on the length
* of the buffer.
* @return a null terminated point to the internal buffer
* @warning The buffer may already have nulls inside of it
* because this class represents memory buffers.
* See ReleaseBuffer()
*/
void *cBuffer::GetBuffer()
{
if (m_pBuffer == 0)
return 0;
m_pBuffer[m_iTail] = 0;
return m_pBuffer;
}
/**
* The complement of the GetBuffer() function.
* @warning The this call resets the internal length of the buffer
* based on the first occurence of a null in the buffer.
*/
void cBuffer::ReleaseBuffer()
{
m_iTail = strlen(m_pBuffer);
}
/**
* Get a raw (not null-terminated) buffer
* @return a pointer to the internal buffer
* @note this function does not try to return a null terminated string
*/
void *cBuffer::GetRawBuffer()
{
if (m_pBuffer == 0)
return 0;
return m_pBuffer;
}
/**
* Removes data starting at iIndex for the length of iLength
* @param iIndex starting index in buffer starting at zero
* @param iLength size in bytes of region to remove
* @return returns BUFFER_NO_ERROR on success or
* BUFFER_REGION_OUTOFBOUNDS if an invalid region is
* specified.
* @note The actual internal buffer is not reallocated
*/
int cBuffer::Remove(int iIndex, int iLength)
{
if (m_iTail == 0)
return BUFFER_IS_EMPTY;
int iRet = BUFFER_NO_ERROR;
int iLen = (iLength > m_iBufferSize) ? m_iBufferSize : iLength;
int iOffset = iIndex;
int iCalcOffset = iLen + iOffset;
// validate region
if (iLen == 0 || iCalcOffset > m_iBufferSize)
return BUFFER_REGION_OUTOFBOUNDS;
if (m_iTail != iCalcOffset)
memmove(&m_pBuffer[iOffset], &m_pBuffer[iCalcOffset], m_iTail - iCalcOffset);
m_iTail -= iLen;
return iRet;
}
/**
* Insert data into a buffer
* @param iIndex Starting location inside of buffer
* @param pData Pointer to data that will be copied
* @param iLength Length of data to be inserted
* @return BUFFER_NO_ERROR
* @throw MEMALLOC memory allocation error
*/
int cBuffer::Insert(int iIndex, const char *pData, int iLength)
{
int iRet = BUFFER_NO_ERROR;
if (iLength == -1)
iLength = strlen(pData);
int iNewSize = iLength+m_iTail+1;
if (iNewSize > m_iBufferSize)
{
// we don't have enough room in the buffer
// so we must create it
iNewSize = AdjustSize(iNewSize);
char *pBuffer = (char*)malloc(iNewSize+1);
if (pBuffer == NULL)
THROW(MEMALLOC);
memcpy(&pBuffer[iIndex+iLength], &m_pBuffer[iIndex], m_iTail-iIndex);
memcpy(&pBuffer[iIndex], (void*)pData, iLength);
if (iIndex != 0)
{
memcpy(&pBuffer[0], &m_pBuffer[0], iIndex);
}
free(m_pBuffer);
m_pBuffer = pBuffer;
m_iBufferSize = iNewSize;
}
else
{
// we have enough room in the buffer
memmove(&m_pBuffer[iIndex+iLength], &m_pBuffer[iIndex], m_iTail-iIndex);
memcpy(&m_pBuffer[iIndex], pData, iLength);
}
m_iTail += iLength;
MakeString();
return iRet;
}
/**
* Append data to buffer
* @param pData Pointer to data that will be copied
* @param iLen Length of data to append
* @return BUFFER_PARAM_INVALID if pData is NULL or BUFFER_NO_ERROR
* @throw MEMALLOC memory allocation error
*/
int cBuffer::Append(char *pData, int iLen)
{
if (iLen == 0)
return 0;
if (pData == 0)
return BUFFER_PARAM_INVALID;
if (iLen == -1)
iLen = strlen(pData);
int iRet = BUFFER_NO_ERROR;
if (iLen >= (m_iBufferSize-m_iTail))
{
// ok, it is.. so compute the new buffer size as being
// the size of the SrcBuffer minus the size of the space
// we have available, plus our buffer's size.
int iNewSize = iLen -
(m_iBufferSize - m_iTail) +
m_iBufferSize;
SetBufferSize(iNewSize);
}
memcpy(&m_pBuffer[m_iTail], pData, iLen);
m_iTail += iLen;
MakeString();
return iRet;
}
/**
* Prepend data into buffer
* @param pData Pointer to data that will be copied
* @param iSize Size of data to prepend
* @return BUFFER_PARAM_INVALID if pData is NULL or BUFFER_NO_ERROR
* @throw MEMALLOC memory allocation error
*/
int cBuffer::Prepend(char *pData, int iSize)
{
if (pData == 0)
return BUFFER_PARAM_INVALID;
if (iSize == -1)
iSize = strlen(pData);
return Insert(0, pData, iSize);
}
int cBuffer::ReplaceWith(char *pData, int iSize)
{
int iRet;
if (pData == 0)
{
Reset();
return BUFFER_NO_ERROR;
}
if (iSize == -1)
iSize = strlen(pData);
Reset();
iRet = Append(pData, iSize);
return iRet;
}
int cBuffer::Truncate(int iCount)
{
m_iTail -= iCount;
return BUFFER_NO_ERROR;
}
int cBuffer::Find(char *pszText, int iOffset)
{
if (m_iTail == 0)
return -1;
MakeString();
int iPos;
char *ploc = strstr(&m_pBuffer[iOffset], pszText);
if (ploc != 0)
iPos = (ploc - m_pBuffer);
else
iPos = -1;
return iPos;
}
int cBuffer::BinaryFind(int index, unsigned char *pPattern, int patternlen)
{
if (m_iTail == 0 || index > m_iTail)
return -1;
unsigned char *pData = (unsigned char*)m_pBuffer+index;
int datalen = m_iTail;
int i,j,k;
i = 0;
while (i < datalen)
{
j = 0;
k = i;
while (j < patternlen)
{
if (pPattern[j] == pData[i])
{
j++;
i++;
continue;
}
break;
}
if (j == patternlen)
return k+index;
i = k+1;
}
return -1;
}
int cBuffer::CopyBetween(char *pPattern1, char *pPattern2, cBuffer &intoBuffer)
{
int iStart, iEnd;
intoBuffer.Reset();
iStart = Find(pPattern1,0);
if (iStart == -1)
return -1;
iEnd = Find(pPattern2, iStart+1);
if (iEnd == 1)
return -1;
iStart += strlen(pPattern1);
intoBuffer.ReplaceWith(m_pBuffer+iStart, iEnd-iStart);
intoBuffer.MakeString();
return 0;
}
int cBuffer::MakeString()
{
if (m_pBuffer)
m_pBuffer[m_iTail] = 0;
return 0;
}
int cBuffer::StringLen()
{
return m_iTail;
}
int cBuffer::IsEmpty()
{
return (m_iTail == 0) ? 1 : 0;
}
unsigned int cBuffer::HashKey()
{
char *pKey = m_pBuffer;
unsigned int iHash = 0;
int i;
for (i=0; i < m_iTail; i++)
{
iHash = (iHash<<5) + iHash + *pKey++;
}
return iHash;
}
void cBuffer::Crypto(char *pszKey)
{
char val;
char *pKey = pszKey;
char *pBuffer = m_pBuffer;
for (int i = 0; i < m_iTail; i++, pBuffer++, pKey++)
{
// rotate key if we reach its end
// warning: assumes key is null terminated string
if (!*(pKey))
pKey = pszKey;
val = (*pBuffer ^ *pKey ^ (char)i);
*pBuffer = val;
}
}
int cBuffer::FindChar(char ch, int iStart)
{
bool f = false;
int i;
for (i = iStart; i < m_iTail; i++)
{
if (m_pBuffer[i] == ch)
{
f = true;
break;
}
}
return (f==true) ? i : -1;
}
int cBuffer::ReverseFindChar(char ch, int iStart)
{
int end = (iStart == -1) ? m_iTail : iStart;
int i;
for (i = end; i > -1; i--)
{
if (m_pBuffer[i] == ch)
break;
}
return i;
}
char cBuffer::operator[](int idx)
{
if (idx >= 0 && idx < m_iTail)
return m_pBuffer[idx];
return 0;
}
char* cBuffer::operator[](char *pPattern)
{
return strstr(m_pBuffer, pPattern);
}
int cBuffer::Replace(char *pPattern, char *with)
{
int iStart = Find(pPattern,0);
if (iStart == -1)
return BUFFER_REPLACE_FAILED;
int ilen = strlen(pPattern);
Remove(iStart, ilen);
Insert(iStart, with, strlen(with));
return BUFFER_NO_ERROR;
}
int cBuffer::ReplaceAll(char *pPattern, char *with)
{
int idx = 0;
int iPatternLen = strlen(pPattern);
int iWithLen = strlen(with);
while ((idx = Find(pPattern, idx)) != -1)
{
Remove(idx, iPatternLen);
Insert(idx, with, iWithLen);
idx += iWithLen;
}
return 0;
}
int cBuffer::Sprintf(int iBufferSize, char *pformat, ...)
{
va_list argptr;
int n;
SetBufferSize(iBufferSize);
char *p = (char*)GetBuffer();
if (p == 0)
return 0;
iBufferSize = GetBufferSize();
va_start(argptr, pformat);
n = vsprintf(p, (const char*)pformat, argptr);
p[n] = 0;
va_end(argptr);
ReleaseBuffer();
MakeString();
return StringLen();
}
void cBuffer::ToUpper()
{
int ichar;
for (int i=0; i < m_iTail; i++)
{
ichar = m_pBuffer[i];
if (ichar > 96 && ichar < 123)
{
m_pBuffer[i] = _toupper(ichar);
}
}
}
void cBuffer::ToLower()
{
int ichar;
for (int i=0; i < m_iTail; i++)
{
ichar = m_pBuffer[i];
if (ichar > 64 && ichar < 91)
{
m_pBuffer[i] = _tolower(ichar);
}
}
}
int cBuffer::Cleanup()
{
ReplaceAll("\t","");
ReplaceAll("\r","");
ReplaceAll("\n","");
if (m_pBuffer == 0)
return 0;
int i;
int j = 0;
for (i=0; i< (int)strlen(m_pBuffer); i++)
{
if (m_pBuffer[i]==' ')
{
j++;
}
else
{
break;
}
}
if (j != 0)
Remove(0,j);
j = 0;
for (i=strlen(m_pBuffer)-1; i>-1; i--)
{
if (m_pBuffer[i]==' ')
{
j++;
}
else
{
break;
}
}
if (j != 0)
Truncate(j);
MakeString();
return 0;
}
int cBuffer::AdjustSize(int iSize)
{
iSize += sizeof(long);
if (iSize <= m_minAlloc)
iSize = m_minAlloc;
else if (iSize > m_minAlloc && iSize < m_midAlloc)
iSize = (iSize * 3) / 2;
return iSize;
}
| [
"[email protected]"
] | [
[
[
1,
698
]
]
] |
5bb46eb22fdafd2bd7fb4655dac82489d8e46621 | b738fc6ffa2205ea210d10c395ae47b25ba26078 | /TUDT/src/MsgFragMonitor.cpp | 965a17ac6d8d62ea1beba871306b2e106e14ba5f | [] | no_license | RallyWRT/ppsocket | d8609233df9bba8d316a85a3d96919b8618ea4b6 | b4b0b16e2ceffe8a697905b1ef1aeb227595b110 | refs/heads/master | 2021-01-19T16:23:26.812183 | 2009-09-23T06:57:58 | 2009-09-23T06:57:58 | 35,471,076 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 902 | cpp | #include ".\msgfragmonitor.h"
MsgFragMonitor::MsgFragMonitor(void)
{
m_currId = 1;
}
MsgFragMonitor::~MsgFragMonitor(void)
{
}
int MsgFragMonitor::CreateMsg()
{
CGuard tmpGuard(m_ConnMutex.GetMutex());
m_mapMsgID[m_currId] = std::set<int>();
return m_currId++;
}
void MsgFragMonitor::AddMsgFrag( int msgId,int fragId )
{
CGuard tmpGuard(m_ConnMutex.GetMutex());
std::set<int> &setFrag = m_mapMsgID[msgId];
setFrag.insert(fragId);
}
std::pair<bool,int> MsgFragMonitor::OnFragACK( int fragId )
{
CGuard tmpGuard(m_ConnMutex.GetMutex());
std::map<int, std::set<int> >::iterator it = m_mapMsgID.begin();
for (;it!=m_mapMsgID.end();it++)
{
std::set<int> &setFrag = (*it).second;
if(setFrag.erase(fragId)>0)
{
int id = (*it).first;
m_mapMsgID.erase(it);
return std::pair<bool,int>(true,id);
}
}
return std::pair<bool,int>(false,0);
} | [
"tantianzuo@159e4f46-9839-11de-8efd-97b2a7529d09"
] | [
[
[
1,
41
]
]
] |
86442b7c6d82766b789d92c04567a6dea6a07166 | 102e18e7d3b93bad03faedb5381caa2cdc2bdba4 | /sports.h | c8d31816ed8bfc751c3b09c4a9aa9079d5e73e03 | [] | no_license | oyvsi/ooprog-prosjekt | 60b9785ef95d37b2d939c24dd3d9caa30f64b3b8 | d9782e81127dc218023d0c4fc9a05062d8f99569 | refs/heads/master | 2020-05-26T08:28:47.693083 | 2011-04-25T15:12:43 | 2011-04-25T15:12:43 | 42,719,617 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 702 | h | /* SPORTS.H
*/
#ifndef __SPORTS_H
#define __SPORTS_H
#include <fstream>
#include "listtool2.h"
class Sport; // Forward declaration
using namespace std;
class Sports {
private:
List* sportlist;
Sport* get_sport();
public:
Sports();
~Sports();
void new_sport();
void remove_sport();
void read_file();
bool read_results(istream* infile, bool update);
void write_results(ostream* outfile);
void write_file();
void display();
void add_division();
void lists(char valg); //Valg == K || Valg == L
void remove_division();
void remove_player(int player_no);
void write_top_ten();
void write_team();
void edit_team();
};
#endif
| [
"eirik.skogstad@f2b5e8df-77c0-03c4-f9aa-19f8674c883b",
"[email protected]",
"[email protected]"
] | [
[
[
1,
4
],
[
23,
23
],
[
25,
26
],
[
31,
31
],
[
33,
33
],
[
38,
38
]
],
[
[
5,
9
],
[
11,
16
],
[
18,
22
],
[
24,
24
],
[
27,
30
],
[
36,
37
]
],
[
[
10,
10
],
[
17,
17
],
[
32,
32
],
[
34,
35
]
]
] |
d9b34f5af1d1c8194f8c2139cca900c92c7fadc3 | 1033609e705e0b432f8a0760d32befa92c2b9cb5 | /branches/0.5/toolrunner/toolrunner.cpp | 23e19f3167399d60f7741456806cabc66b0357e5 | [] | no_license | BackupTheBerlios/cb-svn-svn | 5b89c2c5445cf7a51575cf08c0eaaf832074b266 | 6b512f58bbb56fbc186ca26d5c934e1fe83173af | refs/heads/master | 2020-04-02T00:14:00.063607 | 2005-10-26T13:52:08 | 2005-10-26T13:52:08 | 40,614,579 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,194 | cpp | // This file is part of the Code::Blocks SVN Plugin
// Copyright (C) 2005 Thomas Denk
//
// This program is licensed 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.
//
// $HeadURL$
// $Id$
#include "precompile.h"
const wxEventType EVT_WX_SUCKS = wxNewEventType();
PipedProcess* ToolRunner::cb_process = 0;
Process* ToolRunner::process = 0;
BEGIN_EVENT_TABLE(ToolRunner, wxEvtHandler)
EVT_TIMER(-1, ToolRunner::OnTimer)
EVT_PIPEDPROCESS_STDOUT(ID_PROCESS, ToolRunner::OnOutput)
EVT_PIPEDPROCESS_STDERR(ID_PROCESS, ToolRunner::OnError)
EVT_PIPEDPROCESS_TERMINATED(ID_PROCESS, ToolRunner::OnTerminated)
END_EVENT_TABLE()
int ToolRunner::RunBlocking(const wxString& cmd)
{
assert(!exec.IsEmpty());
assert(!cmd.IsEmpty());
Finish();
currentJob.Clear();
process = new Process(); // make Running() return true
wxString runCommand(exec + " " + cmd);
wxString oldLang;
wxString oldSvnSsh;
wxString oldCvsRsh;
SaveEnvironment();
SetEnvironment();
if ( wxExecute(runCommand, wxEXEC_ASYNC, process) == 0 )
{
Log::Instance()->Red("Execution failed.");
Log::Instance()->Red("Command: " + runCommand);
exec_error = true;
delete process;
process = 0;
RestoreEnvironment();
return -1;
}
RestoreEnvironment();
timer.Start(250); // This is a parachute. There should never really be a single timer event.
while(process->Running())
wxTheApp->Yield(true);
timer.Stop();
lastExitCode = process->exitCode;
if(lastExitCode)
{
blob = ::GetStringFromArray(process->std_err, wxEmptyString);
out = ::GetStringFromArray(process->std_err, "\n");
}
else
{
blob = ::GetStringFromArray(process->std_out, wxEmptyString);
out = ::GetStringFromArray(process->std_out, "\n");
}
std_out = process->std_out;
std_err = process->std_err;
delete process;
process = 0;
return lastExitCode;
};
int ToolRunner::RunJob(Job *theJob, bool insert_first)
{
if(insert_first)
{
jobQueue.push_front(newJob);
}
else
{
jobQueue.push_back(newJob);
}
Finish();
if(!implicit_run)
RunQueue();
insert_first = false;
implicit_run = false;
return 0;
};
int ToolRunner::RunAsync(const wxString& cmd, const wxString& cwd)
{
assert(!exec.IsEmpty());
assert(!cmd.IsEmpty());
std_out.Empty();
std_err.Empty();
blob.Empty();
Log::Instance()->Add(cmd);
cb_process = new PipedProcess((void**)&cb_process, this, ID_PROCESS, true, cwd);
SaveEnvironment();
SetEnvironment();
pid = wxExecute(cmd, wxEXEC_ASYNC, cb_process);
RestoreEnvironment();
if (!pid)
{
Log::Instance()->Red("Execution failed.");
Log::Instance()->Red("Command: " + cmd);
exec_error = true;
delete cb_process;
cb_process = 0;
wxCommandEvent e(EVT_WX_SUCKS, TRANSACTION_FAILURE);
plugin->AddPendingEvent(e);
return -1;
}
timer.Start(100);
return 0;
};
void ToolRunner::RunAgain()
{
QueueAgain();
RunQueue();
};
void ToolRunner::RunQueue()
{
if(!jobQueue.empty())
{
currentJob = jobQueue[0];
jobQueue.pop_front();
RunAsync(currentJob.commandline, currentJob.cwd);
}
};
void ToolRunner::RunBlind(const wxString& cmd)
{
BogusProcess *proc = new BogusProcess();
wxString runCommand(exec + " " + cmd);
wxExecute(runCommand, wxEXEC_ASYNC, proc);
};
void ToolRunner::OnTimer(wxTimerEvent& event)
{
if (cb_process)
((PipedProcess*)cb_process)->HasInput();
if(process)
process->FlushPipe();
}
void ToolRunner::OnOutput(CodeBlocksEvent& event)
{
wxString msg(event.GetString());
std_out.Add(msg);
if(((SubversionPlugin*)plugin)->verbose && !currentJob.verb.IsSameAs("info"))
Log::Instance()->Grey(msg);
}
void ToolRunner::OnError(CodeBlocksEvent& event)
{
wxString msg(event.GetString());
std_err.Add(msg);
Log::Instance()->Grey(msg);
}
void ToolRunner::OnTerminated(CodeBlocksEvent& event)
{
lastExitCode = event.GetInt();
timer.Stop();
if(std_err.Count())
{
blob = ::GetStringFromArray(std_err, wxEmptyString);
out = ::GetStringFromArray(std_err, "\n");
}
else
{
blob = ::GetStringFromArray(std_out, wxEmptyString);
out = ::GetStringFromArray(std_out, "\n");
}
OutputHandler();
}
void ToolRunner::Fail()
{
wxCommandEvent e(EVT_WX_SUCKS, TRANSACTION_FAILURE);
e.SetExtraLong(currentJob.runnerType);
e.SetString(currentJob.verb);
plugin->AddPendingEvent(e);
};
void ToolRunner::Succeed()
{
wxCommandEvent e(EVT_WX_SUCKS, TRANSACTION_SUCCESS);
e.SetExtraLong(currentJob.runnerType);
e.SetString(currentJob.verb);
plugin->AddPendingEvent(e);
};
void ToolRunner::Send(int cmd)
{
wxCommandEvent e(EVT_WX_SUCKS, cmd);
e.SetExtraLong(currentJob.runnerType);
plugin->AddPendingEvent(e);
};
| [
"thomasdenk@96b225bb-4cfa-0310-88f5-88b948d20ad7"
] | [
[
[
1,
235
]
]
] |
bc11c77e5deb4e586d5d1dcb3f0abb14ebb011f5 | 7a310d01d1a4361fd06b40a74a2afc8ddc23b4d3 | /src_plugin/PluginMaking/TmpFavGroup/StdAfx.cpp | 5645d7e8fe7eeee72aaa5eefad011746e67b0970 | [] | no_license | plus7/DonutG | b6fec6111d25b60f9a9ae5798e0ab21bb2fa28f6 | 2d204c36f366d6162eaf02f4b2e1b8bc7b403f6b | refs/heads/master | 2020-06-01T15:30:31.747022 | 2010-08-21T18:51:01 | 2010-08-21T18:51:01 | 767,753 | 1 | 2 | null | null | null | null | SHIFT_JIS | C++ | false | false | 286 | cpp | // stdafx.cpp : 標準インクルードファイルを含むソース ファイル
// TmpFavGroup.pch : 生成されるプリコンパイル済ヘッダー
// stdafx.obj : 生成されるプリコンパイル済タイプ情報
#include "stdafx.h"
| [
"[email protected]"
] | [
[
[
1,
8
]
]
] |
42235bba597e2c6677a8f257d3542213f157a844 | 9907be749dc7553f97c9e51c5f35e69f55bd02c0 | /april5/framework code & project/audio.cpp | f47c6940b341f8af85841bc380bb2b6c835b775c | [] | no_license | jdeering/csci476winthrop | bc8907b9cc0406826de76aca05e6758810377813 | 2bc485781f819c8fd82393ac86de33404e7ad6d3 | refs/heads/master | 2021-01-10T19:53:14.853438 | 2009-04-24T14:26:36 | 2009-04-24T14:26:36 | 32,223,762 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,651 | cpp | #include "audio.h"
/******************************************************
Default Constructor
******************************************************/
Audio::Audio()
{
playing = false;
loop = false;
sample = NULL;
}
/******************************************************
Default Destructor
******************************************************/
Audio::~Audio()
{
playing = false;
loop = false;
destroy_sample(sample);
}
/******************************************************
Constructor
@param sam Allegro audio SAMPLE associated with the object.
@param loops Sets the loop flag
******************************************************/
Audio::Audio(SAMPLE* sam, bool loops)
{
sample = sam;
loop = loops;
Stop();
}
/******************************************************
Loads the sample at the specified file location.
@param file Path to the audio file to load.
@param loops Sets the loop flag
******************************************************/
void Audio::LoadSample(char *file, bool loops)
{
sample = load_sample(file);
loop = loops;
}
/******************************************************
Stops the sample if it is currently playing.
******************************************************/
void Audio::Stop()
{
stop_sample(sample);
playing = false;
}
/******************************************************
Plays the sample at the specified volume.
@param volume The volume at which to play the sample (0 to 255).
@return The voice the sample is being played on.
******************************************************/
int Audio::Play(int volume)
{
if(loop)
{
if(!playing)
{
playing = true;
return play_sample(sample, volume, PAN, FREQ, loop);
}
return 0;
}
else
return play_sample(sample, volume, PAN, FREQ, loop);
}
/******************************************************
Resets the playing sample at the specified volume.
@param volume The volume to change the sample to (0 to 255).
******************************************************/
void Audio::ResetVolume(int volume)
{
adjust_sample(sample, volume, PAN, FREQ, loop);
}
/******************************************************
Resets the loop flag and volume of a playing sample.
@param volume The volume to change the sample to (0 to 255).
@param set_loop Zero to not loop, non-zero to loop.
******************************************************/
void Audio::ResetLoopFlag(int volume, int set_loop)
{
if(set_loop != 0)
loop = true;
else
loop = false;
adjust_sample(sample, volume, PAN, FREQ, loop);
} | [
"lcairco@2656ef14-ecf4-11dd-8fb1-9960f2a117f8"
] | [
[
[
1,
102
]
]
] |
5d811c9b6a347b6b58b6a02f6a360024d461a91e | 4497c10f3b01b7ff259f3eb45d0c094c81337db6 | /Zooming/ContentBasedZooming/MinMax.cpp | 9663c737151ae50312a04b36ef069ba5f6f08ab1 | [] | no_license | liuguoyou/retarget-toolkit | ebda70ad13ab03a003b52bddce0313f0feb4b0d6 | d2d94653b66ea3d4fa4861e1bd8313b93cf4877a | refs/heads/master | 2020-12-28T21:39:38.350998 | 2010-12-23T16:16:59 | 2010-12-23T16:16:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 47 | cpp | #include "StdAfx.h"
#include "MinMax.h"
| [
"kidphys@aeedd7dc-6096-11de-8dc1-e798e446b60a"
] | [
[
[
1,
4
]
]
] |
0108cac57f476a92c6fd2ad5ae4a317a42240401 | 4a266d6931aa06a2343154cab99d8d5cfdac6684 | /csci4041/assign5/Graph.h | ace6f5ca366687f7bcb5d379d7feb8512d4f494e | [] | no_license | Magneticmagnum/robotikdude-school | f0185feb6839ad5c5324756fc86f984fce7abdc1 | cb39138b500c8bbc533e796225588439dcfa6555 | refs/heads/master | 2021-01-10T19:01:39.479621 | 2011-05-17T04:44:47 | 2011-05-17T04:44:47 | 35,382,573 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,886 | h | #ifndef GRAPH_H_
#define GRAPH_H_
#include <string>
#include <iostream>
#include <cstdlib>
class Graph
{
public:
class Edge;
class Vertex;
private:
// number of vertexes
int n;
// number of edges
int m;
// vertex weight, size n
// int* v_wgt;
// start point of each edge list, size n+1
int* x_adj;
// edge list, size m
int* adj;
// edge weight, size m
int* adj_wgt;
// same as v_wgt
Graph::Vertex* vertexes_;
// same as adj and adj_wgt combined
Graph::Edge* edges_;
public:
virtual ~Graph()
{
free (x_adj);
free (adj);
free (adj_wgt);
free (vertexes_);
free (edges_);
}
static Graph* build(const std::string& file);
// size of graph, number of vertexes
int size();
Graph::Vertex& getVertex(const int v);
Graph::Edge& getEdge(const int v, const int u);
Graph::Vertex& operator[](const int i);
void print()
{
int start = 0;
for (int i = 0; i < m; i++) {
if (i >= x_adj[start + 1])
start++;
std::cout << start << " " << adj[i] << " " << adj_wgt[i] << std::endl;
}
}
};
class Graph::Edge
{
private:
int edge_;
Graph* self_;
public:
Edge(int e, Graph* self);
int getWeight();
Graph::Vertex& followArrow();
operator int() const;
};
class Graph::Vertex
{
private:
int vertex_;
Graph* self_;
public:
Vertex(int v, Graph* self);
int id();
int getWeight();
Graph::Edge* getEdges();
int getNumEdges();
// returns the number of edges leaving this vertex
int size();
Graph::Edge& operator[](const int i);
operator int() const;
bool operator==(const Graph::Vertex& v);
};
#endif /* GRAPH_H_ */
| [
"robotikdude@e80761d0-8fc2-79d0-c9d0-3546e327c268"
] | [
[
[
1,
102
]
]
] |
e1862daa939c58f9ddff76025ec88c1efe8d3230 | ca1eec7f5a6382b133a45f7c50ff4b838484c159 | /II Proyecto (13 de dic)/btree.h | 4ff5677e0943b9db00509e6f6725183ac4f3cc37 | [] | no_license | josecastellanos/OrganizaciondeArchivos_Watchmen | 7e55c587c11fd11cd8c4e9b3ddea6f5a6d920c90 | d2621ada6d53da3a1530c3cc20f00502b680b242 | refs/heads/master | 2021-01-01T17:00:58.384806 | 2010-12-13T15:25:35 | 2010-12-13T15:25:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,426 | h | #ifndef BTREE_H
#define BTREE_H
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include "avl.h"
#include <QTextEdit>
using namespace std;
const int maxLlaves = 256;
const int maxApuntadores = maxLlaves + 1;
class entry
{
public:
entry()
{
id=-1;
rrn=-1;
}
long id;
int rrn;// protocolo
};
class nodoB
{
public:
nodoB()
{
for(int i=0; i<maxApuntadores; i++)
{
if(i<maxLlaves)
{
llavesPrimarias[i].id=-1;
llavesPrimarias[i].rrn=-1;
}
apuntadores[i]=-1;
}
cuantos=0;
}
entry llavesPrimarias[maxLlaves];
int apuntadores[maxApuntadores];
int cuantos;
};
const int blocksize=sizeof(nodoB);
class btree
{
public:
btree(char *_name, QTextEdit *log);
void create(int cuantos);
void add(long id, int rrn);
int addRecursiva(unsigned char *m, int cuantos, int pos, long id, int rrn, entry &promo, int &newp);
entry search(long id);
private:
entry searchRecursivo(int pos, long id);
void split(unsigned char *m, int cuantos, entry key, int rrn, nodoB &temp, entry &promo, int &newp, nodoB &newtemp);
void clear(entry *a, int *b);
fstream disco;
QString name;
QTextEdit *log;
};
#endif // BTREE_H
| [
"[email protected]"
] | [
[
[
1,
69
]
]
] |
e443fee3f7608168409f8debc26950c35a98a070 | 478570cde911b8e8e39046de62d3b5966b850384 | /apicompatanamdw/bcdrivers/os/ossrv/stdlibs/apps/libpthread/testconddestroy/src/tconddestroyserver.cpp | 2c07920a564ad79cd294dc5c414ac285eba80ce3 | [] | 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 | 3,530 | cpp | /*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
#include <c32comm.h>
#if defined (__WINS__)
#define PDD_NAME _L("ECDRV")
#else
#define PDD_NAME _L("EUART1")
#define PDD2_NAME _L("EUART2")
#define PDD3_NAME _L("EUART3")
#define PDD4_NAME _L("EUART4")
#endif
#define LDD_NAME _L("ECOMM")
/**
* @file
*
* Pipe test server implementation
*/
#include "tconddestroyserver.h"
#include "tconddestroy.h"
_LIT(KServerName, "tconddestroy");
CConddestroyTestServer* CConddestroyTestServer::NewL()
{
CConddestroyTestServer *server = new(ELeave) CConddestroyTestServer();
CleanupStack::PushL(server);
server->ConstructL(KServerName);
CleanupStack::Pop(server);
return server;
}
static void InitCommsL()
{
TInt ret = User::LoadPhysicalDevice(PDD_NAME);
User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
#ifndef __WINS__
ret = User::LoadPhysicalDevice(PDD2_NAME);
ret = User::LoadPhysicalDevice(PDD3_NAME);
ret = User::LoadPhysicalDevice(PDD4_NAME);
#endif
ret = User::LoadLogicalDevice(LDD_NAME);
User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
ret = StartC32();
User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
}
LOCAL_C void MainL()
{
// Leave the hooks in for platform security
#if (defined __DATA_CAGING__)
RProcess().DataCaging(RProcess::EDataCagingOn);
RProcess().SecureApi(RProcess::ESecureApiOn);
#endif
//InitCommsL();
CActiveScheduler* sched=NULL;
sched=new(ELeave) CActiveScheduler;
CActiveScheduler::Install(sched);
CConddestroyTestServer* server = NULL;
// Create the CTestServer derived server
TRAPD(err, server = CConddestroyTestServer::NewL());
if(!err)
{
// Sync with the client and enter the active scheduler
RProcess::Rendezvous(KErrNone);
sched->Start();
}
delete server;
delete sched;
}
/**
* Server entry point
* @return Standard Epoc error code on exit
*/
TInt main()
{
__UHEAP_MARK;
CTrapCleanup* cleanup = CTrapCleanup::New();
if(cleanup == NULL)
{
return KErrNoMemory;
}
TRAP_IGNORE(MainL());
delete cleanup;
__UHEAP_MARKEND;
return KErrNone;
}
CTestStep* CConddestroyTestServer::CreateTestStep(const TDesC& aStepName)
{
CTestStep* testStep = NULL;
// This server creates just one step but create as many as you want
// They are created "just in time" when the worker thread is created
// install steps
if(aStepName == KTestCond447)
{
testStep = new CTestConddestroy(aStepName);
}
if(aStepName == KTestCond448)
{
testStep = new CTestConddestroy(aStepName);
}
if(aStepName == KTestCond449)
{
testStep = new CTestConddestroy(aStepName);
}
if(aStepName == KTestCond450)
{
testStep = new CTestConddestroy(aStepName);
}
if(aStepName == KTestCond451)
{
testStep = new CTestConddestroy(aStepName);
}
if(aStepName == KTestCond651)
{
testStep = new CTestConddestroy(aStepName);
}
if(aStepName == KTestCond674)
{
testStep = new CTestConddestroy(aStepName);
}
return testStep;
}
| [
"none@none"
] | [
[
[
1,
150
]
]
] |
54a85b36d7e0ffa5b728542e2902b7698392878b | b5ab57edece8c14a67cc98e745c7d51449defcff | /Captain's Log/MainGame/Source/States/CGameWinState.cpp | 70007e58b3c9ad0727f39be069a59a6fff0b9d50 | [] | no_license | tabu34/tht-captainslog | c648c6515424a6fcdb628320bc28fc7e5f23baba | 72d72a45e7ea44bdb8c1ffc5c960a0a3845557a2 | refs/heads/master | 2020-05-30T15:09:24.514919 | 2010-07-30T17:05:11 | 2010-07-30T17:05:11 | 32,187,254 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,150 | cpp | #include "precompiled_header.h"
#include "CGameWinState.h"
#include "..\CGame.h"
#include "..\SGD Wrappers\CSGD_TextureManager.h"
#include "..\SGD Wrappers\CSGD_DirectInput.h"
#include "..\Managers\\MovementControl.h"
#include "CMainMenuState.h"
CGameWinState::CGameWinState()
{
}
CGameWinState::~CGameWinState()
{
}
CGameWinState* CGameWinState::GetInstance()
{
static CGameWinState instance;
return &instance;
}
void CGameWinState::Enter()
{
m_nBGImage = CSGD_TextureManager::GetInstance()->LoadTexture(CGame::GetInstance()->GraphicsPath("gamewin.png").c_str());
}
void CGameWinState::Exit()
{
CSGD_TextureManager::GetInstance()->UnloadTexture(m_nBGImage);
}
bool CGameWinState::Input()
{
if(CSGD_DirectInput::GetInstance()->KeyPressed(DIK_RETURN))
{
CGame::GetInstance()->ChangeState( CMainMenuState::GetInstance() );
}
CMovementControl::GetInstance()->Input();
return true;
}
void CGameWinState::Update(float fElapsedTime)
{
}
void CGameWinState::Render()
{
CSGD_TextureManager::GetInstance()->Draw(m_nBGImage, 0, 0);
CMovementControl::GetInstance()->RenderCursor();
} | [
"notserp007@34577012-8437-c882-6fb8-056151eb068d"
] | [
[
[
1,
54
]
]
] |
c2bf2ccaef79b58c3b950a9f3032c2e81ee8ecb3 | 12ea67a9bd20cbeed3ed839e036187e3d5437504 | /winxgui/Tools/Dev/kscomm/osl/callfunc/CallDll/StdAfx.cpp | 846c6fab0cd3783e4ca03605522849840b501e0d | [] | no_license | cnsuhao/winxgui | e0025edec44b9c93e13a6c2884692da3773f9103 | 348bb48994f56bf55e96e040d561ec25642d0e46 | refs/heads/master | 2021-05-28T21:33:54.407837 | 2008-09-13T19:43:38 | 2008-09-13T19:43:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 205 | cpp | // stdafx.cpp : source file that includes just the standard includes
// CallDll.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
| [
"[email protected]@86f14454-5125-0410-a45d-e989635d7e98"
] | [
[
[
1,
6
]
]
] |
ea07ce1e2f8b196bd1e95f36b43ac426d6a95f32 | 6ec6ebbd57752e179c3c74cb2b5d2d3668e91110 | /rsase/SGBag/src/noyau/Element.h | 1a3147ad0448ecd878e34810cb44242469c4651a | [] | no_license | padenot/usdp | 6e0562a18d2124f1970fb9f2029353c92fdc4fb4 | a3ded795e323e5a2e475ade08839b0f2f41b192b | refs/heads/master | 2016-09-05T15:24:53.368597 | 2010-11-25T16:13:47 | 2010-11-25T16:13:47 | 1,106,052 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,635 | h | /**
* @file Element.h
* @author H4203
*/
#ifndef ELEMENT_H
#define ELEMENT_H
//#define DEBUG_ACHEMINEMENT
#include <QPointF>
#ifdef DEBUG_ACHEMINEMENT
#include <QDebug>
#endif
#include "XmlConfigFactory.h"
//class Zone; //Dependency Generated Source:Element Target:Zone
//@uml.annotationsderived_abstraction="platform:/resource/usdp/ModeleStructurel.emx#_Y1tCkOsVEd-oy8D834IawQ"
//@generated "UML to C++ (com.ibm.xtools.transform.uml2.cpp.CPPTransformation)"
/**
* @class Element
* @brief Classe mère de l'ensemble des éléments dynamique et statique du SGBag.
*/
class Element : public QObject
{
Q_OBJECT
public:
//@uml.annotationsderived_abstraction="platform:/resource/usdp/ModeleStructurel.emx#_Y1tCkOsVEd-oy8D834IawQ?DEFCONSTRUCTOR"
//@generated "UML to C++ (com.ibm.xtools.transform.uml2.cpp.CPPTransformation)"
// TODO : utiliser l'argument "parent" du constructeur de QObject
Element(const XmlConfigFactory::IndexParamValeur& indexParamValeur);
/** Initialise les membres privés de l'élément
*/
virtual void init (const XmlConfigFactory::IndexParamValeur& indexParamValeur,
XmlConfigFactory& fabrique);
//@uml.annotationsderived_abstraction="platform:/resource/usdp/ModeleStructurel.emx#_Y1tCkOsVEd-oy8D834IawQ?DESTRUCTOR"
//@generated "UML to C++ (com.ibm.xtools.transform.uml2.cpp.CPPTransformation)"
virtual ~Element();
//@uml.annotationsderived_abstraction="platform:/resource/usdp/ModeleStructurel.emx#_h21_IPD4Ed-R6YEVT5cViQ"
//@generated "UML to C++ (com.ibm.xtools.transform.uml2.cpp.CPPTransformation)"
/**
* Accesseur sur la position de l'élément
*/
virtual QPointF position() const;
#ifdef DEBUG_ACHEMINEMENT
friend QDebug operator<<(QDebug dbg, const Element &element);
#endif
/**
* Accesseur sur la clef primaire de l'élément
*/
int id();
protected:
//@uml.annotationsderived_abstraction="platform:/resource/usdp/ModeleStructurel.emx#_ncu9YOsVEd-oy8D834IawQ"
//@generated "UML to C++ (com.ibm.xtools.transform.uml2.cpp.CPPTransformation)"
//Zone * zone;
//@uml.annotationsderived_abstraction="platform:/resource/usdp/ModeleStructurel.emx#_YHgIwPG4Ed-XFOLnxrkHLA"
//@generated "UML to C++ (com.ibm.xtools.transform.uml2.cpp.CPPTransformation)"
QPointF _position;
int _id;
#ifdef DEBUG_ACHEMINEMENT
QString _typeElement;
#endif
}; //end class Element
#endif
| [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
] | [
[
[
1,
9
],
[
11,
24
],
[
27,
48
],
[
52,
57
],
[
63,
73
],
[
76,
80
]
],
[
[
10,
10
]
],
[
[
25,
26
],
[
49,
51
],
[
58,
60
]
],
[
[
61,
62
],
[
74,
75
]
]
] |
c98ed54c28a4411d2b0f0ca1a605f5f4bb37ae4d | 822ab63b75d4d4e2925f97b9360a1b718b5321bc | /movetozoom/MoveToZoom.h | b08ca122b8171834613e5a6204ff777e8bb784db | [] | no_license | sriks/decii | 71e4becff5c30e77da8f87a56383e02d48b78b28 | 02c58fbaea69c2448249710d13f2e774762da2c3 | refs/heads/master | 2020-05-17T23:03:27.822905 | 2011-12-16T07:29:38 | 2011-12-16T07:29:38 | 32,251,281 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 623 | h | #ifndef MOVETOZOOM_H
#define MOVETOZOOM_H
#include <QObject>
#include <QAccelerometerReading>
QTM_USE_NAMESPACE
class QGraphicsItem;
class MoveToZoomPrivate;
class MoveToZoom : public QObject
{
Q_OBJECT
public:
explicit MoveToZoom(QGraphicsItem* target,QObject *parent = 0);
~MoveToZoom();
public:
bool event(QEvent *event);
public slots:
void startSensor();
void handleSensorReading(const QAccelerometerReading* sensorReading);
void captureInitialReading();
signals:
void zoom(qreal factor);
private:
MoveToZoomPrivate* d;
};
#endif // MOVETOZOOM_H
| [
"srikanthsombhatla@016151e7-202e-141d-2e90-f2560e693586"
] | [
[
[
1,
31
]
]
] |
cd3f85fbc540538973c37790bc497aec06cf65c0 | ce262ae496ab3eeebfcbb337da86d34eb689c07b | /SEFoundation/SEBase/SEHashSet.inl | 72971f89dc816040ac3b996b9088e890c437bda4 | [] | no_license | pizibing/swingengine | d8d9208c00ec2944817e1aab51287a3c38103bea | e7109d7b3e28c4421c173712eaf872771550669e | refs/heads/master | 2021-01-16T18:29:10.689858 | 2011-06-23T04:27:46 | 2011-06-23T04:27:46 | 33,969,301 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 6,446 | inl | // Swing Engine Version 1 Source Code
// Most of techniques in the engine are mainly based on David Eberly's
// Wild Magic 4 open-source code.The author of Swing Engine learned a lot
// from Eberly's experience of architecture and algorithm.
// Several sub-systems are totally new,and others are re-implimented or
// re-organized based on Wild Magic 4's sub-systems.
// Copyright (c) 2007-2010. All Rights Reserved
//
// Eberly's permission:
// Geometric Tools, Inc.
// http://www.geometrictools.com
// Copyright (c) 1998-2006. All Rights Reserved
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or (at
// your option) any later version. The license is available for reading at
// the location:
// http://www.gnu.org/copyleft/lgpl.html
//----------------------------------------------------------------------------
template <class TKey>
SEHashSet<TKey>::SEHashSet(int iTableSize)
{
SE_ASSERT( iTableSize > 0 );
m_iTableSize = iTableSize;
m_iCount = 0;
m_iIndex = 0;
m_pHashItem = 0;
m_ppTable = SE_NEW SEHSItem*[m_iTableSize];
memset( m_ppTable, 0, m_iTableSize*sizeof(SEHSItem*));
UserHashFunction = 0;
}
//----------------------------------------------------------------------------
template <class TKey>
SEHashSet<TKey>::~SEHashSet()
{
RemoveAll();
SE_DELETE[] m_ppTable;
}
//----------------------------------------------------------------------------
template <class TKey>
int SEHashSet<TKey>::GetCount() const
{
return m_iCount;
}
//----------------------------------------------------------------------------
template <class TKey>
TKey* SEHashSet<TKey>::Insert(const TKey& rKey)
{
// 用哈希函数映射到表项索引
int iIndex = HashFunction(rKey);
SEHSItem* pHashItem = m_ppTable[iIndex];
// 在当前表项列表中查找是否已经存在该关键字
while( pHashItem )
{
if( rKey == pHashItem->m_Key )
{
// 关键字已存在
return &pHashItem->m_Key;
}
pHashItem = pHashItem->m_pNextHashItem;
}
// 插入新值
pHashItem = SE_NEW SEHSItem;
pHashItem->m_Key = rKey;
pHashItem->m_pNextHashItem = m_ppTable[iIndex];
m_ppTable[iIndex] = pHashItem;
m_iCount++;
return &pHashItem->m_Key;
}
//----------------------------------------------------------------------------
template <class TKey>
TKey* SEHashSet<TKey>::Get(const TKey& rKey) const
{
// 用哈希函数映射到表项索引
int iIndex = HashFunction(rKey);
SEHSItem* pHashItem = m_ppTable[iIndex];
// 查找符合指定关键字的项
while( pHashItem )
{
if( rKey == pHashItem->m_Key )
{
return &pHashItem->m_Key;
}
pHashItem = pHashItem->m_pNextHashItem;
}
return 0;
}
//----------------------------------------------------------------------------
template <class TKey>
bool SEHashSet<TKey>::Remove(const TKey& rKey)
{
// 用哈希函数映射到表项索引
int iIndex = HashFunction(rKey);
SEHSItem* pHashItem = m_ppTable[iIndex];
if( !pHashItem )
{
return false;
}
if( rKey == pHashItem->m_Key )
{
// 表项在列表头部
SEHSItem* pTemp = pHashItem;
m_ppTable[iIndex] = pHashItem->m_pNextHashItem;
SE_DELETE pTemp;
m_iCount--;
return true;
}
// 表项可能在列表中,查找并删除
SEHSItem* pPrev = pHashItem;
SEHSItem* pCur = pHashItem->m_pNextHashItem;
while( pCur && rKey != pCur->m_Key )
{
pPrev = pCur;
pCur = pCur->m_pNextHashItem;
}
if( pCur )
{
// 找到该项
pPrev->m_pNextHashItem = pCur->m_pNextHashItem;
SE_DELETE pCur;
m_iCount--;
return true;
}
return false;
}
//----------------------------------------------------------------------------
template <class TKey>
void SEHashSet<TKey>::RemoveAll()
{
if( m_iCount > 0 )
{
for( int iIndex = 0; iIndex < m_iTableSize; iIndex++ )
{
while( m_ppTable[iIndex] )
{
SEHSItem* pTemp = m_ppTable[iIndex];
m_ppTable[iIndex] = m_ppTable[iIndex]->m_pNextHashItem;
SE_DELETE pTemp;
if( --m_iCount == 0 )
{
return;
}
}
}
}
}
//----------------------------------------------------------------------------
template <class TKey>
TKey* SEHashSet<TKey>::GetFirst() const
{
if( m_iCount > 0 )
{
for( m_iIndex = 0; m_iIndex < m_iTableSize; m_iIndex++ )
{
if( m_ppTable[m_iIndex] )
{
m_pHashItem = m_ppTable[m_iIndex];
return &m_pHashItem->m_Key;
}
}
}
return 0;
}
//----------------------------------------------------------------------------
template <class TKey>
TKey* SEHashSet<TKey>::GetNext() const
{
if( m_iCount > 0 )
{
m_pHashItem = m_pHashItem->m_pNextHashItem;
if( m_pHashItem )
{
return &m_pHashItem->m_Key;
}
for( m_iIndex++; m_iIndex < m_iTableSize; m_iIndex++ )
{
if( m_ppTable[m_iIndex] )
{
m_pHashItem = m_ppTable[m_iIndex];
return &m_pHashItem->m_Key;
}
}
}
return 0;
}
//----------------------------------------------------------------------------
template <class TKey>
int SEHashSet<TKey>::HashFunction(const TKey& rKey) const
{
if( UserHashFunction )
{
return (*UserHashFunction)(rKey);
}
static double s_dHashMultiplier = 0.5 * (sqrt(5.0) - 1.0);
unsigned int uiKey;
SESystem::SE_Memcpy(&uiKey, sizeof(unsigned int), &rKey,
sizeof(unsigned int));
uiKey %= m_iTableSize;
double dFraction = fmod(s_dHashMultiplier*uiKey, 1.0);
return (int)floor(m_iTableSize * dFraction);
}
//----------------------------------------------------------------------------
| [
"[email protected]@876e9856-8d94-11de-b760-4d83c623b0ac"
] | [
[
[
1,
223
]
]
] |
16a1302af6168ba21afd3c0817da5b8b56e106a3 | 1e346a7abfd36ceecc4569959aab3de446a15148 | /codebase/pf/pf.h | dfd9259915a744c1286e5441e28fb8eb7dd198f3 | [] | no_license | nnathanuci/ix | 36048cb87ef6872f34f693c577f83bc2e5724141 | 8378ada0a0dfdc431844e4f83e028994de146d80 | refs/heads/master | 2020-05-21T13:01:33.137915 | 2011-05-22T06:31:54 | 2011-05-22T06:31:54 | 1,719,745 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,953 | h | #ifndef _pf_h_
#define _pf_h_
#include <cstdio>
using namespace std;
typedef int RC; // return code
typedef unsigned PageNum;
#define PF_PAGE_SIZE 4096
class PF_FileHandle;
class PF_Manager
{
public:
static PF_Manager* Instance(); // Access to the _pf_manager instance
RC CreateFile (const char *fileName); // Create a new file
RC DestroyFile (const char *fileName); // Destroy a file
RC OpenFile (const char *fileName, PF_FileHandle &fileHandle); // Open a file
RC CloseFile (PF_FileHandle &fileHandle); // Close a file
protected:
PF_Manager(); // Constructor
~PF_Manager(); // Destructor
private:
static PF_Manager *_pf_manager; // (singleton pattern)
};
class PF_FileHandle
{
public:
PF_FileHandle(); // Default constructor
~PF_FileHandle(); // Destructor
RC OpenFile(const char *fileName); // Open File
RC CloseFile(); // Close File
RC TruncateFile(const char *tablename); // Truncate File.
RC ReadPage(PageNum pageNum, void *data); // Get a specific page
RC WritePage(PageNum pageNum, const void *data); // Write a specific page
RC AppendPage(const void *data); // Append a specific page
unsigned GetNumberOfPages(); // Get the number of pages in the file
private:
FILE *handle;
};
#endif
| [
"[email protected]"
] | [
[
[
1,
54
]
]
] |
eecb83ce70b985117362380f09804d7a37197fc8 | d39595c0c12a46ece1b1b41c92a9adcf7fe277ee | /Animation.h | a0dc733d13111b07cef1bda0834d987677da9282 | [] | no_license | pandabear41/Breakout | e89b85708b960e7dd83c22df1552141b1c937af9 | 64967248274055117b3cf709c084818039ec8278 | refs/heads/master | 2021-01-17T05:55:34.279752 | 2011-07-15T05:08:02 | 2011-07-15T05:08:02 | 2,039,821 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 499 | h | #ifndef ANIMATION_H_INCLUDED
#define ANIMATION_H_INCLUDED
#ifdef WIN32
#include <SDL.h>
#else
#include <SDL/SDL.h>
#endif
class Animation {
public:
Animation();
~Animation();
void onTick();
void setFrameRate(int rate);
void setCurrentFrame(int frame);
int getCurrentFrame();
int maxFrames;
bool oscillate;
private:
int currentFrame;
int frameInc;
int frameRate; //Milliseconds
long oldTime;
};
#endif // ANIMATION_H_INCLUDED
| [
"[email protected]"
] | [
[
[
1,
29
]
]
] |
8738eda02a953c99bfe696dda3b339cb09eaf3d8 | 6b69ffde6fd67f5bdfd4f51d41feb7b8cf5aefe4 | /TouchControl/View/Widgets/Slider.h | 0c748ab9b13008a3c39f82b5ab7fc0f64d2b28f2 | [] | no_license | mkrentovskiy/qttswidgetexample | e59a8303d0003d8c2b8178e9cce1adf4b2d6960a | 745ffa2ca206ca74451e7b2087f8b408ad2192e5 | refs/heads/master | 2020-08-08T20:13:37.251389 | 2008-05-05T09:01:22 | 2008-05-05T09:01:22 | 32,144,462 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,244 | h | #ifndef SLIDER_H_
#define SLIDER_H_
#include <QWidget>
#include <QPixmap>
#include <QLabel>
#include "PicButton.h"
#include "../WidgetFabric.h"
#include "../../Variables.h"
class Slider : public QWidget
{
Q_OBJECT
public:
Slider(QWidget *, WidgetControl *, QDomElement &, QDomElement &, WidgetFabric *);
void setPosition(float p) { pos = range(p); calculate(); };
float getPosition() { return pos; };
float range(float f) {
float r = f;
if(f > max) r = max;
if(f < min) r = min;
return r;
};
void setMaxValue(float m) { max = m; }
protected:
void paintEvent(QPaintEvent *event);
void calculate();
private slots:
void stepUp();
void stepDown();
signals:
void valueChanged(float);
void valueChange(float);
private:
QString id;
// Визуальные аспекты
PicButton *up;
PicButton *down;
QPixmap *background;
int xs;
int ys;
int is;
int js;
int yd;
// Формальные аспекты
float min;
float max;
float step;
float pos;
};
#endif /*SLIDER_H_*/
| [
"mkrentovskiy@2d1e7c9e-774c-0410-a78d-1fc8eb1d9a0d"
] | [
[
[
1,
68
]
]
] |
f73ba69f17df41b845392b53dd3d24d1aaf37fac | 7af9fe205f0391d92ae2dad0364f0d2445f136f6 | /game/spells/write.cpp | 16f586e5c3ea00a3543dd2e2df4df65d243c8c6b | [] | no_license | yujack12/Cpp | f3ea85baf9a4f64a17743dbba97b82996642e3f6 | 7c0a0197c5df2dc5b985cdc063f49e90fbe56b21 | refs/heads/master | 2021-01-20T23:32:46.830033 | 2011-12-08T11:38:40 | 2011-12-08T11:38:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,709 | cpp | /**
* Studying C++
* Write some spells to a file for load in our game
*
* Fredi Machado
* http://github.com/fredi
*/
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include "../define.h"
#include "../common.h"
int main()
{
std::ofstream outSpells("../data/spells.dat", std::ios::binary);
if (!outSpells)
{
std::cout << "The file could not be opened." << std::endl;
exit(1);
}
uint32 header = 0x454D4147; // 'GAME'
uint32 recordCount = 3;
uint32 fieldCount = 10;
uint32 recordSize = fieldCount * 4;
outSpells.write(reinterpret_cast<char*>(&header), sizeof(uint32));
outSpells.write(reinterpret_cast<char*>(&recordCount), sizeof(uint32));
outSpells.write(reinterpret_cast<char*>(&fieldCount), sizeof(uint32));
outSpells.write(reinterpret_cast<char*>(&recordSize), sizeof(uint32));
// Damage spell
SpellEntry spell1;
spell1.Id = 1;
spell1.Effect[EFFECT_0] = SPELL_EFFECT_DAMAGE;
spell1.Effect[EFFECT_1] = 0;
spell1.Effect[EFFECT_2] = 0;
spell1.EffectRealPointsPerLevel[EFFECT_0] = 2.0f;
spell1.EffectRealPointsPerLevel[EFFECT_1] = 0.0f;
spell1.EffectRealPointsPerLevel[EFFECT_2] = 0.0f;
spell1.EffectBasePoints[EFFECT_0] = 1;
spell1.EffectBasePoints[EFFECT_1] = 0;
spell1.EffectBasePoints[EFFECT_2] = 0;
// More Damage spell
SpellEntry spell2;
spell2.Id = 2;
spell2.Effect[EFFECT_0] = SPELL_EFFECT_DAMAGE;
spell2.Effect[EFFECT_1] = 0;
spell2.Effect[EFFECT_2] = 0;
spell2.EffectRealPointsPerLevel[EFFECT_0] = 2.0f;
spell2.EffectRealPointsPerLevel[EFFECT_1] = 0.0f;
spell2.EffectRealPointsPerLevel[EFFECT_2] = 0.0f;
spell2.EffectBasePoints[EFFECT_0] = 3;
spell2.EffectBasePoints[EFFECT_1] = 0;
spell2.EffectBasePoints[EFFECT_2] = 0;
// Healing spell
SpellEntry spell3;
spell3.Id = 3;
spell3.Effect[EFFECT_0] = SPELL_EFFECT_HEAL;
spell3.Effect[EFFECT_1] = 0;
spell3.Effect[EFFECT_2] = 0;
spell3.EffectRealPointsPerLevel[EFFECT_0] = 1.0f;
spell3.EffectRealPointsPerLevel[EFFECT_1] = 0.0f;
spell3.EffectRealPointsPerLevel[EFFECT_2] = 0.0f;
spell3.EffectBasePoints[EFFECT_0] = 1;
spell3.EffectBasePoints[EFFECT_1] = 0;
spell3.EffectBasePoints[EFFECT_2] = 0;
outSpells.write(reinterpret_cast<char*>(&spell1), sizeof(SpellEntry));
outSpells.write(reinterpret_cast<char*>(&spell2), sizeof(SpellEntry));
outSpells.write(reinterpret_cast<char*>(&spell3), sizeof(SpellEntry));
outSpells.close();
std::cout << "spells.dat generated." << std::endl;
return 0;
}
| [
"[email protected]"
] | [
[
[
1,
85
]
]
] |
cdbeba78321c15716843c2f6fc380a0647eed986 | ce262ae496ab3eeebfcbb337da86d34eb689c07b | /SEFoundation/SEMath/SEQuaternion.h | b667f6a9d7eb447a49305bd645c97048c01af68f | [] | no_license | pizibing/swingengine | d8d9208c00ec2944817e1aab51287a3c38103bea | e7109d7b3e28c4421c173712eaf872771550669e | refs/heads/master | 2021-01-16T18:29:10.689858 | 2011-06-23T04:27:46 | 2011-06-23T04:27:46 | 33,969,301 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 8,428 | h | // Swing Engine Version 1 Source Code
// Most of techniques in the engine are mainly based on David Eberly's
// Wild Magic 4 open-source code.The author of Swing Engine learned a lot
// from Eberly's experience of architecture and algorithm.
// Several sub-systems are totally new,and others are re-implimented or
// re-organized based on Wild Magic 4's sub-systems.
// Copyright (c) 2007-2010. All Rights Reserved
//
// Eberly's permission:
// Geometric Tools, Inc.
// http://www.geometrictools.com
// Copyright (c) 1998-2006. All Rights Reserved
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or (at
// your option) any later version. The license is available for reading at
// the location:
// http://www.gnu.org/copyleft/lgpl.html
#ifndef Swing_Quaternion_H
#define Swing_Quaternion_H
// Quaternion是形如q = w + x*i + y*j + z*k的超复数,
// 对于4D向量空间向量(w,x,y,z),其模不一定为1,
// 虚部:i^2 = j^2 = k^2 = -1,i*j = k,j*k = i,k*i = j,j*i = -k,k*j = -i,i*k = -j
#include "SEFoundationLIB.h"
#include "SEMatrix3.h"
namespace Swing
{
//----------------------------------------------------------------------------
// Description:
// Author:Sun Che
// Date:20070627
//----------------------------------------------------------------------------
class SE_FOUNDATION_API SEQuaternionf
{
public:
union
{
struct
{
float W;
float X;
float Y;
float Z;
};
float m_fData[4];
};
public:
SEQuaternionf(void);
SEQuaternionf(float fW, float fX, float fY, float fZ);
SEQuaternionf(const SEQuaternionf& rQ);
// 由旋转矩阵构造quaternion.
SEQuaternionf(const SEMatrix3f& rRotMat);
// 由任意轴角度构造quaternion.
SEQuaternionf(const SEVector3f& rAxis, float fAngle);
operator const float* (void) const;
operator float* (void);
float operator [] (int i) const;
float& operator [] (int i);
SEQuaternionf& operator = (const SEQuaternionf& rQ);
bool operator == (const SEQuaternionf& rQ) const;
bool operator != (const SEQuaternionf& rQ) const;
bool operator < (const SEQuaternionf& rQ) const;
bool operator <= (const SEQuaternionf& rQ) const;
bool operator > (const SEQuaternionf& rQ) const;
bool operator >= (const SEQuaternionf& rQ) const;
SEQuaternionf operator + (const SEQuaternionf& rRhsQ) const;
SEQuaternionf operator - (const SEQuaternionf& rRhsQ) const;
SEQuaternionf operator * (const SEQuaternionf& rRhsQ) const;
SEQuaternionf operator * (float fScalar) const;
SEQuaternionf operator / (float fScalar) const;
SEQuaternionf operator - (void) const;
SEQuaternionf& operator += (const SEQuaternionf& rRhsQ);
SEQuaternionf& operator -= (const SEQuaternionf& rRhsQ);
SEQuaternionf& operator *= (float fScalar);
SEQuaternionf& operator /= (float fScalar);
SE_FOUNDATION_API friend SEQuaternionf operator * (float fLhsScalar,
const SEQuaternionf& rRhsQ);
// 必须为旋转矩阵.
inline SEQuaternionf& FromRotationMatrix(const SEMatrix3f& rRotMat);
inline void ToRotationMatrix(SEMatrix3f& rRotMat) const;
SEQuaternionf& FromRotationMatrix(const SEVector3f aRot[3],
bool bIsRow = true);
void ToRotationMatrix(SEVector3f aRot[3], bool bIsRow = true) const;
// 旋转轴必须是单位向量.
inline SEQuaternionf& FromAxisAngle(const SEVector3f& rAxis, float fAngle);
inline void ToAxisAngle(SEVector3f& rAxis, float& rfAngle) const;
// 获取长度.
inline float GetLength(void) const;
// 获取长度平方.
inline float GetSquaredLength(void) const;
// 获取点积.
inline float Dot(const SEQuaternionf& rQ) const;
// 规范化.
inline float Normalize(void);
// 应用于非0 quaternion.
inline void GetInverse(SEQuaternionf& rDesQ) const;
// 获取共轭quaternion.
inline void GetConjugate(SEQuaternionf& rDesQ) const;
// 旋转一个向量.
SEVector3f Rotate(const SEVector3f& rSrcVec) const;
// 球面线性插值.
SEQuaternionf& Slerp(float fT, const SEQuaternionf& rP,
const SEQuaternionf& rQ);
// 线性插值.
SEQuaternionf& Lerp(float fT, const SEQuaternionf& rP,
const SEQuaternionf& rQ);
static const SEQuaternionf IDENTITY;
static const SEQuaternionf ZERO;
private:
inline int CompareData(const SEQuaternionf& rQ) const;
// 用于FromRotationMatrix.
static int m_iNext[3];
};
//----------------------------------------------------------------------------
// Description:
// Author:Sun Che
// Date:20090725
//----------------------------------------------------------------------------
class SE_FOUNDATION_API SEQuaterniond
{
public:
union
{
struct
{
double W;
double X;
double Y;
double Z;
};
double m_dData[4];
};
public:
SEQuaterniond(void);
SEQuaterniond(double dW, double dX, double dY, double dZ);
SEQuaterniond(const SEQuaterniond& rQ);
// 由旋转矩阵构造quaternion.
SEQuaterniond(const SEMatrix3d& rRotMat);
// 由任意轴角度构造quaternion.
SEQuaterniond(const SEVector3d& rAxis, double dAngle);
operator const double* (void) const;
operator double* (void);
double operator [] (int i) const;
double& operator [] (int i);
SEQuaterniond& operator = (const SEQuaterniond& rQ);
bool operator == (const SEQuaterniond& rQ) const;
bool operator != (const SEQuaterniond& rQ) const;
bool operator < (const SEQuaterniond& rQ) const;
bool operator <= (const SEQuaterniond& rQ) const;
bool operator > (const SEQuaterniond& rQ) const;
bool operator >= (const SEQuaterniond& rQ) const;
SEQuaterniond operator + (const SEQuaterniond& rRhsQ) const;
SEQuaterniond operator - (const SEQuaterniond& rRhsQ) const;
SEQuaterniond operator * (const SEQuaterniond& rRhsQ) const;
SEQuaterniond operator * (double dScalar) const;
SEQuaterniond operator / (double dScalar) const;
SEQuaterniond operator - (void) const;
SEQuaterniond& operator += (const SEQuaterniond& rRhsQ);
SEQuaterniond& operator -= (const SEQuaterniond& rRhsQ);
SEQuaterniond& operator *= (double dScalar);
SEQuaterniond& operator /= (double dScalar);
SE_FOUNDATION_API friend SEQuaterniond operator * (double dLhsScalar,
const SEQuaterniond& rRhsQ);
// 必须为旋转矩阵.
inline SEQuaterniond& FromRotationMatrix(const SEMatrix3d& rRotMat);
inline void ToRotationMatrix(SEMatrix3d& rRotMat) const;
SEQuaterniond& FromRotationMatrix(const SEVector3d aRot[3],
bool bIsRow = true);
void ToRotationMatrix(SEVector3d aRot[3], bool bIsRow = true) const;
// 旋转轴必须是单位向量.
inline SEQuaterniond& FromAxisAngle(const SEVector3d& rAxis, double
dAngle);
inline void ToAxisAngle(SEVector3d& rAxis, double& rdAngle) const;
// 获取长度.
inline double GetLength(void) const;
// 获取长度平方.
inline double GetSquaredLength(void) const;
// 获取点积.
inline double Dot(const SEQuaterniond& rQ) const;
// 规范化.
inline double Normalize(void);
// 应用于非0 quaternion.
inline void GetInverse(SEQuaterniond& rDesQ) const;
// 获取共轭quaternion.
inline void GetConjugate(SEQuaterniond& rDesQ) const;
// 旋转一个向量.
SEVector3d Rotate(const SEVector3d& rSrcVec) const;
// 球面线性插值.
SEQuaterniond& Slerp(double dT, const SEQuaterniond& rP,
const SEQuaterniond& rQ);
// 线性插值.
SEQuaterniond& Lerp(double dT, const SEQuaterniond& rP,
const SEQuaterniond& rQ);
static const SEQuaterniond IDENTITY;
static const SEQuaterniond ZERO;
private:
inline int CompareData(const SEQuaterniond& rQ) const;
// 用于FromRotationMatrix.
static int m_iNext[3];
};
#include "SEQuaternion.inl"
}
#endif
| [
"[email protected]@876e9856-8d94-11de-b760-4d83c623b0ac"
] | [
[
[
1,
249
]
]
] |
70468bc972949e7184fcf870fdccb627fcc0bef8 | b681d69490ae6396f24c4d38be0306d5e3dc106a | /src/map.cpp | 9d1a3ded4b5f8535639b6a2a01b62f8cebc690f4 | [] | no_license | baden/letsstart | b27d363328ecd33ce47f75bd90e0235edd965250 | 98929f59038290470bf87ba06c74ffd88e278335 | refs/heads/master | 2016-09-09T18:15:38.770247 | 2009-11-27T00:34:41 | 2009-11-27T00:34:41 | 32,263,772 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 20 | cpp | #include "map.h"
| [
"baden.i.ua@3ae63f96-d6ac-11de-ba7e-09ca73f1295e"
] | [
[
[
1,
2
]
]
] |
e5cb5fe95e5a7d983a889f2df7e78ff37bf0adfd | a2904986c09bd07e8c89359632e849534970c1be | /topcoder/EigenVector.cpp | 7edb55d5d053e7fcbf6601ca10352e72795b0293 | [] | 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 | 2,908 | cpp | // BEGIN CUT HERE
// END CUT HERE
#line 5 "EigenVector.cpp"
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
#define forv(i, v) for (int i = 0; i < (int)(v.size()); ++i)
#define fors(i, s) for (int i = 0; i < (int)(s.length()); ++i)
#define all(a) a.begin(), a.end()
class EigenVector {
public:
vector <int> findEigenVector(vector <string> A) {
}
// BEGIN CUT HERE
public:
void run_test(int Case) { if ((Case == -1) || (Case == 0)) test_case_0(); if ((Case == -1) || (Case == 1)) test_case_1(); if ((Case == -1) || (Case == 2)) test_case_2(); if ((Case == -1) || (Case == 3)) test_case_3(); }
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 vector <int> &Expected, const vector <int> &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: " << print_array(Expected) << endl; cerr << "\tReceived: " << print_array(Received) << endl; } }
void test_case_0() { string Arr0[] = {"1 0 0 0 0",
"0 1 0 0 0",
"0 0 1 0 0",
"0 0 0 1 0",
"0 0 0 0 1"}; vector <string> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arr1[] = { 0, 0, 0, 0, 1 }; vector <int> Arg1(Arr1, Arr1 + (sizeof(Arr1) / sizeof(Arr1[0]))); verify_case(0, Arg1, findEigenVector(Arg0)); }
void test_case_1() { string Arr0[] = {"100 0 0 0",
"0 200 0 0",
"0 0 333 0",
"0 0 0 42"}; vector <string> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arr1[] = { 0, 0, 0, 1 }; vector <int> Arg1(Arr1, Arr1 + (sizeof(Arr1) / sizeof(Arr1[0]))); verify_case(1, Arg1, findEigenVector(Arg0)); }
void test_case_2() { string Arr0[] = {"10 -10 -10 10",
"20 40 -10 -10",
"10 -10 10 20",
"10 10 20 5"}; vector <string> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arr1[] = { 1, -5, 2, 0 }; vector <int> Arg1(Arr1, Arr1 + (sizeof(Arr1) / sizeof(Arr1[0]))); verify_case(2, Arg1, findEigenVector(Arg0)); }
void test_case_3() { string Arr0[] = {"30 20","87 2"}; vector <string> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arr1[] = { 2, 3 }; vector <int> Arg1(Arr1, Arr1 + (sizeof(Arr1) / sizeof(Arr1[0]))); verify_case(3, Arg1, findEigenVector(Arg0)); }
// END CUT HERE
};
// BEGIN CUT HERE
int main() {
EigenVector ___test;
___test.run_test(-1);
}
// END CUT HERE
| [
"shin@CF-7AUJ41TT52JO.(none)"
] | [
[
[
1,
67
]
]
] |
dc629b2a9ffd7dc58e4cead2ddf12a93de7bb164 | 6f7850c90ed97967998033df615d06eacfabd5fa | /common/my_http.h | bc153ad6968bc4f14985a7484f354733aff096ce | [] | no_license | vi-k/whoisalive | 1145b0af6a2a18e951533b00a2103b000abd570a | ae86c1982c1e97eeebc50ba54bf53b9b694078b6 | refs/heads/master | 2021-01-10T02:00:28.585126 | 2010-08-23T01:58:45 | 2010-08-23T01:58:45 | 44,526,120 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,858 | h | #ifndef MY_HTTP_H
#define MY_HTTP_H
#include "my_inet.h"
#include "my_xml.h"
#include <string>
#include <map>
#include <vector>
#include <utility> /* std::pair */
namespace my { namespace http {
/* Разбор строки http-запроса в виде:
GET /path/to/file?param1=value1¶m2=value2¶m3=value3... HTTP/1.1\r\n
Выделение из него, собственно, пути и параметров */
void parse_request(const std::string &line,
std::string &url,
std::vector< std::pair<std::string, std::string> > ¶ms);
/* Разбор строки http-ответа в виде:
HTTP/1.1 200 OK\r\n
HTTP/1.1 404 Page Not Found\r\n
Выделение из него кода и сообщения */
unsigned int parse_reply(const std::string &line,
std::string &status_message);
/* Разбор заголовка (принцип построение одинаков и у запроса и у ответа)
в виде:
Content-Type: text/plain; charset=utf8\r\n
Connection: close\r\n\r\n */
void parse_header(const std::string &lines,
std::vector< std::pair<std::string, std::string> > ¶ms);
std::string percent_decode(const char *str, int len = -1);
inline std::string percent_decode(const std::string &str)
{
return percent_decode(str.c_str(), (int)str.size());
}
std::string percent_encode(const char *str,
const char *escape_symbols = NULL, int len = -1);
inline std::string percent_encode(const std::string &str,
const char *escape_symbols = NULL)
{
return percent_encode(str.c_str(), escape_symbols, (int)str.size());
}
class message
{
public:
asio::streambuf buf_; /* Буфер для чтения их сокета*/
std::string header_; /* Заголовок AS IS */
std::map<std::wstring, std::wstring> header;
std::string body;
message() {}
void read_header(tcp::socket &socket);
void read_body(tcp::socket &socket);
std::wstring content_type();
void to_xml(::xml::ptree &pt);
void to_xml(::xml::wptree &pt);
void save(const std::wstring &filename);
};
class reply : public message
{
public:
std::string reply_; /* Строка ответа AS IS */
unsigned int status_code;
std::wstring status_message;
reply() : message(), status_code(0) {}
void read_reply(tcp::socket &socket);
/* Отправка запроса и получение ответа */
void reply::get(tcp::socket &socket,
const std::string &request, bool do_read_body = true);
};
class request : public message
{
public:
std::string request_; /* Строка запроса AS IS */
std::wstring url; /* URL */
std::map<std::wstring, std::wstring> params; /* Параметры: ?a=A&b=B... */
request() : message() {}
void read_request(tcp::socket &socket);
};
} }
#endif
| [
"victor dunaev ([email protected])"
] | [
[
[
1,
100
]
]
] |
5be0b28847854417fe64adef57e26093a877a527 | ef23e388061a637f82b815d32f7af8cb60c5bb1f | /src/mame/includes/gaelco.h | 907c005a14373cdbb728d28e19790961d032c68a | [] | 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 | 903 | h | /***************************************************************************
Gaelco game hardware from 1991-1996
***************************************************************************/
class gaelco_state : public driver_device
{
public:
gaelco_state(running_machine &machine, const driver_device_config_base &config)
: driver_device(machine, config) { }
/* memory pointers */
UINT16 * m_videoram;
UINT16 * m_spriteram;
UINT16 * m_vregs;
UINT16 * m_screen;
// UINT16 * paletteram; // currently this uses generic palette handling
/* video-related */
tilemap_t *m_tilemap[2];
/* devices */
device_t *m_audiocpu;
};
/*----------- defined in video/gaelco.c -----------*/
WRITE16_HANDLER( gaelco_vram_w );
VIDEO_START( bigkarnk );
VIDEO_START( maniacsq );
SCREEN_UPDATE( bigkarnk );
SCREEN_UPDATE( maniacsq );
| [
"Mike@localhost"
] | [
[
[
1,
37
]
]
] |
0d1667a32271f2529f4d06b0d0ba1fd77af4bd7d | d115cf7a1b374d857f6b094d4b4ccd8e9b1ac189 | /gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/comip.h | 96c001c3b0f8cad870d8f715df79e4796c78211b | [] | no_license | gatoatigrado/pyplusplusclone | 30af9065fb6ac3dcce527c79ed5151aade6a742f | a64dc9aeeb718b2f30bd6a5ff8dcd8bfb1cd2ede | refs/heads/master | 2016-09-05T23:32:08.595261 | 2010-05-16T10:53:45 | 2010-05-16T10:53:45 | 700,369 | 4 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 27,009 | h | /***
* comip.h - Native C++ compiler COM support - COM interface pointers header
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifdef _M_CEE_PURE
#error comip.h header cannot be included under /clr:safe or /clr:pure
#endif
#if !defined(_INC_COMIP)
#define _INC_COMIP
#include <ole2.h>
#include <malloc.h>
#include <comutil.h>
#pragma warning(push)
#pragma warning(disable: 4290)
#pragma push_macro("new")
#undef new
#include <new.h>
class _com_error;
void __stdcall _com_issue_error(HRESULT);
struct __declspec(uuid("00000000-0000-0000-c000-000000000046")) IUnknown;
// Provide Interface to IID association
//
template<typename _Interface, const IID* _IID /*= &__uuidof(_Interface)*/>
class _com_IIID {
public:
typedef _Interface Interface;
static _Interface* GetInterfacePtr() throw()
{
return NULL;
}
static _Interface& GetInterface() throw()
{
return *GetInterfacePtr();
}
static const IID& GetIID() throw()
{
return *_IID;
}
};
template<typename _IIID> class _com_ptr_t {
public:
// Declare interface type so that the type may be available outside
// the scope of this template.
//
typedef _IIID ThisIIID;
typedef typename _IIID::Interface Interface;
// When the compiler supports references in template parameters,
// _CLSID will be changed to a reference. To avoid conversion
// difficulties this function should be used to obtain the
// CLSID.
//
static const IID& GetIID() throw()
{
return ThisIIID::GetIID();
}
// Constructs a smart-pointer from any other smart pointer.
//
template<typename _OtherIID> _com_ptr_t(const _com_ptr_t<_OtherIID>& p)
: m_pInterface(NULL)
{
HRESULT hr = _QueryInterface(p);
if (FAILED(hr) && (hr != E_NOINTERFACE)) {
_com_issue_error(hr);
}
}
// Constructs a smart-pointer from any IUnknown-based interface pointer.
//
template<typename _InterfaceType> _com_ptr_t(_InterfaceType* p)
: m_pInterface(NULL)
{
HRESULT hr = _QueryInterface(p);
if (FAILED(hr) && (hr != E_NOINTERFACE)) {
_com_issue_error(hr);
}
}
// Make sure correct ctor is called
//
_com_ptr_t(__in LPSTR str)
{
new(this) _com_ptr_t(static_cast<LPCSTR> (str), NULL);
}
// Make sure correct ctor is called
//
_com_ptr_t(__in LPWSTR str)
{
new(this) _com_ptr_t(static_cast<LPCWSTR> (str), NULL);
}
// Disable conversion using _com_ptr_t* specialization of
// template<typename _InterfaceType> _com_ptr_t(_InterfaceType* p)
//
explicit _com_ptr_t(_com_ptr_t* p)
: m_pInterface(NULL)
{
if (p == NULL) {
_com_issue_error(E_POINTER);
}
else {
m_pInterface = p->m_pInterface;
AddRef();
}
}
// Default constructor.
//
_com_ptr_t() throw()
: m_pInterface(NULL)
{
}
// This constructor is provided to allow NULL assignment. It will issue
// an error if any value other than null is assigned to the object.
//
_com_ptr_t(int null)
: m_pInterface(NULL)
{
if (null != 0) {
_com_issue_error(E_POINTER);
}
}
// Copy the pointer and AddRef().
//
_com_ptr_t(const _com_ptr_t& cp) throw()
: m_pInterface(cp.m_pInterface)
{
_AddRef();
}
// Saves the interface.
//
_com_ptr_t(Interface* pInterface) throw()
: m_pInterface(pInterface)
{
_AddRef();
}
// Copies the pointer. If fAddRef is TRUE, the interface will
// be AddRef()ed.
//
_com_ptr_t(Interface* pInterface, bool fAddRef) throw()
: m_pInterface(pInterface)
{
if (fAddRef) {
_AddRef();
}
}
// Construct a pointer for a _variant_t object.
//
_com_ptr_t(const _variant_t& varSrc)
: m_pInterface(NULL)
{
HRESULT hr = QueryStdInterfaces(varSrc);
if (FAILED(hr) && (hr != E_NOINTERFACE)) {
_com_issue_error(hr);
}
}
// Calls CoCreateClass with the provided CLSID.
//
explicit _com_ptr_t(const CLSID& clsid, IUnknown* pOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
: m_pInterface(NULL)
{
HRESULT hr = CreateInstance(clsid, pOuter, dwClsContext);
if (FAILED(hr) && (hr != E_NOINTERFACE)) {
_com_issue_error(hr);
}
}
// Calls CoCreateClass with the provided CLSID retrieved from
// the string.
//
explicit _com_ptr_t(LPCWSTR str, IUnknown* pOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
: m_pInterface(NULL)
{
HRESULT hr = CreateInstance(str, pOuter, dwClsContext);
if (FAILED(hr) && (hr != E_NOINTERFACE)) {
_com_issue_error(hr);
}
}
// Calls CoCreateClass with the provided SBCS CLSID retrieved from
// the string.
//
explicit _com_ptr_t(LPCSTR str, IUnknown* pOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
: m_pInterface(NULL)
{
HRESULT hr = CreateInstance(str, pOuter, dwClsContext);
if (FAILED(hr) && (hr != E_NOINTERFACE)) {
_com_issue_error(hr);
}
}
// Queries for interface.
//
template<typename _OtherIID> _com_ptr_t& operator=(const _com_ptr_t<_OtherIID>& p)
{
HRESULT hr = _QueryInterface(p);
if (FAILED(hr) && (hr != E_NOINTERFACE)) {
_com_issue_error(hr);
}
return *this;
}
// Queries for interface.
//
template<typename _InterfaceType> _com_ptr_t& operator=(_InterfaceType* p)
{
HRESULT hr = _QueryInterface(p);
if (FAILED(hr) && (hr != E_NOINTERFACE)) {
_com_issue_error(hr);
}
return *this;
}
// Saves the interface.
//
_com_ptr_t& operator=(Interface* pInterface) throw()
{
if (m_pInterface != pInterface) {
Interface* pOldInterface = m_pInterface;
m_pInterface = pInterface;
_AddRef();
if (pOldInterface != NULL) {
pOldInterface->Release();
}
}
return *this;
}
// Copies and AddRef()'s the interface.
//
_com_ptr_t& operator=(const _com_ptr_t& cp) throw()
{
return operator=(cp.m_pInterface);
}
// This operator is provided to permit the assignment of NULL to the class.
// It will issue an error if any value other than NULL is assigned to it.
//
_com_ptr_t& operator=(int null)
{
if (null != 0) {
_com_issue_error(E_POINTER);
}
return operator=(reinterpret_cast<Interface*>(NULL));
}
// Construct a pointer for a _variant_t object.
//
_com_ptr_t& operator=(const _variant_t& varSrc)
{
HRESULT hr = QueryStdInterfaces(varSrc);
if (FAILED(hr) && (hr != E_NOINTERFACE)) {
_com_issue_error(hr);
}
return *this;
}
// If we still have an interface then Release() it. The interface
// may be NULL if Detach() has previously been called, or if it was
// never set.
//
~_com_ptr_t() throw()
{
_Release();
}
// Saves/sets the interface without AddRef()ing. This call
// will release any previously acquired interface.
//
void Attach(Interface* pInterface) throw()
{
_Release();
m_pInterface = pInterface;
}
// Saves/sets the interface only AddRef()ing if fAddRef is TRUE.
// This call will release any previously acquired interface.
//
void Attach(Interface* pInterface, bool fAddRef) throw()
{
_Release();
m_pInterface = pInterface;
if (fAddRef) {
if (pInterface == NULL) {
_com_issue_error(E_POINTER);
}
else {
pInterface->AddRef();
}
}
}
// Simply NULL the interface pointer so that it isn't Released()'ed.
//
Interface* Detach() throw()
{
Interface* const old = m_pInterface;
m_pInterface = NULL;
return old;
}
// Return the interface. This value may be NULL.
//
operator Interface*() const throw()
{
return m_pInterface;
}
// Queries for the unknown and return it
// Provides minimal level error checking before use.
//
operator Interface&() const
{
if (m_pInterface == NULL) {
_com_issue_error(E_POINTER);
}
return *m_pInterface;
}
// Allows an instance of this class to act as though it were the
// actual interface. Also provides minimal error checking.
//
Interface& operator*() const
{
if (m_pInterface == NULL) {
_com_issue_error(E_POINTER);
}
return *m_pInterface;
}
// Returns the address of the interface pointer contained in this
// class. This is useful when using the COM/OLE interfaces to create
// this interface.
//
Interface** operator&() throw()
{
_Release();
m_pInterface = NULL;
return &m_pInterface;
}
// Allows this class to be used as the interface itself.
// Also provides simple error checking.
//
Interface* operator->() const
{
if (m_pInterface == NULL) {
_com_issue_error(E_POINTER);
}
return m_pInterface;
}
// This operator is provided so that simple boolean expressions will
// work. For example: "if (p) ...".
// Returns TRUE if the pointer is not NULL.
//
operator bool() const throw()
{
return m_pInterface != NULL;
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator==(const _com_ptr_t<_OtherIID>& p)
{
return _CompareUnknown(p) == 0;
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator==(_com_ptr_t<_OtherIID>& p)
{
return _CompareUnknown(p) == 0;
}
// Compare two pointers
//
template<typename _InterfaceType> bool operator==(_InterfaceType* p)
{
return _CompareUnknown(p) == 0;
}
// Compare with other interface
//
bool operator==(Interface* p)
{
return (m_pInterface == p)
? true
: _CompareUnknown(p) == 0;
}
// Compare two smart pointers
//
bool operator==(const _com_ptr_t& p) throw()
{
return operator==(p.m_pInterface);
}
// Compare two smart pointers
//
bool operator==(_com_ptr_t& p) throw()
{
return operator==(p.m_pInterface);
}
// For comparison to NULL
//
bool operator==(int null)
{
if (null != 0) {
_com_issue_error(E_POINTER);
}
return m_pInterface == NULL;
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator!=(const _com_ptr_t<_OtherIID>& p)
{
return !(operator==(p));
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator!=(_com_ptr_t<_OtherIID>& p)
{
return !(operator==(p));
}
// Compare two pointers
//
template<typename _InterfaceType> bool operator!=(_InterfaceType* p)
{
return !(operator==(p));
}
// For comparison to NULL
//
bool operator!=(int null)
{
return !(operator==(null));
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator<(const _com_ptr_t<_OtherIID>& p)
{
return _CompareUnknown(p) < 0;
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator<(_com_ptr_t<_OtherIID>& p)
{
return _CompareUnknown(p) < 0;
}
// Compare two pointers
//
template<typename _InterfaceType> bool operator<(_InterfaceType* p)
{
return _CompareUnknown(p) < 0;
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator>(const _com_ptr_t<_OtherIID>& p)
{
return _CompareUnknown(p) > 0;
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator>(_com_ptr_t<_OtherIID>& p)
{
return _CompareUnknown(p) > 0;
}
// Compare two pointers
//
template<typename _InterfaceType> bool operator>(_InterfaceType* p)
{
return _CompareUnknown(p) > 0;
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator<=(const _com_ptr_t<_OtherIID>& p)
{
return _CompareUnknown(p) <= 0;
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator<=(_com_ptr_t<_OtherIID>& p)
{
return _CompareUnknown(p) <= 0;
}
// Compare two pointers
//
template<typename _InterfaceType> bool operator<=(_InterfaceType* p)
{
return _CompareUnknown(p) <= 0;
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator>=(const _com_ptr_t<_OtherIID>& p)
{
return _CompareUnknown(p) >= 0;
}
// Compare two smart pointers
//
template<typename _OtherIID> bool operator>=(_com_ptr_t<_OtherIID>& p)
{
return _CompareUnknown(p) >= 0;
}
// Compare two pointers
//
template<typename _InterfaceType> bool operator>=(_InterfaceType* p)
{
return _CompareUnknown(p) >= 0;
}
// Provides error-checking Release()ing of this interface.
//
void Release()
{
if (m_pInterface == NULL) {
_com_issue_error(E_POINTER);
}
else {
m_pInterface->Release();
m_pInterface = NULL;
}
}
// Provides error-checking AddRef()ing of this interface.
//
void AddRef()
{
if (m_pInterface == NULL) {
_com_issue_error(E_POINTER);
}
else {
m_pInterface->AddRef();
}
}
// Another way to get the interface pointer without casting.
//
Interface* GetInterfacePtr() const throw()
{
return m_pInterface;
}
// Another way to get the interface pointer without casting.
// Use for [in, out] parameter passing
Interface*& GetInterfacePtr() throw()
{
return m_pInterface;
}
// Loads an interface for the provided CLSID.
// Returns an HRESULT. Any previous interface is unconditionally released.
//
HRESULT CreateInstance(const CLSID& rclsid, IUnknown* pOuter = NULL, DWORD dwClsContext = CLSCTX_ALL) throw()
{
HRESULT hr;
_Release();
if (dwClsContext & (CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER)) {
IUnknown* pIUnknown;
hr = CoCreateInstance(rclsid, pOuter, dwClsContext, __uuidof(IUnknown), reinterpret_cast<void**>(&pIUnknown));
if (SUCCEEDED(hr)) {
hr = OleRun(pIUnknown);
if (SUCCEEDED(hr)) {
hr = pIUnknown->QueryInterface(GetIID(), reinterpret_cast<void**>(&m_pInterface));
}
pIUnknown->Release();
}
}
else {
hr = CoCreateInstance(rclsid, pOuter, dwClsContext, GetIID(), reinterpret_cast<void**>(&m_pInterface));
}
if (FAILED(hr)) {
// just in case refcount = 0 and dtor gets called
m_pInterface = NULL;
}
return hr;
}
// Creates the class specified by clsidString. clsidString may
// contain a class id, or a prog id string.
//
HRESULT CreateInstance(LPCWSTR clsidString, IUnknown* pOuter = NULL, DWORD dwClsContext = CLSCTX_ALL) throw()
{
if (clsidString == NULL) {
return E_INVALIDARG;
}
CLSID clsid;
HRESULT hr;
if (clsidString[0] == L'{') {
hr = CLSIDFromString(const_cast<LPWSTR> (clsidString), &clsid);
}
else {
hr = CLSIDFromProgID(const_cast<LPWSTR> (clsidString), &clsid);
}
if (FAILED(hr)) {
return hr;
}
return CreateInstance(clsid, pOuter, dwClsContext);
}
// Creates the class specified by SBCS clsidString. clsidString may
// contain a class id, or a prog id string.
//
HRESULT CreateInstance(LPCSTR clsidStringA, IUnknown* pOuter = NULL, DWORD dwClsContext = CLSCTX_ALL) throw()
{
if (clsidStringA == NULL) {
return E_INVALIDARG;
}
int size = lstrlenA(clsidStringA) + 1;
int destSize = MultiByteToWideChar(CP_ACP, 0, clsidStringA, size, NULL, 0);
if (destSize == 0) {
return HRESULT_FROM_WIN32(GetLastError());
}
LPWSTR clsidStringW;
clsidStringW = static_cast<LPWSTR>(_malloca(destSize * sizeof(WCHAR)));
if (clsidStringW == NULL) {
return E_OUTOFMEMORY;
}
if (MultiByteToWideChar(CP_ACP, 0, clsidStringA, size, clsidStringW, destSize) == 0) {
_freea(clsidStringW);
return HRESULT_FROM_WIN32(GetLastError());
}
HRESULT hr=CreateInstance(clsidStringW, pOuter, dwClsContext);
_freea(clsidStringW);
return hr;
}
// Attach to the active object specified by rclsid.
// Any previous interface is released.
//
HRESULT GetActiveObject(const CLSID& rclsid) throw()
{
_Release();
IUnknown* pIUnknown;
HRESULT hr = ::GetActiveObject(rclsid, NULL, &pIUnknown);
if (SUCCEEDED(hr)) {
hr = pIUnknown->QueryInterface(GetIID(), reinterpret_cast<void**>(&m_pInterface));
pIUnknown->Release();
}
if (FAILED(hr)) {
// just in case refcount = 0 and dtor gets called
m_pInterface = NULL;
}
return hr;
}
// Attach to the active object specified by clsidString.
// First convert the LPCWSTR to a CLSID.
//
HRESULT GetActiveObject(LPCWSTR clsidString) throw()
{
if (clsidString == NULL) {
return E_INVALIDARG;
}
CLSID clsid;
HRESULT hr;
if (clsidString[0] == '{') {
hr = CLSIDFromString(const_cast<LPWSTR> (clsidString), &clsid);
}
else {
hr = CLSIDFromProgID(const_cast<LPWSTR> (clsidString), &clsid);
}
if (FAILED(hr)) {
return hr;
}
return GetActiveObject(clsid);
}
// Attach to the active object specified by clsidStringA.
// First convert the LPCSTR to a LPCWSTR.
//
HRESULT GetActiveObject(LPCSTR clsidStringA) throw()
{
if (clsidStringA == NULL) {
return E_INVALIDARG;
}
int size = lstrlenA(clsidStringA) + 1;
int destSize = MultiByteToWideChar(CP_ACP, 0, clsidStringA, size, NULL, 0);
LPWSTR clsidStringW;
__try {
clsidStringW = static_cast<LPWSTR>(_alloca(destSize * sizeof(WCHAR)));
}
__except (1) {
clsidStringW = NULL;
}
if (clsidStringW == NULL) {
return E_OUTOFMEMORY;
}
if (MultiByteToWideChar(CP_ACP, 0, clsidStringA, size, clsidStringW, destSize) == 0) {
return HRESULT_FROM_WIN32(GetLastError());
}
return GetActiveObject(clsidStringW);
}
// Performs the QI for the specified IID and returns it in p.
// As with all QIs, the interface will be AddRef'd.
//
template<typename _InterfaceType> HRESULT QueryInterface(const IID& iid, _InterfaceType*& p) throw ()
{
if (m_pInterface != NULL) {
return m_pInterface->QueryInterface(iid, reinterpret_cast<void**>(&p));
}
return E_POINTER;
}
// Performs the QI for the specified IID and returns it in p.
// As with all QIs, the interface will be AddRef'd.
//
template<typename _InterfaceType> HRESULT QueryInterface(const IID& iid, _InterfaceType** p) throw()
{
return QueryInterface(iid, *p);
}
private:
// The Interface.
//
Interface* m_pInterface;
// Releases only if the interface is not null.
// The interface is not set to NULL.
//
void _Release() throw()
{
if (m_pInterface != NULL) {
m_pInterface->Release();
}
}
// AddRefs only if the interface is not NULL
//
void _AddRef() throw()
{
if (m_pInterface != NULL) {
m_pInterface->AddRef();
}
}
// Performs a QI on pUnknown for the interface type returned
// for this class. The interface is stored. If pUnknown is
// NULL, or the QI fails, E_NOINTERFACE is returned and
// _pInterface is set to NULL.
//
template<typename _InterfacePtr> HRESULT _QueryInterface(_InterfacePtr p) throw()
{
HRESULT hr;
// Can't QI NULL
//
if (p != NULL) {
// Query for this interface
//
Interface* pInterface;
hr = p->QueryInterface(GetIID(), reinterpret_cast<void**>(&pInterface));
// Save the interface without AddRef()ing.
//
Attach(SUCCEEDED(hr)? pInterface: NULL);
}
else {
operator=(static_cast<Interface*>(NULL));
hr = E_NOINTERFACE;
}
return hr;
}
// Compares the provided pointer with this by obtaining IUnknown interfaces
// for each pointer and then returning the difference.
//
template<typename _InterfacePtr> int _CompareUnknown(_InterfacePtr p)
{
IUnknown* pu1, *pu2;
if (m_pInterface != NULL) {
HRESULT hr = m_pInterface->QueryInterface(__uuidof(IUnknown), reinterpret_cast<void**>(&pu1));
if (FAILED(hr)) {
_com_issue_error(hr);
pu1 = NULL;
}
else {
pu1->Release();
}
}
else {
pu1 = NULL;
}
if (p != NULL) {
HRESULT hr = p->QueryInterface(__uuidof(IUnknown), reinterpret_cast<void**>(&pu2));
if (FAILED(hr)) {
_com_issue_error(hr);
pu2 = NULL;
}
else {
pu2->Release();
}
}
else {
pu2 = NULL;
}
return pu1 - pu2;
}
// Try to extract either IDispatch* or an IUnknown* from
// the VARIANT
//
HRESULT QueryStdInterfaces(const _variant_t& varSrc) throw()
{
if (V_VT(&varSrc) == VT_DISPATCH) {
return _QueryInterface(V_DISPATCH(&varSrc));
}
if (V_VT(&varSrc) == VT_UNKNOWN) {
return _QueryInterface(V_UNKNOWN(&varSrc));
}
// We have something other than an IUnknown or an IDispatch.
// Can we convert it to either one of these?
// Try IDispatch first
//
VARIANT varDest;
VariantInit(&varDest);
HRESULT hr = VariantChangeType(&varDest, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc)), 0, VT_DISPATCH);
if (SUCCEEDED(hr)) {
hr = _QueryInterface(V_DISPATCH(&varSrc));
}
if (hr == E_NOINTERFACE) {
// That failed ... so try IUnknown
//
VariantInit(&varDest);
hr = VariantChangeType(&varDest, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc)), 0, VT_UNKNOWN);
if (SUCCEEDED(hr)) {
hr = _QueryInterface(V_UNKNOWN(&varSrc));
}
}
VariantClear(&varDest);
return hr;
}
};
// Reverse comparison operators for _com_ptr_t
//
template<typename _InterfaceType> bool operator==(int null, _com_ptr_t<_InterfaceType>& p)
{
if (null != 0) {
_com_issue_error(E_POINTER);
}
return p == NULL;
}
template<typename _Interface, typename _InterfacePtr> bool operator==(_Interface* i, _com_ptr_t<_InterfacePtr>& p)
{
return p == i;
}
template<typename _Interface> bool operator!=(int null, _com_ptr_t<_Interface>& p)
{
if (null != 0) {
_com_issue_error(E_POINTER);
}
return p != NULL;
}
template<typename _Interface, typename _InterfacePtr> bool operator!=(_Interface* i, _com_ptr_t<_InterfacePtr>& p)
{
return p != i;
}
template<typename _Interface> bool operator<(int null, _com_ptr_t<_Interface>& p)
{
if (null != 0) {
_com_issue_error(E_POINTER);
}
return p > NULL;
}
template<typename _Interface, typename _InterfacePtr> bool operator<(_Interface* i, _com_ptr_t<_InterfacePtr>& p)
{
return p > i;
}
template<typename _Interface> bool operator>(int null, _com_ptr_t<_Interface>& p)
{
if (null != 0) {
_com_issue_error(E_POINTER);
}
return p < NULL;
}
template<typename _Interface, typename _InterfacePtr> bool operator>(_Interface* i, _com_ptr_t<_InterfacePtr>& p)
{
return p < i;
}
template<typename _Interface> bool operator<=(int null, _com_ptr_t<_Interface>& p)
{
if (null != 0) {
_com_issue_error(E_POINTER);
}
return p >= NULL;
}
template<typename _Interface, typename _InterfacePtr> bool operator<=(_Interface* i, _com_ptr_t<_InterfacePtr>& p)
{
return p >= i;
}
template<typename _Interface> bool operator>=(int null, _com_ptr_t<_Interface>& p)
{
if (null != 0) {
_com_issue_error(E_POINTER);
}
return p <= NULL;
}
template<typename _Interface, typename _InterfacePtr> bool operator>=(_Interface* i, _com_ptr_t<_InterfacePtr>& p)
{
return p <= i;
}
#pragma pop_macro("new")
#pragma warning(pop)
#endif // _INC_COMIP
| [
"roman_yakovenko@dc5859f9-2512-0410-ae5c-dd123cda1f76"
] | [
[
[
1,
1035
]
]
] |
516b3ecf2fe19ca2036c6f51f27ef0c1d4adfab9 | 6baa03d2d25d4685cd94265bd0b5033ef185c2c9 | /TGL/src/states/state_levelpackscreen.cpp | c471f3ef195aaed0546e3e14f75d7b3f67f94c0c | [] | 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 | 22,032 | cpp | #ifdef KITSCHY_DEBUG_MEMORY
#include "debug_memorymanager.h"
#endif
#ifdef _WIN32
#include "windows.h"
#endif
#include "stdio.h"
#include "math.h"
#include "stdlib.h"
#include "string.h"
#include "gl.h"
#include "glu.h"
#include "SDL.h"
#include "SDL_mixer.h"
#include "SDL_ttf.h"
#include "pthread.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_ship.h"
#include "TGLmap.h"
#include "TGL.h"
#include "TGLapp.h"
#include "TGLreplay.h"
#include "TGLinterface.h"
#include "LevelPack.h"
#include "PlayerProfile.h"
int TGLapp::levelpackscreen_cycle(KEYBOARDSTATE *k)
{
bool m_recheck_interface=false;
bool m_reload_tutorial=false;
/*
if (m_lp_music_channel == -1) {
m_lp_music_channel = Sound_play_continuous(m_SFXM->get("levelpack"), m_player_profile->m_music_volume);
} // if
*/
if (m_game!=0) {
delete m_game;
m_game=0;
} // if
if (SDL_ShowCursor(SDL_QUERY)!=SDL_ENABLE) SDL_ShowCursor(SDL_ENABLE);
if (m_state_cycle==0) {
TGLInterfaceElement *e;
m_selected_level=0;
m_lp_replay_mode=0;
m_lp_replay_timmer=0;
if (m_lp_tutorial_game!=0) {
delete m_lp_tutorial_game;
m_lp_tutorial_game=0;
} // if
if (m_lp_tutorial_replay!=0) {
delete m_lp_tutorial_replay;
m_lp_tutorial_replay=0;
} // if
// Make sure that the current player has the selected ship unlocked:
if (!m_player_profile->m_ships.MemberP(&m_selected_ship)) {
m_selected_ship=*(m_player_profile->m_ships[0]);
} // if
TGLinterface::reset();
TGLinterface::add_element(new TGLbutton("Back",m_font32,10,10,180,60,0));
e=new TGLbutton("Change Level Pack",m_font16,430,10,200,60,1);
TGLinterface::add_element(e);
TGLinterface::add_element(new TGLframe(20,120,330,340));
TGLinterface::add_element(new TGLframe(370,120,250,340));
TGLinterface::add_element(new TGLText("Select a level:",m_font16,180,105,true));
TGLinterface::add_element(new TGLText(m_current_levelpack->m_name,m_font32,180,150,true));
TGLinterface::add_element(new TGLText("Select a ship:",m_font16,500,105,true));
// Add the levels to the inferface:
{
int i;
LevelPack_Level *level;
char tmp[128];
m_lp_first_level=m_player_profile->progress_in_levelpack(m_current_levelpack->m_id)-1;
if (m_lp_first_level+3>m_current_levelpack->m_levels.Length()) m_lp_first_level=m_current_levelpack->m_levels.Length()-3;
if (m_lp_first_level<0) m_lp_first_level=0;
for(i=0;i<3 && i<m_current_levelpack->m_levels.Length();i++) {
int time;
level=m_current_levelpack->m_levels[i+m_lp_first_level];
sprintf(tmp,"Level %i: %s",i+m_lp_first_level+1,level->m_name);
m_lp_level_name[i]=new TGLText(tmp,m_font16,30,float(200+i*90),false);
TGLinterface::add_element(m_lp_level_name[i]);
time=m_player_profile->get_besttime(m_current_levelpack->m_id,i+m_lp_first_level,m_selected_ship);
if (time==-1) {
sprintf(tmp,"Best Time:: --:--:--");
} else {
int hunds=(time/10)%100;
int secs=(time/1000)%60;
int mins=time/60000;
sprintf(tmp,"Best Time:: %i:%.2i:%.2i",mins,secs,hunds);
} // if
m_lp_level_time[i]=new TGLText(tmp,m_font16,30,float(220+i*90),false);
sprintf(tmp,"Points: %i [%i]",level->m_points,level->m_points*m_player_profile->number_of_times_completed(m_current_levelpack->m_id,i+m_lp_first_level));
m_lp_level_points[i]=new TGLText(tmp,m_font16,30,float(240+i*90),false);
TGLinterface::add_element(m_lp_level_time[i]);
TGLinterface::add_element(m_lp_level_points[i]);
m_lp_viewreplay_buttons[i]=new TGLbutton("View Replay",m_font16,180,float(210+i*90),120,20,10+i*2);
TGLinterface::add_element(m_lp_viewreplay_buttons[i]);
if (time==-1) m_lp_viewreplay_buttons[i]->m_enabled=false;
else m_lp_viewreplay_buttons[i]->m_enabled=true;
m_lp_play_buttons[i]=new TGLbutton("Play",m_font16,180,float(235+i*90),120,20,11+i*2);
TGLinterface::add_element(m_lp_play_buttons[i]);
if (m_player_profile->progress_in_levelpack(m_current_levelpack->m_id)<i+m_lp_first_level) {
m_lp_play_buttons[i]->m_enabled=false;
} else {
SDL_WarpMouse(240,245+i*90);
m_lp_play_buttons[i]->m_enabled=true;
} // if
} // for
m_lp_level_uparrow=new TGLbutton(m_GLTM->get("interface/uparrow"),310,200,30,100,2);
TGLinterface::add_element(m_lp_level_uparrow);
if (m_lp_first_level==0) m_lp_level_uparrow->m_enabled=false;
m_lp_level_downarrow=new TGLbutton(m_GLTM->get("interface/downarrow"),310,320,30,100,3);
TGLinterface::add_element(m_lp_level_downarrow);
if (m_lp_first_level+3>=m_current_levelpack->m_levels.Length()) m_lp_level_downarrow->m_enabled=false;
}
// Add the ships to the interface:
{
m_lp_ship_leftarrow=new TGLbutton(m_GLTM->get("interface/leftarrow"),380,140,40,40,4);
TGLinterface::add_element(m_lp_ship_leftarrow);
if (m_player_profile->m_ships.Position(&m_selected_ship)==0) m_lp_ship_leftarrow->m_enabled=false;
else m_lp_ship_leftarrow->m_enabled=true;
m_lp_ship_rightarrow=new TGLbutton(m_GLTM->get("interface/rightarrow"),570,140,40,40,5);
TGLinterface::add_element(m_lp_ship_rightarrow);
if (m_player_profile->m_ships.Position(&m_selected_ship)==m_player_profile->m_ships.Length()-1) m_lp_ship_rightarrow->m_enabled=false;
else m_lp_ship_rightarrow->m_enabled=true;
}
} // if
if (m_state_fading==1) {
int mouse_x=0,mouse_y=0,button=0,button_status=0;
int ID=-1;
if (!m_mouse_click_x.EmptyP()) {
int *tmp;
tmp=m_mouse_click_x.ExtractIni();
mouse_x=*tmp;
delete tmp;
tmp=m_mouse_click_y.ExtractIni();
mouse_y=*tmp;
delete tmp;
tmp=m_mouse_click_button.ExtractIni();
button=*tmp;
delete tmp;
} else {
button_status=SDL_GetMouseState(&mouse_x,&mouse_y);
button=0;
} // if
if (k->key_press(SDLK_SPACE) || k->key_press(SDLK_RETURN)) button=1;
if (m_lp_replay_mode==0) ID=TGLinterface::update_state(mouse_x,mouse_y,button,button_status,k);
else ID=-1;
if (ID!=-1) {
switch(ID) {
case 0:
case 1:
m_state_fading=2;
m_state_fading_cycle=0;
m_state_selection=ID;
break;
case 2:
// levels up
{
m_lp_first_level--;
m_recheck_interface=true;
}
break;
case 3:
// levels down
{
m_lp_first_level++;
m_recheck_interface=true;
}
break;
case 4:
{
int pos=m_player_profile->m_ships.Position(&m_selected_ship);
pos--;
m_selected_ship=*(m_player_profile->m_ships[pos]);
m_recheck_interface=true;
m_reload_tutorial=true;
}
break;
case 5:
{
int pos=m_player_profile->m_ships.Position(&m_selected_ship);
pos++;
m_selected_ship=*(m_player_profile->m_ships[pos]);
m_recheck_interface=true;
m_reload_tutorial=true;
}
break;
case 10:
case 12:
case 14:
// View replay:
m_state_fading=2;
m_state_fading_cycle=0;
m_state_selection=ID;
break;
case 11:
case 13:
case 15:
// Play:
m_state_fading=2;
m_state_fading_cycle=0;
m_state_selection=ID;
break;
} // switch
} // if
}
if (m_recheck_interface) {
int i;
LevelPack_Level *level;
TGLInterfaceElement *old;
char tmp[128];
if (m_lp_first_level==0) m_lp_level_uparrow->m_enabled=false;
else m_lp_level_uparrow->m_enabled=true;
if (m_lp_first_level+3>=m_current_levelpack->m_levels.Length()) m_lp_level_downarrow->m_enabled=false;
else m_lp_level_downarrow->m_enabled=true;
for(i=0;i<3 && i<m_current_levelpack->m_levels.Length();i++) {
int time;
level=m_current_levelpack->m_levels[i+m_lp_first_level];
sprintf(tmp,"Level %i: %s",i+m_lp_first_level+1,level->m_name);
old=m_lp_level_name[i];
m_lp_level_name[i]=new TGLText(tmp,m_font16,30,float(200+i*90),false);
TGLinterface::substitute_element(old,m_lp_level_name[i]);
delete old;
time=m_player_profile->get_besttime(m_current_levelpack->m_id,i+m_lp_first_level,m_selected_ship);
if (time==-1) {
sprintf(tmp,"Best Time:: --:--:--");
} else {
int hunds=(time/10)%100;
int secs=(time/1000)%60;
int mins=time/60000;
sprintf(tmp,"Best Time:: %i:%.2i:%.2i",mins,secs,hunds);
} // if
old=m_lp_level_time[i];
m_lp_level_time[i]=new TGLText(tmp,m_font16,30,float(220+i*90),false);
TGLinterface::substitute_element(old,m_lp_level_time[i]);
delete old;
old=m_lp_level_points[i];
sprintf(tmp,"Points: %i [%i]",level->m_points,level->m_points*m_player_profile->number_of_times_completed(m_current_levelpack->m_id,i+m_lp_first_level));
m_lp_level_points[i]=new TGLText(tmp,m_font16,30,float(240+i*90),false);
TGLinterface::substitute_element(old,m_lp_level_points[i]);
delete old;
if (time==-1) m_lp_viewreplay_buttons[i]->m_enabled=false;
else m_lp_viewreplay_buttons[i]->m_enabled=true;
if (m_player_profile->progress_in_levelpack(m_current_levelpack->m_id)<i+m_lp_first_level) {
m_lp_play_buttons[i]->m_enabled=false;
} else {
m_lp_play_buttons[i]->m_enabled=true;
} // if
} // for
int pos=m_player_profile->m_ships.Position(&m_selected_ship);
if (pos==0) m_lp_ship_leftarrow->m_enabled=false;
else m_lp_ship_leftarrow->m_enabled=true;
if (pos==m_player_profile->m_ships.Length()-1) m_lp_ship_rightarrow->m_enabled=false;
else m_lp_ship_rightarrow->m_enabled=true;
} // if
if (m_reload_tutorial || m_lp_tutorial_game==0) {
char *ship_tutorial[]={"tutorial1-vp",
"tutorial1-xt",
"tutorial1-sr",
"tutorial1-nb",
"tutorial1-vb",
"tutorial1-dodg",
"tutorial1-gravis",
"tutorial1-acc",
"tutorial1-gyr",
"tutorial1-def",
"tutorial1-harp",
"tutorial1-pul",
};
if (m_lp_tutorial_game!=0) {
delete m_lp_tutorial_game;
m_lp_tutorial_game=0;
} // if
if (m_lp_tutorial_replay!=0) {
delete m_lp_tutorial_replay;
m_lp_tutorial_replay=0;
} // if
if (ship_tutorial[m_selected_ship]!=0) {
char *replay_name=0;
replay_name=new char[strlen(ship_tutorial[m_selected_ship])+15];
sprintf(replay_name,"tutorials/%s.rpl",ship_tutorial[m_selected_ship]);
FILE *fp=fopen(replay_name,"rb");
if (fp!=0) {
m_lp_tutorial_replay=new TGLreplay(fp);
fclose(fp);
m_lp_tutorial_replay_text.Delete();
// Load the text messages:
{
char *replay_text_name;
replay_text_name=new char[strlen(ship_tutorial[m_selected_ship])+15];
sprintf(replay_text_name,"tutorials/%s.txt",ship_tutorial[m_selected_ship]);
FILE *fp=fopen(replay_text_name,"rb");
if (fp!=0) {
int time;
char line[256],*text,*tmp;
fgets(line,255,fp);
while(!feof(fp)) {
if (1==sscanf(line,"%i",&time)) {
TextNode *n;
text = line;
while((*text)!=' ' && (*text)!=0) text++;
tmp = text;
while((*tmp)!=0) {
if ((*tmp)=='\n' || (*tmp)=='\r') *tmp=0;
tmp++;
} // while
n = new TextNode();
n->m_time = time;
n->m_text = new char[strlen(text)+1];
strcpy(n->m_text,text);
m_lp_tutorial_replay_text.Add(n);
} // if
fgets(line,255,fp);
} // while
fclose(fp);
} // if
delete []replay_text_name;
}
} // if
delete []replay_name;
} // if
} // if
if (m_lp_tutorial_replay!=0) {
if (m_lp_tutorial_game==0) {
m_lp_tutorial_game=new TGL(m_lp_tutorial_replay->get_map(),
m_lp_tutorial_replay->get_playership(m_lp_tutorial_replay->get_playername(0)),
m_lp_tutorial_replay->get_initial_fuel(),
0,
0,m_GLTM);
m_lp_tutorial_game->reset();
} // if
List<TGLobject> *l=m_lp_tutorial_game->get_map()->get_objects("TGLobject");
List<TGLobject> to_delete,to_add;
TGLobject *o;
bool retval;
retval = m_lp_tutorial_replay->execute_cycle(&m_lvc,l,&to_delete,&to_add);
l->ExtractAll();
delete l;
while(!to_delete.EmptyP()) {
o=to_delete.ExtractIni();
m_lp_tutorial_game->get_map()->remove_object(o);
delete o;
} // while
while(!to_add.EmptyP()) {
o=to_add.ExtractIni();
m_lp_tutorial_game->get_map()->add_object(o);
delete o;
} // while
if (m_lp_replay_mode==2) {
if (!m_lp_tutorial_game->cycle(&m_lvc,m_GLTM,m_SFXM,m_player_profile->m_sfx_volume)) retval=false;
} else {
if (!m_lp_tutorial_game->cycle(&m_lvc,m_GLTM,m_SFXM,0)) retval=false;
} // if
if (!retval) {
delete m_lp_tutorial_game;
m_lp_tutorial_game=0;
delete m_lp_tutorial_replay;
m_lp_tutorial_replay=0;
} // if
} // if
if (k->key_press(SDLK_f)) {
if (m_lp_replay_mode==0) {
m_lp_replay_mode=1;
m_lp_replay_timmer=0;
} else if (m_lp_replay_mode==2) {
m_lp_replay_mode=3;
m_lp_replay_timmer=0;
} // if
} // if
if (m_lp_replay_mode==1) {
m_lp_replay_timmer++;
if (m_lp_replay_timmer>=25) {
m_lp_replay_mode=2;
m_lp_replay_timmer=0;
} // if
} // if
if (m_lp_replay_mode==3) {
m_lp_replay_timmer++;
if (m_lp_replay_timmer>=25) {
m_lp_replay_mode=0;
m_lp_replay_timmer=0;
} // if
} // if
if (m_state_fading==2 && m_state_fading_cycle>25) {
SDL_ShowCursor(SDL_DISABLE);
switch(m_state_selection) {
case 0: if (m_lp_music_channel!=-1) Mix_HaltChannel(m_lp_music_channel);
m_lp_music_channel=-1;
return TGL_STATE_MAINMENU;
break;
case 1: return TGL_STATE_LEVELPACKBROWSER;
break;
case 10:
// View replay:
{
// m_lp_first_level
FILE *fp;
char tmp[256];
sprintf(tmp,"%splayers/%s/%s-level-%i-%i.rpl",
m_player_data_path,
m_player_profile->m_name,m_current_levelpack->m_id,m_lp_first_level,
m_selected_ship);
fp=fopen(tmp,"rb");
if (fp!=0) {
m_game_replay_mode=2;
m_game_replay=new TGLreplay(fp);
m_game_replay->rewind();
fclose(fp);
char *map_name=m_game_replay->get_map();
m_game=new TGL(map_name,m_selected_ship,m_current_levelpack->m_levels[m_lp_first_level]->m_initial_fuel,m_player_profile->m_sfx_volume,m_player_profile->m_music_volume,m_GLTM);
m_game->reset();
m_game_state=0;
m_game_state_cycle=0;
m_game_previous_state=TGL_STATE_LEVELPACKSCREEN;
m_game_reinit_previous_state=false;
return TGL_STATE_GAME;
}
}
break;
case 12:
// View replay:
{
// m_lp_first_level
FILE *fp;
char tmp[256];
sprintf(tmp,"%splayers/%s/%s-level-%i-%i.rpl",
m_player_data_path,
m_player_profile->m_name,m_current_levelpack->m_id,m_lp_first_level+1,
m_selected_ship);
fp=fopen(tmp,"rb");
if (fp!=0) {
m_game_replay_mode=2;
m_game_replay=new TGLreplay(fp);
m_game_replay->rewind();
fclose(fp);
char *map_name=m_game_replay->get_map();
m_game=new TGL(map_name,m_selected_ship,m_current_levelpack->m_levels[m_lp_first_level+1]->m_initial_fuel,m_player_profile->m_sfx_volume,m_player_profile->m_music_volume,m_GLTM);
m_game->reset();
m_game_state=0;
m_game_state_cycle=0;
m_game_previous_state=TGL_STATE_LEVELPACKSCREEN;
m_game_reinit_previous_state=false;
return TGL_STATE_GAME;
}
}
break;
case 14:
// View replay:
{
// m_lp_first_level
{
FILE *fp;
char tmp[256];
sprintf(tmp,"%splayers/%s/%s-level-%i-%i.rpl",
m_player_data_path,
m_player_profile->m_name,m_current_levelpack->m_id,m_lp_first_level+2,
m_selected_ship);
fp=fopen(tmp,"rb");
if (fp!=0) {
m_game_replay_mode=2;
m_game_replay=new TGLreplay(fp);
m_game_replay->rewind();
fclose(fp);
char *map_name=m_game_replay->get_map();
m_game=new TGL(map_name,m_selected_ship,m_current_levelpack->m_levels[m_lp_first_level+2]->m_initial_fuel,m_player_profile->m_sfx_volume,m_player_profile->m_music_volume,m_GLTM);
m_game->reset();
m_game_state=0;
m_game_state_cycle=0;
m_game_previous_state=TGL_STATE_LEVELPACKSCREEN;
m_game_reinit_previous_state=false;
return TGL_STATE_GAME;
}
}
}
break;
case 11:
// Play:
m_selected_level = m_lp_first_level;
if (m_lp_music_channel!=-1) Mix_HaltChannel(m_lp_music_channel);
m_lp_music_channel=-1;
return TGL_STATE_PREGAME;
case 13:
// Play:
m_selected_level = m_lp_first_level + 1;
if (m_lp_music_channel!=-1) Mix_HaltChannel(m_lp_music_channel);
m_lp_music_channel=-1;
return TGL_STATE_PREGAME;
case 15:
// Play:
m_selected_level = m_lp_first_level + 2;
if (m_lp_music_channel!=-1) Mix_HaltChannel(m_lp_music_channel);
m_lp_music_channel=-1;
return TGL_STATE_PREGAME;
break;
} // switch
} // if
if (m_state_fading==0 || m_state_fading==2) m_state_fading_cycle++;
if (m_state_fading==0 && m_state_fading_cycle>25) m_state_fading=1;
if (m_state_fading==0 && m_lp_music_channel!=-1) Mix_Volume(m_lp_music_channel, int(m_player_profile->m_music_volume*(m_state_fading_cycle/25.0f)));
if (m_state_fading==1 && m_lp_music_channel!=-1) Mix_Volume(m_lp_music_channel, m_player_profile->m_music_volume);
if (m_state_fading==2 && m_lp_music_channel!=-1) Mix_Volume(m_lp_music_channel, int(m_player_profile->m_music_volume*((25-m_state_fading_cycle)/25.0f)));
return TGL_STATE_LEVELPACKSCREEN;
} /* TGLapp::levelpackscreen_cycle */
void TGLapp::levelpackscreen_draw(void)
{
char buffer[256];
float replay_full_factor=0;
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT);
TGLinterface::draw();
// Draw scores:
sprintf(buffer,"Total Points: %i",m_player_profile->get_points());
TGLinterface::print_left(buffer,m_font16,230,40);
sprintf(buffer,"Level Pack Points: %i",m_player_profile->get_points(m_current_levelpack->m_id));
TGLinterface::print_left(buffer,m_font16,230,60);
// Draw Selected ship:
{
int i,s;
GLTile *t;
for(i=-1;i<2;i++) {
s=m_player_profile->m_ships.Position(&m_selected_ship)+i;
if (s>=0 && s<m_player_profile->m_ships.Length()) {
t=m_GLTM->get(TGL::ship_tiles[*(m_player_profile->m_ships[s])]);
if (i==0) {
t->draw(495,160,0,0,1);
} else {
t->draw(1,1,1,0.33f,float(495+i*48),160,0,0,0.66f);
} // if
} // if
} // for
TGLinterface::print_center(TGL::ship_names[m_selected_ship],m_font32,495,220);
}
switch(m_lp_replay_mode) {
case 0:
replay_full_factor=0;
break;
case 1:
{
float f=0;
f=abs(m_lp_replay_timmer)/25.0F;
fade_in_alpha(f);
replay_full_factor=f;
}
break;
case 2: fade_in_alpha(1);
replay_full_factor=1;
break;
case 3:
{
float f=0;
f=abs(25-m_lp_replay_timmer)/25.0F;
fade_in_alpha(f);
replay_full_factor=f;
}
break;
} // switch
// Draw tutorial:
{
if (m_lp_tutorial_game!=0) {
int old[4];
glGetIntegerv(GL_VIEWPORT,old);
glViewport(int(380*(1-replay_full_factor)),int(80*(1-replay_full_factor)),
int(640*replay_full_factor+230*(1-replay_full_factor)),int(480*replay_full_factor+172*(1-replay_full_factor)));
m_lp_tutorial_game->draw(m_GLTM);
glViewport(old[0],old[1],old[2],old[3]);
{
float f=0.6f+0.4f*float(sin(m_state_cycle*0.1));
if (m_lp_replay_mode==0 || m_lp_replay_mode==1) TGLinterface::print_center("Press F to maximize",m_font16,320*replay_full_factor+495*(1-replay_full_factor),20*replay_full_factor+250*(1-replay_full_factor),1,1,1,f);
if (m_lp_replay_mode==2 || m_lp_replay_mode==3) TGLinterface::print_center("Press F to minimize",m_font16,320*replay_full_factor+495*(1-replay_full_factor),20*replay_full_factor+250*(1-replay_full_factor),1,1,1,f);
}
{
int i,j;
float y;
char buffer[128];
char *tmp=0;
/* Text messages in replays */
{
TextNode *n;
m_lp_tutorial_replay_text.Rewind();
while(m_lp_tutorial_replay_text.Iterate(n)) {
if (n->m_time<m_lp_tutorial_game->get_cycle()) tmp = n->m_text;
} // while
}
if (tmp!=0) {
i=0;
y=445*replay_full_factor+425*(1-replay_full_factor);
while(tmp[i]!=0) {
for(j=0;tmp[i]!=0 && tmp[i]!='/';i++,j++) buffer[j]=tmp[i];
buffer[j]=0;
if (tmp[i]=='/') i++;
TGLinterface::print_center(buffer,m_font16,320*replay_full_factor+495*(1-replay_full_factor),y);
y+=20;
} // while
} // if
}
} else {
TGLinterface::print_center("No tutorial available",m_font16,320*replay_full_factor+495*(1-replay_full_factor),240*replay_full_factor+300*(1-replay_full_factor));
} // if
}
switch(m_state_fading) {
case 0:
{
float f=0;
f=abs(int(25-m_state_fading_cycle))/25.0F;
fade_in_alpha(f);
}
break;
case 1:
break;
case 2:
{
float f=0;
f=abs(int(m_state_fading_cycle))/25.0F;
fade_in_alpha(f);
}
break;
} // switch
} /* TGLapp::levelpackscreen_draw */
| [
"santi.ontanon@535450eb-5f2b-0410-a0e9-a13dc2d1f197"
] | [
[
[
1,
731
]
]
] |
677d34741e4680cced0b4360afc2a2337a565b07 | b22c254d7670522ec2caa61c998f8741b1da9388 | /Server/MapManager/ServerSignaler.h | 9289b6bab750f84c6338192176b62b4fd57a7f88 | [] | no_license | ldaehler/lbanet | 341ddc4b62ef2df0a167caff46c2075fdfc85f5c | ecb54fc6fd691f1be3bae03681e355a225f92418 | refs/heads/master | 2021-01-23T13:17:19.963262 | 2011-03-22T21:49:52 | 2011-03-22T21:49:52 | 39,529,945 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,013 | h | /*
------------------------[ Lbanet Source ]-------------------------
Copyright (C) 2009
Author: Vivien Delage [Rincevent_123]
Email : [email protected]
-------------------------------[ GNU License ]-------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-----------------------------------------------------------------------------
*/
#ifndef __LBANET_SIGNALER_SERVER_H__
#define __LBANET_SIGNALER_SERVER_H__
#include "SignalerBase.h"
#include "MapHandlerThread.h"
/*
************************************************************************************************************************
* class ServerSignaler
************************************************************************************************************************
*/
class ServerSignaler : public SignalerBase
{
public:
//! constructor
ServerSignaler(MapHandlerThread * MH)
: _MH(MH)
{}
//! destructor
virtual ~ServerSignaler(){}
//! send signal
virtual void SendSignal(long actorid, long signal, const std::vector<long> &targets,
bool broadcast = false)
{
LbaNet::ActorSignalInfo aif;
aif.ActorId = actorid;
aif.SignalId = signal;
for(size_t i=0; i<targets.size(); ++i)
aif.Targets.push_back(targets[i]);
_MH->SignalActor(aif, broadcast);
}
private:
MapHandlerThread * _MH;
};
#endif | [
"vdelage@3806491c-8dad-11de-9a8c-6d5b7d1e4d13"
] | [
[
[
1,
66
]
]
] |
455fafa3873f56f9d0209a704c5cd64339c45e7d | 74c8da5b29163992a08a376c7819785998afb588 | /NetAnimal/Game/wheel/MyWheelController/include/WheelGame.h | c5e7f0d4fd34d5e053db4c25bdda77eb55550e0d | [] | no_license | dbabox/aomi | dbfb46c1c9417a8078ec9a516cc9c90fe3773b78 | 4cffc8e59368e82aed997fe0f4dcbd7df626d1d0 | refs/heads/master | 2021-01-13T14:05:10.813348 | 2011-06-07T09:36:41 | 2011-06-07T09:36:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,375 | h | #ifndef __Orz_WheelGame_h__
#define __Orz_WheelGame_h__
#include "WheelClockListener.h"
#include "WheelControllerConfig.h"
#include "WheelEngineListener.h"
#include "WheelGameInterface.h"
#include "WheelClock.h"
#include "MyHardware.h"
#include <Ogre/Ogre.h>
namespace Orz
{
class WheelEngineInterface;
class SMS;
typedef boost::shared_ptr<WheelEngineInterface> WheelEngineInterfacePtr;
//typedef boost::shared_ptr<WheelGameInterface> WheelGameInterfacePtr;
class _OrzMyWheelControlleExport WheelGame: public WheelGameInterface, public WheelClockListener
{
public:
#ifdef _GAME1
void enableScene(int i);
typedef boost::function< void (int i) > EnableSceneFunction;
#else
void enableScene(const std::string & name, bool second);
typedef boost::function< void (const std::string & , bool) > EnableSceneFunction;
#endif
virtual ~WheelGame(void);
WheelGame(EventWorld * world, WheelEngineInterfacePtr engine, WheelClockPtr clock, EnableSceneFunction enableSceneFunction);
public:
virtual void clockChanged(int second);
void setLogoShow(bool show);
void setAllSecond(int second);
void addBottomToUI(void);
void setSelectVisible(bool visible);
void resetClock(void);
void setStartUIVisible(bool visible);
void setEndUIVisible(bool visible);
void updateClock(TimeType interval);
void update(TimeType interval);
void runWinner(void);
ComponentPtr getHardware(void) const;
ComponentPtr getGameLevel(void) const;
ComponentPtr getGSM(void) const;
EventWorld * getWorld(void) const;
int answerTime(void);
Ogre::Overlay * getOverlay(void);
ComponentPtr getDataServer(void);
void reportEarnings(void);
private:
bool report(std::string & result);
bool extend(int coins, std::string & result);
bool clearData(std::string & result);
void getSms(const SMS & sms);
Ogre::OverlayContainer* _select;
WheelEngineInterfacePtr _engine;
EventWorld * _world;
WheelClockPtr _clock;
Orz::ComponentPtr _dataServer;
Orz::ComponentPtr _hardware;
Orz::ComponentPtr _pool;
ComponentPtr _gsmComp;
ComponentPtr _gameGsmComp;
ComponentPtr _gameLevel;
ComponentPtr _table;
EnableSceneFunction _enableSceneFunction;
boost::signals2::connection _gsmConnection;
};
}
#endif
| [
"[email protected]"
] | [
[
[
1,
101
]
]
] |
3d4b4dcc06bcc528c8a9a81d0b1bd63f94bb77c5 | 40b507c2dde13d14bb75ee1b3c16b4f3f82912d1 | /core/smn_maplists.cpp | 16eb1d75c78362fbb33417d99bb1fa8ac12db1d8 | [] | no_license | Nephyrin/-furry-octo-nemesis | 5da2ef75883ebc4040e359a6679da64ad8848020 | dd441c39bd74eda2b9857540dcac1d98706de1de | refs/heads/master | 2016-09-06T01:12:49.611637 | 2008-09-14T08:42:28 | 2008-09-14T08:42:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,706 | cpp | /**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#include <sh_list.h>
#include "sm_globals.h"
#include "sm_trie_tpl.h"
#include "CellArray.h"
#include "convar.h"
#include "sourcemm_api.h"
#include "LibrarySys.h"
#include "TextParsers.h"
#include "sm_stringutil.h"
#include "sourcemod.h"
#include "Logger.h"
#include "HandleSys.h"
using namespace SourceHook;
struct maplist_info_t
{
bool bIsCompat;
bool bIsPath;
char name[PLATFORM_MAX_PATH];
char path[PLATFORM_MAX_PATH];
time_t last_modified_time;
CellArray *pArray;
int serial;
};
#define MAPLIST_FLAG_MAPSFOLDER (1<<0) /**< On failure, use all maps in the maps folder. */
#define MAPLIST_FLAG_CLEARARRAY (1<<1) /**< If an input array is specified, clear it before adding. */
#define MAPLIST_FLAG_NO_DEFAULT (1<<2) /**< Do not read "default" or "mapcyclefile" on failure. */
class MapLists : public SMGlobalClass, public ITextListener_SMC
{
public:
enum MapListState
{
MPS_NONE,
MPS_GLOBAL,
MPS_MAPLIST,
};
public:
MapLists()
{
m_pMapCycleFile = NULL;
m_ConfigLastChanged = 0;
m_nSerialChange = 0;
}
void OnSourceModAllInitialized()
{
g_SourceMod.BuildPath(Path_SM, m_ConfigFile, sizeof(m_ConfigFile), "configs/maplists.cfg");
}
void OnSourceModShutdown()
{
DumpCache(NULL);
}
void AddOrUpdateDefault(const char *name, const char *file)
{
char path[PLATFORM_MAX_PATH];
maplist_info_t *pMapList, **ppMapList;
if ((ppMapList = m_ListLookup.retrieve(name)) == NULL)
{
pMapList = new maplist_info_t;
pMapList->bIsCompat = true;
pMapList->bIsPath = true;
pMapList->last_modified_time = 0;
strncopy(pMapList->name, name, sizeof(pMapList->name));
pMapList->pArray = NULL;
g_SourceMod.BuildPath(Path_Game,
pMapList->path,
sizeof(pMapList->path),
"%s",
file);
pMapList->serial = 0;
m_ListLookup.insert(name, pMapList);
m_MapLists.push_back(pMapList);
return;
}
pMapList = *ppMapList;
/* Don't modify if it's from the config file */
if (!pMapList->bIsCompat)
{
return;
}
g_SourceMod.BuildPath(Path_Game,
path,
sizeof(path),
"%s",
file);
/* If the path matches, don't reset the serial/time */
if (strcmp(path, pMapList->path) == 0)
{
return;
}
strncopy(pMapList->path, path, sizeof(pMapList->path));
pMapList->bIsPath = true;
pMapList->last_modified_time = 0;
pMapList->serial = 0;
}
void UpdateCache()
{
bool fileFound;
SMCError error;
time_t fileTime;
SMCStates states = {0, 0};
fileFound = g_LibSys.FileTime(m_ConfigFile, FileTime_LastChange, &fileTime);
/* If the file is found and hasn't changed, bail out now. */
if (fileFound && fileTime == m_ConfigLastChanged)
{
return;
}
/* If the file wasn't found, and we already have entries, we bail out too.
* This case lets us optimize when a user deletes the config file, so we
* don't reparse every single time the function is called.
*/
if (!fileFound && m_MapLists.size() > 0)
{
return;
}
m_pMapCycleFile = icvar->FindVar("mapcyclefile");
/* Dump everything we know about. */
List<maplist_info_t *> compat;
DumpCache(&compat);
/* All this is to add the default entry back in. */
maplist_info_t *pDefList = new maplist_info_t;
pDefList->bIsPath = true;
strncopy(pDefList->name, "mapcyclefile", sizeof(pDefList->name));
g_SourceMod.BuildPath(Path_Game,
pDefList->path,
sizeof(pDefList->path),
"%s",
m_pMapCycleFile ? m_pMapCycleFile->GetString() : "mapcycle.txt");
pDefList->last_modified_time = 0;
pDefList->pArray = NULL;
pDefList->serial = 0;
m_ListLookup.insert("mapcyclefile", pDefList);
m_MapLists.push_back(pDefList);
/* Now parse the config file even if we don't know about it.
* This will give us a nice error message.
*/
if ((error = g_TextParser.ParseFile_SMC(m_ConfigFile, this, &states))
!= SMCError_Okay)
{
const char *errmsg = g_TextParser.GetSMCErrorString(error);
if (errmsg == NULL)
{
errmsg = "Unknown error";
}
g_Logger.LogError("[SM] Could not parse file \"%s\"", m_ConfigFile);
g_Logger.LogError("[SM] Error on line %d (col %d): %s",
states.line,
states.col,
errmsg);
}
else
{
m_ConfigLastChanged = fileTime;
}
/* Now, re-add compat stuff back in if we can. */
List<maplist_info_t *>::iterator iter = compat.begin();
while (iter != compat.end())
{
if (m_ListLookup.retrieve((*iter)->name) != NULL)
{
/* The compatibility shim is no longer needed. */
delete (*iter)->pArray;
delete (*iter);
}
else
{
m_ListLookup.insert((*iter)->name, (*iter));
m_MapLists.push_back((*iter));
}
iter = compat.erase(iter);
}
}
void ReadSMC_ParseStart()
{
m_CurState = MPS_NONE;
m_IgnoreLevel = 0;
m_pCurMapList = NULL;
}
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name)
{
if (m_IgnoreLevel)
{
m_IgnoreLevel++;
return SMCResult_Continue;
}
if (m_CurState == MPS_NONE)
{
if (strcmp(name, "MapLists") == 0)
{
m_CurState = MPS_GLOBAL;
}
else
{
m_IgnoreLevel = 1;
}
}
else if (m_CurState == MPS_GLOBAL)
{
m_pCurMapList = new maplist_info_t;
memset(m_pCurMapList, 0, sizeof(maplist_info_t));
strncopy(m_pCurMapList->name, name, sizeof(m_pCurMapList->name));
m_CurState = MPS_MAPLIST;
}
else if (m_CurState == MPS_MAPLIST)
{
m_IgnoreLevel++;
}
return SMCResult_Continue;
}
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
{
if (m_IgnoreLevel || m_pCurMapList == NULL)
{
return SMCResult_Continue;
}
if (strcmp(key, "file") == 0)
{
g_SourceMod.BuildPath(Path_Game,
m_pCurMapList->path,
sizeof(m_pCurMapList->path),
"%s",
value);
m_pCurMapList->bIsPath = true;
}
else if (strcmp(key, "target") == 0)
{
strncopy(m_pCurMapList->path, value, sizeof(m_pCurMapList->path));
m_pCurMapList->bIsPath = false;
}
return SMCResult_Continue;
}
SMCResult ReadSMC_LeavingSection(const SMCStates *states)
{
if (m_IgnoreLevel)
{
m_IgnoreLevel--;
return SMCResult_Continue;
}
if (m_CurState == MPS_MAPLIST)
{
if (m_pCurMapList != NULL
&& m_pCurMapList->path[0] != '\0'
&& m_ListLookup.retrieve(m_pCurMapList->name) == NULL)
{
m_ListLookup.insert(m_pCurMapList->name, m_pCurMapList);
m_MapLists.push_back(m_pCurMapList);
m_pCurMapList = NULL;
}
else
{
delete m_pCurMapList;
m_pCurMapList = NULL;
}
m_CurState = MPS_GLOBAL;
}
else if (m_CurState == MPS_GLOBAL)
{
m_CurState = MPS_NONE;
}
return SMCResult_Continue;
}
void ReadSMC_ParseEnd(bool halted, bool failed)
{
delete m_pCurMapList;
m_pCurMapList = NULL;
}
static int sort_maps_in_adt_array(const void *str1, const void *str2)
{
return strcmp((char *)str1, (char *)str2);
}
CellArray *UpdateMapList(CellArray *pUseArray, const char *name, int *pSerial, unsigned int flags)
{
int change_serial;
CellArray *pNewArray = NULL;
bool success, free_new_array;
free_new_array = false;
if ((success = GetMapList(&pNewArray, name, &change_serial)) == false)
{
if ((flags & MAPLIST_FLAG_NO_DEFAULT) != MAPLIST_FLAG_NO_DEFAULT)
{
/* If this list failed, and it's not the default, try the default.
*/
if (strcmp(name, "default") != 0)
{
success = GetMapList(&pNewArray, name, &change_serial);
}
/* If either of the last two conditions failed, try again if we can. */
if (!success && strcmp(name, "mapcyclefile") != 0)
{
success = GetMapList(&pNewArray, "mapcyclefile", &change_serial);
}
}
}
/* If there was a success, and the serial has not changed, bail out. */
if (success && *pSerial == change_serial)
{
return NULL;
}
/**
* If there was a success but no map list, we need to look in the maps folder.
* If there was a failure and the flag is specified, we need to look in the maps folder.
*/
if ((success && pNewArray == NULL)
|| (!success && ((flags & MAPLIST_FLAG_MAPSFOLDER) == MAPLIST_FLAG_MAPSFOLDER)))
{
char path[255];
IDirectory *pDir;
pNewArray = new CellArray(64);
free_new_array = true;
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "maps");
if ((pDir = g_LibSys.OpenDirectory(path)) != NULL)
{
char *ptr;
cell_t *blk;
char buffer[PLATFORM_MAX_PATH];
while (pDir->MoreFiles())
{
if (!pDir->IsEntryFile()
|| strcmp(pDir->GetEntryName(), ".") == 0
|| strcmp(pDir->GetEntryName(), "..") == 0)
{
pDir->NextEntry();
continue;
}
strncopy(buffer, pDir->GetEntryName(), sizeof(buffer));
if ((ptr = strstr(buffer, ".bsp")) == NULL || ptr[4] != '\0')
{
pDir->NextEntry();
continue;
}
*ptr = '\0';
if (!engine->IsMapValid(buffer))
{
pDir->NextEntry();
continue;
}
if ((blk = pNewArray->push()) == NULL)
{
pDir->NextEntry();
continue;
}
strncopy((char *)blk, buffer, 255);
pDir->NextEntry();
}
g_LibSys.CloseDirectory(pDir);
}
/* Remove the array if there were no items. */
if (pNewArray->size() == 0)
{
delete pNewArray;
pNewArray = NULL;
}
else
{
qsort(pNewArray->base(),
pNewArray->size(),
pNewArray->blocksize() * sizeof(cell_t),
sort_maps_in_adt_array);
}
change_serial = -1;
}
/* If there is still no array by this point, bail out. */
if (pNewArray == NULL)
{
*pSerial = -1;
return NULL;
}
*pSerial = change_serial;
/* If there is no input array, return something temporary. */
if (pUseArray == NULL)
{
if (free_new_array)
{
return pNewArray;
}
else
{
return pNewArray->clone();
}
}
/* Clear the input array if necessary. */
if ((flags & MAPLIST_FLAG_CLEARARRAY) == MAPLIST_FLAG_CLEARARRAY)
{
pUseArray->clear();
}
/* Copy. */
cell_t *blk_dst;
cell_t *blk_src;
for (size_t i = 0; i < pNewArray->size(); i++)
{
blk_dst = pUseArray->push();
blk_src = pNewArray->at(i);
strncopy((char *)blk_dst, (char *)blk_src, pUseArray->blocksize() * sizeof(cell_t));
}
/* Free resources if necessary. */
if (free_new_array)
{
delete pNewArray;
}
/* Return the array we were given. */
return pUseArray;
}
private:
bool GetMapList(CellArray **ppArray, const char *name, int *pSerial)
{
time_t last_time;
maplist_info_t *pMapList, **ppMapList;
if ((ppMapList = m_ListLookup.retrieve(name)) == NULL)
{
return false;
}
pMapList = *ppMapList;
if (!pMapList->bIsPath)
{
return GetMapList(ppArray, pMapList->path, pSerial);
}
/* If it is a path, and the path is "*", assume all files must be used. */
if (strcmp(pMapList->path, "*") == 0)
{
*ppArray = NULL;
return true;
}
if (m_pMapCycleFile != NULL && strcmp(name, "mapcyclefile") == 0)
{
char path[PLATFORM_MAX_PATH];
g_SourceMod.BuildPath(Path_Game,
path,
sizeof(path),
"%s",
m_pMapCycleFile ? m_pMapCycleFile->GetString() : "mapcycle.txt");
if (strcmp(path, pMapList->path) != 0)
{
strncopy(pMapList->path, path, sizeof(pMapList->path));
pMapList->last_modified_time = 0;
}
}
if (!g_LibSys.FileTime(pMapList->path, FileTime_LastChange, &last_time)
|| last_time > pMapList->last_modified_time)
{
/* Reparse */
FILE *fp;
cell_t *blk;
char buffer[255];
if ((fp = fopen(pMapList->path, "rt")) == NULL)
{
return false;
}
delete pMapList->pArray;
pMapList->pArray = new CellArray(64);
while (!feof(fp) && fgets(buffer, sizeof(buffer), fp) != NULL)
{
size_t len = strlen(buffer);
char *ptr = UTIL_TrimWhitespace(buffer, len);
if (*ptr == '\0'
|| *ptr == ';'
|| strncmp(ptr, "//", 2) == 0)
{
continue;
}
if (!engine->IsMapValid(ptr))
{
continue;
}
if ((blk = pMapList->pArray->push()) != NULL)
{
strncopy((char *)blk, ptr, 255);
}
}
fclose(fp);
pMapList->last_modified_time = last_time;
pMapList->serial = ++m_nSerialChange;
}
if (pMapList->pArray == NULL || pMapList->pArray->size() == 0)
{
return false;
}
*pSerial = pMapList->serial;
*ppArray = pMapList->pArray;
return true;
}
void DumpCache(List<maplist_info_t *> *compat_list)
{
m_ListLookup.clear();
List<maplist_info_t *>::iterator iter = m_MapLists.begin();
while (iter != m_MapLists.end())
{
if (compat_list != NULL && (*iter)->bIsCompat)
{
compat_list->push_back((*iter));
}
else
{
delete (*iter)->pArray;
delete (*iter);
}
iter = m_MapLists.erase(iter);
}
}
private:
char m_ConfigFile[PLATFORM_MAX_PATH];
time_t m_ConfigLastChanged;
ConVar *m_pMapCycleFile;
KTrie<maplist_info_t *> m_ListLookup;
List<maplist_info_t *> m_MapLists;
MapListState m_CurState;
unsigned int m_IgnoreLevel;
maplist_info_t *m_pCurMapList;
int m_nSerialChange;
} s_MapLists;
static cell_t LoadMapList(IPluginContext *pContext, const cell_t *params)
{
char *str;
Handle_t hndl;
cell_t *addr, flags;
CellArray *pArray, *pNewArray;
hndl = params[1];
pContext->LocalToPhysAddr(params[2], &addr);
pContext->LocalToString(params[3], &str);
flags = params[4];
/* Make sure the input Handle is valid */
pArray = NULL;
if (hndl != BAD_HANDLE)
{
HandleError err;
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
if ((err = g_HandleSys.ReadHandle(hndl, htCellArray, &sec, (void **)&pArray))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
}
}
/* Make sure the map list cache is up to date at the root */
s_MapLists.UpdateCache();
/* Try to get the map list. */
if ((pNewArray = s_MapLists.UpdateMapList(pArray, str, addr, flags)) == NULL)
{
return BAD_HANDLE;
}
/* If the user wanted a new array, create it now. */
if (hndl == BAD_HANDLE)
{
if ((hndl = g_HandleSys.CreateHandle(htCellArray, pNewArray, pContext->GetIdentity(), g_pCoreIdent, NULL))
== BAD_HANDLE)
{
*addr = -1;
delete pNewArray;
return BAD_HANDLE;
}
}
return hndl;
}
static cell_t SetMapListCompatBind(IPluginContext *pContext, const cell_t *params)
{
char *name, *file;
pContext->LocalToString(params[1], &name);
pContext->LocalToString(params[2], &file);
s_MapLists.UpdateCache();
s_MapLists.AddOrUpdateDefault(name, file);
return 1;
}
REGISTER_NATIVES(mapListNatives)
{
{"ReadMapList", LoadMapList},
{"SetMapListCompatBind", SetMapListCompatBind},
{NULL, NULL},
};
| [
"[email protected]",
"[email protected]"
] | [
[
[
1,
389
],
[
391,
668
]
],
[
[
390,
390
]
]
] |
18e08d0f37f59ab174b07b046003db9ac57318db | e6960d26699857b7eb203ab7847ad1f385fc99f9 | /src/GAME.H | 475a60827c73d860df894145b21e3dce1f09436d | [] | no_license | tomekc/raycaster3d | 7d74990379969cc0b328728df1b4b83637bcb893 | 4a0935458e4b180eb016a3631fa1bdf5a45ced42 | refs/heads/master | 2020-05-29T11:16:06.157909 | 2011-08-19T11:48:47 | 2011-08-19T11:48:47 | 2,233,237 | 1 | 1 | null | null | null | null | WINDOWS-1250 | C++ | false | false | 4,097 | h | #include <stdio.h>
#include <allegro.h>
#include "pakfile.h"
#include "defs.h"
extern "C" void DC_LightSetup (void *ptable, int lightOn);
extern "C" void DC_ScreenSetup (int wt, int ht, void *screen);
extern "C" void DC_Sliver (int col, int slice, int dist, byte *wall);
class Game;
/*---------------------------------------------------------------------
TABLES.CC
---------------------------------------------------------------------*/
void generateTrigTables ();
void generateViewTables (int w, int *,int *);
extern int *fisheye_table; // do kompensacji efektu "rybiego oka"
extern int *pixel_delta; // r˘§nica do k†ta promienia biegn†cego wprost
extern int tangent[ANGLES]; // nachylenie prostej dla ka§dego k†ta
extern int sinus[ANGLES];
extern int cosinus[ANGLES];
/*---------------------------------------------------------------------
TEXTURES.CC
---------------------------------------------------------------------*/
class Textures
{
byte *mapptr;
int nummaps;
public:
Textures ();
void load (PAKfile *res, char *name);
~Textures ();
byte* operator[] (int n);
};
/*---------------------------------------------------------------------
OBJECTS.CC
---------------------------------------------------------------------*/
enum objtype_t { o_actor, o_player, o_static, o_door };
class Object
{
protected:
int gridx,gridy; // pozycja w siatce
Game *parent;
objtype_t objtype;
};
class ActorObj : public Object
{
int xpos, ypos; // dok’adna pozycja
int angle; // k†t
public:
ActorObj (Game *);
void position (int x, int y, int a);
void rotate (int a); // obr˘Ť
void move (int n);
void strafe (int n); // p˘jd¦ bokiem
int checkMove (int x,int y);
int getx() { return xpos; }
int gety() { return ypos; }
int geta() { return angle; }
int getgridx() { return gridx; }
int getgridy() { return gridy; }
};
//---------------------------------------------------------------------------
class PlayerObj : public ActorObj
{
int view_x, view_y, view_w, view_h; // wspolrzedne obrazu
BITMAP *double_buffer;
int *fisheye, *pixdelta;
public:
PlayerObj (Game *);
~PlayerObj ();
void destroy_view ();
void init_view (int x,int y,int w,int h);
void render ();
void toscreen ();
int get_w ()
{
return view_w;
}
};
//---------------------------------------------------------------------------
enum doorstate_t { d_open, d_closed, d_locked, d_opening, d_closing };
enum doortype_t { d_horiz, d_vert };
class DoorObj : public Object
{
doorstate_t state;
doortype_t type;
int pos; // stan: 0 = otwarte, 63 = zamkniete
public:
DoorObj (Game*, int,int,doortype_t );
void open ();
void close ();
void act (); // powoduje robienie czegož z drzwiami
int getpos ()
{
return pos;
}
};
/*------------------------------------------------------------------------
GAME.CC
--------------------------------------------------------------------------*/
void Error (char *str);
class Game {
PAKfile *res;
PlayerObj *player1, *player2;
byte tilemap[64][64];
byte objectmap[64][64];
// view properties
//int view_maxw, view_maxh;
//int view_w, view_h, view_x, view_y;
void *light_table;
int light_flag;
int done_flag;
//BITMAP *viewbuf;
// texture maps
Textures wall_tex;
Textures object_tex;
// inne
friend void poll_keyboard(...);
void logo ();
public:
Game ();
~Game ();
void startup (); // perform startup operations
void draw (PlayerObj *); // draw player's view
void run (); // main gameloop !!!
void renderer_init (); // init view
int loadmap (char* name); // load and interpret a map
byte tileat (int x,int y)
{
return tilemap[63-(y&63)][x&63];
}
byte objectat (int x, int y)
{
return objectmap[63-(y&63)][x&63];
}
};
| [
"[email protected]"
] | [
[
[
1,
149
]
]
] |
bc2cb1434bfe26b76a0213ea1836831c1de0ee0a | 32aae73d2e203fdac4b718f2113e7f399c3d07ef | /sand/src/cgraphic.h | 6d2a8629c453ccd008d90d25b97ebb0142f21029 | [] | no_license | BackupTheBerlios/sandsimulation | d718688d03162c9bfb20617d6dd47696833f8b91 | b025cdb823c734723d53bbc632a17e23aaa009c3 | refs/heads/master | 2021-01-10T19:59:04.529749 | 2006-02-14T23:17:18 | 2006-02-14T23:17:18 | 40,039,316 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,695 | h | // written by Christian Klein
//graphik: change:30.dez.2005
// change 18.01.2006
// 12. Feb. 2006: change: now able to draw orthogonal graphic
// and resize with + and -
// with u,d,r,l you can center it
// add time intevall:
// q-> quicker; s -> slower
// config.txt example -> end of file
#ifndef __CGRAPHIC_H__
#define __CGRAPHIC_H__
#include <string>
#include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h>
#include <stdlib.h>
#include "configtool.h"
//define TESTSPEED
class cgraphic
{
public:
cgraphic() {QuitEnable = false;SetConfigName("config.txt");};
virtual ~cgraphic(){};
virtual void Init();
virtual void Run();
virtual void Quit();
void SetConfigName(std::string _Name);
void GetConfigName(std::string &_Name);
protected:
virtual void setup_opengl( int width, int height );
virtual void Swap_between_Fullscreen_And_Window();
virtual void Events();
virtual void KeyEvents( SDL_keysym* keysym );
virtual void InitScreen();
virtual void DrawScreen();
virtual void ReadConfig();
virtual void WriteConfig();
unsigned long TimeLeft();
bool QuitEnable;
SDL_Surface *screen;
ConfigTool Config;
double screen_size;
double centerx,centery;
unsigned long TickIntervall; // time in millisec
#ifdef TESTSPEED
double TESTSPEED_VALUE;
unsigned long TESTSPEED_COUNT;
#endif
};
#endif
// Example of config.txt:
/*
resx=800
resy=600
bits=24
fullscreen=0
Orthogonal=1
ScreenSize=0.6
CenterX=0.0
CenterY=0.0
TimeIntervall=10
datapath=/
execname=MyApplication
AppName=MyApplication
*/
| [
"chrikle"
] | [
[
[
1,
78
]
]
] |
857ac453cbe973d4286afecd1ae1b8349548ec45 | 71ffdff29137de6bda23f02c9e22a45fe94e7910 | /KillaCoptuz3000/src/Behaviour/CScript.cpp | 7f8ac7f40123c3587e16460a04fbf92be2659787 | [] | no_license | anhoppe/killakoptuz3000 | f2b6ecca308c1d6ebee9f43a1632a2051f321272 | fbf2e77d16c11abdadf45a88e1c747fa86517c59 | refs/heads/master | 2021-01-02T22:19:10.695739 | 2009-03-15T21:22:31 | 2009-03-15T21:22:31 | 35,839,301 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 1,931 | cpp | // ***************************************************************
// CScript version: 1.0 · date: 05/06/2007
// -------------------------------------------------------------
//
// -------------------------------------------------------------
// Copyright (C) 2007 - All Rights Reserved
// ***************************************************************
//
// ***************************************************************
#include <string>
#include "KillaCoptuz3000/src/Behaviour\CScript.h"
#include "KillaCoptuz3000/src/Behaviour\CWaypoint.h"
#include "KillaCoptuz3000/src/Functions.h"
CScript::CScript(const char* t_scriptFileName)
{
TiXmlDocument a_doc;
TiXmlNode* a_nodePtr;
TiXmlElement* a_elemPtr;
std::string a_str;
CBehavior* a_behavPtr;
if (a_doc.LoadFile(t_scriptFileName))
{
for(a_nodePtr = a_doc.FirstChild("behavior"); a_nodePtr; a_nodePtr = a_doc.IterateChildren(a_nodePtr))
{
a_elemPtr = a_nodePtr->ToElement();
if (getAttributeStr(a_elemPtr, "type",a_str))
{
if (a_str == "waypoint")
{
a_behavPtr = new CWaypoint();
a_behavPtr->load(a_nodePtr);
m_behavior.push_back(a_behavPtr);
}
}
}
}
m_activeBehavior = 0;
}
CScript::~CScript()
{
std::vector<CBehavior*>::iterator a_it;
for (a_it = m_behavior.begin(); a_it != m_behavior.end(); a_it++)
{
delete *a_it;
}
m_behavior.clear();
}
void CScript::update(SBehaviorData& t_data)
{
if(m_behavior.size() > 0)
{
if (m_behavior[m_activeBehavior]->update(t_data))
{
m_activeBehavior++;
if (m_activeBehavior >= m_behavior.size())
{
m_activeBehavior = 0;
}
}
}
} | [
"anhoppe@9386d06f-8230-0410-af72-8d16ca8b68df"
] | [
[
[
1,
70
]
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.