blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
5
146
content_id
stringlengths
40
40
detected_licenses
listlengths
0
7
license_type
stringclasses
2 values
repo_name
stringlengths
6
79
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
4 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.07k
426M
star_events_count
int64
0
27
fork_events_count
int64
0
12
gha_license_id
stringclasses
3 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
6 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
1 class
length_bytes
int64
20
6.28M
extension
stringclasses
20 values
content
stringlengths
20
6.28M
authors
listlengths
1
16
author_lines
listlengths
1
16
3298aecafe7a05db79f120a3d3d9c635fb07b39e
fcf03ead74f6dc103ec3b07ffe3bce81c820660d
/Messaging/TextMTM/txtc/TXCLIENT.H
d3cacbeae7ba39a36b050cc8c16ea888f12ebb6c
[]
no_license
huellif/symbian-example
72097c9aec6d45d555a79a30d576dddc04a65a16
56f6c5e67a3d37961408fc51188d46d49bddcfdc
refs/heads/master
2016-09-06T12:49:32.021854
2010-10-14T06:31:20
2010-10-14T06:31:20
38,062,421
2
0
null
null
null
null
UTF-8
C++
false
false
2,956
h
// TXCLIENT.H // // Copyright (c) 1999 Symbian Ltd. All rights reserved. // #if !defined (__TXCLIENT_H__) #define __TXCLIENT_H__ #include <e32base.h> #include <badesca.h> #include <msvapi.h> #include <mtclbase.h> const TUint KAddresseeListResizeGranularity = 5; #include "txut.h" // // CTextMtmClient // Implements CBaseMtm to provide Client-side Text MTM // class CTextMtmClient : public CBaseMtm { public: //Construction and destruction IMPORT_C static CTextMtmClient* NewL(CRegisteredMtmDll& aRegisteredMtmDll,CMsvSession& aMsvSession); ~CTextMtmClient(); // Store and restore entry data void SaveMessageL(); void LoadMessageL(); // Response message creation CMsvOperation* ReplyL (TMsvId aReplyEntryId, TMsvPartList aPartlist, TRequestStatus& aCompletionStatus); CMsvOperation* ForwardL(TMsvId aForwardEntryId, TMsvPartList aPartList, TRequestStatus& aCompletionStatus); // Validation and search TMsvPartList ValidateMessage(TUint aPartList); TMsvPartList Find(const TDesC& aTextToFind, TMsvPartList aPartList); // Addressees have no meaning in the text mtm. void AddAddresseeL(const TDesC& aRealAddress); void AddAddresseeL(const TDesC& aRealAddress, const TDesC& aAlias); void RemoveAddressee(TInt aIndex); // MTM-specific functionality TInt QueryCapability(TUid aCapability, TInt& aResponse); void InvokeSyncFunctionL(TInt aFunctionId,const CMsvEntrySelection& aSelection, TDes8& aParameter); CMsvOperation* InvokeAsyncFunctionL(TInt aFunctionId,const CMsvEntrySelection& aSelection, TDes8& aParameter, TRequestStatus& aCompletionStatus); void CreateAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TRequestStatus& aStatus); void CreateAttachmentL(RFile& aFile, const TDesC8& aMimeType, TRequestStatus& aStatus); void CreateLinkedAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TRequestStatus& aStatus); void CreateMessageAttachmentL(TMsvId aAttachmentId, TRequestStatus& aStatus); TMsvId DefaultServiceL() const; void RemoveDefaultServiceL(); void ChangeDefaultServiceL(const TMsvId& aService); // Text-specific TMTMTxtSettings& TxtSettings(); CMTMTxtSettings& Settings(); protected: CTextMtmClient(CRegisteredMtmDll& aRegisteredMtmDll,CMsvSession& aMsvSession); void ContextEntrySwitched(); void ConstructL(); private: // Properties TMTMTxtSettings iTxtSettings; CMTMTxtSettings* iSettings; }; // Addresses are not used in this MTM inline void CTextMtmClient::AddAddresseeL(const TDesC& /*aRealAddress*/) {}; inline void CTextMtmClient::AddAddresseeL(const TDesC& /*aRealAddress*/, const TDesC& /*aAlias*/) {}; inline void CTextMtmClient::RemoveAddressee(TInt /*aIndex*/) {}; inline TMTMTxtSettings& CTextMtmClient::TxtSettings() { return iTxtSettings; } inline CMTMTxtSettings& CTextMtmClient::Settings() { return *iSettings; } #endif // __TXCLIENT_H__
[ "liuxk99@bdc341c6-17c0-11de-ac9f-1d9250355bca" ]
[ [ [ 1, 91 ] ] ]
315ca9ae94d98052eca30090ac47071ec9027430
8c234510906db9ae4e724c8efb0238892cb3a128
/apps/StereoGR/OpenGLView.h
708041f295c7cb19988db75abc1012d3831d78cf
[ "BSD-3-Clause" ]
permissive
hcl3210/opencv
7b8b752982afaf402a361eb8475c24e7f4c08671
b34b1c3540716a3dadfd2b9e3bbc4253774c636d
refs/heads/master
2020-05-19T12:45:52.864577
2008-08-20T01:57:54
2008-08-20T01:57:54
177,025
2
0
null
null
null
null
WINDOWS-1251
C++
false
false
2,581
h
// OpenGLView.h : interface of the COpenGLView class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_OPENGLVIEW_H__8E83909C_3A90_11D1_AB25_000000000000__INCLUDED_) #define AFX_OPENGLVIEW_H__8E83909C_3A90_11D1_AB25_000000000000__INCLUDED_ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 #include <gl\gl.h> class COpenGLView : public CView { protected: // create from serialization only COpenGLView(); DECLARE_DYNCREATE(COpenGLView) // Attributes protected: GLint m_width; // ширина окна OpenGL GLint m_height; // высота окна OpenGL POINT m_mousePosition; GLdouble m_translate[3]; GLdouble m_rotate[16]; public: CDocument* GetDocument(); // Operations public: protected: CClientDC *m_pDC; // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(COpenGLView) public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); protected: virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); //}}AFX_VIRTUAL // Implementation public: virtual void DrawScene(CDC* pDC = 0); void InitCameraPosition(); void SetOwnContext(); void TrackBall(CPoint last, CPoint init, double& angle, double& x, double& y, double& z); void Swap(); void EndScene(); void BeginScene(); virtual ~COpenGLView(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: BOOL SetPixelFormat(HDC hdc); BOOL CreateGLContext(HDC hdc); // Generated message map functions protected: int InitOpenGL(); //{{AFX_MSG(COpenGLView) afx_msg void OnDestroy(); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); //}}AFX_MSG DECLARE_MESSAGE_MAP() private: HGLRC m_hrc; }; #ifndef _DEBUG // debug version in OpenGLView.cpp inline CDocument* COpenGLView::GetDocument() { return (CDocument*)m_pDocument; } #endif ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. #endif // !defined(AFX_OPENGLVIEW_H__8E83909C_3A90_11D1_AB25_000000000000__INCLUDED_)
[ [ [ 1, 93 ] ] ]
ed6daf8151d292010f5a8b4a47dbdf6b22e17a1b
789bfae90cbb728db537b24eb9ab21c88bda2786
/source/LogoZoomInStateClass.h
80586cf368101fb1640f2bb7daef3e7db5835977
[ "MIT" ]
permissive
Izhido/bitsweeper
b89db2c2050cbc82ea60d31d2f31b041a1e913a3
a37902c5b9ae9c25ee30694c2ba0974fd235090e
refs/heads/master
2021-01-23T11:49:21.723909
2011-12-24T22:43:30
2011-12-24T22:43:30
34,614,275
0
2
null
null
null
null
UTF-8
C++
false
false
416
h
#ifndef LOGOZOOMINSTATECLASS_H #define LOGOZOOMINSTATECLASS_H #include "StateClass.h" #define LOGO_ZOOM_IN_STATE 1 class LogoZoomInStateClass : public StateClass { public: LogoZoomInStateClass(); void Start(class CommonDataClass* CommonData); void Run(class CommonDataClass* CommonData); void Draw(CommonDataClass* CommonData); private: int Count; float Factor; }; #endif
[ "[email protected]@66f87ebb-1a6f-337b-3a26-6cadc16acdcf" ]
[ [ [ 1, 27 ] ] ]
659bf1effc8b211f4289bcfcde7795610cc215d3
9b6eced5d80668bd4328a8f3d1f75c97f04f5e08
/bthci/hci2implementations/hctls/usb_original/fdc/src/fdchctloriginalmain.cpp
3155ed71d358c6bc10d98c4ed2d2b094c2616334
[]
no_license
SymbianSource/oss.FCL.sf.os.bt
3ca94a01740ac84a6a35718ad3063884ea885738
ba9e7d24a7fa29d6dd93808867c28bffa2206bae
refs/heads/master
2021-01-18T23:42:06.315016
2010-10-14T10:30:12
2010-10-14T10:30:12
72,765,157
1
0
null
null
null
null
UTF-8
C++
false
false
900
cpp
// Copyright (c) 2007-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: // /** @file @internalComponent */ #include <ECom/ImplementationProxy.h> #include "fdchctloriginal.h" const TImplementationProxy ImplementationTable[] = { IMPLEMENTATION_PROXY_ENTRY(0x200345EA, CFdcHctlOriginal::NewL) }; EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) { aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); return ImplementationTable; }
[ "none@none" ]
[ [ [ 1, 33 ] ] ]
445f093c30124cf4c3d53c770aef5b5cf00d54b3
fc4946d917dc2ea50798a03981b0274e403eb9b7
/gentleman/gentleman/WindowsAPICodePack/WindowsAPICodePack/DirectX/DirectX/Direct2D/D2DInterfaces.cpp
0028c33c52138360cbd8e6b70c8930e7e0c6dc03
[]
no_license
midnite8177/phever
f9a55a545322c9aff0c7d0c45be3d3ddd6088c97
45529e80ebf707e7299887165821ca360aa1907d
refs/heads/master
2020-05-16T21:59:24.201346
2010-07-12T23:51:53
2010-07-12T23:51:53
34,965,829
3
2
null
null
null
null
UTF-8
C++
false
false
90,748
cpp
// Copyright (c) Microsoft Corporation. All rights reserved. #include "stdafx.h" #include <vector> #include "WIC/WICBitmapSource.h" #include "WIC/WICBitmap.h" #include "WIC/WICBitmapLock.h" #include "DXGI/DXGISurface.h" #include "DirectWrite/DWriteTextFormat.h" #include "DirectWrite/DWriteTextLayout.h" #include "DirectWrite/DWriteRenderingParams.h" using namespace std; using namespace Microsoft::WindowsAPICodePack::DirectX::WindowsImagingComponent; using namespace Microsoft::WindowsAPICodePack::DirectX::DXGI; namespace Microsoft { namespace WindowsAPICodePack { namespace DirectX { namespace Direct2D1 { D2DResource::D2DResource( ) : DirectUnknown() { } D2DResource::D2DResource( IUnknown *pInner ) : DirectUnknown(pInner) { } D2DFactory ^ D2DResource::GetFactory( ) { ID2D1Factory * factory = NULL; GetInterface<ID2D1Resource>()->GetFactory(&factory); return factory ? gcnew D2DFactory(factory) : nullptr; } D2DBitmap::D2DBitmap( ) : D2DResource() { } D2DBitmap::D2DBitmap( IUnknown *pInner ) : D2DResource(pInner) { } SizeF D2DBitmap::Size::get() { D2D1_SIZE_F returnCopy; returnCopy = GetInterface<ID2D1Bitmap>()->GetSize( ); SizeF returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } SizeU D2DBitmap::PixelSize::get() { D2D1_SIZE_U returnCopy; returnCopy = GetInterface<ID2D1Bitmap>()->GetPixelSize( ); SizeU returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } D2D::PixelFormat D2DBitmap::PixelFormat::get( ) { D2D1_PIXEL_FORMAT returnCopy; returnCopy = GetInterface<ID2D1Bitmap>()->GetPixelFormat( ); D2D::PixelFormat returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } DpiF D2DBitmap::Dpi::get( ) { ::FLOAT dpiXCopy; ::FLOAT dpiYCopy; GetInterface<ID2D1Bitmap>()->GetDpi( &dpiXCopy, &dpiYCopy ); return DpiF(dpiXCopy, dpiYCopy); } void D2DBitmap::CopyFromBitmap( D2DBitmap ^ bitmap, Point2U destPoint, RectU srcRect ) { D2D1_POINT_2U destPointCopy; destPoint.CopyTo(&destPointCopy); D2D1_RECT_U srcRectCopy; srcRect.CopyTo(&srcRectCopy); CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromBitmap( &destPointCopy, bitmap->GetInterface<ID2D1Bitmap>(), &srcRectCopy )); } void D2DBitmap::CopyFromBitmap( D2DBitmap ^ bitmap, Point2U destPoint ) { D2D1_POINT_2U destPointCopy; destPoint.CopyTo(&destPointCopy); CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromBitmap( &destPointCopy, bitmap->GetInterface<ID2D1Bitmap>(), NULL )); } void D2DBitmap::CopyFromBitmap( D2DBitmap ^ bitmap, RectU srcRect ) { D2D1_RECT_U srcRectCopy; srcRect.CopyTo(&srcRectCopy); CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromBitmap( NULL, bitmap->GetInterface<ID2D1Bitmap>(), &srcRectCopy )); } void D2DBitmap::CopyFromBitmap( D2DBitmap ^ bitmap ) { CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromBitmap( NULL, bitmap->GetInterface<ID2D1Bitmap>(), NULL )); } void D2DBitmap::CopyFromRenderTarget( RenderTarget ^ renderTarget, Point2U destPoint, RectU srcRect ) { D2D1_POINT_2U destPointCopy; destPoint.CopyTo(&destPointCopy); D2D1_RECT_U srcRectCopy; srcRect.CopyTo(&srcRectCopy); CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromRenderTarget( &destPointCopy, renderTarget->GetInterface<ID2D1RenderTarget>(), &srcRectCopy )); } void D2DBitmap::CopyFromRenderTarget( RenderTarget ^ renderTarget ) { CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromRenderTarget( NULL, renderTarget->GetInterface<ID2D1RenderTarget>(), NULL )); } void D2DBitmap::CopyFromRenderTarget( RenderTarget ^ renderTarget, Point2U destPoint ) { D2D1_POINT_2U destPointCopy; destPoint.CopyTo(&destPointCopy); CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromRenderTarget( &destPointCopy, renderTarget->GetInterface<ID2D1RenderTarget>(), NULL )); } void D2DBitmap::CopyFromRenderTarget( RenderTarget ^ renderTarget, RectU srcRect ) { D2D1_RECT_U srcRectCopy; srcRect.CopyTo(&srcRectCopy); CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromRenderTarget( NULL, renderTarget->GetInterface<ID2D1RenderTarget>(), &srcRectCopy )); } void D2DBitmap::CopyFromMemory( RectU dstRect, IntPtr srcData, UINT32 pitch ) { D2D1_RECT_U dstRectCopy; dstRect.CopyTo(&dstRectCopy); CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromMemory( &dstRectCopy, srcData.ToPointer(), pitch )); } void D2DBitmap::CopyFromMemory( IntPtr srcData, UINT32 pitch ) { CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromMemory( NULL, srcData.ToPointer(), pitch )); } void D2DBitmap::CopyFromMemory( RectU dstRect, array<unsigned char>^ srcData, UINT32 pitch ) { D2D1_RECT_U dstRectCopy; dstRect.CopyTo(&dstRectCopy); pin_ptr<unsigned char> srcDataPtr = &srcData[0]; CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromMemory( &dstRectCopy, srcDataPtr, pitch )); } void D2DBitmap::CopyFromMemory( array<unsigned char>^ srcData, UINT32 pitch ) { pin_ptr<unsigned char> srcDataPtr = &srcData[0]; CommonUtils::VerifyResult( GetInterface<ID2D1Bitmap>()->CopyFromMemory( NULL, srcDataPtr, pitch )); } GradientStopCollection::GradientStopCollection( ) : D2DResource() { } GradientStopCollection::GradientStopCollection( IUnknown *pInner ) : D2DResource(pInner) { } UINT32 GradientStopCollection::GradientStopCount::get( ) { return GetInterface<ID2D1GradientStopCollection>()->GetGradientStopCount(); } ReadOnlyCollection<GradientStop>^ GradientStopCollection::GetGradientStops( ) { D2D1_GRADIENT_STOP *gradientStopsCopy = NULL; List<GradientStop> ^ gradientStops = gcnew List<GradientStop>(); UINT32 count = GetInterface<ID2D1GradientStopCollection>()->GetGradientStopCount(); if (count > 0) { vector<D2D1_GRADIENT_STOP> gradientStopsCopy(count); ZeroMemory(&gradientStopsCopy[0], sizeof(D2D1_GRADIENT_STOP) * (count)); GetInterface<ID2D1GradientStopCollection>()->GetGradientStops( &gradientStopsCopy[0], count ); for(UINT i = 0; i < count; ++i) { GradientStop gradientStop; gradientStop.CopyFrom(gradientStopsCopy[i]); gradientStops->Add(gradientStop); } } return gcnew ReadOnlyCollection<GradientStop>(gradientStops); } Gamma GradientStopCollection::ColorInterpolationGamma::get( ) { return static_cast<Gamma>(GetInterface<ID2D1GradientStopCollection>()->GetColorInterpolationGamma()); } D2D::ExtendMode GradientStopCollection::ExtendMode::get( ) { return static_cast<D2D::ExtendMode>(GetInterface<ID2D1GradientStopCollection>()->GetExtendMode()); } Brush::Brush( ) : D2DResource() { } Brush::Brush( IUnknown *pInner ) : D2DResource(pInner) { } void Brush::Opacity::set( FLOAT opacity) { GetInterface<ID2D1Brush>()->SetOpacity( opacity ); } void Brush::Transform::set( Matrix3x2F transform ) { D2D1_MATRIX_3X2_F transformCopy; transform.CopyTo(&transformCopy); GetInterface<ID2D1Brush>()->SetTransform( &transformCopy ); } FLOAT Brush::Opacity::get( ) { return GetInterface<ID2D1Brush>()->GetOpacity( ); } Matrix3x2F Brush::Transform::get( ) { D2D1_MATRIX_3X2_F transformCopy; GetInterface<ID2D1Brush>()->GetTransform( &transformCopy ); Matrix3x2F transform; transform.CopyFrom(transformCopy); return transform; } BitmapBrush::BitmapBrush( ) : Brush() { } BitmapBrush::BitmapBrush( IUnknown *pInner ) : Brush(pInner) { } void BitmapBrush::ExtendModeX::set( ExtendMode extendModeX ) { GetInterface<ID2D1BitmapBrush>()->SetExtendModeX( static_cast<D2D1_EXTEND_MODE>(extendModeX) ); } void BitmapBrush::ExtendModeY::set( ExtendMode extendModeY ) { GetInterface<ID2D1BitmapBrush>()->SetExtendModeY( static_cast<D2D1_EXTEND_MODE>(extendModeY) ); } void BitmapBrush::InterpolationMode::set( BitmapInterpolationMode interpolationMode ) { GetInterface<ID2D1BitmapBrush>()->SetInterpolationMode( static_cast<D2D1_BITMAP_INTERPOLATION_MODE>(interpolationMode) ); } void BitmapBrush::SetBitmap( D2DBitmap ^ bitmap ) { GetInterface<ID2D1BitmapBrush>()->SetBitmap( bitmap->GetInterface<ID2D1Bitmap>() ); } ExtendMode BitmapBrush::ExtendModeX::get( ) { return static_cast<ExtendMode>(GetInterface<ID2D1BitmapBrush>()->GetExtendModeX()); } ExtendMode BitmapBrush::ExtendModeY::get( ) { return static_cast<ExtendMode>(GetInterface<ID2D1BitmapBrush>()->GetExtendModeY()); } BitmapInterpolationMode BitmapBrush::InterpolationMode::get( ) { return static_cast<BitmapInterpolationMode>(GetInterface<ID2D1BitmapBrush>()->GetInterpolationMode()); } D2DBitmap ^ BitmapBrush::GetBitmap( ) { ID2D1Bitmap * ptr = NULL; GetInterface<ID2D1BitmapBrush>()->GetBitmap(&ptr); return ptr ? gcnew D2DBitmap(ptr) : nullptr; } SolidColorBrush::SolidColorBrush( ) : Brush() { } SolidColorBrush::SolidColorBrush( IUnknown *pInner ) : Brush(pInner) { } void SolidColorBrush::Color::set( ColorF color ) { D2D1_COLOR_F colorCopy; color.CopyTo(&colorCopy); GetInterface<ID2D1SolidColorBrush>()->SetColor( &colorCopy ); } ColorF SolidColorBrush::Color::get( ) { D2D1_COLOR_F returnCopy; returnCopy = GetInterface<ID2D1SolidColorBrush>()->GetColor( ); ColorF returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } LinearGradientBrush::LinearGradientBrush( ) : Brush() { } LinearGradientBrush::LinearGradientBrush( IUnknown *pInner ) : Brush(pInner) { } void LinearGradientBrush::StartPoint::set( Point2F startPoint ) { D2D1_POINT_2F startPointCopy; startPoint.CopyTo(&startPointCopy); GetInterface<ID2D1LinearGradientBrush>()->SetStartPoint( startPointCopy ); } void LinearGradientBrush::EndPoint::set( Point2F endPoint ) { D2D1_POINT_2F endPointCopy; endPoint.CopyTo(&endPointCopy); GetInterface<ID2D1LinearGradientBrush>()->SetEndPoint( endPointCopy ); } Point2F LinearGradientBrush::StartPoint::get( ) { D2D1_POINT_2F returnCopy = GetInterface<ID2D1LinearGradientBrush>()->GetStartPoint( ); Point2F returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } Point2F LinearGradientBrush::EndPoint::get( ) { D2D1_POINT_2F returnCopy = GetInterface<ID2D1LinearGradientBrush>()->GetEndPoint( ); Point2F returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } GradientStopCollection ^ LinearGradientBrush::GetGradientStopCollection( ) { ID2D1GradientStopCollection * ptr = NULL; GetInterface<ID2D1LinearGradientBrush>()->GetGradientStopCollection(&ptr); return ptr ? gcnew GradientStopCollection(ptr) : nullptr; } RadialGradientBrush::RadialGradientBrush( ) : Brush() { } RadialGradientBrush::RadialGradientBrush( IUnknown *pInner ) : Brush(pInner) { } void RadialGradientBrush::Center::set( Point2F center ) { D2D1_POINT_2F centerCopy; center.CopyTo(&centerCopy); GetInterface<ID2D1RadialGradientBrush>()->SetCenter( centerCopy ); } void RadialGradientBrush::GradientOriginOffset::set( Point2F gradientOriginOffset ) { D2D1_POINT_2F gradientOriginOffsetCopy; gradientOriginOffset.CopyTo(&gradientOriginOffsetCopy); GetInterface<ID2D1RadialGradientBrush>()->SetGradientOriginOffset( gradientOriginOffsetCopy ); } void RadialGradientBrush::RadiusX::set( FLOAT radiusX ) { GetInterface<ID2D1RadialGradientBrush>()->SetRadiusX( radiusX ); } void RadialGradientBrush::RadiusY::set( FLOAT radiusY ) { GetInterface<ID2D1RadialGradientBrush>()->SetRadiusY( radiusY ); } Point2F RadialGradientBrush::Center::get( ) { D2D1_POINT_2F returnCopy = GetInterface<ID2D1RadialGradientBrush>()->GetCenter( ); Point2F returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } Point2F RadialGradientBrush::GradientOriginOffset::get( ) { D2D1_POINT_2F returnCopy = GetInterface<ID2D1RadialGradientBrush>()->GetGradientOriginOffset( ); Point2F returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } FLOAT RadialGradientBrush::RadiusX::get( ) { return GetInterface<ID2D1RadialGradientBrush>()->GetRadiusX(); } FLOAT RadialGradientBrush::RadiusY::get( ) { return GetInterface<ID2D1RadialGradientBrush>()->GetRadiusY(); } GradientStopCollection ^ RadialGradientBrush::GetGradientStopCollection( ) { ID2D1GradientStopCollection * ptr = NULL; GetInterface<ID2D1RadialGradientBrush>()->GetGradientStopCollection(&ptr); return ptr ? gcnew GradientStopCollection(ptr) : nullptr; } DrawingStateBlock::DrawingStateBlock( ) : D2DResource() { } DrawingStateBlock::DrawingStateBlock( IUnknown *pInner ) : D2DResource(pInner) { } DrawingStateDescription DrawingStateBlock::Description::get( ) { D2D1_DRAWING_STATE_DESCRIPTION stateDescriptionCopy; GetInterface<ID2D1DrawingStateBlock>()->GetDescription( &stateDescriptionCopy ); DrawingStateDescription stateDescription; stateDescription.CopyFrom(stateDescriptionCopy); return stateDescription; } void DrawingStateBlock::Description::set( DrawingStateDescription stateDescription ) { D2D1_DRAWING_STATE_DESCRIPTION stateDescriptionCopy; stateDescription.CopyTo(&stateDescriptionCopy); GetInterface<ID2D1DrawingStateBlock>()->SetDescription( &stateDescriptionCopy ); } RenderingParams^ DrawingStateBlock::GetTextRenderingParams() { IDWriteRenderingParams* renderingParams = NULL; GetInterface<ID2D1DrawingStateBlock>()->GetTextRenderingParams(&renderingParams); return renderingParams ? gcnew RenderingParams(renderingParams) : nullptr; } void DrawingStateBlock::SetTextRenderingParams(RenderingParams^ textRenderingParams) { GetInterface<ID2D1DrawingStateBlock>()->SetTextRenderingParams( textRenderingParams == nullptr ? NULL : textRenderingParams->GetInterface<IDWriteRenderingParams>() ); } RenderTarget::RenderTarget( ) : D2DResource() { } RenderTarget::RenderTarget( IUnknown *pInner ) : D2DResource(pInner) { } D2DBitmap ^ RenderTarget::CreateBitmap( SizeU size, BitmapProperties bitmapProperties ) { D2D1_SIZE_U sizeCopy; size.CopyTo(&sizeCopy); D2D1_BITMAP_PROPERTIES bitmapPropertiesCopy; bitmapProperties.CopyTo(&bitmapPropertiesCopy); ID2D1Bitmap * bitmapPtr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateBitmap( sizeCopy, NULL, 0, &bitmapPropertiesCopy, &bitmapPtr )); return bitmapPtr ? gcnew D2DBitmap(bitmapPtr): nullptr; } D2DBitmap ^ RenderTarget::CreateBitmap( SizeU size, IntPtr sourceData, UINT32 pitch, BitmapProperties bitmapProperties ) { D2D1_SIZE_U sizeCopy; size.CopyTo(&sizeCopy); D2D1_BITMAP_PROPERTIES bitmapPropertiesCopy; bitmapProperties.CopyTo(&bitmapPropertiesCopy); ID2D1Bitmap * bitmapPtr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateBitmap( sizeCopy, sourceData.ToPointer(), pitch, &bitmapPropertiesCopy, &bitmapPtr )); return bitmapPtr ? gcnew D2DBitmap(bitmapPtr): nullptr; } D2DBitmap ^ RenderTarget::CreateBitmap( SizeU size, array<unsigned char>^ sourceBytes, UINT32 pitch, BitmapProperties bitmapProperties ) { D2D1_SIZE_U sizeCopy; size.CopyTo(&sizeCopy); D2D1_BITMAP_PROPERTIES bitmapPropertiesCopy; bitmapProperties.CopyTo(&bitmapPropertiesCopy); pin_ptr<unsigned char> bytePtr = &sourceBytes[0]; ID2D1Bitmap * bitmapPtr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateBitmap( sizeCopy, bytePtr, pitch, &bitmapPropertiesCopy, &bitmapPtr )); return bitmapPtr ? gcnew D2DBitmap(bitmapPtr): nullptr; } D2DBitmap ^ RenderTarget::CreateBitmapFromWicBitmap( BitmapSource^ wicBitmapSource, BitmapProperties bitmapProperties ) { D2D1_BITMAP_PROPERTIES bitmapPropertiesCopy; bitmapProperties.CopyTo(&bitmapPropertiesCopy); ID2D1Bitmap * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateBitmapFromWicBitmap( wicBitmapSource->GetInterface<IWICBitmapSource>(), &bitmapPropertiesCopy, &ptr )); return ptr ? gcnew D2DBitmap(ptr): nullptr; } D2DBitmap ^ RenderTarget::CreateBitmapFromWicBitmap( BitmapSource^ wicBitmapSource ) { ID2D1Bitmap * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateBitmapFromWicBitmap( wicBitmapSource->GetInterface<IWICBitmapSource>(), NULL, &ptr )); return ptr ? gcnew D2DBitmap(ptr): nullptr; } D2DBitmap ^ RenderTarget::CreateSharedBitmap( WICBitmapLock^ wicBitmap, BitmapProperties bitmapProperties ) { D2D1_BITMAP_PROPERTIES bitmapPropertiesCopy; bitmapProperties.CopyTo(&bitmapPropertiesCopy); ID2D1Bitmap * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateSharedBitmap( __uuidof(IWICBitmapLock), (void*) wicBitmap->GetInterface<IWICBitmapLock>(), &bitmapPropertiesCopy, &ptr )); return ptr ? gcnew D2DBitmap(ptr): nullptr; } D2DBitmap ^ RenderTarget::CreateSharedBitmap( WICBitmapLock^ wicBitmap ) { ID2D1Bitmap * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateSharedBitmap( __uuidof(IWICBitmapLock), (void*) wicBitmap->GetInterface<IWICBitmapLock>(), NULL, &ptr )); return ptr ? gcnew D2DBitmap(ptr): nullptr; } D2DBitmap ^ RenderTarget::CreateSharedBitmap( Surface^ surface, BitmapProperties bitmapProperties ) { D2D1_BITMAP_PROPERTIES bitmapPropertiesCopy; bitmapProperties.CopyTo(&bitmapPropertiesCopy); ID2D1Bitmap * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateSharedBitmap( __uuidof(IDXGISurface), (void*) surface->GetInterface<IDXGISurface>(), &bitmapPropertiesCopy, &ptr )); return ptr ? gcnew D2DBitmap(ptr): nullptr; } D2DBitmap ^ RenderTarget::CreateSharedBitmap( Surface^ surface ) { ID2D1Bitmap * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateSharedBitmap( __uuidof(IDXGISurface), (void*) surface->GetInterface<IDXGISurface>(), NULL, &ptr )); return ptr ? gcnew D2DBitmap(ptr): nullptr; } D2DBitmap ^ RenderTarget::CreateSharedBitmap( D2DBitmap ^ bitmap, BitmapProperties bitmapProperties ) { D2D1_BITMAP_PROPERTIES bitmapPropertiesCopy; bitmapProperties.CopyTo(&bitmapPropertiesCopy); ID2D1Bitmap * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateSharedBitmap( __uuidof(ID2D1Bitmap), (void*) bitmap->GetInterface<ID2D1Bitmap>(), &bitmapPropertiesCopy, &ptr )); return ptr ? gcnew D2DBitmap(ptr): nullptr; } D2DBitmap ^ RenderTarget::CreateSharedBitmap( D2DBitmap ^ bitmap ) { ID2D1Bitmap * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateSharedBitmap( __uuidof(ID2D1Bitmap), (void*) bitmap->GetInterface<ID2D1Bitmap>(), NULL, &ptr )); return ptr ? gcnew D2DBitmap(ptr): nullptr; } BitmapBrush ^ RenderTarget::CreateBitmapBrush( D2DBitmap ^ bitmap, BitmapBrushProperties bitmapBrushProperties, BrushProperties brushProperties ) { D2D1_BITMAP_BRUSH_PROPERTIES bitmapBrushPropertiesCopy; bitmapBrushProperties.CopyTo(&bitmapBrushPropertiesCopy); D2D1_BRUSH_PROPERTIES brushPropertiesCopy; brushProperties.CopyTo(&brushPropertiesCopy); ID2D1BitmapBrush * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateBitmapBrush( bitmap->GetInterface<ID2D1Bitmap>(), &bitmapBrushPropertiesCopy, &brushPropertiesCopy, &ptr )); return ptr ? gcnew BitmapBrush(ptr): nullptr; } BitmapBrush ^ RenderTarget::CreateBitmapBrush( D2DBitmap ^ bitmap, BitmapBrushProperties bitmapBrushProperties ) { D2D1_BITMAP_BRUSH_PROPERTIES bitmapBrushPropertiesCopy; bitmapBrushProperties.CopyTo(&bitmapBrushPropertiesCopy); ID2D1BitmapBrush * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateBitmapBrush( bitmap->GetInterface<ID2D1Bitmap>(), &bitmapBrushPropertiesCopy, NULL, &ptr )); return ptr ? gcnew BitmapBrush(ptr): nullptr; } BitmapBrush ^ RenderTarget::CreateBitmapBrush( D2DBitmap ^ bitmap, BrushProperties brushProperties ) { D2D1_BRUSH_PROPERTIES brushPropertiesCopy; brushProperties.CopyTo(&brushPropertiesCopy); ID2D1BitmapBrush * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateBitmapBrush( bitmap->GetInterface<ID2D1Bitmap>(), NULL, &brushPropertiesCopy, &ptr )); return ptr ? gcnew BitmapBrush(ptr): nullptr; } BitmapBrush ^ RenderTarget::CreateBitmapBrush( D2DBitmap ^ bitmap ) { ID2D1BitmapBrush * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateBitmapBrush( bitmap->GetInterface<ID2D1Bitmap>(), NULL, NULL, &ptr )); return ptr ? gcnew BitmapBrush(ptr): nullptr; } SolidColorBrush ^ RenderTarget::CreateSolidColorBrush( ColorF color, BrushProperties brushProperties ) { D2D1_COLOR_F colorCopy; color.CopyTo(&colorCopy); D2D1_BRUSH_PROPERTIES brushPropertiesCopy; brushProperties.CopyTo(&brushPropertiesCopy); ID2D1SolidColorBrush * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateSolidColorBrush( &colorCopy, &brushPropertiesCopy, &ptr )); return ptr ? gcnew SolidColorBrush(ptr): nullptr; } SolidColorBrush ^ RenderTarget::CreateSolidColorBrush( ColorF color ) { D2D1_COLOR_F colorCopy; color.CopyTo(&colorCopy); ID2D1SolidColorBrush * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateSolidColorBrush( &colorCopy, NULL, &ptr )); return ptr ? gcnew SolidColorBrush(ptr): nullptr; } GradientStopCollection ^ RenderTarget::CreateGradientStopCollection( IEnumerable<GradientStop> ^ gradientStops, Gamma colorInterpolationGamma, ExtendMode extendMode ) { vector<D2D1_GRADIENT_STOP> gradientStopsVector; ID2D1GradientStopCollection * ptr = NULL; for each (GradientStop gradientStop in gradientStops) { D2D1_GRADIENT_STOP gradientStopsCopy; gradientStop.CopyTo(&gradientStopsCopy); gradientStopsVector.push_back(gradientStopsCopy); } CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateGradientStopCollection( gradientStopsVector.size() > 0 ? &gradientStopsVector[0] : NULL, static_cast<UINT>(gradientStopsVector.size()), static_cast<D2D1_GAMMA>(colorInterpolationGamma), static_cast<D2D1_EXTEND_MODE>(extendMode), &ptr )); return ptr ? gcnew GradientStopCollection(ptr) : nullptr; } LinearGradientBrush ^ RenderTarget::CreateLinearGradientBrush( LinearGradientBrushProperties linearGradientBrushProperties, GradientStopCollection ^ gradientStopCollection, BrushProperties brushProperties ) { D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushPropertiesCopy; linearGradientBrushProperties.CopyTo(&linearGradientBrushPropertiesCopy); D2D1_BRUSH_PROPERTIES brushPropertiesCopy; brushProperties.CopyTo(&brushPropertiesCopy); ID2D1LinearGradientBrush * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateLinearGradientBrush( &linearGradientBrushPropertiesCopy, &brushPropertiesCopy, gradientStopCollection->GetInterface<ID2D1GradientStopCollection>(), &ptr )); return ptr ? gcnew LinearGradientBrush(ptr): nullptr; } LinearGradientBrush ^ RenderTarget::CreateLinearGradientBrush( LinearGradientBrushProperties linearGradientBrushProperties, GradientStopCollection ^ gradientStopCollection ) { D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushPropertiesCopy; linearGradientBrushProperties.CopyTo(&linearGradientBrushPropertiesCopy); ID2D1LinearGradientBrush * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateLinearGradientBrush( &linearGradientBrushPropertiesCopy, NULL, gradientStopCollection->GetInterface<ID2D1GradientStopCollection>(), &ptr )); return ptr ? gcnew LinearGradientBrush(ptr): nullptr; } RadialGradientBrush ^ RenderTarget::CreateRadialGradientBrush( RadialGradientBrushProperties radialGradientBrushProperties, GradientStopCollection ^ gradientStopCollection, BrushProperties brushProperties ) { D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushPropertiesCopy; radialGradientBrushProperties.CopyTo(&radialGradientBrushPropertiesCopy); D2D1_BRUSH_PROPERTIES brushPropertiesCopy; brushProperties.CopyTo(&brushPropertiesCopy); ID2D1RadialGradientBrush * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateRadialGradientBrush( &radialGradientBrushPropertiesCopy, &brushPropertiesCopy, gradientStopCollection->GetInterface<ID2D1GradientStopCollection>(), &ptr )); return ptr ? gcnew RadialGradientBrush(ptr) : nullptr; } RadialGradientBrush ^ RenderTarget::CreateRadialGradientBrush( RadialGradientBrushProperties radialGradientBrushProperties, GradientStopCollection ^ gradientStopCollection ) { D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushPropertiesCopy; radialGradientBrushProperties.CopyTo(&radialGradientBrushPropertiesCopy); ID2D1RadialGradientBrush * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateRadialGradientBrush( &radialGradientBrushPropertiesCopy, NULL, gradientStopCollection->GetInterface<ID2D1GradientStopCollection>(), &ptr )); return ptr ? gcnew RadialGradientBrush(ptr) : nullptr; } BitmapRenderTarget ^ RenderTarget::CreateCompatibleRenderTarget( CompatibleRenderTargetOptions options, SizeF desiredSize, SizeU desiredPixelSize ) { D2D1_SIZE_F desiredSizeCopy; desiredSize.CopyTo(&desiredSizeCopy); D2D1_SIZE_U desiredPixelSizeCopy; desiredPixelSize.CopyTo(&desiredPixelSizeCopy); ID2D1BitmapRenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateCompatibleRenderTarget( &desiredSizeCopy, &desiredPixelSizeCopy, NULL, static_cast<D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS>(options), &ptr )); return ptr ? gcnew BitmapRenderTarget(ptr) : nullptr; } BitmapRenderTarget ^ RenderTarget::CreateCompatibleRenderTarget( CompatibleRenderTargetOptions options, SizeF desiredSize ) { D2D1_SIZE_F desiredSizeCopy; desiredSize.CopyTo(&desiredSizeCopy); ID2D1BitmapRenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateCompatibleRenderTarget( &desiredSizeCopy, NULL, NULL, static_cast<D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS>(options), &ptr )); return ptr ? gcnew BitmapRenderTarget(ptr) : nullptr; } BitmapRenderTarget ^ RenderTarget::CreateCompatibleRenderTarget( CompatibleRenderTargetOptions options, SizeU desiredPixelSize ) { D2D1_SIZE_U desiredPixelSizeCopy; desiredPixelSize.CopyTo(&desiredPixelSizeCopy); ID2D1BitmapRenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateCompatibleRenderTarget( NULL, &desiredPixelSizeCopy, NULL, static_cast<D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS>(options), &ptr )); return ptr ? gcnew BitmapRenderTarget(ptr) : nullptr; } BitmapRenderTarget ^ RenderTarget::CreateCompatibleRenderTarget( CompatibleRenderTargetOptions options ) { ID2D1BitmapRenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateCompatibleRenderTarget( NULL, NULL, NULL, static_cast<D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS>(options), &ptr )); return ptr ? gcnew BitmapRenderTarget(ptr) : nullptr; } BitmapRenderTarget ^ RenderTarget::CreateCompatibleRenderTarget() { ID2D1BitmapRenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateCompatibleRenderTarget( NULL, NULL, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, &ptr )); return ptr ? gcnew BitmapRenderTarget(ptr) : nullptr; } BitmapRenderTarget ^ RenderTarget::CreateCompatibleRenderTarget( CompatibleRenderTargetOptions options, D2D::PixelFormat desiredFormat, SizeF desiredSize, SizeU desiredPixelSize ) { D2D1_SIZE_F desiredSizeCopy; desiredSize.CopyTo(&desiredSizeCopy); D2D1_SIZE_U desiredPixelSizeCopy; desiredPixelSize.CopyTo(&desiredPixelSizeCopy); D2D1_PIXEL_FORMAT desiredFormatCopy; desiredFormat.CopyTo(&desiredFormatCopy); ID2D1BitmapRenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateCompatibleRenderTarget( &desiredSizeCopy, &desiredPixelSizeCopy, &desiredFormatCopy, static_cast<D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS>(options), &ptr )); return ptr ? gcnew BitmapRenderTarget(ptr) : nullptr; } BitmapRenderTarget ^ RenderTarget::CreateCompatibleRenderTarget( CompatibleRenderTargetOptions options, D2D::PixelFormat desiredFormat, SizeF desiredSize ) { D2D1_SIZE_F desiredSizeCopy; desiredSize.CopyTo(&desiredSizeCopy); D2D1_PIXEL_FORMAT desiredFormatCopy; desiredFormat.CopyTo(&desiredFormatCopy); ID2D1BitmapRenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateCompatibleRenderTarget( &desiredSizeCopy, NULL, &desiredFormatCopy, static_cast<D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS>(options), &ptr )); return ptr ? gcnew BitmapRenderTarget(ptr) : nullptr; } BitmapRenderTarget ^ RenderTarget::CreateCompatibleRenderTarget( CompatibleRenderTargetOptions options, D2D::PixelFormat desiredFormat, SizeU desiredPixelSize ) { D2D1_SIZE_U desiredPixelSizeCopy; desiredPixelSize.CopyTo(&desiredPixelSizeCopy); D2D1_PIXEL_FORMAT desiredFormatCopy; desiredFormat.CopyTo(&desiredFormatCopy); ID2D1BitmapRenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateCompatibleRenderTarget( NULL, &desiredPixelSizeCopy, &desiredFormatCopy, static_cast<D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS>(options), &ptr )); return ptr ? gcnew BitmapRenderTarget(ptr) : nullptr; } BitmapRenderTarget ^ RenderTarget::CreateCompatibleRenderTarget( CompatibleRenderTargetOptions options, D2D::PixelFormat desiredFormat ) { D2D1_PIXEL_FORMAT desiredFormatCopy; desiredFormat.CopyTo(&desiredFormatCopy); ID2D1BitmapRenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateCompatibleRenderTarget( NULL, NULL, &desiredFormatCopy, static_cast<D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS>(options), &ptr )); return ptr ? gcnew BitmapRenderTarget(ptr) : nullptr; } Layer ^ RenderTarget::CreateLayer( SizeF size ) { D2D1_SIZE_F sizeCopy; size.CopyTo(&sizeCopy); ID2D1Layer * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateLayer( &sizeCopy, &ptr )); return ptr ? gcnew Layer(ptr) : nullptr; } Layer ^ RenderTarget::CreateLayer( ) { ID2D1Layer * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateLayer( NULL , &ptr )); return ptr ? gcnew Layer(ptr) : nullptr; } Mesh ^ RenderTarget::CreateMesh( ) { ID2D1Mesh * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1RenderTarget>()->CreateMesh( &ptr )); return ptr ? gcnew Mesh(ptr) : nullptr; } void RenderTarget::DrawLine( Point2F point0, Point2F point1, Brush ^ brush, FLOAT strokeWidth, StrokeStyle ^ strokeStyle ) { pin_ptr<Point2F> point0Copy = &point0; pin_ptr<Point2F> point1Copy = &point1; GetInterface<ID2D1RenderTarget>()->DrawLine( *((D2D1_POINT_2F*)point0Copy), *((D2D1_POINT_2F*)point1Copy), brush->GetInterface<ID2D1Brush>(), strokeWidth, strokeStyle ? strokeStyle->GetInterface<ID2D1StrokeStyle>() : NULL ); } void RenderTarget::DrawLine( Point2F point0, Point2F point1, Brush ^ brush, FLOAT strokeWidth ) { DrawLine(point0, point1, brush, strokeWidth, nullptr); } void RenderTarget::DrawRectangle( RectF rect, Brush ^ brush, FLOAT strokeWidth, StrokeStyle ^ strokeStyle ) { pin_ptr<const RectF> rectPtr = &rect; GetInterface<ID2D1RenderTarget>()->DrawRectangle( (D2D1_RECT_F*)(rectPtr), brush->GetInterface<ID2D1Brush>(), strokeWidth, strokeStyle ? strokeStyle->GetInterface<ID2D1StrokeStyle>() : NULL ); } void RenderTarget::DrawRectangle( RectF rect, Brush ^ brush, FLOAT strokeWidth ) { DrawRectangle(rect, brush, strokeWidth, nullptr); } void RenderTarget::FillRectangle( RectF rect, Brush ^ brush ) { pin_ptr<const RectF> rectCopy = &rect; GetInterface<ID2D1RenderTarget>()->FillRectangle( (D2D1_RECT_F*)rectCopy, brush->GetInterface<ID2D1Brush>() ); } void RenderTarget::DrawRoundedRectangle( RoundedRect roundedRect, Brush ^ brush, FLOAT strokeWidth, StrokeStyle ^ strokeStyle ) { pin_ptr<const RoundedRect> roundedRectCopy = &roundedRect; GetInterface<ID2D1RenderTarget>()->DrawRoundedRectangle( (D2D1_ROUNDED_RECT*)roundedRectCopy, brush->GetInterface<ID2D1Brush>(), strokeWidth, strokeStyle ? strokeStyle->GetInterface<ID2D1StrokeStyle>() : NULL ); } void RenderTarget::DrawRoundedRectangle( RoundedRect roundedRect, Brush ^ brush, FLOAT strokeWidth ) { DrawRoundedRectangle(roundedRect, brush, strokeWidth, nullptr); } void RenderTarget::FillRoundedRectangle( RoundedRect roundedRect, Brush ^ brush ) { pin_ptr<const RoundedRect> roundedRectCopy = &roundedRect; GetInterface<ID2D1RenderTarget>()->FillRoundedRectangle( (D2D1_ROUNDED_RECT*)roundedRectCopy, brush->GetInterface<ID2D1Brush>() ); } void RenderTarget::DrawEllipse( Ellipse ellipse, Brush ^ brush, FLOAT strokeWidth, StrokeStyle ^ strokeStyle ) { D2D1_ELLIPSE ellipseCopy; ellipse.CopyTo(&ellipseCopy); GetInterface<ID2D1RenderTarget>()->DrawEllipse( &ellipseCopy, brush->GetInterface<ID2D1Brush>(), strokeWidth, strokeStyle ? strokeStyle->GetInterface<ID2D1StrokeStyle>() : NULL ); } void RenderTarget::DrawEllipse( Ellipse ellipse, Brush ^ brush, FLOAT strokeWidth ) { DrawEllipse(ellipse, brush, strokeWidth, nullptr); } void RenderTarget::FillEllipse( Ellipse ellipse, Brush ^ brush ) { D2D1_ELLIPSE ellipseCopy; ellipse.CopyTo(&ellipseCopy); GetInterface<ID2D1RenderTarget>()->FillEllipse( &ellipseCopy, brush->GetInterface<ID2D1Brush>() ); } void RenderTarget::DrawGeometry( Geometry ^ geometry, Brush ^ brush, FLOAT strokeWidth, StrokeStyle ^ strokeStyle ) { GetInterface<ID2D1RenderTarget>()->DrawGeometry( geometry->GetInterface<ID2D1Geometry>(), brush->GetInterface<ID2D1Brush>(), strokeWidth, strokeStyle ? strokeStyle->GetInterface<ID2D1StrokeStyle>() : NULL ); } void RenderTarget::DrawGeometry( Geometry ^ geometry, Brush ^ brush, FLOAT strokeWidth ) { DrawGeometry(geometry, brush, strokeWidth, nullptr); } void RenderTarget::FillGeometry( Geometry ^ geometry, Brush ^ brush, Brush ^ opacityBrush ) { GetInterface<ID2D1RenderTarget>()->FillGeometry( geometry->GetInterface<ID2D1Geometry>(), brush->GetInterface<ID2D1Brush>(), opacityBrush ? opacityBrush->GetInterface<ID2D1Brush>() : NULL ); } void RenderTarget::FillGeometry( Geometry ^ geometry, Brush ^ brush ) { FillGeometry(geometry, brush, nullptr); } void RenderTarget::FillMesh( Mesh ^ mesh, Brush ^ brush ) { GetInterface<ID2D1RenderTarget>()->FillMesh( mesh->GetInterface<ID2D1Mesh>(), brush->GetInterface<ID2D1Brush>() ); } void RenderTarget::FillOpacityMask( D2DBitmap ^ opacityMask, Brush ^ brush, OpacityMaskContent content, RectF destinationRectangle, RectF sourceRectangle ) { D2D1_RECT_F destinationRectangleCopy; destinationRectangle.CopyTo(&destinationRectangleCopy); D2D1_RECT_F sourceRectangleCopy; sourceRectangle.CopyTo(&sourceRectangleCopy); GetInterface<ID2D1RenderTarget>()->FillOpacityMask( opacityMask->GetInterface<ID2D1Bitmap>(), brush->GetInterface<ID2D1Brush>(), static_cast<D2D1_OPACITY_MASK_CONTENT>(content), &destinationRectangleCopy, &sourceRectangleCopy ); } void RenderTarget::FillOpacityMaskAtOrigin( D2DBitmap ^ opacityMask, Brush ^ brush, OpacityMaskContent content, RectF sourceRectangle ) { D2D1_RECT_F sourceRectangleCopy; sourceRectangle.CopyTo(&sourceRectangleCopy); GetInterface<ID2D1RenderTarget>()->FillOpacityMask( opacityMask->GetInterface<ID2D1Bitmap>(), brush->GetInterface<ID2D1Brush>(), static_cast<D2D1_OPACITY_MASK_CONTENT>(content), NULL, &sourceRectangleCopy ); } void RenderTarget::FillOpacityMask( D2DBitmap ^ opacityMask, Brush ^ brush, OpacityMaskContent content, RectF destinationRectangle ) { D2D1_RECT_F destinationRectangleCopy; destinationRectangle.CopyTo(&destinationRectangleCopy); GetInterface<ID2D1RenderTarget>()->FillOpacityMask( opacityMask->GetInterface<ID2D1Bitmap>(), brush->GetInterface<ID2D1Brush>(), static_cast<D2D1_OPACITY_MASK_CONTENT>(content), &destinationRectangleCopy, NULL ); } void RenderTarget::FillOpacityMask( D2DBitmap ^ opacityMask, Brush ^ brush, OpacityMaskContent content ) { GetInterface<ID2D1RenderTarget>()->FillOpacityMask( opacityMask->GetInterface<ID2D1Bitmap>(), brush->GetInterface<ID2D1Brush>(), static_cast<D2D1_OPACITY_MASK_CONTENT>(content), NULL, NULL ); } void RenderTarget::DrawBitmap( D2DBitmap ^ bitmap, FLOAT opacity, BitmapInterpolationMode interpolationMode, RectF destinationRectangle, RectF sourceRectangle ) { D2D1_RECT_F destinationRectangleCopy; destinationRectangle.CopyTo(&destinationRectangleCopy); D2D1_RECT_F sourceRectangleCopy; sourceRectangle.CopyTo(&sourceRectangleCopy); GetInterface<ID2D1RenderTarget>()->DrawBitmap( bitmap->GetInterface<ID2D1Bitmap>(), &destinationRectangleCopy, opacity, static_cast<D2D1_BITMAP_INTERPOLATION_MODE>(interpolationMode), &sourceRectangleCopy ); } void RenderTarget::DrawBitmap( D2DBitmap ^ bitmap ) { GetInterface<ID2D1RenderTarget>()->DrawBitmap( bitmap->GetInterface<ID2D1Bitmap>(), NULL, 1.0, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, NULL ); } void RenderTarget::DrawBitmap( D2DBitmap ^ bitmap, FLOAT opacity, BitmapInterpolationMode interpolationMode, RectF destinationRectangle ) { D2D1_RECT_F destinationRectangleCopy; destinationRectangle.CopyTo(&destinationRectangleCopy); GetInterface<ID2D1RenderTarget>()->DrawBitmap( bitmap->GetInterface<ID2D1Bitmap>(), &destinationRectangleCopy, opacity, static_cast<D2D1_BITMAP_INTERPOLATION_MODE>(interpolationMode), NULL ); } void RenderTarget::DrawBitmapAtOrigin( D2DBitmap ^ bitmap, FLOAT opacity, BitmapInterpolationMode interpolationMode, RectF sourceRectangle ) { D2D1_RECT_F sourceRectangleCopy; sourceRectangle.CopyTo(&sourceRectangleCopy); GetInterface<ID2D1RenderTarget>()->DrawBitmap( bitmap->GetInterface<ID2D1Bitmap>(), NULL, opacity, static_cast<D2D1_BITMAP_INTERPOLATION_MODE>(interpolationMode), &sourceRectangleCopy ); } void RenderTarget::DrawBitmap( D2DBitmap ^ bitmap, FLOAT opacity, BitmapInterpolationMode interpolationMode ) { GetInterface<ID2D1RenderTarget>()->DrawBitmap( bitmap->GetInterface<ID2D1Bitmap>(), NULL, opacity, static_cast<D2D1_BITMAP_INTERPOLATION_MODE>(interpolationMode), NULL ); } GdiInteropRenderTarget^ RenderTarget::GetGdiInteropRenderTarget() { ID2D1GdiInteropRenderTarget* gdiRenderTargt = NULL; GetInterface<IUnknown>()->QueryInterface(__uuidof(ID2D1GdiInteropRenderTarget), (void**) &gdiRenderTargt); return gdiRenderTargt ? gcnew GdiInteropRenderTarget(gdiRenderTargt) : nullptr; } void RenderTarget::Transform::set( Matrix3x2F transform ) { D2D1_MATRIX_3X2_F transformCopy; transform.CopyTo(&transformCopy); GetInterface<ID2D1RenderTarget>()->SetTransform( &transformCopy ); } Matrix3x2F RenderTarget::Transform::get( ) { D2D1_MATRIX_3X2_F transformCopy; GetInterface<ID2D1RenderTarget>()->GetTransform( &transformCopy ); Matrix3x2F transform; transform.CopyFrom(transformCopy); return transform; } void RenderTarget::AntialiasMode::set( D2D::AntialiasMode antialiasMode ) { GetInterface<ID2D1RenderTarget>()->SetAntialiasMode( static_cast<D2D1_ANTIALIAS_MODE>(antialiasMode) ); } D2D::AntialiasMode RenderTarget::AntialiasMode::get( ) { return static_cast<D2D::AntialiasMode>(GetInterface<ID2D1RenderTarget>()->GetAntialiasMode()); } void RenderTarget::TextAntialiasMode::set( D2D::TextAntialiasMode textAntialiasMode ) { GetInterface<ID2D1RenderTarget>()->SetTextAntialiasMode( static_cast<D2D1_TEXT_ANTIALIAS_MODE>(textAntialiasMode) ); } D2D::TextAntialiasMode RenderTarget::TextAntialiasMode::get( ) { return static_cast<D2D::TextAntialiasMode>(GetInterface<ID2D1RenderTarget>()->GetTextAntialiasMode()); } void RenderTarget::Tags::set( D2D::Tags tags ) { GetInterface<ID2D1RenderTarget>()->SetTags( static_cast<D2D1_TAG>(tags.Tag1), static_cast<D2D1_TAG>(tags.Tag2) ); } D2D::Tags RenderTarget::Tags::get( ) { D2D1_TAG tag1, tag2; GetInterface<ID2D1RenderTarget>()->GetTags( &tag1, &tag2 ); return D2D::Tags(static_cast<UINT64>(tag1), static_cast<UINT64>(tag2)); } void RenderTarget::PushLayer( LayerParameters layerParameters, Layer ^ layer ) { D2D1_LAYER_PARAMETERS layerParametersCopy; layerParameters.CopyTo(&layerParametersCopy); GetInterface<ID2D1RenderTarget>()->PushLayer( &layerParametersCopy, layer->GetInterface<ID2D1Layer>() ); } void RenderTarget::PopLayer( ) { GetInterface<ID2D1RenderTarget>()->PopLayer( ); } D2D::Tags RenderTarget::Flush( ) { D2D1_TAG tag1, tag2; HRESULT hr = GetInterface<ID2D1RenderTarget>()->Flush( &tag1, &tag2 ); if (!SUCCEEDED(hr)) { Exception^ e = CommonUtils::GetExceptionForHR(hr); throw gcnew Direct2DException( String::Format("Flush has failed with error: {0} Tags=({1}, {2}).", e->Message, static_cast<UInt64>(tag1), static_cast<UInt64>(tag2)), e); } else { return D2D::Tags(static_cast<UINT64>(tag1), static_cast<UINT64>(tag2)); } } bool RenderTarget::TryFlush([System::Runtime::InteropServices::Out] D2D::Tags % tags, [System::Runtime::InteropServices::Out] ErrorCode % errorCode) { D2D1_TAG tag1, tag2; HRESULT hr = GetInterface<ID2D1RenderTarget>()->Flush( &tag1, &tag2 ); errorCode = static_cast<ErrorCode>(hr); tags = D2D::Tags(static_cast<UINT64>(tag1), static_cast<UINT64>(tag2)); return SUCCEEDED(hr) ? true : false; } void RenderTarget::SaveDrawingState( DrawingStateBlock ^ drawingStateBlock ) { GetInterface<ID2D1RenderTarget>()->SaveDrawingState( drawingStateBlock->GetInterface<ID2D1DrawingStateBlock>() ); } void RenderTarget::RestoreDrawingState( DrawingStateBlock ^ drawingStateBlock ) { GetInterface<ID2D1RenderTarget>()->RestoreDrawingState( drawingStateBlock->GetInterface<ID2D1DrawingStateBlock>() ); } void RenderTarget::PushAxisAlignedClip( RectF clipRect, D2D::AntialiasMode antialiasMode ) { D2D1_RECT_F clipRectCopy; clipRect.CopyTo(&clipRectCopy); GetInterface<ID2D1RenderTarget>()->PushAxisAlignedClip( &clipRectCopy, static_cast<D2D1_ANTIALIAS_MODE>(antialiasMode) ); } void RenderTarget::PopAxisAlignedClip( ) { GetInterface<ID2D1RenderTarget>()->PopAxisAlignedClip( ); } void RenderTarget::Clear( ColorF clearColor ) { D2D1_COLOR_F clearColorCopy; clearColor.CopyTo(&clearColorCopy); GetInterface<ID2D1RenderTarget>()->Clear( &clearColorCopy ); } void RenderTarget::Clear( ) { GetInterface<ID2D1RenderTarget>()->Clear( NULL ); } void RenderTarget::BeginDraw( ) { GetInterface<ID2D1RenderTarget>()->BeginDraw( ); } D2D::Tags RenderTarget::EndDraw( ) { D2D1_TAG tag1, tag2; HRESULT hr = GetInterface<ID2D1RenderTarget>()->EndDraw( &tag1, &tag2 ); if (!SUCCEEDED(hr)) { Exception^ e = CommonUtils::GetExceptionForHR(hr); throw gcnew Direct2DException( String::Format("EndDraw has failed with error: {0} Tags=({1},{2}).", e->Message, static_cast<UInt64>(tag1), static_cast<UInt64>(tag2)), e); } else { return D2D::Tags(static_cast<UINT64>(tag1), static_cast<UINT64>(tag2)); } } bool RenderTarget::TryEndDraw([System::Runtime::InteropServices::Out] D2D::Tags % tags, [System::Runtime::InteropServices::Out] ErrorCode % errorCode) { D2D1_TAG tag1, tag2; HRESULT hr = GetInterface<ID2D1RenderTarget>()->EndDraw( &tag1, &tag2 ); errorCode = static_cast<ErrorCode>(hr); tags = D2D::Tags(static_cast<UINT64>(tag1), static_cast<UINT64>(tag2)); return SUCCEEDED(hr) ? true : false; } D2D::PixelFormat RenderTarget::PixelFormat::get( ) { D2D1_PIXEL_FORMAT returnCopy; returnCopy = GetInterface<ID2D1RenderTarget>()->GetPixelFormat( ); D2D::PixelFormat returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } void RenderTarget::Dpi::set(DpiF dpi) { GetInterface<ID2D1RenderTarget>()->SetDpi( dpi.X, dpi.Y ); } DpiF RenderTarget::Dpi::get() { ::FLOAT dpiXCopy; ::FLOAT dpiYCopy; GetInterface<ID2D1RenderTarget>()->GetDpi( &dpiXCopy, &dpiYCopy ); return DpiF(dpiXCopy, dpiYCopy); } SizeF RenderTarget::Size::get( ) { D2D1_SIZE_F returnCopy; returnCopy = GetInterface<ID2D1RenderTarget>()->GetSize( ); SizeF returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } SizeU RenderTarget::PixelSize::get( ) { D2D1_SIZE_U returnCopy; returnCopy = GetInterface<ID2D1RenderTarget>()->GetPixelSize( ); SizeU returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } UINT32 RenderTarget::MaximumBitmapSize::get( ) { return GetInterface<ID2D1RenderTarget>()->GetMaximumBitmapSize(); } Boolean RenderTarget::IsSupported( RenderTargetProperties renderTargetProperties ) { D2D1_RENDER_TARGET_PROPERTIES renderTargetPropertiesCopy; renderTargetProperties.CopyTo(&renderTargetPropertiesCopy); return GetInterface<ID2D1RenderTarget>()->IsSupported( &renderTargetPropertiesCopy ) != 0; } void RenderTarget::DrawText( String^ text, TextFormat^ textFormat, RectF layoutRect, Brush^ defaultForegroundBrush, DrawTextOptions options, MeasuringMode measuringMode) { UINT strLen = text->Length; D2D1_RECT_F rectCopy; layoutRect.CopyTo(&rectCopy); IntPtr chars = Marshal::StringToCoTaskMemUni( text ); try { GetInterface<ID2D1RenderTarget>()->DrawText( (WCHAR *)chars.ToPointer(), strLen, textFormat->GetInterface<IDWriteTextFormat>(), &rectCopy, defaultForegroundBrush->GetInterface<ID2D1Brush>(), static_cast<D2D1_DRAW_TEXT_OPTIONS>(options), static_cast<DWRITE_MEASURING_MODE>(measuringMode)); } finally { Marshal::FreeCoTaskMem(chars); } } void RenderTarget::DrawText( String^ text, TextFormat^ textFormat, RectF layoutRect, Brush^ defaultForegroundBrush, DrawTextOptions options ) { DrawText(text, textFormat, layoutRect, defaultForegroundBrush, options, MeasuringMode::Natural); } void RenderTarget::DrawText( String^ text, TextFormat^ textFormat, RectF layoutRect, Brush^ defaultForegroundBrush, MeasuringMode measuringMode) { DrawText(text, textFormat, layoutRect, defaultForegroundBrush, DrawTextOptions::None, measuringMode); } void RenderTarget::DrawText( String^ text, TextFormat^ textFormat, RectF layoutRect, Brush^ defaultForegroundBrush) { DrawText(text, textFormat, layoutRect, defaultForegroundBrush, DrawTextOptions::None, MeasuringMode::Natural); } void RenderTarget::DrawGlyphRun( Point2F baselineOrigin, array<GlyphRun>^ glyphRun, Brush^ foregroundBrush, MeasuringMode measuringMode) { D2D1_POINT_2F originCopy; baselineOrigin.CopyTo(&originCopy); DWRITE_GLYPH_RUN * pGlyphRun = new DWRITE_GLYPH_RUN[glyphRun->Length]; for (int i = 0; i < glyphRun->Length; i++) { glyphRun[i].CopyTo(&pGlyphRun[i]); } try { GetInterface<ID2D1RenderTarget>()->DrawGlyphRun( originCopy, pGlyphRun, foregroundBrush ? foregroundBrush->GetInterface<ID2D1Brush>() : NULL, static_cast<DWRITE_MEASURING_MODE>(measuringMode)); } finally { if (glyphRun->Length > 0) { for (int i = 0; i < glyphRun->Length; i++) { delete [] pGlyphRun[i].glyphAdvances; delete [] pGlyphRun[i].glyphIndices; delete [] pGlyphRun[i].glyphOffsets; } delete [] pGlyphRun; } } } void RenderTarget::DrawGlyphRun( Point2F baselineOrigin, array<GlyphRun>^ glyphRun, Brush^ foregroundBrush) { DrawGlyphRun(baselineOrigin, glyphRun, foregroundBrush, MeasuringMode::Natural); } RenderingParams^ RenderTarget::GetTextRenderingParams() { IDWriteRenderingParams* renderingParams = NULL; GetInterface<ID2D1RenderTarget>()->GetTextRenderingParams(&renderingParams); return renderingParams ? gcnew RenderingParams(renderingParams) : nullptr; } void RenderTarget::SetTextRenderingParams(RenderingParams^ textRenderingParams) { GetInterface<ID2D1RenderTarget>()->SetTextRenderingParams( textRenderingParams == nullptr ? NULL : textRenderingParams->GetInterface<IDWriteRenderingParams>() ); } void RenderTarget::DrawTextLayout( Point2F origin, TextLayout^ textLayout, Brush^ defaultForegroundBrush, DrawTextOptions options) { D2D1_POINT_2F originCopy; origin.CopyTo(&originCopy); GetInterface<ID2D1RenderTarget>()->DrawTextLayout( originCopy, textLayout->GetInterface<IDWriteTextLayout>(), defaultForegroundBrush->GetInterface<ID2D1Brush>(), static_cast<D2D1_DRAW_TEXT_OPTIONS>(options)); } void RenderTarget::DrawTextLayout( Point2F origin, TextLayout^ textLayout, Brush^ defaultForegroundBrush) { D2D1_POINT_2F originCopy; origin.CopyTo(&originCopy); GetInterface<ID2D1RenderTarget>()->DrawTextLayout( originCopy, textLayout->GetInterface<IDWriteTextLayout>(), defaultForegroundBrush->GetInterface<ID2D1Brush>()); } BitmapRenderTarget::BitmapRenderTarget( ) : RenderTarget() { } BitmapRenderTarget::BitmapRenderTarget( IUnknown *pInner ) : RenderTarget(pInner) { } D2DBitmap ^ BitmapRenderTarget::GetBitmap( ) { ID2D1Bitmap * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1BitmapRenderTarget>()->GetBitmap( &ptr )); return ptr ? gcnew D2DBitmap(ptr) : nullptr; } HwndRenderTarget::HwndRenderTarget( ) : RenderTarget() { } HwndRenderTarget::HwndRenderTarget( IUnknown *pInner ) : RenderTarget(pInner) { } Boolean HwndRenderTarget::IsOccluded::get() { if (GetInterface<ID2D1HwndRenderTarget>()->CheckWindowState() & D2D1_WINDOW_STATE_OCCLUDED) return true; else return false; } WindowState HwndRenderTarget::CheckWindowState( ) { return static_cast<WindowState>(GetInterface<ID2D1HwndRenderTarget>()->CheckWindowState()); } void HwndRenderTarget::Resize( SizeU pixelSize ) { D2D1_SIZE_U pixelSizeCopy; pixelSize.CopyTo(&pixelSizeCopy); CommonUtils::VerifyResult( GetInterface<ID2D1HwndRenderTarget>()->Resize( &pixelSizeCopy )); } IntPtr HwndRenderTarget::WindowHandle::get( ) { return IntPtr(GetInterface<ID2D1HwndRenderTarget>()->GetHwnd()); } GdiInteropRenderTarget::GdiInteropRenderTarget( ) : DirectUnknown() { } GdiInteropRenderTarget::GdiInteropRenderTarget( IUnknown *pInner ) : DirectUnknown(pInner) { } IntPtr GdiInteropRenderTarget::GetDC( DCInitializeMode mode ) { HDC hdc; CommonUtils::VerifyResult( GetInterface<ID2D1GdiInteropRenderTarget>()->GetDC( static_cast<D2D1_DC_INITIALIZE_MODE>(mode), &hdc )); return IntPtr(hdc); } void GdiInteropRenderTarget::ReleaseDC( Rect updaterect ) { ::RECT updateCopy; updaterect.CopyTo(&updateCopy); CommonUtils::VerifyResult( GetInterface<ID2D1GdiInteropRenderTarget>()->ReleaseDC( &updateCopy )); } void GdiInteropRenderTarget::ReleaseDC( ) { CommonUtils::VerifyResult( GetInterface<ID2D1GdiInteropRenderTarget>()->ReleaseDC( NULL )); } DCRenderTarget::DCRenderTarget( ) : RenderTarget() { } DCRenderTarget::DCRenderTarget( IUnknown *pInner ) : RenderTarget(pInner) { } void DCRenderTarget::BindDC( IntPtr hDC, Rect pSubRect ) { ::RECT pSubRectCopy; pSubRect.CopyTo(&pSubRectCopy); CommonUtils::VerifyResult( GetInterface<ID2D1DCRenderTarget>()->BindDC( static_cast<HDC>(hDC.ToPointer()), &pSubRectCopy )); } StrokeStyle::StrokeStyle( ) : D2DResource() { } StrokeStyle::StrokeStyle( IUnknown *pInner ) : D2DResource(pInner) { } CapStyle StrokeStyle::StartCap::get( ) { return static_cast<CapStyle>(GetInterface<ID2D1StrokeStyle>()->GetStartCap()); } CapStyle StrokeStyle::EndCap::get( ) { return static_cast<CapStyle>(GetInterface<ID2D1StrokeStyle>()->GetEndCap()); } CapStyle StrokeStyle::DashCap::get( ) { return static_cast<CapStyle>(GetInterface<ID2D1StrokeStyle>()->GetDashCap()); } FLOAT StrokeStyle::MiterLimit::get( ) { return GetInterface<ID2D1StrokeStyle>()->GetMiterLimit(); } D2D::LineJoin StrokeStyle::LineJoin::get( ) { return static_cast<D2D::LineJoin>(GetInterface<ID2D1StrokeStyle>()->GetLineJoin()); } FLOAT StrokeStyle::DashOffset::get( ) { return GetInterface<ID2D1StrokeStyle>()->GetDashOffset(); } D2D::DashStyle StrokeStyle::DashStyle::get( ) { return static_cast<D2D::DashStyle>(GetInterface<ID2D1StrokeStyle>()->GetDashStyle()); } UINT32 StrokeStyle::DashesCount::get( ) { return GetInterface<ID2D1StrokeStyle>()->GetDashesCount(); } cli::array<FLOAT> ^ StrokeStyle::Dashes::get( ) { cli::array<FLOAT> ^dashes = nullptr; UINT count = GetInterface<ID2D1StrokeStyle>()->GetDashesCount();; dashes = gcnew cli::array<FLOAT>(count); pin_ptr<FLOAT> dashesCopy = &dashes[0]; GetInterface<ID2D1StrokeStyle>()->GetDashes( dashesCopy, dashes->Length ); return dashes; } Geometry::Geometry( ) : D2DResource() { } Geometry::Geometry( IUnknown *pInner ) : D2DResource(pInner) { } RectF Geometry::GetBounds( Matrix3x2F worldTransform ) { D2D1_MATRIX_3X2_F worldTransformCopy; worldTransform.CopyTo(&worldTransformCopy); D2D1_RECT_F boundsCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->GetBounds( &worldTransformCopy, &boundsCopy )); RectF bounds; bounds.CopyFrom(boundsCopy); return bounds; } RectF Geometry::GetBounds( ) { D2D1_RECT_F boundsCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->GetBounds( NULL, &boundsCopy )); RectF bounds; bounds.CopyFrom(boundsCopy); return bounds; } RectF Geometry::GetWidenedBounds( FLOAT strokeWidth, StrokeStyle ^ strokeStyle, FLOAT flatteningTolerance, Matrix3x2F worldTransform ) { D2D1_MATRIX_3X2_F worldTransformCopy; worldTransform.CopyTo(&worldTransformCopy); D2D1_RECT_F boundsCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->GetWidenedBounds( strokeWidth, strokeStyle ? strokeStyle->GetInterface<ID2D1StrokeStyle>() : NULL, &worldTransformCopy, flatteningTolerance, &boundsCopy )); RectF bounds; bounds.CopyFrom(boundsCopy); return bounds; } RectF Geometry::GetWidenedBounds( FLOAT strokeWidth, StrokeStyle ^ strokeStyle, FLOAT flatteningTolerance ) { D2D1_RECT_F boundsCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->GetWidenedBounds( strokeWidth, strokeStyle ? strokeStyle->GetInterface<ID2D1StrokeStyle>() : NULL, NULL, flatteningTolerance, &boundsCopy )); RectF bounds; bounds.CopyFrom(boundsCopy); return bounds; } RectF Geometry::GetWidenedBounds( FLOAT strokeWidth, StrokeStyle ^ strokeStyle ) { D2D1_RECT_F boundsCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->GetWidenedBounds( strokeWidth, strokeStyle ? strokeStyle->GetInterface<ID2D1StrokeStyle>() : NULL, NULL, &boundsCopy )); RectF bounds; bounds.CopyFrom(boundsCopy); return bounds; } Boolean Geometry::StrokeContainsPoint( Point2F point, FLOAT strokeWidth, StrokeStyle ^ strokeStyle, FLOAT flatteningTolerance, Matrix3x2F worldTransform ) { D2D1_POINT_2F pointCopy; point.CopyTo(&pointCopy); D2D1_MATRIX_3X2_F worldTransformCopy; worldTransform.CopyTo(&worldTransformCopy); BOOL contains; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->StrokeContainsPoint( pointCopy, strokeWidth, strokeStyle ? strokeStyle->GetInterface<ID2D1StrokeStyle>() : NULL, &worldTransformCopy, flatteningTolerance, &contains )); return contains != 0; } Boolean Geometry::StrokeContainsPoint( Point2F point, FLOAT strokeWidth, StrokeStyle ^ strokeStyle, FLOAT flatteningTolerance ) { D2D1_POINT_2F pointCopy; point.CopyTo(&pointCopy); BOOL contains; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->StrokeContainsPoint( pointCopy, strokeWidth, strokeStyle ? strokeStyle->GetInterface<ID2D1StrokeStyle>() : NULL, NULL , flatteningTolerance, &contains )); return contains != 0; } Boolean Geometry::StrokeContainsPoint( Point2F point, FLOAT strokeWidth, StrokeStyle ^ strokeStyle ) { D2D1_POINT_2F pointCopy; point.CopyTo(&pointCopy); BOOL contains; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->StrokeContainsPoint( pointCopy, strokeWidth, strokeStyle ? strokeStyle->GetInterface<ID2D1StrokeStyle>() : NULL, NULL , &contains )); return contains != 0; } Boolean Geometry::FillContainsPoint( Point2F point, FLOAT flatteningTolerance, Matrix3x2F worldTransform ) { D2D1_POINT_2F pointCopy; point.CopyTo(&pointCopy); D2D1_MATRIX_3X2_F worldTransformCopy; worldTransform.CopyTo(&worldTransformCopy); BOOL contains; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->FillContainsPoint( pointCopy, &worldTransformCopy, flatteningTolerance, &contains )); return contains != 0; } Boolean Geometry::FillContainsPoint( Point2F point, FLOAT flatteningTolerance ) { D2D1_POINT_2F pointCopy; point.CopyTo(&pointCopy); BOOL contains; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->FillContainsPoint( pointCopy, NULL , flatteningTolerance, &contains )); return contains != 0; } Boolean Geometry::FillContainsPoint( Point2F point ) { D2D1_POINT_2F pointCopy; point.CopyTo(&pointCopy); BOOL contains; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->FillContainsPoint( pointCopy, NULL , &contains )); return contains != 0; } GeometryRelation Geometry::CompareWithGeometry( Geometry ^ inputGeometry, FLOAT flatteningTolerance, Matrix3x2F inputGeometryTransform ) { D2D1_MATRIX_3X2_F inputGeometryTransformCopy; inputGeometryTransform.CopyTo(&inputGeometryTransformCopy); GeometryRelation relation; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->CompareWithGeometry( inputGeometry->GetInterface<ID2D1Geometry>(), &inputGeometryTransformCopy, flatteningTolerance, reinterpret_cast<D2D1_GEOMETRY_RELATION *>(static_cast<GeometryRelation *>(&relation)) )); return relation; } GeometryRelation Geometry::CompareWithGeometry( Geometry ^ inputGeometry, FLOAT flatteningTolerance ) { D2D1_GEOMETRY_RELATION relation; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->CompareWithGeometry( inputGeometry->GetInterface<ID2D1Geometry>(), NULL, flatteningTolerance, &relation )); return static_cast<GeometryRelation>(relation); } GeometryRelation Geometry::CompareWithGeometry( Geometry ^ inputGeometry ) { D2D1_GEOMETRY_RELATION relation; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->CompareWithGeometry( inputGeometry->GetInterface<ID2D1Geometry>(), NULL, &relation )); return static_cast<GeometryRelation>(relation); } FLOAT Geometry::ComputeArea( FLOAT flatteningTolerance, Matrix3x2F worldTransform ) { D2D1_MATRIX_3X2_F worldTransformCopy; worldTransform.CopyTo(&worldTransformCopy); ::FLOAT areaCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->ComputeArea( &worldTransformCopy, flatteningTolerance, &areaCopy )); return areaCopy; } FLOAT Geometry::ComputeArea( FLOAT flatteningTolerance ) { ::FLOAT areaCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->ComputeArea( NULL, flatteningTolerance, &areaCopy )); return areaCopy; } FLOAT Geometry::ComputeArea( ) { ::FLOAT areaCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->ComputeArea( NULL, &areaCopy )); return areaCopy; } FLOAT Geometry::ComputeLength( FLOAT flatteningTolerance, Matrix3x2F worldTransform ) { D2D1_MATRIX_3X2_F worldTransformCopy; worldTransform.CopyTo(&worldTransformCopy); ::FLOAT lengthCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->ComputeLength( &worldTransformCopy, flatteningTolerance, &lengthCopy )); return lengthCopy; } FLOAT Geometry::ComputeLength( FLOAT flatteningTolerance ) { ::FLOAT lengthCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->ComputeLength( NULL, flatteningTolerance, &lengthCopy )); return lengthCopy; } FLOAT Geometry::ComputeLength( ) { ::FLOAT lengthCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->ComputeLength( NULL, &lengthCopy )); return lengthCopy; } Point2F Geometry::ComputePointAtLength( FLOAT length, [System::Runtime::InteropServices::Out] Point2F % unitTangentVector, FLOAT flatteningTolerance, Matrix3x2F worldTransform ) { D2D1_MATRIX_3X2_F worldTransformCopy; worldTransform.CopyTo(&worldTransformCopy); D2D1_POINT_2F pointCopy; D2D1_POINT_2F unitTangentVectorCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->ComputePointAtLength( length, &worldTransformCopy, flatteningTolerance, &pointCopy, &unitTangentVectorCopy )); unitTangentVector.CopyFrom(unitTangentVectorCopy); Point2F point; point.CopyFrom(pointCopy); return point; } Point2F Geometry::ComputePointAtLength( FLOAT length, [System::Runtime::InteropServices::Out] Point2F % unitTangentVector, FLOAT flatteningTolerance ) { D2D1_POINT_2F pointCopy; D2D1_POINT_2F unitTangentVectorCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->ComputePointAtLength( length, NULL, flatteningTolerance, &pointCopy, &unitTangentVectorCopy )); unitTangentVector.CopyFrom(unitTangentVectorCopy); Point2F point; point.CopyFrom(pointCopy); return point; } Point2F Geometry::ComputePointAtLength( FLOAT length, [System::Runtime::InteropServices::Out] Point2F % unitTangentVector ) { D2D1_POINT_2F pointCopy; D2D1_POINT_2F unitTangentVectorCopy; CommonUtils::VerifyResult( GetInterface<ID2D1Geometry>()->ComputePointAtLength( length, NULL, &pointCopy, &unitTangentVectorCopy )); unitTangentVector.CopyFrom(unitTangentVectorCopy); Point2F point; point.CopyFrom(pointCopy); return point; } RectangleGeometry::RectangleGeometry( ) : Geometry() { } RectangleGeometry::RectangleGeometry( IUnknown *pInner ) : Geometry(pInner) { } RectF RectangleGeometry::Rectangle::get( ) { D2D1_RECT_F rectCopy; GetInterface<ID2D1RectangleGeometry>()->GetRect( &rectCopy ); RectF rect; rect.CopyFrom(rectCopy); return rect; } RoundedRectangleGeometry::RoundedRectangleGeometry( ) : Geometry() { } RoundedRectangleGeometry::RoundedRectangleGeometry( IUnknown *pInner ) : Geometry(pInner) { } D2D::RoundedRect RoundedRectangleGeometry::RoundedRectangle::get( ) { D2D1_ROUNDED_RECT roundedRectCopy; GetInterface<ID2D1RoundedRectangleGeometry>()->GetRoundedRect( &roundedRectCopy ); D2D::RoundedRect roundedRect; roundedRect.CopyFrom(roundedRectCopy); return roundedRect; } EllipseGeometry::EllipseGeometry( ) : Geometry() { } EllipseGeometry::EllipseGeometry( IUnknown *pInner ) : Geometry(pInner) { } D2D::Ellipse EllipseGeometry::Ellipse::get( ) { D2D1_ELLIPSE ellipseCopy; GetInterface<ID2D1EllipseGeometry>()->GetEllipse( &ellipseCopy ); D2D::Ellipse ellipse; ellipse.CopyFrom(ellipseCopy); return ellipse; } SimplifiedGeometrySink::SimplifiedGeometrySink( ) : DirectUnknown() { } SimplifiedGeometrySink::SimplifiedGeometrySink( IUnknown *pInner ) : DirectUnknown(pInner) { } void SimplifiedGeometrySink::SetFillMode( FillMode fillMode ) { GetInterface<ID2D1SimplifiedGeometrySink>()->SetFillMode( static_cast<D2D1_FILL_MODE>(fillMode) ); } void SimplifiedGeometrySink::SetSegmentFlags( PathSegment vertexFlags ) { GetInterface<ID2D1SimplifiedGeometrySink>()->SetSegmentFlags( static_cast<D2D1_PATH_SEGMENT>(vertexFlags) ); } void SimplifiedGeometrySink::BeginFigure( Point2F startPoint, FigureBegin figureBegin ) { D2D1_POINT_2F startPointCopy; startPoint.CopyTo(&startPointCopy); GetInterface<ID2D1SimplifiedGeometrySink>()->BeginFigure( startPointCopy, static_cast<D2D1_FIGURE_BEGIN>(figureBegin) ); } void SimplifiedGeometrySink::AddLines( IEnumerable<Point2F> ^ points ) { vector<D2D1_POINT_2F> pointsVector; for each(Point2F point in points) { pointsVector.push_back(D2D1_POINT_2F()); point.CopyTo(&pointsVector.back()); } GetInterface<ID2D1SimplifiedGeometrySink>()->AddLines( pointsVector.size() > 0 ? &pointsVector[0] : NULL, static_cast<UINT>(pointsVector.size()) ); } void SimplifiedGeometrySink::AddBeziers( IEnumerable<BezierSegment> ^ beziers ) { vector<D2D1_BEZIER_SEGMENT> beziersVector; for each(BezierSegment bezier in beziers) { beziersVector.push_back(D2D1_BEZIER_SEGMENT()); bezier.CopyTo(&beziersVector.back()); } GetInterface<ID2D1SimplifiedGeometrySink>()->AddBeziers( beziersVector.size() > 0 ? &beziersVector[0] : NULL, static_cast<UINT>(beziersVector.size()) ); } void SimplifiedGeometrySink::EndFigure( FigureEnd figureEnd ) { GetInterface<ID2D1SimplifiedGeometrySink>()->EndFigure( static_cast<D2D1_FIGURE_END>(figureEnd) ); } void SimplifiedGeometrySink::Close( ) { CommonUtils::VerifyResult( GetInterface<ID2D1SimplifiedGeometrySink>()->Close( )); } GeometrySink::GeometrySink( ) : SimplifiedGeometrySink() { } GeometrySink::GeometrySink( IUnknown *pInner ) : SimplifiedGeometrySink(pInner) { } void GeometrySink::AddLine( Point2F point ) { D2D1_POINT_2F pointCopy; point.CopyTo(&pointCopy); GetInterface<ID2D1GeometrySink>()->AddLine( pointCopy ); } void GeometrySink::AddBezier( BezierSegment bezier ) { D2D1_BEZIER_SEGMENT bezierCopy; bezier.CopyTo(&bezierCopy); GetInterface<ID2D1GeometrySink>()->AddBezier( &bezierCopy ); } void GeometrySink::AddQuadraticBezier( QuadraticBezierSegment bezier ) { D2D1_QUADRATIC_BEZIER_SEGMENT bezierCopy; bezier.CopyTo(&bezierCopy); GetInterface<ID2D1GeometrySink>()->AddQuadraticBezier( &bezierCopy ); } void GeometrySink::AddQuadraticBeziers( IEnumerable<QuadraticBezierSegment> ^ beziers ) { vector<D2D1_QUADRATIC_BEZIER_SEGMENT> beziersVector; for each(QuadraticBezierSegment bezier in beziers) { beziersVector.push_back(D2D1_QUADRATIC_BEZIER_SEGMENT()); bezier.CopyTo(&beziersVector.back()); } GetInterface<ID2D1GeometrySink>()->AddQuadraticBeziers( beziersVector.size() > 0 ? &beziersVector[0] : NULL, static_cast<UINT>(beziersVector.size()) ); } void GeometrySink::AddArc( ArcSegment arc ) { D2D1_ARC_SEGMENT arcCopy; arc.CopyTo(&arcCopy); GetInterface<ID2D1GeometrySink>()->AddArc( &arcCopy ); } TessellationSink::TessellationSink( ) : DirectUnknown() { } TessellationSink::TessellationSink( IUnknown *pInner ) : DirectUnknown(pInner) { } void TessellationSink::AddTriangles( IEnumerable<Triangle> ^ triangles ) { vector<D2D1_TRIANGLE> trianglesVector; for each(Triangle triangle in triangles) { trianglesVector.push_back(D2D1_TRIANGLE()); triangle.CopyTo(&trianglesVector.back()); } GetInterface<ID2D1TessellationSink>()->AddTriangles( trianglesVector.size() > 0 ? &trianglesVector[0] : NULL, static_cast<UINT>(trianglesVector.size()) ); } void TessellationSink::Close( ) { CommonUtils::VerifyResult( GetInterface<ID2D1TessellationSink>()->Close( )); } PathGeometry::PathGeometry( ) : Geometry() { } PathGeometry::PathGeometry( IUnknown *pInner ) : Geometry(pInner) { } GeometrySink ^ PathGeometry::Open( ) { ID2D1GeometrySink * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1PathGeometry>()->Open( &ptr )); return ptr ? gcnew GeometrySink(ptr) : nullptr; } UINT32 PathGeometry::SegmentCount::get( ) { UINT32 count; CommonUtils::VerifyResult( GetInterface<ID2D1PathGeometry>()->GetSegmentCount( &count )); return count; } UINT32 PathGeometry::FigureCount::get( ) { UINT32 count; CommonUtils::VerifyResult( GetInterface<ID2D1PathGeometry>()->GetFigureCount( &count )); return count; } GeometryGroup::GeometryGroup( ) : Geometry() { } GeometryGroup::GeometryGroup( IUnknown *pInner ) : Geometry(pInner) { } D2D::FillMode GeometryGroup::FillMode::get( ) { return static_cast<D2D::FillMode>(GetInterface<ID2D1GeometryGroup>()->GetFillMode()); } UINT32 GeometryGroup::SourceGeometryCount::get( ) { return GetInterface<ID2D1GeometryGroup>()->GetSourceGeometryCount(); } ReadOnlyCollection<Geometry ^> ^ GeometryGroup::GetSourceGeometries( ) { UINT count = GetInterface<ID2D1GeometryGroup>()->GetSourceGeometryCount(); vector<ID2D1Geometry*> sourcesVector(count); if (count > 0) { GetInterface<ID2D1GeometryGroup>()->GetSourceGeometries( &sourcesVector[0], count ); } return CommonUtils::GetCollection<Geometry, ID2D1Geometry>(count, sourcesVector); } TransformedGeometry::TransformedGeometry( ) : Geometry() { } TransformedGeometry::TransformedGeometry( IUnknown *pInner ) : Geometry(pInner) { } Geometry ^ TransformedGeometry::GetSourceGeometry( ) { ID2D1Geometry * ptr = NULL; GetInterface<ID2D1TransformedGeometry>()->GetSourceGeometry( &ptr ); return ptr ? gcnew Geometry(ptr) : nullptr; } Matrix3x2F TransformedGeometry::Transform::get( ) { D2D1_MATRIX_3X2_F transformCopy; GetInterface<ID2D1TransformedGeometry>()->GetTransform( &transformCopy ); Matrix3x2F transform; transform.CopyFrom(transformCopy); return transform; } Mesh::Mesh( ) : D2DResource() { } Mesh::Mesh( IUnknown *pInner ) : D2DResource(pInner) { } TessellationSink ^ Mesh::Open( ) { ID2D1TessellationSink * ptr = NULL; CommonUtils::VerifyResult(GetInterface<ID2D1Mesh>()->Open(&ptr)); return ptr ? gcnew TessellationSink(ptr) : nullptr; } Layer::Layer( ) : D2DResource() { } Layer::Layer( IUnknown *pInner ) : D2DResource(pInner) { } SizeF Layer::Size::get( ) { D2D1_SIZE_F returnCopy; returnCopy = GetInterface<ID2D1Layer>()->GetSize( ); SizeF returnValue; returnValue.CopyFrom(returnCopy); return returnValue; } D2DFactory::D2DFactory( ) : DirectUnknown() { } D2DFactory::D2DFactory( IUnknown *pInner ) : DirectUnknown(pInner) { } void D2DFactory::ReloadSystemMetrics( ) { CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->ReloadSystemMetrics( )); } DpiF D2DFactory::DesktopDpi::get( ) { ::FLOAT dpiXCopy; ::FLOAT dpiYCopy; GetInterface<ID2D1Factory>()->GetDesktopDpi( &dpiXCopy, &dpiYCopy ); return DpiF(dpiXCopy, dpiYCopy); } RectangleGeometry ^ D2DFactory::CreateRectangleGeometry( RectF rectangle ) { D2D1_RECT_F rectangleCopy; rectangle.CopyTo(&rectangleCopy); ID2D1RectangleGeometry * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->CreateRectangleGeometry( &rectangleCopy, &ptr )); return ptr ? gcnew RectangleGeometry(ptr) : nullptr; } RoundedRectangleGeometry ^ D2DFactory::CreateRoundedRectangleGeometry( RoundedRect roundedRectangle ) { D2D1_ROUNDED_RECT roundedRectangleCopy; roundedRectangle.CopyTo(&roundedRectangleCopy); ID2D1RoundedRectangleGeometry * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->CreateRoundedRectangleGeometry( &roundedRectangleCopy, &ptr )); return ptr ? gcnew RoundedRectangleGeometry(ptr) : nullptr; } EllipseGeometry ^ D2DFactory::CreateEllipseGeometry( Ellipse ellipse ) { D2D1_ELLIPSE ellipseCopy; ellipse.CopyTo(&ellipseCopy); ID2D1EllipseGeometry * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->CreateEllipseGeometry( &ellipseCopy, &ptr )); return ptr ? gcnew EllipseGeometry(ptr): nullptr; } GeometryGroup ^ D2DFactory::CreateGeometryGroup( FillMode fillMode, IEnumerable<Geometry ^> ^ geometries ) { vector<ID2D1Geometry*> geometryVector; UINT count = CommonUtils::FillIUnknownsVector<Geometry,ID2D1Geometry>(geometries, geometryVector); ID2D1GeometryGroup * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->CreateGeometryGroup( static_cast<D2D1_FILL_MODE>(fillMode), count > 0 ? &geometryVector[0] : NULL, count, &ptr )); return ptr ? gcnew GeometryGroup(ptr): nullptr; } TransformedGeometry ^ D2DFactory::CreateTransformedGeometry( Geometry ^ sourceGeometry, Matrix3x2F transform ) { D2D1_MATRIX_3X2_F transformCopy; transform.CopyTo(&transformCopy); ID2D1TransformedGeometry * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->CreateTransformedGeometry( sourceGeometry->GetInterface<ID2D1Geometry>(), &transformCopy, &ptr )); return ptr ? gcnew TransformedGeometry(ptr): nullptr; } PathGeometry ^ D2DFactory::CreatePathGeometry( ) { ID2D1PathGeometry * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->CreatePathGeometry( &ptr )); return ptr ? gcnew PathGeometry(ptr): nullptr; } StrokeStyle ^ D2DFactory::CreateStrokeStyle( StrokeStyleProperties strokeStyleProperties, cli::array<FLOAT> ^ dashes ) { D2D1_STROKE_STYLE_PROPERTIES strokeStylePropertiesCopy; strokeStyleProperties.CopyTo(&strokeStylePropertiesCopy); ::FLOAT *dashesCopy = NULL; pin_ptr<FLOAT> dashesInner = dashes ? &dashes[0] : nullptr; dashesCopy = static_cast<::FLOAT *>(dashesInner); ID2D1StrokeStyle * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->CreateStrokeStyle( &strokeStylePropertiesCopy, dashes ? dashesCopy : NULL, dashes ? dashes->Length : 0, &ptr )); return ptr ? gcnew StrokeStyle(ptr): nullptr; } StrokeStyle ^ D2DFactory::CreateStrokeStyle( StrokeStyleProperties strokeStyleProperties ) { return CreateStrokeStyle(strokeStyleProperties, nullptr); } RenderTarget ^ D2DFactory::CreateWicBitmapRenderTarget( WICBitmap^ target, RenderTargetProperties renderTargetProperties ) { D2D1_RENDER_TARGET_PROPERTIES renderTargetPropertiesCopy; renderTargetProperties.CopyTo(&renderTargetPropertiesCopy); ID2D1RenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->CreateWicBitmapRenderTarget( target->GetInterface<IWICBitmap>(), &renderTargetPropertiesCopy, &ptr )); return ptr ? gcnew RenderTarget(ptr): nullptr; } HwndRenderTarget ^ D2DFactory::CreateHwndRenderTarget( RenderTargetProperties renderTargetProperties, HwndRenderTargetProperties hwndRenderTargetProperties ) { D2D1_RENDER_TARGET_PROPERTIES renderTargetPropertiesCopy; renderTargetProperties.CopyTo(&renderTargetPropertiesCopy); D2D1_HWND_RENDER_TARGET_PROPERTIES hwndRenderTargetPropertiesCopy; hwndRenderTargetProperties.CopyTo(&hwndRenderTargetPropertiesCopy); ID2D1HwndRenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->CreateHwndRenderTarget( &renderTargetPropertiesCopy, &hwndRenderTargetPropertiesCopy, &ptr )); return ptr ? gcnew HwndRenderTarget(ptr): nullptr; } RenderTarget ^ D2DFactory::CreateDxgiSurfaceRenderTarget( Surface^ dxgiSurface, RenderTargetProperties renderTargetProperties ) { D2D1_RENDER_TARGET_PROPERTIES renderTargetPropertiesCopy; renderTargetProperties.CopyTo(&renderTargetPropertiesCopy); ID2D1RenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->CreateDxgiSurfaceRenderTarget( dxgiSurface->GetInterface<IDXGISurface>(), &renderTargetPropertiesCopy, &ptr )); return ptr ? gcnew RenderTarget(ptr): nullptr; } DCRenderTarget ^ D2DFactory::CreateDCRenderTarget( RenderTargetProperties renderTargetProperties ) { D2D1_RENDER_TARGET_PROPERTIES renderTargetPropertiesCopy; renderTargetProperties.CopyTo(&renderTargetPropertiesCopy); ID2D1DCRenderTarget * ptr = NULL; CommonUtils::VerifyResult( GetInterface<ID2D1Factory>()->CreateDCRenderTarget( &renderTargetPropertiesCopy, &ptr )); return ptr ? gcnew DCRenderTarget(ptr): nullptr; } } } } }
[ "lucemia@9e708c16-f4dd-11de-aa3c-59de0406b4f5" ]
[ [ [ 1, 3991 ] ] ]
a72b28cbd0bc133809ed7e722e06883737f63541
b14d5833a79518a40d302e5eb40ed5da193cf1b2
/cpp/extern/xercesc++/2.6.0/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp
fb24d3b9a109fc02eacf127e0d73c23d86191864
[ "Apache-2.0" ]
permissive
andyburke/bitflood
dcb3fb62dad7fa5e20cf9f1d58aaa94be30e82bf
fca6c0b635d07da4e6c7fbfa032921c827a981d6
refs/heads/master
2016-09-10T02:14:35.564530
2011-11-17T09:51:49
2011-11-17T09:51:49
2,794,411
1
0
null
null
null
null
UTF-8
C++
false
false
11,313
cpp
/* * Copyright 2001-2002,2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMCDATASectionImpl.cpp,v 1.15 2004/09/08 13:55:51 peiyongz Exp $ */ #include "DOMCDATASectionImpl.hpp" #include "DOMNodeImpl.hpp" #include "DOMRangeImpl.hpp" #include "DOMDocumentImpl.hpp" #include "DOMCasts.hpp" #include "DOMStringPool.hpp" #include <xercesc/dom/DOMException.hpp> #include <xercesc/util/XMLUniDefs.hpp> XERCES_CPP_NAMESPACE_BEGIN DOMCDATASectionImpl::DOMCDATASectionImpl(DOMDocument *ownerDoc, const XMLCh *dat) : fNode(ownerDoc), fParent(ownerDoc), fCharacterData(ownerDoc, dat) { } DOMCDATASectionImpl::DOMCDATASectionImpl(const DOMCDATASectionImpl &other, bool) : fNode(*castToNodeImpl(&other)), fParent(*castToParentImpl(&other)), fChild(*castToChildImpl(&other)), fCharacterData(other.fCharacterData) { // revisit. SOmething nees to make "deep" work. } DOMCDATASectionImpl::~DOMCDATASectionImpl() { } DOMNode *DOMCDATASectionImpl::cloneNode(bool deep) const { DOMNode* newNode = new (this->getOwnerDocument(), DOMDocumentImpl::CDATA_SECTION_OBJECT) DOMCDATASectionImpl(*this, deep); fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); return newNode; } const XMLCh * DOMCDATASectionImpl::getNodeName() const { static const XMLCh gcdata_section[] = {chPound, chLatin_c, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chDash, chLatin_s, chLatin_e, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, 0}; return gcdata_section; } short DOMCDATASectionImpl::getNodeType() const { return DOMNode::CDATA_SECTION_NODE; } bool DOMCDATASectionImpl::isIgnorableWhitespace() const { return fNode.ignorableWhitespace(); } // // splitText. revist - factor into a common function for use // here and in DOMTextImpl // DOMText *DOMCDATASectionImpl::splitText(XMLSize_t offset) { if (fNode.isReadOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); } XMLSize_t len = fCharacterData.fDataBuf->getLen(); if (offset > len || offset < 0) throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager); DOMText *newText = getOwnerDocument()->createCDATASection( this->substringData(offset, len - offset)); DOMNode *parent = getParentNode(); if (parent != 0) parent->insertBefore(newText, getNextSibling()); fCharacterData.fDataBuf->chop(offset); if (this->getOwnerDocument() != 0) { Ranges* ranges = ((DOMDocumentImpl *)this->getOwnerDocument())->getRanges(); if (ranges != 0) { XMLSize_t sz = ranges->size(); if (sz != 0) { for (XMLSize_t i =0; i<sz; i++) { ranges->elementAt(i)->updateSplitInfo( this, newText, offset); } } } } return newText; } bool DOMCDATASectionImpl::getIsWhitespaceInElementContent() const { return isIgnorableWhitespace(); } const XMLCh* DOMCDATASectionImpl::getWholeText() { throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMNodeMemoryManager); return 0; } DOMText* DOMCDATASectionImpl::replaceWholeText(const XMLCh*){ throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMNodeMemoryManager); return 0; } void DOMCDATASectionImpl::release() { if (fNode.isOwned() && !fNode.isToBeReleased()) throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument(); if (doc) { fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); fParent.release(); fCharacterData.releaseBuffer(); doc->release(this, DOMDocumentImpl::CDATA_SECTION_OBJECT); } else { // shouldn't reach here throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); } } // // Delegation stubs for other DOM_Node inherited functions. // DOMNode* DOMCDATASectionImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); } DOMNamedNodeMap* DOMCDATASectionImpl::getAttributes() const {return fNode.getAttributes (); } DOMNodeList* DOMCDATASectionImpl::getChildNodes() const {return fParent.getChildNodes (); } DOMNode* DOMCDATASectionImpl::getFirstChild() const {return fParent.getFirstChild (); } DOMNode* DOMCDATASectionImpl::getLastChild() const {return fParent.getLastChild (); } const XMLCh* DOMCDATASectionImpl::getLocalName() const {return fNode.getLocalName (); } const XMLCh* DOMCDATASectionImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } DOMNode* DOMCDATASectionImpl::getNextSibling() const {return fChild.getNextSibling (); } const XMLCh* DOMCDATASectionImpl::getNodeValue() const {return fCharacterData.getNodeValue (); } DOMDocument* DOMCDATASectionImpl::getOwnerDocument() const {return fParent.fOwnerDocument; } const XMLCh* DOMCDATASectionImpl::getPrefix() const {return fNode.getPrefix (); } DOMNode* DOMCDATASectionImpl::getParentNode() const {return fChild.getParentNode (this); } DOMNode* DOMCDATASectionImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); } bool DOMCDATASectionImpl::hasChildNodes() const {return fParent.hasChildNodes (); } DOMNode* DOMCDATASectionImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) {return fParent.insertBefore (newChild, refChild); } void DOMCDATASectionImpl::normalize() {fNode.normalize (); } DOMNode* DOMCDATASectionImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); } DOMNode* DOMCDATASectionImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) {return fParent.replaceChild (newChild, oldChild); } bool DOMCDATASectionImpl::isSupported(const XMLCh *feature, const XMLCh *version) const {return fNode.isSupported (feature, version); } void DOMCDATASectionImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } bool DOMCDATASectionImpl::hasAttributes() const {return fNode.hasAttributes(); } bool DOMCDATASectionImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } bool DOMCDATASectionImpl::isEqualNode(const DOMNode* arg) const {return fParent.isEqualNode(arg); } void* DOMCDATASectionImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) {return fNode.setUserData(key, data, handler); } void* DOMCDATASectionImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } const XMLCh* DOMCDATASectionImpl::getBaseURI() const {return fNode.getBaseURI(); } short DOMCDATASectionImpl::compareTreePosition(const DOMNode* other) const {return fNode.compareTreePosition(other); } const XMLCh* DOMCDATASectionImpl::getTextContent() const {return fNode.getTextContent(); } void DOMCDATASectionImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } const XMLCh* DOMCDATASectionImpl::lookupNamespacePrefix(const XMLCh* namespaceURI, bool useDefault) const {return fNode.lookupNamespacePrefix(namespaceURI, useDefault); } bool DOMCDATASectionImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } const XMLCh* DOMCDATASectionImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } DOMNode* DOMCDATASectionImpl::getInterface(const XMLCh* feature) {return fNode.getInterface(feature); } // // Delegation of CharacerData functions. // const XMLCh* DOMCDATASectionImpl::getData() const {return fCharacterData.getData();} XMLSize_t DOMCDATASectionImpl::getLength() const {return fCharacterData.getLength();} const XMLCh* DOMCDATASectionImpl::substringData(XMLSize_t offset, XMLSize_t count) const {return fCharacterData.substringData(this, offset, count);} void DOMCDATASectionImpl::appendData(const XMLCh *arg) {fCharacterData.appendData(this, arg);} void DOMCDATASectionImpl::insertData(XMLSize_t offset, const XMLCh *arg) {fCharacterData.insertData(this, offset, arg);} void DOMCDATASectionImpl::deleteData(XMLSize_t offset, XMLSize_t count) {fCharacterData.deleteData(this, offset, count);} void DOMCDATASectionImpl::replaceData(XMLSize_t offset, XMLSize_t count, const XMLCh *arg) {fCharacterData.replaceData(this, offset, count, arg);} void DOMCDATASectionImpl::setData(const XMLCh *data) {fCharacterData.setData(this, data);} void DOMCDATASectionImpl::setNodeValue(const XMLCh *nodeValue) {fCharacterData.setNodeValue (this, nodeValue); } XERCES_CPP_NAMESPACE_END
[ [ [ 1, 220 ] ] ]
fd1fc4534d0b1a4bc9d981f256396625bd929756
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/mw/classicui/uifw/apps/S60_SDK5.0/bctestbutton/inc/bctestbuttonappUi.h
d9b00a92b775b81c993bba5b7e0612e86a6d1594
[]
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
1,491
h
/* * 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: Test BC for Template control API. * */ #ifndef C_BCTESTBUTTONAPPUI_H #define C_BCTESTBUTTONAPPUI_H #include <aknviewappui.h> class CBCTestButtonView; class CBCTestUtil; /** * Application UI class * * @lib bctestutil.lib */ class CBCTestButtonAppUi : public CAknViewAppUi { public: // Constructors and destructor /** * ctor */ CBCTestButtonAppUi(); /** * symbian 2nd ctor */ void ConstructL(); /** * dtor */ virtual ~CBCTestButtonAppUi(); private: /** * From CEikAppUi */ void HandleCommandL( TInt aCommand ); private: // data /** * pointor to the view. * own */ CBCTestButtonView* iView; /** * pointor to the BC Test framework utility. * own */ CBCTestUtil* iTestUtil; }; #endif // C_BCTESTBUTTONAPPUI_H // End of File
[ "none@none" ]
[ [ [ 1, 75 ] ] ]
2d1d32a00d28e65b9ebf17732797d9376dd7ffdb
1e976ee65d326c2d9ed11c3235a9f4e2693557cf
/CommonSources/AppSettings/AppSettings.h
aef2c3e0291e5fadba6c7108fcb791d6fb5dda73
[]
no_license
outcast1000/Jaangle
062c7d8d06e058186cb65bdade68a2ad8d5e7e65
18feb537068f1f3be6ecaa8a4b663b917c429e3d
refs/heads/master
2020-04-08T20:04:56.875651
2010-12-25T10:44:38
2010-12-25T10:44:38
19,334,292
3
0
null
null
null
null
UTF-8
C++
false
false
1,804
h
// /* // * // * Copyright (C) 2003-2010 Alexandros Economou // * // * This file is part of Jaangle (http://www.jaangle.com) // * // * 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, 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 GNU Make; see the file COPYING. If not, write to // * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // * http://www.gnu.org/copyleft/gpl.html // * // */ #ifndef _AppSettings_h_ #define _AppSettings_h_ #include <string> class AppSettings { public: AppSettings() {} virtual ~AppSettings() {} virtual BOOL Load(LPCTSTR connectionString = NULL) = 0; virtual BOOL Save() = 0; //virtual BOOL Read(LPCTSTR str, INT &value, INT defaultVal) const = 0; virtual BOOL Read(LPCTSTR category, LPCTSTR setting, INT &value, INT defaultVal) = 0; virtual BOOL Read(LPCTSTR category, LPCTSTR setting, std::basic_string<TCHAR>& value, LPCTSTR defaultVal) = 0; //virtual BOOL Write(const TCHAR *str, INT value) = 0; //virtual BOOL write(const char *str, DOUBLE value) = 0; //virtual BOOL Write(const char *str, LPCTSTR value) = 0; virtual BOOL Write(LPCTSTR category, LPCTSTR setting, LPCTSTR value) = 0; virtual BOOL Write(LPCTSTR category, LPCTSTR setting, INT value) = 0; }; #endif
[ "outcast1000@dc1b949e-fa36-4f9e-8e5c-de004ec35678" ]
[ [ [ 1, 48 ] ] ]
6b3dba4788e0d85e1089ab26209c0a2f546f173d
95e016343ccf789171118a23fb57c83d3bee5f83
/plot.cpp
c6b5dbb776d9b0b412aea8d5db0c604cd26c10c8
[]
no_license
Giboon/Zad1-Miejsce-zerowe
80a0eccd7b934cec00c76e12573589c2acfb0531
04f5a86ed998d749e5253c5a9fe2c12f0c501a0f
refs/heads/master
2021-01-10T20:39:44.764615
2011-10-14T09:31:07
2011-10-14T09:31:07
2,534,618
0
0
null
null
null
null
UTF-8
C++
false
false
355
cpp
#include "plot.h" Plot::Plot(double begin, double end){ m_a = begin; m_b = end; } void Plot::hornerMe(){ } double Plot::function1(double arg){ return 3*arg+sin(arg)-exp(arg); } double Plot::function2(double arg){ return pow(3,arg)-arg+1; } double Plot::function3(double arg){ return 2*exp(-arg)-sin(arg); }
[ [ [ 1, 22 ] ] ]
d9d267cb73a9cd9be4086ee138ad6b4d95129360
022d2957a29fe5054263a406bbdd85289cf17ee0
/GontrolPC/ConfigMgr/IniConfigMgr.h
4b6ce25a845f50656ed4877267088c564a39e028
[]
no_license
amanuelg3/remote-control-with-android
aa6705da5c76311515ef6c4c972b7e64745be76d
5e51aff7d1727608c615a0027c746592ebc4ba92
refs/heads/master
2016-09-03T01:07:29.047261
2011-06-11T16:25:32
2011-06-11T16:25:32
35,783,127
1
0
null
null
null
null
UTF-8
C++
false
false
771
h
#ifndef INICONFIGMGR_H_ #define INICONFIGMGR_H_ class CIniConfigMgr : public IConfigMgr { public: CIniConfigMgr(); virtual ~CIniConfigMgr(); virtual void SetTag(const wchar_t * wszTag); virtual const wchar_t * GetTag() const; virtual int Open(bool fCreate); virtual int Close(); virtual int SetKeyValueString(const wchar_t * wszKey, const wchar_t * wszValue); virtual int SetKeyValueInt(const wchar_t * wszKey, int Value); virtual int GetKeyValueString(const wchar_t * wszKey, wchar_t * wszValue, int * pLength) const; virtual int GetKeyValueInt(const wchar_t * wszKey, int * pValue) const; DECLARE_REF private: wchar_t m_wszTag[MAX_PATH]; std::map<std::wstring,std::wstring> m_mapKeyValue; bool m_fModified; }; #endif
[ "wzmvictor@5d9a875e-b1a7-14b0-4603-314cddc6b85c" ]
[ [ [ 1, 28 ] ] ]
89c40a8c1f324c8aa3699822c8b8e676fb9913c6
3ea6d378a57e4a62be5b6e14138e2ac3212bdd6c
/exercises/data_structures/btree/btree_cpp/btree_cpp_driver.cpp
35a96ac62c3877c12efca1eda9103db83225be24
[]
no_license
stevenc49/dotcsc
8f8bcac83c8bdf2a5a9a3920455444563f0268c3
52d40c8a2b167bdeeed5f22f2d48a43e4e6470a7
refs/heads/master
2021-01-23T03:05:11.732403
2010-04-10T05:27:30
2010-04-10T05:27:30
39,530,969
0
0
null
null
null
null
UTF-8
C++
false
false
377
cpp
#include <iostream> #include "btree_cpp.h" using namespace std; int main() { Btree tree; // = new Btree(); int i; for(i=0; i<=100; i++) { tree.insert(i); } tree.destroy_tree(); if ( tree.search(15) != NULL ) cout << "found\n" << endl; else cout << "not found\n" << endl; return 0; }
[ "stevenc49@bb60cac8-25a5-11de-870d-bbf10152ea7e" ]
[ [ [ 1, 26 ] ] ]
d63f52ed620b7c3cbbc6d6021454eaaf34bf34ba
8e884f5b3617ff81a593273fb23286b4d789f548
/MakeDef/Virtual/PCL_VSet.hxx
91bc731664c9e14fa157f4fea8a225b88aef9324
[]
no_license
mau4x/PCL-1
76716e6af3f1e616ca99ac790ef6c5e8c36a8d46
b440c2ce3f3016c0c6f2ecdea9643f1a9bae19cc
refs/heads/master
2020-04-06T21:48:35.864329
2011-08-12T21:38:54
2011-08-12T21:38:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,645
hxx
///! ///! Public Methods ///! public: // General Management virtual uint Length() const PCL_PURE; // 0 for empty set virtual void SetLength(uint NewLength) PCL_PURE; // 0 to make set empty virtual void SetAll(bool NewValue) PCL_PURE; virtual void Copy(const VSet &SourceSet) PCL_PURE; virtual void SetValue(uint Member, bool NewValue) PCL_PURE; virtual bool Value(uint Member) const PCL_PURE; // Set Logics virtual void Not(void) PCL_PURE; virtual void And(const VSet &Set) PCL_PURE; virtual void Or(const VSet &Set) PCL_PURE; virtual void Xor(const VSet &Set) PCL_PURE; virtual bool IsEqual(const VSet &Set) const PCL_PURE; virtual bool IsEmpty(void) const PCL_PURE; ///! ///! Public Operators ///! public: virtual bool operator [](uint Member) const PCL_PURE; // .Value() {Same as Pascal's 'in'} // Assignments virtual const VSet& operator =(bool NewValue) PCL_PURE; // .SetAll(NewValue) virtual const VSet& operator &=(const VSet &Set) PCL_PURE; // .And(Set) virtual const VSet& operator |=(const VSet &Set) PCL_PURE; // .Or(Set) virtual const VSet& operator ^=(const VSet &Set) PCL_PURE; // .Xor(Set) virtual const VSet& operator +=(uint Member) PCL_PURE; // .SetValue(Member, true) virtual const VSet& operator -=(uint Member) PCL_PURE; // .SetValue(Member, false) // Comparisons virtual bool operator ==(const VSet &Set) const PCL_PURE; // .IsEqual(Set) virtual bool operator !=(const VSet &Set) const PCL_PURE; // !.IsEqual(Set) ///! ///! Protected Methods (Direct access to the set) ///! virtual uint _Size(void) const PCL_PURE; virtual puchar _Addr(void) const PCL_PURE;
[ [ [ 1, 38 ] ] ]
fe8346b68d63fa661a0d1bfb2cd312f49eb27575
4e708256396ac2e5374286018174f01497c9a7e9
/phonetheater/QGpsList.cpp
4fea619aeb5f74408d65c3810b1e4d64d9587eb2
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
momofarm/MobileTheater
8bcea21e178077cebe2683422e9869cca14df374
921f60b6ea520fa23d46c3f9d6b16f7955f12514
refs/heads/master
2021-01-10T20:44:23.134327
2010-09-29T07:27:36
2010-09-29T07:27:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,695
cpp
#include "QGPSList.h" #include "Constants.h" #include <QTextCodec> #include <parser.h> #include <QVariant> #include <QStringList> QGpsList::QGpsList(QString lng, QString lat, QObject *pParent): QUrlFactory::QUrlFactory(pParent, lng) { strLngLatParm = QString("%1,%2").arg(lng).arg(lat); } QString QGpsList::GetParm() { QString strPath(PATH_LOC); QString strPathAndParm = strPath + strLngLatParm; QByteArray ar = strPathAndParm.toAscii(); QTextCodec *codec = QTextCodec::codecForName("BIG5"); QString encoded = codec->toUnicode(ar); return encoded; } void QGpsList::DealResult(QByteArray &result) { //handle this part is important QTextCodec *codec = QTextCodec::codecForName("UTF-8"); QString encoded = codec->toUnicode(result); encoded.replace(QString("&quot"), QString("\"")); encoded.replace(QString(";"), QString("")); QByteArray json; json.append(encoded.toUtf8()); QJson::Parser parser; bool ok; QVariant result2 = parser.parse(json, &ok); QVariantList list = result2.toList(); if (list.size() > 0) { for (int i = 0; i < list.size(); i++) { QVariantList list2 = list.at(i).toList(); QString strTheaterID = list2.at(0).toString(); QString strTheaterName = list2.at(3).toString(); ids.push_back(strTheaterID); names.push_back(strTheaterName); } } else { return; } } QStringList QGpsList::GetTopList() { return ids; } QStringList QGpsList::GetNames() { return names; }
[ [ [ 1, 88 ] ] ]
4788f4cb42c7a4ae24185664c0b863761a9756ee
f177993b13e97f9fecfc0e751602153824dfef7e
/ImPro/ImProFilters/TouchLibFilter/Touchlib/src/DsCaptureFilter.cpp
4399e19e93279ada1f94eb49b727b7ade8d01fbb
[]
no_license
svn2github/imtophooksln
7bd7412947d6368ce394810f479ebab1557ef356
bacd7f29002135806d0f5047ae47cbad4c03f90e
refs/heads/master
2020-05-20T04:00:56.564124
2010-09-24T09:10:51
2010-09-24T09:10:51
11,787,598
1
0
null
null
null
null
UTF-8
C++
false
false
5,497
cpp
#include <DsCaptureFilter.h> #define DEFAULT_CAPTURE_WIDTH 320 #define DEFAULT_CAPTURE_HEIGHT 240 #define DEFAULT_CAPTURE_RATE 15 IplImage* DsCaptureFilter::acquiredImage = 0; DsCaptureFilter::DsCaptureFilter(char* s) : CBaseVideoRenderer(__uuidof(CLSID_Sampler), NAME("Frame Sampler"), 0, 0), Filter(s) { graph = NULL; mediaControl = NULL; mediaEvent = NULL; captureWidth = DEFAULT_CAPTURE_WIDTH; captureHeight = DEFAULT_CAPTURE_HEIGHT; captureRate = DEFAULT_CAPTURE_RATE; started = false; } DsCaptureFilter::~DsCaptureFilter() { // Do not forget to release after use if(mediaControl) mediaControl->Release(); if(graph) graph->Release(); if(newFrameEvent) CloseHandle(newFrameEvent); CoUninitialize(); } // Very basic setup of capture filter, we should do error checking bool DsCaptureFilter::initialize() { IBaseFilter* sourceFilter = NULL; IPin* sourcePin = NULL; HRESULT hr = CoInitialize(0); hr = CoCreateInstance(CLSID_FilterGraph, 0, CLSCTX_INPROC,IID_IGraphBuilder, (void **)&graph); hr = graph->QueryInterface(IID_IMediaControl, (void **)&mediaControl); //sampler = new Sampler(0, &hr); IPin* renderPin = NULL; hr = this->FindPin(L"In", &renderPin); hr = graph->AddFilter((IBaseFilter*)this, L"Sampler"); if(strcmp(source, "cam") == 0) // Capture from camera { ICreateDevEnum* devs = NULL; hr = CoCreateInstance (CLSID_SystemDeviceEnum, 0, CLSCTX_INPROC, IID_ICreateDevEnum, (void **) &devs); IEnumMoniker* cams = NULL; hr = devs?devs->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, &cams, 0):0; IMoniker* mon = NULL; hr = cams?cams->Next (1, &mon, 0):0; hr = mon?mon->BindToObject(0,0,IID_IBaseFilter, (void**)&sourceFilter):0; hr = graph->AddFilter(sourceFilter, L"Capture Source"); } else // Capture from AVI { WCHAR filename[256]; MultiByteToWideChar(0, 0, source, -1, filename, sizeof(filename)); hr = graph->AddSourceFilter(filename, L"File Source", &sourceFilter); hr = sourceFilter?sourceFilter->FindPin(L"Output", &sourcePin):0; hr = graph?graph->QueryInterface(IID_IMediaEvent, (void **)&mediaEvent):0; hr = graph?graph->QueryInterface(IID_IMediaSeeking, (void **)&mediaSeek):0; } IEnumPins* pins = NULL; hr = sourceFilter?sourceFilter->EnumPins(&pins):0; hr = pins?pins->Next(1,&sourcePin, 0):0; hr = graph->Connect(sourcePin, renderPin); newFrameEvent = CreateEvent(0, FALSE, FALSE, L"NewFrameEvent"); return true; } void DsCaptureFilter::acquireImage(void *param) { /* while(1) { if(capture) { acquiredImage = cvQueryFrame( capture ); // rewind the movie. if(!acquiredImage) cvSetCaptureProperty(capture, CV_CAP_PROP_POS_MSEC, 0); Sleep(32); } else { _endthread(); } } */ } void DsCaptureFilter::process(IplImage *frame) { Filter::process(frame); acquiredImage = NULL; destination = NULL; } void DsCaptureFilter::getParameters(ParameterMap& pMap) { pMap[std::string("source")] = std::string(source); pMap[std::string("format")] = toString(captureWidth)+"x"+ toString(captureHeight)+"@"+ toString(captureRate); } void DsCaptureFilter::setParameter(const char *name, const char *value) { // I dont like this, the user is not notified about any errors that occur // during this very fragile process of setting up capture... // Perhaps we should have a CTouchScreen initialize() which sets up the capture // filter to remedy this. (Nick) if(!graph) { if(strcmp(name, "source") == 0) { strcpy(source, value); initialize(); } if(strcmp(name, "format") == 0) { sscanf(value, "%dx%d@%d", &captureWidth, &captureHeight, &captureRate); } } } bool DsCaptureFilter::isRunning() { return destination != NULL; } void DsCaptureFilter::kernel() { HRESULT hr; long eventCode; LONG_PTR param1, param2; if(!started) { mediaControl->Run(); started = true; } destination = NULL; if(mediaEvent) { mediaEvent->GetEvent(&eventCode, &param1, &param2, 0); // if we have reached the end of the video, start it over if(eventCode == EC_COMPLETE) { LONGLONG cur = 0; hr = mediaSeek->SetPositions(&cur, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); hr = mediaControl->Run(); } mediaEvent->FreeEventParams(eventCode, param1, param2); } // Wait for a frame to arrive DWORD dw = WaitForSingleObject(newFrameEvent, INFINITE); destination = acquiredImage; } void DsCaptureFilter::kernelWithROI() { kernel(); } HRESULT DsCaptureFilter::CheckMediaType(const CMediaType *media ) { VIDEOINFO* vi; if(!IsEqualGUID( *media->Subtype(), MEDIASUBTYPE_RGB24) || !(vi = (VIDEOINFO *)media->Format()) ) return E_FAIL; // If capturing from camera, specify the format if(strcmp(source, "cam") == 0) { if(vi->bmiHeader.biWidth != captureWidth) return E_FAIL; if(vi->bmiHeader.biHeight != captureHeight) return E_FAIL; } DsCaptureFilter::acquiredImage = ::cvCreateImageHeader(cvSize(vi->bmiHeader.biWidth, vi->bmiHeader.biHeight), 8, 3); return S_OK; } HRESULT DsCaptureFilter::DoRenderSample(IMediaSample *sample) { BYTE* data; sample->GetPointer(&data); DsCaptureFilter::acquiredImage->imageData = (char*)data; SetEvent(newFrameEvent); return S_OK; }
[ "ndhumuscle@fa729b96-8d43-11de-b54f-137c5e29c83a" ]
[ [ [ 1, 224 ] ] ]
ad151e30430b6df6df662ca2752d407b84896649
288b16c1ed1f982722a897e9a4adae35bdbf1824
/Step0/QueueControl.h
cd28148a73e250d697509f89a596dc025e08d7b9
[]
no_license
yohei1126/boundedqueue
2c12e10ebe3e0128710c9c36c39332aaebcdc33e
8fbae4f0a529a9be1bc225952de46d3d35d9732b
refs/heads/master
2020-05-09T21:55:44.168713
2011-10-02T08:43:08
2011-10-02T08:43:08
2,494,631
0
0
null
null
null
null
UTF-8
C++
false
false
132
h
#ifndef __QUEUE_CONTROL_H_ #define __QUEUE_CONTROL_H_ class QueueControl { public: virtual ~QueueControl() {} }; #endif
[ [ [ 1, 9 ] ] ]
77643b008964983159532712d4876d8b1b76b50e
629e4fdc23cb90c0144457e994d1cbb7c6ab8a93
/lib/graphics/shader/attribute.cpp
c4dbe1191c22d3f2a29dbe5bed70162f608b3aeb
[]
no_license
akin666/ice
4ed846b83bcdbd341b286cd36d1ef5b8dc3c0bf2
7cfd26a246f13675e3057ff226c17d95a958d465
refs/heads/master
2022-11-06T23:51:57.273730
2011-12-06T22:32:53
2011-12-06T22:32:53
276,095,011
0
0
null
null
null
null
UTF-8
C++
false
false
7,525
cpp
/* * attribute.cpp * * Created on: 19.4.2010 * Author: akin */ #include "attribute.h" #include <iostream> namespace ice { Attribute::Attribute( ) { m_program_id = 0; } Attribute::~Attribute() { } void Attribute::setProgram( unsigned int program ) { m_program_id = program; } void Attribute::attach( std::string name ) throw (GraphicsException) { m_name = name; m_attribute_id = glGetAttribLocation( m_program_id , (const GLchar*)name.c_str() ); if( m_attribute_id < 0 ) { throw GraphicsException("Attribute location was not found."); } GL_TEST_ERROR("[in vertex attribute attach]") } std::string Attribute::getName() { return m_name; } void Attribute::enable() { glEnableVertexAttribArray( m_attribute_id ); GL_TEST_ERROR("[in attribute vertex enable]") } void Attribute::disable() { glDisableVertexAttribArray( m_attribute_id ); GL_TEST_ERROR("[in attribute vertex disable]") } void Attribute::setPointer( int data_size , GLenum data_type , GLsizei stride ) { //glEnableVertexAttribArray(0); //We like submitting vertices on stream 0 for no special reason //The starting point of the VBO, for the vertices //glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(MyVertex), BUFFER_OFFSET(0)); //glEnableVertexAttribArray(1); //We like submitting normals on stream 1 for no special reason //The starting point of normals, 12 bytes away //glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(MyVertex), BUFFER_OFFSET(12)); //glEnableVertexAttribArray(2); //We like submitting texcoords on stream 2 for no special reason //The starting point of texcoords, 24 bytes away //glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(MyVertex), BUFFER_OFFSET(24)); // A (starting point), How many datas, normalized?, size of whole element (0=packed data), position in data ?? // glBindBuffer( GL_ARRAY_BUFFER , buffer_id ); glEnableVertexAttribArray( m_attribute_id ); // GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer glVertexAttribPointer( m_attribute_id , data_size , data_type , GL_FALSE , stride , NULL ); //glBindBuffer(GL_ARRAY_BUFFER, vboIds[0]); //glEnableVertexAttribArray(VETEX_POS_INDX); //glVertexAttribPointer(VERTEX_POS_INDX, VERTEX_POS_SIZE, GL_FLOAT, GL_FALSE, vtxStrides[0], 0); } void Attribute::setPointer(int size, GLenum type, void *ptr) { // glVertexAttribPointer( GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); glVertexAttribPointer( 0 , size, type, GL_FALSE , 0 , ptr ); GL_TEST_ERROR("[in] vertex pointer") } void Attribute::set(float v) { glVertexAttrib1f( m_attribute_id , v ); GL_TEST_ERROR("[in] vertexset") } void Attribute::set(float v, float v2) { glVertexAttrib2f( m_attribute_id , v , v2 ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(float v, float v2, float v3) { glVertexAttrib3f( m_attribute_id , v , v2 , v3 ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(float v, float v2, float v3, float v4) { glVertexAttrib4f( m_attribute_id , v , v2 , v3 , v4 ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(double v) { glVertexAttrib1d( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(double v, double v2) { glVertexAttrib2d( m_attribute_id , v , v2 ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(double v, double v2, double v3) { glVertexAttrib3d( m_attribute_id , v , v2 , v3 ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(double v, double v2, double v3, double v4) { glVertexAttrib4d( m_attribute_id , v , v2 , v3 , v4 ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(short v) { glVertexAttrib1s( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(short v, short v2) { glVertexAttrib2s( m_attribute_id , v , v2 ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(short v, short v2, short v3) { glVertexAttrib3s( m_attribute_id , v , v2 , v3 ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(short v, short v2, short v3, short v4) { glVertexAttrib4s( m_attribute_id , v , v2 , v3 , v4 ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(float *v) { glVertexAttrib1fv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set2(float *v) { glVertexAttrib2fv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set3(float *v) { glVertexAttrib3fv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4(float *v) { glVertexAttrib4fv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(double *v) { glVertexAttrib1dv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set2(double *v) { glVertexAttrib2dv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set3(double *v) { glVertexAttrib3dv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4(double *v) { glVertexAttrib4dv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set(short *v) { glVertexAttrib1sv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set2(short *v) { glVertexAttrib2sv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set3(short *v) { glVertexAttrib3sv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4(short *v) { glVertexAttrib4sv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4(int *v) { glVertexAttrib4iv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4(char *v) { glVertexAttrib4bv( m_attribute_id , (GLbyte*)v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4(unsigned char *v) { glVertexAttrib4ubv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4(unsigned short *v) { glVertexAttrib4usv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4(unsigned int *v) { glVertexAttrib4uiv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } // normalized void Attribute::setN(unsigned char v, unsigned char v2, unsigned char v3, unsigned char v4) { glVertexAttrib4Nub( m_attribute_id , v , v2 , v3 , v4 ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4N(char *v) { glVertexAttrib4Nbv( m_attribute_id , (GLbyte*)v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4N(short *v) { glVertexAttrib4Nsv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4N(int *v) { glVertexAttrib4Niv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4N(unsigned char *v) { glVertexAttrib4Nubv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4N(unsigned short *v) { glVertexAttrib4Nusv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } void Attribute::set4N(unsigned int *v) { glVertexAttrib4Nuiv( m_attribute_id , v ); GL_TEST_ERROR("[in] vertex set") } }
[ "akin@lich", "akin@localhost" ]
[ [ [ 1, 26 ], [ 28, 34 ], [ 36, 272 ] ], [ [ 27, 27 ], [ 35, 35 ] ] ]
9580abcf078e5cd69c4919bf0f5fa209e2e7f062
78fb44a7f01825c19d61e9eaaa3e558ce80dcdf5
/samples/refapp/include/CRefAppSubSystem.h
f4bb09bbae852b10c05c0a227e2f7c11abb91dab
[]
no_license
LiberatorUSA/GUCE
a2d193e78d91657ccc4eab50fab06de31bc38021
a4d6aa5421f8799cedc7c9f7dc496df4327ac37f
refs/heads/master
2021-01-02T08:14:08.541536
2011-09-08T03:00:46
2011-09-08T03:00:46
41,840,441
0
0
null
null
null
null
UTF-8
C++
false
false
3,926
h
/* * Copyright (C) Dinand Vanvelzen. 2002 - 2007. All rights reserved. * * All source code herein is the property of Dinand Vanvelzen. You may not sell * or otherwise commercially exploit the source or things you created based on * the source. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * IN NO EVENT SHALL DINAND VANVELZEN BE LIABLE FOR ANY SPECIAL, INCIDENTAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef REFAPP_CREFAPPSUBSYSTEM_H #define REFAPP_CREFAPPSUBSYSTEM_H /*-------------------------------------------------------------------------// // // // INCLUDES // // // //-------------------------------------------------------------------------*/ #ifndef GUCE_CORE_MACROS_H #include "guceCORE_macros.h" #define GUCE_CORE_MACROS_H #endif /* GUCE_CORE_MACROS_H ? */ #ifndef GUCEF_CORE_COBSERVINGNOTIFIER_H #include "CObservingNotifier.h" #define GUCEF_CORE_COBSERVINGNOTIFIER_H #endif /* GUCEF_CORE_COBSERVINGNOTIFIER_H ? */ /*-------------------------------------------------------------------------// // // // CLASSES // // // //-------------------------------------------------------------------------*/ namespace Ogre { class Overlay; } class COgreDebugOverlay; /*-------------------------------------------------------------------------*/ class CRefAppSubSystem : public GUCEF::CORE::CObservingNotifier { public: CRefAppSubSystem( void ); virtual ~CRefAppSubSystem(); /** * Event callback member function. * * @param notifier the notifier that sent the notification * @param eventid the unique event id for an event * @param eventdata optional notifier defined user data */ virtual void OnNotify( GUCEF::CORE::CNotifier* notifier , const GUCEF::CORE::CEvent& eventid , GUCEF::CORE::CICloneable* eventdata = NULL ); protected: virtual void OnUpdate( const GUCEF::CORE::UInt64 tickCount , const GUCEF::CORE::Float64 updateDeltaInMilliSecs ); private: CRefAppSubSystem( const CRefAppSubSystem& src ); CRefAppSubSystem& operator=( const CRefAppSubSystem& src ); private: //GUCE::GUI::CGUIConsole* m_console; COgreDebugOverlay* m_debugOverlay; }; /*-------------------------------------------------------------------------*/ #endif /* REFAPP_CREFAPPSUBSYSTEM_H ? */ /*-------------------------------------------------------------------------// // // // Info & Changes // // // //-------------------------------------------------------------------------// - 14-01-2007 : - Dinand: Initial implementation -----------------------------------------------------------------------------*/
[ [ [ 1, 96 ] ] ]
9992ca5230779c3aa9bab9b17df5470e38e62d74
ab2777854d7040cc4029edcd1eccc6d48ca55b29
/Translator/ezTransXP/ezTransXP.cpp
4b02913d4b5b4135f79a978acfc0815e738eba15
[]
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
34,520
cpp
// ezTransXP.cpp : Defines the initialization routines for the DLL. // #pragma warning(disable:4996) #include "stdafx.h" #include "ezTransXP.h" #include "hash.hpp" #include "EZTransOptionDlg.h" #include <stdio.h> #include <process.h> #include <map> #define TRANS_BUF_SIZE 4096 // 왼쪽 2Byte : KS5601 전각 기호 코드 // 오른쪽 2Byte : SHIFT-JIS 전각 기호 코드 const char _SHIFT_JIS_CHAR_MAP[][4] = { {'\xA1', '\xCD', '\x81', '\x8F'}, // '\\' {'\xA3', '\xC0', '\x81', '\x97'}, // '@' {'\xA3', '\xA8', '\x81', '\x69'}, // '(' {'\xA3', '\xA9', '\x81', '\x6A'}, // ')' {'\xA3', '\xBC', '\x81', '\x83'}, // '<' {'\xA3', '\xBE', '\x81', '\x84'}, // '>' {'\xA3', '\xDB', '\x81', '\x6D'}, // '[' {'\xA3', '\xDD', '\x81', '\x6E'}, // ']' {'\xA3', '\xFB', '\x81', '\x6F'}, // '{' {'\xA3', '\xFD', '\x81', '\x70'}, // '}' {'\xA2', '\xC8', '\x81', '\x4A'}, // ″ {'\xA2', '\xC8', '\x81', '\x4B'}, // ″ {'\xA2', '\xC8', '\x81', '\x8D'}, // ″ {'\xA2', '\xC7', '\x81', '\x4C'}, // ´ {'\xA2', '\xC7', '\x81', '\x4D'}, // ´ {'\xA2', '\xC7', '\x81', '\x8C'}, // ´ {'\xA1', '\xAE', '\x81', '\x65'}, // ‘ {'\xA1', '\xAF', '\x81', '\x66'}, // ’ {'\xA1', '\xB0', '\x81', '\x67'}, // “ {'\xA1', '\xB1', '\x81', '\x68'}, // ” {'\x00', '\x00', '\x00', '\x00'} }; #ifdef _DEBUG #define new DEBUG_NEW #endif // The one and only CezTransXPApp object CezTransXPApp theApp; ////////////////////////////////////////////////////////////////////////// // // Export Functions // ////////////////////////////////////////////////////////////////////////// // GetPluginInfo extern "C" __declspec(dllexport) BOOL __stdcall GetPluginInfo(PLUGIN_INFO* pPluginInfo) { BOOL bRetVal = FALSE; if(sizeof(PLUGIN_INFO) <= pPluginInfo->cch) { // Set Plugin Icon ID pPluginInfo->nIconID = IDI_ICON1; // Set Plugin Name wcscpy_s(pPluginInfo->wszPluginName, 64, L"ezTrans XP"); // Set Plugin Type (Algorithm, Filter, Translator) wcscpy_s(pPluginInfo->wszPluginType, 16, L"Translator"); // Set Download URL wcscpy_s(pPluginInfo->wszDownloadUrl, 256, L"http://www.aralgood.com/update_files_AT3/Plugin/Translator/ezTransXP.zip"); bRetVal = TRUE; } return bRetVal; } // OnPluginInit extern "C" __declspec(dllexport) BOOL __stdcall OnPluginInit(HWND hAralWnd, LPWSTR wszPluginOption) { return theApp.OnPluginInit(hAralWnd, wszPluginOption); } // OnPluginClose extern "C" __declspec(dllexport) BOOL __stdcall OnPluginClose() { return theApp.OnPluginClose(); } // OnPluginOption extern "C" __declspec(dllexport) BOOL __stdcall OnPluginOption() { return theApp.OnPluginOption(); } // OnObjectInit extern "C" __declspec(dllexport) BOOL __stdcall OnObjectInit(TRANSLATION_OBJECT* pTransObj) { return theApp.OnObjectInit(pTransObj); } // OnObjectClose extern "C" __declspec(dllexport) BOOL __stdcall OnObjectClose(TRANSLATION_OBJECT* pTransObj) { return theApp.OnObjectClose(pTransObj); } // OnObjectMove extern "C" __declspec(dllexport) BOOL __stdcall OnObjectMove(TRANSLATION_OBJECT* pTransObj) { return theApp.OnObjectMove(pTransObj); } // OnObjectOption extern "C" __declspec(dllexport) BOOL __stdcall OnObjectOption(TRANSLATION_OBJECT* pTransObj) { return theApp.OnObjectOption(pTransObj); } // Main Translation Function BOOL __stdcall Translate(TRANSLATION_OBJECT* pTransObject) { return theApp.TranslateJ2K(pTransObject); } // //TODO: If this DLL is dynamically linked against the MFC DLLs, // any functions exported from this DLL which call into // MFC must have the AFX_MANAGE_STATE macro added at the // very beginning of the function. // // For example: // // extern "C" BOOL PASCAL EXPORT ExportedFunction() // { // AFX_MANAGE_STATE(AfxGetStaticModuleState()); // // normal function body here // } // // It is very important that this macro appear in each // function, prior to any calls into MFC. This means that // it must appear as the first statement within the // function, even before any object variable declarations // as their constructors may generate calls into the MFC // DLL. // // Please see MFC Technical Notes 33 and 58 for additional // details. // // CezTransXPApp BEGIN_MESSAGE_MAP(CezTransXPApp, CWinApp) END_MESSAGE_MAP() // CezTransXPApp construction CezTransXPApp::CezTransXPApp() : m_hTransThread(NULL) , m_hRequestEvent(NULL) , m_hResponseEvent(NULL) , m_pCurTransObj(NULL) { ZeroMemory(&m_sATCTNR3, sizeof(CONTAINER_PROC_ENTRY)); } // CezTransXPApp initialization BOOL CezTransXPApp::InitInstance() { CWinApp::InitInstance(); return TRUE; } BOOL CezTransXPApp::OnPluginInit( HWND hAralWnd, LPWSTR wszPluginOption ) { TRACE(_T("CezTransXPApp::OnPluginInit() begin \n")); BOOL bRetVal = FALSE; // Initializing Code //::MessageBox(NULL, _T("CezTransXPApp"), _T("CezTransXPApp"), MB_OK | MB_TOPMOST); // 컨테이너 윈도우 저장 m_hAralWnd = hAralWnd; // 옵션 스트링 버퍼 연결 m_wszPluginOption = wszPluginOption; // 컨테이너 함수 HMODULE hATCTNR3 = GetModuleHandle(_T("ATCTNR3.DLL")); if(hATCTNR3 && INVALID_HANDLE_VALUE != hATCTNR3) { ZeroMemory(&m_sATCTNR3, sizeof(CONTAINER_PROC_ENTRY)); m_sATCTNR3.procHookWin32Api = (PROC_HookWin32Api) GetProcAddress(hATCTNR3, "HookWin32Api"); m_sATCTNR3.procUnhookWin32Api = (PROC_UnhookWin32Api) GetProcAddress(hATCTNR3, "UnhookWin32Api"); m_sATCTNR3.procHookCodePoint = (PROC_HookCodePoint) GetProcAddress(hATCTNR3, "HookCodePoint"); m_sATCTNR3.procUnhookCodePoint = (PROC_UnhookCodePoint) GetProcAddress(hATCTNR3, "UnhookCodePoint"); m_sATCTNR3.procCreateTransCtx = (PROC_CreateTransCtx) GetProcAddress(hATCTNR3, "CreateTransCtx"); m_sATCTNR3.procDeleteTransCtx = (PROC_DeleteTransCtx) GetProcAddress(hATCTNR3, "DeleteTransCtx"); m_sATCTNR3.procTranslateUsingCtx = (PROC_TranslateUsingCtx) GetProcAddress(hATCTNR3, "TranslateUsingCtx"); m_sATCTNR3.procIsAppLocaleLoaded = (PROC_IsAppLocaleLoaded) GetProcAddress(hATCTNR3, "IsAppLocaleLoaded"); m_sATCTNR3.procSuspendAllThread = (PROC_SuspendAllThread) GetProcAddress(hATCTNR3, "SuspendAllThread"); m_sATCTNR3.procResumeAllThread = (PROC_ResumeAllThread) GetProcAddress(hATCTNR3, "ResumeAllThread"); m_sATCTNR3.procIsAllThreadSuspended = (PROC_IsAllThreadSuspended) GetProcAddress(hATCTNR3, "IsAllThreadSuspended"); } // 동기화 객체 초기화 InitializeCriticalSection(&m_csTrans); m_hRequestEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL); m_hResponseEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL); /* BOOL bInitRes = FALSE; for(int i=0; i<100; i++) { if(::WaitForSingleObject(m_hResponseEvent, 0) == WAIT_OBJECT_0) { bInitRes = TRUE; break; } ::Sleep(50); } if(FALSE == bInitRes) m_strErrorMsg = _T("Initializing Time-out!"); */ //::WaitForSingleObject(m_hResponseEvent, INFINITE); InitEZTrans(); // Check ezTransXP was Initialized if(!m_strErrorMsg.IsEmpty()) { MessageBox(NULL, m_strErrorMsg, _T("ezTransXP Initialize Error"), MB_OK | MB_TOPMOST); } else { // 이지트랜스 쓰레드를 시작 UINT dwTransThreadID = 0; m_hTransThread = (HANDLE)_beginthreadex(NULL, 0, TransThreadFunc, this, 0, &dwTransThreadID); if(m_hTransThread) { bRetVal = TRUE; } else { MessageBox(NULL, _T("이지트랜스 쓰레드를 시작할 수 없습니다."), _T("ezTransXP Initialize Error"), MB_OK | MB_TOPMOST); } } TRACE(_T("CezTransXPApp::OnPluginInit() end \n")); return bRetVal; } BOOL IsASCIIOnly(LPCTSTR cszString) { if(NULL == cszString) return FALSE; size_t i = 0; while(cszString[i]) { if( ((BYTE*)cszString)[i++] >= 0x80 ) return FALSE; } return TRUE; } void CezTransXPApp::InitEZTrans() { m_strErrorMsg = _T(""); m_strHomeDir = _T(""); try { while(m_strHomeDir.IsEmpty()) { m_strHomeDir = GetEZTransHomeDir(); if( m_strHomeDir.IsEmpty() ) { if( ::MessageBox( NULL, _T("EZ Trans XP가 설치된 경로를 수 없습니다.\r\n경로를 직접 찾으시겠습니까?"), _T("ezTransXP Plugin"), MB_YESNO | MB_TOPMOST) == IDYES ) { ITEMIDLIST *pidlBrowse; TCHAR pszPathname[MAX_PATH] = {0,}; BROWSEINFO BrInfo; BrInfo.hwndOwner = NULL; BrInfo.pidlRoot = NULL; memset(&BrInfo, 0, sizeof(BrInfo)); BrInfo.pszDisplayName = pszPathname; BrInfo.lpszTitle = _T("ez Trans-XP 위치 지정"); BrInfo.ulFlags = BIF_RETURNONLYFSDIRS; pidlBrowse = ::SHBrowseForFolder(&BrInfo); if( pidlBrowse != NULL) { BOOL bModalRes = ::SHGetPathFromIDList(pidlBrowse, pszPathname); if(bModalRes) { m_strHomeDir.Format(_T("%s\\Dat"), pszPathname); } } } else { throw _T("EZ Trans XP 가 설치된 경로를 찾을 수 없습니다."); } } } // 영문 경로인지 검사 if(IsASCIIOnly(m_strHomeDir) == FALSE) { if( ::MessageBox( NULL, _T("EZ Trans XP 경로에 한글이 섞여 있을 경우 제대로 동작하지 않을 수 있습니다.\r\n그래도 계속 진행하시겠습니까?"), _T("ezTransXP Plugin"), MB_YESNO) == IDNO ) { throw _T("EZ Trans XP를 영문 폴더에 설치하신 후 다시 시도해 주십시오."); } } // 이지트랜스 함수모듬 구조체 초기화 ZeroMemory(&m_EZDLL, sizeof(m_EZDLL)); // J2K 번역 모듈 로드 CString strJ2KDllPath = m_strHomeDir + _T("\\..\\J2KEngine.dll"); m_EZDLL.hJKMod = LoadLibrary(strJ2KDllPath); if (m_EZDLL.hJKMod == NULL) throw _T("J2KEngine.dll을 로드할 수 없습니다."); // DLL로부터 함수 포인터 얻기 FARPROC pFuncAddr = NULL; pFuncAddr = GetProcAddress(m_EZDLL.hJKMod, "J2K_InitializeEx"); memcpy( &m_EZDLL.J2K_InitializeEx, &pFuncAddr, sizeof(FARPROC) ); pFuncAddr = GetProcAddress(m_EZDLL.hJKMod, "J2K_TranslateMMNT"); memcpy( &m_EZDLL.J2K_TranslateMMNT, &pFuncAddr, sizeof(FARPROC) ); pFuncAddr = GetProcAddress(m_EZDLL.hJKMod, "J2K_FreeMem"); memcpy( &m_EZDLL.J2K_FreeMem, &pFuncAddr, sizeof(FARPROC) ); pFuncAddr = GetProcAddress(m_EZDLL.hJKMod, "J2K_StopTranslation"); memcpy( &m_EZDLL.J2K_StopTranslation, &pFuncAddr, sizeof(FARPROC) ); pFuncAddr = GetProcAddress(m_EZDLL.hJKMod, "J2K_Terminate"); memcpy( &m_EZDLL.J2K_Terminate, &pFuncAddr, sizeof(FARPROC) ); if (m_EZDLL.J2K_InitializeEx == NULL || m_EZDLL.J2K_TranslateMMNT == NULL || m_EZDLL.J2K_FreeMem == NULL || m_EZDLL.J2K_StopTranslation == NULL || m_EZDLL.J2K_Terminate == NULL) throw _T("잘못된 J2KEngine.dll 파일입니다."); } catch (LPCTSTR strErr) { m_strErrorMsg = strErr; } return; } void CezTransXPApp::CloseEZTrans() { if (m_EZDLL.J2K_StopTranslation && m_EZDLL.J2K_Terminate) { m_EZDLL.J2K_StopTranslation(0); /* m_EZDLL.J2K_Terminate(); */ } if (m_EZDLL.hJKMod) { /* FreeLibrary(m_EZDLL.hJKMod); */ } ZeroMemory(&m_EZDLL, sizeof(m_EZDLL)); m_hAralWnd = NULL; } BOOL CezTransXPApp::OnPluginOption() { return TRUE; } BOOL CezTransXPApp::OnPluginClose() { if(m_hTransThread) { HANDLE hTmp = m_hTransThread; m_hTransThread = NULL; ::SetEvent(m_hRequestEvent); ::WaitForSingleObject(hTmp, 3000); ::CloseHandle(m_hTransThread); } CloseEZTrans(); // 동기화 객체 말기화 ::CloseHandle(m_hRequestEvent); ::CloseHandle(m_hResponseEvent); m_hRequestEvent = NULL; m_hResponseEvent = NULL; DeleteCriticalSection(&m_csTrans); return TRUE; } BOOL CezTransXPApp::OnObjectInit(TRANSLATION_OBJECT* pTransObj) { if(NULL == pTransObj) return FALSE; /* // Create Pre-translation buffer pTransObj->pPreTransBuf = malloc(TRANS_BUF_LEN); pTransObj->nPreTransBufLen = TRANS_BUF_LEN; ZeroMemory(pTransObj->pPreTransBuf, pTransObj->nPreTransBufLen); // Create Post-translation buffer pTransObj->pPostTransBuf = malloc(TRANS_BUF_LEN); pTransObj->nPostTransBufLen = TRANS_BUF_LEN; ZeroMemory(pTransObj->pPostTransBuf, pTransObj->nPostTransBufLen); */ // Set the translation function pointer pTransObj->procTranslate = Translate; return TRUE; } BOOL CezTransXPApp::OnObjectClose(TRANSLATION_OBJECT* pTransObj) { if(NULL == pTransObj) return FALSE; // Delete Pre-translation buffer if(pTransObj->pPreTransBuf) { delete [] (char*)pTransObj->pPreTransBuf; pTransObj->pPreTransBuf = NULL; } pTransObj->nPreTransBufLen = 0; // Delete Post-translation buffer if(pTransObj->pPostTransBuf) { delete [] (char*)pTransObj->pPostTransBuf; pTransObj->pPostTransBuf = NULL; } pTransObj->nPostTransBufLen = 0; // Reset the translation function pointer pTransObj->procTranslate = NULL; return TRUE; } BOOL CezTransXPApp::OnObjectMove(TRANSLATION_OBJECT* pTransObj) { return TRUE; } BOOL CezTransXPApp::OnObjectOption(TRANSLATION_OBJECT* pTransObj) { if(m_hAralWnd && IsWindow(m_hAralWnd)) { CEZTransOptionDlg opt_dlg; opt_dlg.m_bRemoveTrace = (pTransObj->wszObjectOption[0] && pTransObj->wszObjectOption[0] == L'1') ? TRUE : FALSE; opt_dlg.m_bRemoveDupSpace = (pTransObj->wszObjectOption[0] && pTransObj->wszObjectOption[1] == L'1') ? TRUE : FALSE; if(opt_dlg.DoModal() == IDOK) { // 옵션 적용 pTransObj->wszObjectOption[0] = (opt_dlg.m_bRemoveTrace ? L'1' : L'0'); pTransObj->wszObjectOption[1] = (opt_dlg.m_bRemoveDupSpace ? L'1' : L'0'); pTransObj->wszObjectOption[2] = L'\0'; // 옵션 생략 가능? if(opt_dlg.m_bRemoveTrace == TRUE && opt_dlg.m_bRemoveDupSpace == FALSE) pTransObj->wszObjectOption[0] = L'\0'; } } return TRUE; } BOOL CezTransXPApp::TranslateJ2K(TRANSLATION_OBJECT* pTransObject) { BOOL bRetVal = FALSE; // Check translation object is NULL if(NULL == pTransObject) return FALSE; TRANSLATION_OBJECT* pPrevObject = pTransObject->pPrevObject; TRANSLATION_OBJECT* pNextObject = pTransObject->pNextObject; // Check the previous object is NULL if(NULL == pPrevObject) return FALSE; // Check pre-translation buffer of the previous object is NULL if(NULL == pPrevObject->pPreTransBuf || 0 == pPrevObject->nPreTransBufLen) return FALSE; // Create text buffer as double size of pre-translation buffer if(pTransObject->pPreTransBuf) { delete [] (char*)pTransObject->pPreTransBuf; pTransObject->pPreTransBuf = NULL; pTransObject->nPreTransBufLen = 0; } pTransObject->nPreTransBufLen = strlen((LPCSTR)pPrevObject->pPreTransBuf) * 2 + 10; pTransObject->pPreTransBuf = new char[pTransObject->nPreTransBufLen]; ////////////////////////////////////////////////////////////////////////// // // Pre-translation // ZeroMemory(pTransObject->pPreTransBuf, pTransObject->nPreTransBufLen); EnterCriticalSection(&m_csTrans); m_pCurTransObj = pTransObject; ResetEvent(m_hResponseEvent); BOOL bSetEventResult = ::SetEvent(m_hRequestEvent); TRACE(_T("[aral1] Request Trans Event ON!! (bSetEventResult : %d) \n"), bSetEventResult); DWORD dwTransWait = ::WaitForSingleObject(m_hResponseEvent, INFINITE); TRACE(_T("[aral1] Received Response of Trans Event (dwTransWait : %d) \n"), dwTransWait); //if(dwTransWait == WAIT_OBJECT_0) bRetVal = TRUE; pTransObject->nPreTransBufLen = strlen((LPCSTR)pTransObject->pPreTransBuf) + 1; LeaveCriticalSection(&m_csTrans); // // End of Pre-translation // ////////////////////////////////////////////////////////////////////////// // Check the next object is NULL if(NULL == pNextObject) return FALSE; // Check the next function is available if(NULL == pNextObject->procTranslate) return FALSE; // * Call next translation function BOOL bRes = pNextObject->procTranslate(pTransObject->pNextObject); if(FALSE == bRes) return FALSE; // Check post-translation buffer of the next object is NULL if(NULL == pNextObject->pPostTransBuf || 0 == pNextObject->nPostTransBufLen) return FALSE; // Create text buffer as double size of pre-translation buffer if(pTransObject->pPostTransBuf) { delete [] (char*)pTransObject->pPostTransBuf; pTransObject->pPostTransBuf = NULL; pTransObject->nPostTransBufLen = 0; } pTransObject->pPostTransBuf = new char[pNextObject->nPostTransBufLen]; pTransObject->nPostTransBufLen = pNextObject->nPreTransBufLen; ////////////////////////////////////////////////////////////////////////// // // Post-translation // ZeroMemory(pTransObject->pPostTransBuf, pTransObject->nPostTransBufLen); memcpy_s(pTransObject->pPostTransBuf, pTransObject->nPostTransBufLen, pNextObject->pPostTransBuf, pNextObject->nPostTransBufLen); // // End of Post-translation // ////////////////////////////////////////////////////////////////////////// return TRUE; } // 이지트랜스 홈 디랙토리 초기화 CString CezTransXPApp::GetEZTransHomeDir() { CString strRetVal = _T(""); TCHAR szHomeDir[MAX_PATH]; HKEY hKey; DWORD dwLen = MAX_PATH; try { if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\ChangShin\\ezTrans"), 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS) throw -1; if (RegQueryValueEx(hKey, _T("FilePath"), NULL, NULL, (LPBYTE)szHomeDir, &dwLen) != ERROR_SUCCESS) throw -2; RegCloseKey(hKey); if ( _tcslen(szHomeDir) == 0 ) throw -3; strRetVal.Format(_T("%s\\Dat"), szHomeDir); } catch (int nErrCode) { nErrCode = nErrCode; } return strRetVal; } unsigned int __stdcall CezTransXPApp::TransThreadFunc(void* pParam) { TRACE(_T("[aral1] 번역 쓰레드 시작 \n")); // 번역텍스트 캐시 map<UINT, CTextElement*> mapCache; CTextElement CacheHead; CTextElement CacheTail; CacheHead.pNextLink = &CacheTail; CacheTail.pPrevLink = &CacheHead; // 번역용 버퍼 char* pBuf1 = new char[TRANS_BUF_SIZE]; char* pBuf2 = new char[TRANS_BUF_SIZE]; CezTransXPApp* pThis = (CezTransXPApp*)pParam; // 이지트랜스 초기화함수 호출 #ifdef UNICODE char szHomeDir[MAX_PATH]; ::WideCharToMultiByte(CP_ACP, 0, (LPCTSTR)pThis->m_strHomeDir, -1, szHomeDir, MAX_PATH, NULL, NULL); pThis->m_EZDLL.J2K_InitializeEx(EZTR_INIT_STR, szHomeDir); #else m_EZDLL.J2K_InitializeEx(EZTR_INIT_STR, (LPCSTR)m_strHomeDir); #endif //::SetEvent(pThis->m_hResponseEvent); // 이지트랜스 초기화가 되었다고 알려주는 용도 while(pThis->m_hTransThread) { DWORD dwTransWait = WaitForSingleObject(pThis->m_hRequestEvent, INFINITE); TRACE(_T("[aral1] Received Request of Trans Event (dwTransWait : %d) \n"), dwTransWait); if(pThis->m_hTransThread == NULL) { TRACE(_T("[aral1] Exit (pThis->m_hTransThread == NULL) \n")); break; } TRANSLATION_OBJECT* pTransObject = pThis->m_pCurTransObj; TRANSLATION_OBJECT* pPrevObject = pTransObject->pPrevObject; if('\0' == ((LPSTR)pPrevObject->pPreTransBuf)[0]) { ((LPSTR)pTransObject->pPreTransBuf)[0] = '\0'; } else { // 이 원문 텍스트의 해시 구하기 UINT dwTextHash = MakeStringHash((LPCSTR)pPrevObject->pPreTransBuf); // 캐시에서 찾아보기 map<UINT, CTextElement*>::iterator iter = mapCache.find(dwTextHash); CTextElement* pTextElem = NULL; // 캐시에 있으면 if(mapCache.end() != iter) { pTextElem = iter->second; // 리스트에서 빠져나오기 pTextElem->pPrevLink->pNextLink = pTextElem->pNextLink; pTextElem->pNextLink->pPrevLink = pTextElem->pPrevLink; } // 캐시에 없으면 이지트랜스로 번역 else { LPCSTR cszJpnText = (LPSTR)pPrevObject->pPreTransBuf; BOOL bRemoveTrace = (pTransObject->wszObjectOption[0] && pTransObject->wszObjectOption[0] == L'1') ? TRUE : FALSE; BOOL bRemoveDupSpace = (pTransObject->wszObjectOption[0] && pTransObject->wszObjectOption[1] == L'1') ? TRUE : FALSE; // 괄호 문자 인코딩 (옵션 적용) if(bRemoveTrace) { pThis->EncodeTrace(cszJpnText, pBuf1); cszJpnText = pBuf1; } // 전각 문자 인코딩 pThis->EncodeTwoByte(cszJpnText, pBuf2); cszJpnText = pBuf2; char* szTrans = pThis->m_EZDLL.J2K_TranslateMMNT(0, cszJpnText); if(szTrans) { LPCSTR cszKorText = szTrans; // 중복 공백 제거 (옵션 적용) if(bRemoveDupSpace) { pThis->FilterDupSpaces(cszKorText, pBuf2); cszKorText = pBuf2; } // 전각 문자 디코딩 pThis->DecodeTwoByte(cszKorText, pBuf1); cszKorText = pBuf1; // 괄호 문자 디코딩 if(bRemoveTrace) { pThis->FilterTrace(cszKorText, pBuf2); pThis->DecodeTrace(pBuf2, pBuf1); cszKorText = pBuf1; } pThis->m_EZDLL.J2K_FreeMem(szTrans); pTextElem = new CTextElement(); pTextElem->dwHash = dwTextHash; pTextElem->strTranslatedText = cszKorText; // 캐시가 꽉 찼다면 빈자리 확보해 놓기 if(mapCache.size() >= 10000) { CTextElement* pDelElem = CacheTail.pPrevLink; CacheTail.pPrevLink = pDelElem->pPrevLink; mapCache.erase(pDelElem->dwHash); delete pDelElem; } // 캐시에 삽입 mapCache.insert(pair<UINT, CTextElement*>(dwTextHash, pTextElem)); } } if(pTextElem && pTransObject->pPreTransBuf && pTransObject->nPreTransBufLen) { size_t nLen = pTextElem->strTranslatedText.length(); if( nLen > (pTransObject->nPreTransBufLen-1) ) { strncpy((LPSTR)pTransObject->pPreTransBuf, pTextElem->strTranslatedText.c_str(), pTransObject->nPreTransBufLen-1); ((LPSTR)pTransObject->pPreTransBuf)[pTransObject->nPreTransBufLen-1] = _T('\0'); } else { strcpy((LPSTR)pTransObject->pPreTransBuf, pTextElem->strTranslatedText.c_str()); } // 헤드 다음으로 삽입 pTextElem->pPrevLink = &CacheHead; pTextElem->pNextLink = CacheHead.pNextLink; CacheHead.pNextLink->pPrevLink = pTextElem; CacheHead.pNextLink = pTextElem; } }// end of else of if('\0' == pThis->m_pJpnText[0]) BOOL bSetEventResult = ::SetEvent(pThis->m_hResponseEvent); TRACE(_T("[aral1] Response Trans Event ON!! (result : %d) \n"), bSetEventResult); } // 버퍼 삭제 delete [] pBuf1; delete [] pBuf2; // 맵의 원소들 삭제 TRACE(_T("[aral1] Map : %d \n"), mapCache.size()); for(map<UINT, CTextElement*>::iterator iter = mapCache.begin(); iter != mapCache.end(); iter++) { CTextElement* pTextElem = iter->second; if(pTextElem) delete pTextElem; } TRACE(_T("[aral1] Trans Thread Terminated!!!!! \n")); return 0; } ////////////////////////////////////////////////////////////////////////// // // 번역기가 괄호를 마음대로 붙여버리는 경우 일부 게임에서 오류 증상 // 따라서 이런 경우 제거 // ex) "소(쇠)고기를 먹었다." -> "소고기를 먹었다." // ////////////////////////////////////////////////////////////////////////// void CezTransXPApp::FilterTrace(LPCSTR cszKorSrc, LPSTR szKorTar) { if(NULL==cszKorSrc || NULL==szKorTar || '\0'==cszKorSrc[0] || '\0'==szKorTar[0]) return; size_t len = strlen(cszKorSrc); size_t i = 0; // 오리지널 인덱스 size_t j = 0; // 버퍼 인덱스 while(i<len) { // 2바이트 문자면 if((BYTE)cszKorSrc[i] >= 0x80 && (BYTE)cszKorSrc[i+1] != '\0') { if((BYTE)cszKorSrc[i] == 0xA1 && (BYTE)cszKorSrc[i+1] == 0xA1) { i += 2; szKorTar[j++] = ' '; } else { szKorTar[j++] = cszKorSrc[i++]; szKorTar[j++] = cszKorSrc[i++]; } } // 1바이트 문자면 else { if(cszKorSrc[i] == '(') { //// AT 제어 문자이면 //if( strncmp(&cszKorSrc[i], "(\at", 4) == 0 ) //{ // do // { // szKorTar[j++] = cszKorSrc[i++]; // }while(cszKorSrc[i-1] != ')' && i<len); //} //// 아니라 그냥 '(' 괄호 이면 //else //{ while(cszKorSrc[i] != ')' && i<len) { if((BYTE)cszKorSrc[i] >= 0x80 && (BYTE)cszKorSrc[i+1] != '\0') i++; i++; } if(i<len) { i++; if(cszKorSrc[i]==' ') i++; } //} } else if(cszKorSrc[i] == '{') { while(cszKorSrc[i] != '}' && i<len) { if((BYTE)cszKorSrc[i] >= 0x80 && (BYTE)cszKorSrc[i+1] != '\0') i++; i++; } if(i<len) { i++; if(cszKorSrc[i]==' ') i++; } } else if(cszKorSrc[i] == '[') { while(cszKorSrc[i] != ']' && i<len) { if((BYTE)cszKorSrc[i] >= 0x80 && (BYTE)cszKorSrc[i+1] != '\0') i++; i++; } if(i<len) { i++; if(cszKorSrc[i]==' ') i++; } } else if(cszKorSrc[i] == '<') { while((cszKorSrc[i] != '>' && cszKorSrc[i] != ')')&& i<len) { if((BYTE)cszKorSrc[i] >= 0x80 && (BYTE)cszKorSrc[i+1] != '\0') i++; i++; } if(i<len) { i++; if(cszKorSrc[i]==' ') i++; //if(j>0 && ':' == szKorText[j-1]) szKorText[j-1] = ' '; } } else if(cszKorSrc[i] == ':') { i++; } else { szKorTar[j++] = cszKorSrc[i++]; } } } szKorTar[j] = '\0'; #ifdef DEBUG OutputDebugStringA("<FilterTrace Start>"); OutputDebugStringA(cszKorSrc); OutputDebugStringA(szKorTar); OutputDebugStringA("<FilterTrace End>"); #endif } ////////////////////////////////////////////////////////////////////////// // // 번역기를 거친 후 공백(' ')이 필요이상으로 늘어나는 경우가 있다. // 이런 경우 하나만 남기고 모두 제거 // ex) "즉 , 이렇게 변함" -> "즉, 이렇게 변함" // ////////////////////////////////////////////////////////////////////////// void CezTransXPApp::FilterDupSpaces(LPCSTR cszKorSrc, LPSTR szKorTar) { if(NULL==cszKorSrc || NULL==szKorTar || '\0'==cszKorSrc[0] || '\0'==szKorTar[0]) return; size_t len = strlen(cszKorSrc); size_t i = 0; // 오리지널 인덱스 size_t j = 0; // 버퍼 인덱스 while(i<len) { // 2바이트 문자면 if((BYTE)cszKorSrc[i] >= 0x80 && (BYTE)cszKorSrc[i+1] != '\0') { if((BYTE)cszKorSrc[i] == 0xA1 && //「 」 『 』 0xB8 <= (BYTE)cszKorSrc[i+1] && (BYTE)cszKorSrc[i+1] <= 0xBB) { if(j>0 && szKorTar[j-1] == ' ') j--; szKorTar[j++] = cszKorSrc[i++]; szKorTar[j++] = cszKorSrc[i++]; if(cszKorSrc[i] == ' ') i++; } else { szKorTar[j++] = cszKorSrc[i++]; szKorTar[j++] = cszKorSrc[i++]; } } // 1바이트 문자면 else { if((cszKorSrc[i] == ' ') && (i+1 < len) && (cszKorSrc[i+1] == ' ' || cszKorSrc[i+1] == ',')) { i++; } else { szKorTar[j++] = cszKorSrc[i++]; } } } szKorTar[j] = '\0'; #ifdef DEBUG OutputDebugStringA("<FilterDupSpaces Start>"); OutputDebugStringA(cszKorSrc); OutputDebugStringA(szKorTar); OutputDebugStringA("<FilterDupSpaces End>"); #endif } ////////////////////////////////////////////////////////////////////////// // // 전각 특수문자를 이지트랜스가 마음대로 ASCII코드로 바꿔버려서 이를 방지 // 하기위해 값을 잠시 변환시킴 // ex) "〈ゆか〉" -> "(\atA3BC)ゆか(\atA3BE)" // ////////////////////////////////////////////////////////////////////////// void CezTransXPApp::EncodeTwoByte(LPCSTR cszJpnSrc, LPSTR szJpnTar) { if(NULL==cszJpnSrc || NULL==szJpnTar) return; if('\0'==cszJpnSrc[0]) { szJpnTar[0] = '\0'; return; } size_t len = strlen(cszJpnSrc); size_t i = 0; // 오리지널 인덱스 size_t j = 0; // 버퍼 인덱스 while(i<len) { if((BYTE)cszJpnSrc[i] >= 0x80 && (BYTE)cszJpnSrc[i+1] != '\0') { int nTarInc = 2; szJpnTar[j] = cszJpnSrc[i]; szJpnTar[j+1] = cszJpnSrc[i+1]; for(int k=0; _SHIFT_JIS_CHAR_MAP[k][0]; k++) { if(_SHIFT_JIS_CHAR_MAP[k][2] == cszJpnSrc[i] && _SHIFT_JIS_CHAR_MAP[k][3] == cszJpnSrc[i+1]) { nTarInc = sprintf(&szJpnTar[j], "_&%03u%03u&_", (BYTE)_SHIFT_JIS_CHAR_MAP[k][0], (BYTE)_SHIFT_JIS_CHAR_MAP[k][1]); } } i += 2; j += nTarInc; } else { szJpnTar[j++] = cszJpnSrc[i++]; } } szJpnTar[j] = '\0'; #ifdef DEBUG OutputDebugStringA("<EncodeTwoByte Start>"); OutputDebugStringA(cszJpnSrc); OutputDebugStringA(szJpnTar); OutputDebugStringA("<EncodeTwoByte End>"); #endif } ////////////////////////////////////////////////////////////////////////// // // 이지트랜스 번역 전 변환시켰던 전각특수기호들을 복구 // ex) "(\atA3BC)주인공(\atA3BE)" -> "〈주인공〉" // ////////////////////////////////////////////////////////////////////////// void CezTransXPApp::DecodeTwoByte(LPCSTR cszKorSrc, LPSTR szKorTar) { if(NULL==cszKorSrc || NULL==szKorTar) return; if('\0'==cszKorSrc[0]) { szKorTar[0] = '\0'; return; } size_t len = strlen(cszKorSrc); size_t i = 0; // 오리지널 인덱스 size_t j = 0; // 버퍼 인덱스 while(i<len) { size_t nCopyLen = len-i; const char* pEncPtr = strstr(&cszKorSrc[i], "_&"); // "_&" 프리픽스를 찾았다면 if(NULL != pEncPtr) { // 변환시킬 데이터가 확실한가? //if( (UINT_PTR)pEncPtr - (UINT_PTR)cszKorSrc + 9 < len // && '&' == *(pEncPtr+8) // && '_' == *(pEncPtr+9) ) if(GetEncodedLen(pEncPtr) == 10) { nCopyLen = (UINT_PTR)pEncPtr - (UINT_PTR)(&cszKorSrc[i]); } // 변환시키면 안되는 _&라면 else { pEncPtr = NULL; nCopyLen = 2; } } else { pEncPtr = NULL; } // 일반 문자열 복사 memcpy(&szKorTar[j], &cszKorSrc[i], nCopyLen); i += nCopyLen; j += nCopyLen; if(pEncPtr) { // 특수 문자 디코드 int val1, val2; sscanf(pEncPtr+2, "%03u%03u", &val1, &val2); ((BYTE*)szKorTar)[j] = (BYTE)val1; ((BYTE*)szKorTar)[j+1] = (BYTE)val2; i += 10; j += 2; } } szKorTar[j] = '\0'; #ifdef DEBUG OutputDebugStringA("<DecodeTwoByte Start>"); OutputDebugStringA(cszKorSrc); OutputDebugStringA(szKorTar); OutputDebugStringA("<DecodeTwoByte End>"); #endif } ////////////////////////////////////////////////////////////////////////// // // 자동 생성되는 괄호를 확실히 판별하기 위해 // 원래 있던 괄호는 부호화 // ex) "[ゆか]" -> "(\at5B)ゆか(\at5D)" // ////////////////////////////////////////////////////////////////////////// void CezTransXPApp::EncodeTrace(LPCSTR cszJpnSrc, LPSTR szJpnTar) { if(NULL==cszJpnSrc || NULL==szJpnTar) return; if('\0'==cszJpnSrc[0]) { szJpnTar[0] = '\0'; return; } size_t len = strlen(cszJpnSrc); size_t i = 0; // 오리지널 인덱스 size_t j = 0; // 버퍼 인덱스 while(i<len) { // 2바이트 문자인 경우 if((BYTE)cszJpnSrc[i] >= 0x80 && (BYTE)cszJpnSrc[i+1] != '\0') { szJpnTar[j++] = cszJpnSrc[i++]; szJpnTar[j++] = cszJpnSrc[i++]; } // 1바이트 문자인 경우 else { // 문자가 괄호면 if(cszJpnSrc[i] == '(' || cszJpnSrc[i] == ')' || cszJpnSrc[i] == '[' || cszJpnSrc[i] == ']' || cszJpnSrc[i] == '{' || cszJpnSrc[i] == '}' || cszJpnSrc[i] == '<' || cszJpnSrc[i] == '>' || cszJpnSrc[i] == ':') { j += sprintf(&szJpnTar[j], "_&%03u&_", (BYTE)cszJpnSrc[i++]); } // 일반 문자면 else { szJpnTar[j++] = cszJpnSrc[i++]; } } } szJpnTar[j] = '\0'; #ifdef DEBUG OutputDebugStringA("<EncodeTrace Start>"); OutputDebugStringA(cszJpnSrc); OutputDebugStringA(szJpnTar); OutputDebugStringA("<EncodeTrace End>"); #endif } ////////////////////////////////////////////////////////////////////////// // // 이지트랜스 번역 전 변환시켰던 괄호들을 복구 // ex) "(\at5B)ゆか(\at5D)" -> "[ゆか]" // ////////////////////////////////////////////////////////////////////////// void CezTransXPApp::DecodeTrace(LPCSTR cszKorSrc, LPSTR szKorTar) { if(NULL==cszKorSrc || NULL==szKorTar) return; if('\0'==cszKorSrc[0]) { szKorTar[0] = '\0'; return; } size_t len = strlen(cszKorSrc); size_t i = 0; // 오리지널 인덱스 size_t j = 0; // 버퍼 인덱스 while(i<len) { size_t nCopyLen = len-i; const char* pEncPtr = strstr(&cszKorSrc[i], "_&"); // "_&" 프리픽스를 찾았다면 if(NULL != pEncPtr) { // 변환시킬 데이터가 확실한가? //if( (UINT_PTR)pEncPtr - (UINT_PTR)cszKorSrc + 6 < len // && '&' == *(pEncPtr+5) // && '_' == *(pEncPtr+6) ) if(GetEncodedLen(pEncPtr) == 7) { nCopyLen = (UINT_PTR)pEncPtr - (UINT_PTR)(&cszKorSrc[i]); } // 변환시키면 안되는 _&라면 else { pEncPtr = NULL; nCopyLen = 2; } } else { pEncPtr = NULL; } // 일반 문자열 복사 memcpy(&szKorTar[j], &cszKorSrc[i], nCopyLen); i += nCopyLen; j += nCopyLen; if(pEncPtr) { // 괄호 문자 디코드 int val1; sscanf(pEncPtr+2, "%03u", &val1); ((BYTE*)szKorTar)[j] = (BYTE)val1; i += 7; j += 1; } } szKorTar[j] = '\0'; #ifdef DEBUG OutputDebugStringA("<DncodeTrace Start>"); OutputDebugStringA(cszKorSrc); OutputDebugStringA(szKorTar); OutputDebugStringA("<DncodeTrace End>"); #endif } size_t CezTransXPApp::GetEncodedLen( LPCSTR cszBytes ) { size_t nRetVal = 0; if(NULL != cszBytes) { size_t len = strlen(cszBytes); if(len >= 7 && '_' == cszBytes[0] && '&' == cszBytes[1] && isdigit(cszBytes[2]) && isdigit(cszBytes[3]) && isdigit(cszBytes[4]) && '&' == cszBytes[5] && '_' == cszBytes[6]) nRetVal = 7; else if(len >= 10 && '_' == cszBytes[0] && '&' == cszBytes[1] && isdigit(cszBytes[2]) && isdigit(cszBytes[3]) && isdigit(cszBytes[4]) && isdigit(cszBytes[5]) && isdigit(cszBytes[6]) && isdigit(cszBytes[7]) && '&' == cszBytes[8] && '_' == cszBytes[9]) nRetVal = 10; } return nRetVal; }
[ "arallab3@883913d8-bf2b-11de-8cd0-f941f5a20a08" ]
[ [ [ 1, 1314 ] ] ]
b50c22a22fbc229e224c2bcd3b0a0dbacb6029dc
463c3b62132d215e245a097a921859ecb498f723
/lib/dlib/logger/extra_logger_headers.h
be33b08ecf669efdacdc55908a27d483987ff1e8
[ "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
1,222
h
// Copyright (C) 2006 Davis E. King ([email protected]) // License: Boost Software License See LICENSE.txt for the full license. #ifndef DLIB_EXTRA_LOGGER_HEADERs_ #define DLIB_EXTRA_LOGGER_HEADERs_ #include "logger_kernel_abstract.h" #include "logger_kernel_1.h" #include <iostream> #include <string> #include "../uintn.h" // ---------------------------------------------------------------------------------------- namespace dlib { void print_datetime_logger_header ( std::ostream& out, const std::string& logger_name, const log_level& l, const uint64 thread_id ); /*! requires - is not called more than once at a time (i.e. is not called from multiple threads at the same time). ensures - let DATE be the current date and time (e.g. Thu Aug 31 16:41:52 2006). - prints a string to out in the form: "l.name (DATE) [thread_id] logger_name:" !*/ } // ---------------------------------------------------------------------------------------- #ifdef NO_MAKEFILE #include "extra_logger_headers.cpp" #endif #endif // DLIB_EXTRA_LOGGER_HEADERs_
[ "jimmy@DGJ3X3B1.(none)" ]
[ [ [ 1, 41 ] ] ]
ef5bc3e8ed6ba65c73def3bd5c17cc5313d8138d
0f8559dad8e89d112362f9770a4551149d4e738f
/Wall_Destruction/Havok/Source/Common/SceneData/Mesh/Channels/hkxVertexSelectionChannel.h
b2a1f0475f7ad69b2e97781506988ca387df81ca
[]
no_license
TheProjecter/olafurabertaymsc
9360ad4c988d921e55b8cef9b8dcf1959e92d814
456d4d87699342c5459534a7992f04669e75d2e1
refs/heads/master
2021-01-10T15:15:49.289873
2010-09-20T12:58:48
2010-09-20T12:58:48
45,933,002
0
0
null
null
null
null
UTF-8
C++
false
false
1,855
h
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ #ifndef INC_VERTEX_SELECTION_CHANNEL_H #define INC_VERTEX_SELECTION_CHANNEL_H /// Meta information extern const class hkClass hkxVertexSelectionChannelClass; /// Stores a selection of vertex indices class hkxVertexSelectionChannel : public hkReferencedObject { //+vtable(true) //+version(1) public: HK_DECLARE_CLASS_ALLOCATOR( HK_MEMORY_CLASS_SCENE_DATA ); HK_DECLARE_REFLECTION(); hkxVertexSelectionChannel() { } hkxVertexSelectionChannel(hkFinishLoadedObjectFlag f) : hkReferencedObject(f), m_selectedVertices(f) { } // // Members // public: hkArray<hkInt32> m_selectedVertices; }; #endif // INC_VERTEX_SELECTION_CHANNEL_H /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222) * * Confidential Information of Havok. (C) Copyright 1999-2009 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at www.havok.com/tryhavok. * */
[ [ [ 1, 53 ] ] ]
14d6c80d0bd005b2f0dce08eb1f46c71ee91244f
59166d9d1eea9b034ac331d9c5590362ab942a8f
/Forest/xmlRoot/xmlLeaf/xmlLeafLoad.cpp
e8c26599d4f8ee9a3388332a0d655e5788a7436a
[]
no_license
seafengl/osgtraining
5915f7b3a3c78334b9029ee58e6c1cb54de5c220
fbfb29e5ae8cab6fa13900e417b6cba3a8c559df
refs/heads/master
2020-04-09T07:32:31.981473
2010-09-03T15:10:30
2010-09-03T15:10:30
40,032,354
0
3
null
null
null
null
WINDOWS-1251
C++
false
false
8,805
cpp
#include "xmlLeafLoad.h" #include "xmlLeafNames.h" xmlLeafLoad::xmlLeafLoad() { } xmlLeafLoad::~xmlLeafLoad() { } void xmlLeafLoad::ParseXml( TiXmlElement* root , dataLeaf *_data ) { //разбор xml и заполнение бинарных данных m_pDataLeaf = _data; //извлечь данные о листве DecodeLeaf( root ); } void xmlLeafLoad::DecodeLeaf( TiXmlElement* root ) { //извлечь данные о листве //извлечение информации из узла XML TiXmlNode* node = root->FirstChild( m_LeafNames.m_sLeaf.c_str() ); if ( node ) { TiXmlElement* pLeaf = node->ToElement(); //извлечь имя элемента const char *_name = pLeaf->Value(); std::string _sElem( _name ); //получить указатель на первый атрибут элемента TiXmlAttribute* _attr = pLeaf->FirstAttribute(); //декодировать параметр для альфа теста DecodeAttrAlfa( _attr ); //извлечь данные о текстурах DecodeTextures( pLeaf ); //извлечь данные о вершинах DecodeVertexs( pLeaf ); //извлечь данные о влиянии ветра DecodeWind( pLeaf ); } } void xmlLeafLoad::DecodeAttrAlfa( TiXmlAttribute* _attr ) { //декодировать параметр для альфа теста while ( _attr ) { //имя атрибута const char *_name = _attr->Name(); std::string _sAttr( _name ); //извлекаем значения if ( _sAttr == m_LeafNames.m_sAlfaTest ) { double alfa = 0.0; _attr->QueryDoubleValue( &alfa ); m_pDataLeaf->m_fAlphaTestValue = alfa; } //переходим к следующему атрибуту _attr = _attr->Next(); } } void xmlLeafLoad::DecodeTextures( TiXmlElement* root ) { //извлечь данные о текстурах //извлечение информации из узла XML TiXmlNode* node = root->FirstChild( m_LeafNames.m_sTextures.c_str() ); if ( node ) { TiXmlElement* pTextures = node->ToElement(); //извлечь имя элемента const char *_name = pTextures->Value(); std::string _sElem( _name ); //извлечь данные о текстуре DecodeTexture( pTextures ); } } void xmlLeafLoad::DecodeTexture( TiXmlElement* root ) { //извлечь данные о текстуре //перебор всех категорий for ( TiXmlElement *pElem = root->FirstChildElement() ; pElem ; pElem = pElem->NextSiblingElement() ) { //извлечь имя элемента const char *_name = pElem->Value(); std::string _sAttr( _name ); if ( _sAttr == m_LeafNames.m_sTexture ) { //получить указатель на первый атрибут элемента TiXmlAttribute* _attr = pElem->FirstAttribute(); //декодировать атрибут имя текстуры DecodeAttrTexture( _attr ); } } } void xmlLeafLoad::DecodeAttrTexture( TiXmlAttribute* _attr ) { //декодировать атрибут имя текстуры while ( _attr ) { //имя атрибута const char *_name = _attr->Name(); std::string _sAttr( _name ); //извлекаем значения if ( _sAttr == m_LeafNames.m_sVal ) m_pDataLeaf->m_vTextures.push_back( _attr->Value() ); //переходим к следующему атрибуту _attr = _attr->Next(); } } void xmlLeafLoad::DecodeVertexs( TiXmlElement* root ) { //извлечь данные о вершинах //извлечение информации из узла XML TiXmlNode* node = root->FirstChild( m_LeafNames.m_sVertexs.c_str() ); if ( node ) { TiXmlElement* pVertex = node->ToElement(); //извлечь имя элемента const char *_name = pVertex->Value(); std::string _sElem( _name ); //извлечь данные о точке DecodePoints( pVertex ); } } void xmlLeafLoad::DecodePoints( TiXmlElement* root ) { //извлечь данные о точке //перебор всех категорий for ( TiXmlElement *pElem = root->FirstChildElement() ; pElem ; pElem = pElem->NextSiblingElement() ) { //извлечь имя элемента const char *_name = pElem->Value(); std::string _sAttr( _name ); if ( _sAttr == m_LeafNames.m_sPoint ) { //получить указатель на первый атрибут элемента TiXmlAttribute* _attr = pElem->FirstAttribute(); //декодировать параметр точки DecodeAttrPoint( _attr ); } } } void xmlLeafLoad::DecodeAttrPoint( TiXmlAttribute* _attr ) { //декодировать параметр точки double x , y , z; double nx , ny , nz; double s0 , t0 , p0 , q0; double s1 , t1 , p1; while ( _attr ) { //имя атрибута const char *_name = _attr->Name(); std::string _sAttr( _name ); //извлекаем значения if ( _sAttr == m_LeafNames.m_sX ) _attr->QueryDoubleValue( &x ); else if ( _sAttr == m_LeafNames.m_sY ) _attr->QueryDoubleValue( &y ); else if ( _sAttr == m_LeafNames.m_sZ ) _attr->QueryDoubleValue( &z ); else if ( _sAttr == m_LeafNames.m_sT0 ) _attr->QueryDoubleValue( &t0 ); else if ( _sAttr == m_LeafNames.m_snX ) _attr->QueryDoubleValue( &nx ); else if ( _sAttr == m_LeafNames.m_snY ) _attr->QueryDoubleValue( &ny ); else if ( _sAttr == m_LeafNames.m_snZ ) _attr->QueryDoubleValue( &nz ); else if ( _sAttr == m_LeafNames.m_sP0 ) _attr->QueryDoubleValue( &p0 ); else if ( _sAttr == m_LeafNames.m_sS0 ) _attr->QueryDoubleValue( &s0 ); else if ( _sAttr == m_LeafNames.m_sQ0 ) _attr->QueryDoubleValue( &q0 ); else if ( _sAttr == m_LeafNames.m_sS1 ) _attr->QueryDoubleValue( &s1 ); else if ( _sAttr == m_LeafNames.m_sT1 ) _attr->QueryDoubleValue( &t1 ); else if ( _sAttr == m_LeafNames.m_sP1 ) _attr->QueryDoubleValue( &p1 ); //переходим к следующему атрибуту _attr = _attr->Next(); } m_pDataLeaf->m_vCoords.push_back( x ); m_pDataLeaf->m_vCoords.push_back( y ); m_pDataLeaf->m_vCoords.push_back( z ); m_pDataLeaf->m_vNormals.push_back( nx ); m_pDataLeaf->m_vNormals.push_back( ny ); m_pDataLeaf->m_vNormals.push_back( nz ); m_pDataLeaf->m_vTexCoords0.push_back( s0 ); m_pDataLeaf->m_vTexCoords0.push_back( t0 ); m_pDataLeaf->m_vTexCoords0.push_back( p0 ); m_pDataLeaf->m_vTexCoords0.push_back( q0 ); m_pDataLeaf->m_vTexCoords1.push_back( s1 ); m_pDataLeaf->m_vTexCoords1.push_back( t1 ); m_pDataLeaf->m_vTexCoords1.push_back( p1 ); } void xmlLeafLoad::DecodeWind( TiXmlElement* root ) { //извлечь данные о влиянии ветра //извлечение информации из узла XML TiXmlNode* node = root->FirstChild( m_LeafNames.m_sWind.c_str() ); if ( node ) { TiXmlElement* pWind = node->ToElement(); //извлечь имя элемента const char *_name = pWind->Value(); std::string _sElem( _name ); //получить указатель на первый атрибут элемента TiXmlAttribute* _attr = pWind->FirstAttribute(); //извлечь атрибуты ветра DecodeAttrWind( _attr ); } } void xmlLeafLoad::DecodeAttrWind( TiXmlAttribute* _attr ) { double dFrqY = 0; double dFrqZ = 0; double dAmpY = 0; double dAmpZ = 0; //извлечь атрибуты ветра while ( _attr ) { //имя атрибута const char *_name = _attr->Name(); std::string _sAttr( _name ); //извлекаем значения if ( _sAttr == m_LeafNames.m_sFreqY ) _attr->QueryDoubleValue( &dFrqY ); else if ( _sAttr == m_LeafNames.m_sFreqZ ) _attr->QueryDoubleValue( &dFrqZ ); else if ( _sAttr == m_LeafNames.m_sAmplY ) _attr->QueryDoubleValue( &dAmpY ); else if ( _sAttr == m_LeafNames.m_sAmplZ ) _attr->QueryDoubleValue( &dAmpZ ); //переходим к следующему атрибуту _attr = _attr->Next(); } //передача считанных значений m_pDataLeaf->m_fFreqY = dFrqY; m_pDataLeaf->m_fFreqZ = dFrqZ; m_pDataLeaf->m_fAmplY = dAmpY; m_pDataLeaf->m_fAmplZ = dAmpZ; }
[ "asmzx79@3290fc28-3049-11de-8daa-cfecb5f7ff5b" ]
[ [ [ 1, 317 ] ] ]
18daa112ae79d4f7bc545cb26e7eea1e02f1bdfe
33f59b1ba6b12c2dd3080b24830331c37bba9fe2
/Depend/Foundation/Mathematics/Wm4Matrix4.cpp
ab5b41fb7d40e582c0301c70c0495d5d70783704
[]
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,104
cpp
// Geometric Tools, Inc. // http://www.geometrictools.com // Copyright (c) 1998-2006. All Rights Reserved // // The Wild Magic Version 4 Foundation Library source code is supplied // under the terms of the license agreement // http://www.geometrictools.com/License/Wm4FoundationLicense.pdf // and may not be copied or disclosed except in accordance with the terms // of that agreement. #include "Wm4FoundationPCH.h" #include "Wm4Matrix4.h" using namespace Wm4; template<> const Matrix4<float> Matrix4<float>::ZERO( 0.0f,0.0f,0.0f,0.0f, 0.0f,0.0f,0.0f,0.0f, 0.0f,0.0f,0.0f,0.0f, 0.0f,0.0f,0.0f,0.0f); template<> const Matrix4<float> Matrix4<float>::IDENTITY( 1.0f,0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f,0.0f, 0.0f,0.0f,1.0f,0.0f, 0.0f,0.0f,0.0f,1.0f); template<> const Matrix4<double> Matrix4<double>::ZERO( 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0); template<> const Matrix4<double> Matrix4<double>::IDENTITY( 1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,0.0,0.0,1.0);
[ "yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa" ]
[ [ [ 1, 35 ] ] ]
6e58a0e7ad1ba536ca7cb0072602baa00e66af8b
a29ec259efa2c2f13e24be86a4c6ba174780857d
/projects/tpfinal/RPGItem.cpp
c4293351c4cd360293badb1d71d8c064405067bd
[]
no_license
nlelouche/programacion2
639ffb55d06af4f696031ec777bec898b6224774
5ec9b29014c13786230e834deb44679b110351b4
refs/heads/master
2016-09-06T15:40:38.888016
2007-11-09T01:03:51
2007-11-09T01:03:51
32,653,635
0
0
null
null
null
null
UTF-8
C++
false
false
960
cpp
#include "RPGItem.h" //--------------------------------------------------------------------------- RPGItem::RPGItem() : m_pGUISprite(NULL) { } //--------------------------------------------------------------------------- RPGItem::~RPGItem() { delete m_pGUISprite; } //--------------------------------------------------------------------------- void RPGItem::Use(RPGCharacter *pCharacter) { } //--------------------------------------------------------------------------- // devuelve el sprite de la GUI Sprite *RPGItem::GetGUISprite() { return m_pGUISprite; } //--------------------------------------------------------------------------- // setea el sprite de la GUI void RPGItem::SetGUISprite(char *pszFile, float fScale) { delete m_pGUISprite; m_pGUISprite = new Sprite(); m_pGUISprite->LoadIni(pszFile); m_pGUISprite->SetScale(fScale); } //---------------------------------------------------------------------------
[ "yoviacthulhu@70076bbf-733e-0410-a12a-85c366f55b74" ]
[ [ [ 1, 35 ] ] ]
ed96a3ea43cc50b35ca04818d3709b185fff6618
9b6ed0d2c04038b0161b9f24b869ad72941d896f
/Algorithms samples/sort-algorithms.cpp
7db4dfe0bcb0b5f1d5136ef99353f0e001b79545
[]
no_license
vsoftphuong/ACM-problems
51b2f99d874790a3e23e81fd30c8f81df8fac235
bcb179ecb0aeb7fedbd01bd435e424a2b24757e7
refs/heads/master
2023-07-19T22:12:17.169784
2009-09-24T20:00:49
2009-09-24T20:00:49
null
0
0
null
null
null
null
ISO-8859-1
C++
false
false
3,745
cpp
#include <cstdlib> #include <iostream> using namespace std; //On2, s is an array void selectionSort(int *s, int n){//S is the array to order, n the size of the array int min; int temp;//Contain the temporal value of the array to the swap for(int i = 0; i < n; i++){ min = i; for(int j = i+1; j < n; j++) if(s[j] < s[min]) min = j; temp = s[i]; s[i] = s[min]; s[min] = temp; } } //More faster than selectionSort, s is an array void insertionSort(int *s, int n){ int i,j; int temp; for(i = 0; i < n; i++){ j = i; while((j>0) && (s[j] < s[j-1]) ){ temp = s[j]; s[j] = s[j-1]; s[j-1] = temp; j = j - 1; } } } //Promedio nlog2n /* * Elegir un elemento de la lista de elementos a ordenar, al que llamaremos pivote. * Resituar los demás elementos de la lista a cada lado del pivote, de manera que a un lado queden todos los menores que él, y al otro los mayores. En este momento, el pivote ocupa exactamente el lugar que le corresponderá en la lista ordenada. * La lista queda separada en dos sublistas, una formada por los elementos a la izquierda del pivote, y otra por los elementos a su derecha. * Repetir este proceso de forma recursiva para cada sublista mientras éstas contengan más de un elemento. Una vez terminado este proceso todos los elementos estarán ordenados. Como se puede suponer, la eficiencia del algoritmo depende de la posición en la que termine el pivote elegido. * En el mejor caso, el pivote termina en el centro de la lista, dividiéndola en dos sublistas de igual tamaño. En este caso, el orden de complejidad del algoritmo es O(n·log n). * En el peor caso, el pivote termina en un extremo de la lista. El orden de complejidad del algoritmo es entonces de O(n²). El peor caso dependerá de la implementación del algoritmo, aunque habitualmente ocurre en listas que se encuentran ordenadas, o casi ordenadas. Pero principalmente depende del pivote, si por ejemplo el algoritmo implementado toma como pivote siempre el primer elemento del array, y el array que le pasamos esta ordenado, siempre va a generar a su izquierda un array vacío, lo que es ineficiente. http://es.wikipedia.org/wiki/Quicksort */ void quicksort(int *array, int inf, int sup){ //Inicializacion de variables int pivote = lista[sup]; int i = inf; int j = sup - 1;//Pues el sup es el pivote int contenedor; int cont = 1; // Verificamos que no se crucen los límites if(inf >= sup) return; // Clasificamos la sublista while(cont){ //i = sup-1; //j = sup+1; while( (lista[i] < pivote) && (i < j) ){ ++i;} while( (lista[j] > pivote) && (j > i) ) { --j; } if (lista[i] > lista[j]){//Swap contenedor = lista[i]; lista[i] = lista[j]; lista[j] = contenedor; } else cont = 0; } // Copiamos el pivote en su posición final if(lista[i] > lista[sup]){ contenedor = lista[i]; lista[i] = lista[sup]; lista[sup] = contenedor; } // Aplicamos el procedimiento recursivamente a cada sublista quicksort(lista, inf, i - 1); quicksort(lista, i + 1, sup); } //--------------------------------- int main(int argc, char *argv[]) { int arraySize = 10; int array [10] = {5,1,88,5,8,9,3,2,99,1}; printf("\nUnordered:\n"); for(int i = 0; i < 10; i++) printf(" N: %d", array[i]); printf("\nOrdered:\n"); //selectionSort(array, arraySize); //insertionSort(array, arraySize); quicksort(array, 0, arraySize - 1); for(int i = 0; i < 10; i++) printf(" N: %d", array[i]); printf("\n"); system("PAUSE"); return EXIT_SUCCESS; }
[ [ [ 1, 118 ] ] ]
43ace1a1bd9c70ebe71551e22810841624773e67
975d45994f670a7f284b0dc88d3a0ebe44458a82
/logica/WarBugsLogic/LWarBugsLib/C3DObject.cpp
728ccb5a261c95a78b8977ed3f3ade69b4e255bf
[]
no_license
phabh/warbugs
2b616be17a54fbf46c78b576f17e702f6ddda1e6
bf1def2f8b7d4267fb7af42df104e9cdbe0378f8
refs/heads/master
2020-12-25T08:51:02.308060
2010-11-15T00:37:38
2010-11-15T00:37:38
60,636,297
0
0
null
null
null
null
ISO-8859-1
C++
false
false
1,797
cpp
/* * Classe C3DObject * * Autor: Eder Figueiredo * * Objetivo: Objeto base para todas as outras classes 3D * */ #ifndef _C3DOBJECT_CPP_ //Define a criação da classe #define _C3DOBJECT_CPP_ #include "C3DObject.h" void C3DObject::initC3DObject() { coordenada = new Ponto(); modelo = -1; textura2D = -1; textura3D = -1; animacao = -1; } void C3DObject::initC3DObject(Ponto *posicao, int modeloID, int textura3DID, int animacaoID, int textura2DID) { coordenada = posicao; modelo = modeloID; textura2D = textura2DID; textura3D = textura3DID; animacao = animacaoID; } void C3DObject::initC3DObject(float x, float z, int modeloID, int textura3DID, int animacaoID, int textura2DID) { coordenada->x = x; coordenada->z = z; modelo = modeloID; textura2D = textura2DID; textura3D = textura3DID; animacao = animacaoID; } Ponto *C3DObject::getPosition() { return(coordenada); } int C3DObject::getModel() { return(modelo); } int C3DObject::get2DTexture() { return(textura2D); } int C3DObject::get3DTexture() { return(textura3D); } void C3DObject::setModel(int valor) { modelo = valor; } void C3DObject::set2DTexture(int valor) { textura2D = valor; } void C3DObject::set3DTexture(int valor) { textura3D = valor; } void C3DObject::setPosition(float x, float z) { coordenada->x = x; coordenada->z = z; } void C3DObject::setPosition(Ponto *newPonto) { coordenada->x = newPonto->x; coordenada->z = newPonto->z; } //Métodos matemáticos float C3DObject::modulo(float valor) { if (valor < 0) { valor = valor*(-1); } return (valor); } //Métodos 3D float C3DObject::getDistanceToPoint(Ponto *ponto) { return(modulo(coordenada->x - ponto->x) + modulo(coordenada->z - ponto->z)); } #endif
[ [ [ 1, 94 ] ] ]
8286e1c62a68158b59d7cb3d84235a1c7a2ed3aa
60a0446ebe21475ac32eab7980da21b0fa34b995
/src/ChromaticTuner.cpp
2d14f7ac78f17dc828f22f14410eb1b22a68c926
[]
no_license
wwm/Tuner-for-Samsung-Bada
075b5c1abea68d1b4156adb9a31102b62305e92b
cc5deb8fd21d9fe51d79f963304fa57878c3ec36
refs/heads/master
2021-01-16T21:24:13.511381
2011-05-24T19:04:09
2011-05-24T19:04:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,482
cpp
/** * Name : GuitarTuner * Version : * Vendor : Kaan Yamanyar * Description : Guitar Tuner for bada */ #include "ChromaticTuner.h" #include "GTuner.h" //#include "PitchDetection.h" using namespace Osp::App; using namespace Osp::Base; using namespace Osp::System; using namespace Osp::Ui; using namespace Osp::Ui::Controls; using namespace Osp::Base::Utility; ChromaticTuner::ChromaticTuner() { _pAudioManager = null; _pGTuner = null; } ChromaticTuner::~ChromaticTuner() { if (_pAudioManager != null) { _pAudioManager->StopRecord(); delete _pAudioManager; _pAudioManager = null; } } Application* ChromaticTuner::CreateInstance(void) { // Create the instance through the constructor. ChromaticTuner* g = new ChromaticTuner(); return g; } bool ChromaticTuner::OnAppInitializing(AppRegistry& appRegistry) { // TODO: // Initialize UI resources and application specific data. // The application's permanent data and context can be obtained from the appRegistry. // // If this method is successful, return true; otherwise, return false. // If this method returns false, the application will be terminated. // Uncomment the following statement to listen to the screen on/off events. //PowerManager::SetScreenEventListener(*this); // Create a form _pGTuner = new GTuner(); _pGTuner->Initialize(); // Add the form to the frame Frame *pFrame = GetAppFrame()->GetFrame(); pFrame->AddControl(*_pGTuner); // Set the current form pFrame->SetCurrentForm(*_pGTuner); // Draw and Show the form _pGTuner->Draw(); _pGTuner->Show(); return true; } bool ChromaticTuner::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination) { if (_pAudioManager != null) { delete _pAudioManager; _pAudioManager = null; } // TODO: // Deallocate resources allocated by this application for termination. // The application's permanent data and context can be saved via appRegistry. return true; } void ChromaticTuner::OnForeground(void) { //AppLog("OnForeGround!!!!!!!!!"); if (_pAudioManager != null) { delete _pAudioManager; _pAudioManager = null; } _pAudioManager = new AudioManager(_pGTuner); _pAudioManager->Construct(); _pAudioManager->StartRecord(); /* * For Testing Uncomment this, expected value is 861.328 ShortBuffer* s = GenerateDTMF(1000,440); ByteBuffer* b = new ByteBuffer(); b->Construct(2000); s->SetPosition(0); b->SetPosition(0); while (b->HasRemaining()) { short ss; s->Get(ss); b->SetShort(ss); } FftAlgorithm* p = new FftAlgorithm(); double d = p->ProcessData(b); AppLog("Val: %f",d); delete s; delete b; delete p; */ } void ChromaticTuner::OnBackground(void) { //AppLog("OnBACKGround!!!!!!!!!"); if (_pAudioManager != null) { _pAudioManager->StopRecord(); //_pAudioManager->AudioInStop(); //no need deletion will stop it delete _pAudioManager; _pAudioManager = null; } } void ChromaticTuner::OnLowMemory(void) { // TODO: // Free unused resources or close the application. } void ChromaticTuner::OnBatteryLevelChanged(BatteryLevel batteryLevel) { // TODO: // Handle any changes in battery level here. // Stop using multimedia features(camera, mp3 etc.) if the battery level is CRITICAL. } void ChromaticTuner::OnScreenOn(void) { // TODO: // Get the released resources or resume the operations that were paused or stopped in OnScreenOff(). } void ChromaticTuner::OnScreenOff(void) { // TODO: // Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device to enter the sleep mode to save the battery. // Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a callback before the device enters the sleep mode. // Similarly, do not perform lengthy operations in this listener method. Any operation must be a quick one. } //this is for testing purposes ShortBuffer* ChromaticTuner::GenerateDTMF(int length, float freq1) { int PLAYBACKFREQ = 44100; float PI2 = 3.1415926535897932384626433832795f * 2; int i; ShortBuffer* dest = new ShortBuffer(); dest->Construct(length); for (i = 0; i < length; i++) { double jj = Math::Sin(i * (PI2 * (PLAYBACKFREQ / freq1))); short y = (short) (jj * 16383); dest->Set(i, y); } return dest; }
[ [ [ 1, 163 ] ] ]
2320b1e84d46ac8da30daccda9b24c23718ae441
19b8f2132768c8c52238180e15815cbd4243b41d
/ENVIADOS Fase I EDA/PriArith Solved/PrimArith/main.cpp
d9474ef237ed6856035bacee5b3352bced145121
[]
no_license
Greatfox/Programas-EDA
604ae99e2576ecfae8a0a2965834d1206f41fb02
73d5d5961e041c27aadea0314f066e21e6d87807
refs/heads/master
2016-09-03T02:23:10.221535
2011-12-16T04:44:39
2011-12-16T04:44:39
2,279,239
0
0
null
null
null
null
UTF-8
C++
false
false
2,987
cpp
/*#include <iostream> #include <stdio.h> #include <vector> #include <string.h> #include <algorithm> #include <stdlib.h> #include <math.h> using namespace std; int main() { string a,b; int contador,acarreo,temp; while(cin>>a) { cin>>b; contador=0; acarreo=0; if(a.length()==1 && b.length()==1) if(atoi(&a[0])==0 && atoi(&b[0])==0) break; if(a.length()<=b.length()) { for(int i=1;i<=a.length();i++) { if((atoi(&a[a.length()-i])/int(pow(10,i-1)))+(atoi(&b[b.length()-i])/int(pow(10,i-1)))+acarreo>=10) {contador++; cout<<"acarreo "<<(atoi(&a[a.length()-i])/int(pow(10,i-1)))+(atoi(&b[b.length()-i])/int(pow(10,i-1)))<<" "<<i<<endl; acarreo=1;} else{acarreo=0;} temp=i; cout<<acarreo<<endl; } if(acarreo==1 && b.length()>a.length()) if((atoi(&b[b.length()-(temp+1)])/int(pow(10,(temp+1)-1)))+acarreo>=10) contador++; if(contador>1) cout<<contador<<" "<<"carry"<<" "<<"operations."<<endl; else if(contador==1) cout<<contador<<" "<<"carry"<<" "<<"operation."<<endl; else{cout<<"No"<<" "<<"carry"<<" "<<"operation."<<endl;} } if(a.length()>b.length()) { for(int i=1;i<=b.length();i++) { if((atoi(&a[a.length()-i])/int(pow(10,i-1)))+(atoi(&b[b.length()-i])/int(pow(10,i-1)))+acarreo>=10) {contador++; cout<<"acarreo "<<(atoi(&a[a.length()-i])/int(pow(10,i-1)))+(atoi(&b[b.length()-i])/int(pow(10,i-1)))<<" "<<i<<endl; acarreo=1; } else{acarreo=0;} temp=i; } if(acarreo==1 && a.length()>b.length()) if((atoi(&a[a.length()-(temp+1)])/int(pow(10,(temp+1)-1)))+acarreo>=10) contador++; if(contador>1) cout<<contador<<" "<<"carry"<<" "<<"operations."<<endl; else if(contador==1) cout<<contador<<" "<<"carry"<<" "<<"operation."<<endl; else{cout<<"No"<<" "<<"carry"<<" "<<"operation."<<endl;} } } } */ #include <iostream> #include <stdio.h> #include <vector> #include <string.h> #include <algorithm> #include <stdlib.h> #include <math.h> using namespace std; int main() { unsigned long long a; unsigned long long b; int acarreo,suma,conta; while(cin>>a) { cin>>b; if((a == 0) && (b == 0)) break; acarreo=0; suma=0; conta=0; while((a > 0) || (b > 0)) { suma = acarreo + (a % 10) + (b % 10); if (suma >= 10) conta++; acarreo = suma / 10; a =a/ 10; b =b/ 10; } if (conta == 0) cout << "No carry operation." << endl; else if (conta == 1) cout << conta<< " carry operation." << endl; else { cout << conta << " carry operations." << endl; } } return 0; }
[ [ [ 1, 120 ] ] ]
9e98e315a049647f0ce67953dba18439faecca54
f838c6ad5dd7ffa6d9687b0eb49d5381e6f2e776
/branches/[25.11.2007]arcoder_fixup/imgs/bmp_file.h
d18b5f9ba73813d8891091c16f86747c7b764512
[]
no_license
BackupTheBerlios/wiccoder-svn
e773acb186aa9966eaf7848cda454ab0b5d948c5
c329182382f53d7a427caec4b86b11968d516af9
refs/heads/master
2021-01-11T11:09:56.248990
2009-08-19T11:28:23
2009-08-19T11:28:23
40,806,440
0
0
null
null
null
null
UTF-8
C++
false
false
1,335
h
/******************************************************************************* * file: bmp_file.h * * version: 0.0.1 * * author: mice (mailto:[email protected], ICQ:332-292-380) * * description: not available * * tests: none * *******************************************************************************/ #ifndef IMGS_BMP_FILE_INCLUDED #define IMGS_BMP_FILE_INCLUDED //////////////////////////////////////////////////////////////////////////////// // headers #include <string> #include <fstream> #include "img_rgb.h" //////////////////////////////////////////////////////////////////////////////// // imgs namespace namespace imgs { //////////////////////////////////////////////////////////////////////////////// // bmp_file public declaration int bmp_read(img_rgb &rgb, const std::string &filename); int bmp_write(const img_rgb &rgb, const std::string &filename); int bmp_read(img_rgb &rgb, std::istream &in); int bmp_write(const img_rgb &rgb, std::ostream &out); } // namespace imgs #endif // IMGS_BMP_FILE_INCLUDED
[ "wonder_mice@b1028fda-012f-0410-8370-c1301273da9f" ]
[ [ [ 1, 40 ] ] ]
9368b544a5f2796d46a98eeb7292dbf33fee3bb1
de0881d85df3a3a01924510134feba2fbff5b7c3
/addons/ofxBox2D/Box2D/Source/Dynamics/Contacts/b2CircleContact.cpp
fc80d9e43197f49566512cfa5f473318cbf858e4
[]
no_license
peterkrenn/ofx-dev
6091def69a1148c05354e55636887d11e29d6073
e08e08a06be6ea080ecd252bc89c1662cf3e37f0
refs/heads/master
2021-01-21T00:32:49.065810
2009-06-26T19:13:29
2009-06-26T19:13:29
146,543
1
1
null
null
null
null
UTF-8
C++
false
false
3,835
cpp
/* * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com * * 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 "b2CircleContact.h" #include "../b2Body.h" #include "../b2WorldCallbacks.h" #include "../../Common/b2BlockAllocator.h" #include <new> b2Contact* b2CircleContact::Create(b2Shape* shape1, b2Shape* shape2, b2BlockAllocator* allocator) { void* mem = allocator->Allocate(sizeof(b2CircleContact)); return new (mem) b2CircleContact(shape1, shape2); } void b2CircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) { ((b2CircleContact*)contact)->~b2CircleContact(); allocator->Free(contact, sizeof(b2CircleContact)); } b2CircleContact::b2CircleContact(b2Shape* s1, b2Shape* s2) : b2Contact(s1, s2) { b2Assert(m_shape1->GetType() == e_circleShape); b2Assert(m_shape2->GetType() == e_circleShape); m_manifold.pointCount = 0; m_manifold.points[0].normalImpulse = 0.0f; m_manifold.points[0].tangentImpulse = 0.0f; } void b2CircleContact::Evaluate(b2ContactListener* listener) { b2Body* b1 = m_shape1->GetBody(); b2Body* b2 = m_shape2->GetBody(); b2Manifold m0; memcpy(&m0, &m_manifold, sizeof(b2Manifold)); b2CollideCircles(&m_manifold, (b2CircleShape*)m_shape1, b1->GetXForm(), (b2CircleShape*)m_shape2, b2->GetXForm()); b2ContactPoint cp; cp.shape1 = m_shape1; cp.shape2 = m_shape2; cp.friction = m_friction; cp.restitution = m_restitution; if (m_manifold.pointCount > 0) { m_manifoldCount = 1; b2ManifoldPoint* mp = m_manifold.points + 0; if (m0.pointCount == 0) { mp->normalImpulse = 0.0f; mp->tangentImpulse = 0.0f; if (listener) { cp.position = b1->GetWorldPoint(mp->localPoint1); b2Vec2 v1 = b1->GetLinearVelocityFromLocalPoint(mp->localPoint1); b2Vec2 v2 = b2->GetLinearVelocityFromLocalPoint(mp->localPoint2); cp.velocity = v2 - v1; cp.normal = m_manifold.normal; cp.separation = mp->separation; cp.id = mp->id; listener->Add(&cp); } } else { b2ManifoldPoint* mp0 = m0.points + 0; mp->normalImpulse = mp0->normalImpulse; mp->tangentImpulse = mp0->tangentImpulse; if (listener) { cp.position = b1->GetWorldPoint(mp->localPoint1); b2Vec2 v1 = b1->GetLinearVelocityFromLocalPoint(mp->localPoint1); b2Vec2 v2 = b2->GetLinearVelocityFromLocalPoint(mp->localPoint2); cp.velocity = v2 - v1; cp.normal = m_manifold.normal; cp.separation = mp->separation; cp.id = mp->id; listener->Persist(&cp); } } } else { m_manifoldCount = 0; if (m0.pointCount > 0 && listener) { b2ManifoldPoint* mp0 = m0.points + 0; cp.position = b1->GetWorldPoint(mp0->localPoint1); b2Vec2 v1 = b1->GetLinearVelocityFromLocalPoint(mp0->localPoint1); b2Vec2 v2 = b2->GetLinearVelocityFromLocalPoint(mp0->localPoint2); cp.velocity = v2 - v1; cp.normal = m0.normal; cp.separation = mp0->separation; cp.id = mp0->id; listener->Remove(&cp); } } }
[ [ [ 1, 121 ] ] ]
06d009de02054585b58944934e3d9326c7bed60c
0cc80cab288248cd9c3a2cc922487ac2afd5148c
/tu_quoque/tu_quoque/Console.hpp
6661fbf22ffe13bf897809a7538e6edd6c866895
[]
no_license
WestleyArgentum/tu-quoque
a3fbdb37dfebe9e9f0b00254144a48fdee89e946
38f661a145916768727b1a6fb7df5aa37072b6d2
refs/heads/master
2021-01-02T08:57:39.513862
2011-02-20T05:56:36
2011-02-20T05:56:36
33,832,399
0
0
null
null
null
null
UTF-8
C++
false
false
590
hpp
/**************************************************************************************************/ /*! \file Console.hpp \author Robert Onulak \brief Console window. Copyright (C) 2010 DigiPen Institute of Technology. Reproduction or disclosure of this file or its contents without the prior written consent of DigiPen Institute of Technology is prohibited. */ /**************************************************************************************************/ #pragma once void CreateConsole( void ); void RemoveConsole( void ); void ClearConsole ();
[ "westleyargentum@259acd2b-3792-e4e4-6ce2-44c093ac8a23" ]
[ [ [ 1, 20 ] ] ]
4f48c576217b1b02b867afbc288c7f8368a149cc
1a7dc583c09bb1278ec7fd4d7798f9f9d37c6f4d
/OpenLRS_RX_without_semsors/thUndeadMODsRX.pde
bfe708a4529a82a47e63a67078f39c4d12aabcaf
[]
no_license
xotab26/customopenlrs
afea5aea1f4b956bbe4a647fe4eb26a5bd8af722
8ba26e0fd6e90fbe06c20d7a2c59e5017f6b87e2
refs/heads/master
2021-01-16T01:01:56.935216
2011-12-06T06:27:10
2011-12-06T06:27:10
40,381,874
0
0
null
null
null
null
UTF-8
C++
false
false
2,388
pde
//************************************************************** //**************** thUndeadMODs ******************************** //* library which includes my Mods for the openLRS //* Includes: //* - RSSI MOD //* - In FLight Fail-Safe //* Neat ain't it ? :D //* - More stuff will be added //* //* Updates here: http://www.fpvuk.org/forum/index.php?topic=3642.0 //* and here: http://forum.flytron.com/viewtopic.php?f=7&t=207 //************************************************************** //work vars unsigned char i; //############ Le Stuff :D ######################## //void undeadFSwrite(void) //{ // if (RF_Rx_Buffer[0] == 'F') // thUndead's FS :P // { // // Red_LED_OFF; // for(i = 0; i<8; i++) //Write into the Servo Buffer // { // temp_int = (256*RF_Rx_Buffer[1+(2*i)]) + RF_Rx_Buffer[2+(2*i)]; // if ((temp_int>1500) && (temp_int<4500)) Servo_Buffer[i] = temp_int; // // } // save_failsafe_values(); // rx_reset(); // digitalWrite(RED_LED_pin,1); // // Red_LED_ON; // // // // } //} void thUndeadRSSI(void) { //*************************************** //* thUndead's RSSI MOD //* info: RSSI voltage according to avg rssi value :D Rx_RSSI = _spi_read(0x26); // Read the RSSI value rssicounter++; //counter which resets after getting to 41 if (rssicounter <= RSSI_SMOOTH) rssipwm= rssipwm + Rx_RSSI ; //adds values into temp buffer else rssicounter =0; if (rssicounter == RSSI_SMOOTH) { rssipwm = rssipwm / RSSI_SMOOTH; // averege 40 rssi values to get stable reading rssibuf = map(rssipwm,00,RSSI_MAX,00,250); //map value for pwm: MAX = 2.6v bad rssi unver 1 v analogWrite(RSSI_OUT,rssibuf); //write the RSSI voltage #if DEBUG_MODE == 98 Serial.print("RSSI:"); //some debugging Serial.println(rssipwm); Serial.println(rssibuf); #endif } //*************************************** } boolean thedelay(int ms) { static long temptime =0 ; if ((millis() - temptime) >ms) { temptime = millis(); return 1; } else return 0; }
[ [ [ 1, 93 ] ] ]
4dd5db360343dc57487ea9d1e5e752b11dee4e36
974a20e0f85d6ac74c6d7e16be463565c637d135
/trunk/packages/dCompilerKit/dFiniteAutomata/dChatertSetMap.cpp
c06d62a6ee10cf3a4e4ac69a743822bd1529dfa6
[]
no_license
Naddiseo/Newton-Dynamics-fork
cb0b8429943b9faca9a83126280aa4f2e6944f7f
91ac59c9687258c3e653f592c32a57b61dc62fb6
refs/heads/master
2021-01-15T13:45:04.651163
2011-11-12T04:02:33
2011-11-12T04:02:33
2,759,246
0
0
null
null
null
null
UTF-8
C++
false
false
2,807
cpp
/* Copyright (c) <2009> <Newton Game Dynamics> * * 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 */ #include "dFiniteAutomata.h" #include "dChatertSetMap.h" dChatertSetMap::ChatertSet::ChatertSet (const char* const set, int count, int id) :m_count (count) ,m_id (id) { _ASSERTE (sizeof (m_characters) > count * sizeof (char)); memcpy (m_characters, set, count * sizeof (char)); m_characters[count] = 0; qsort (m_characters, count, sizeof (char), sort); int m = 0; for (int i = 0; i < m_count; ) { char ch = m_characters[i]; for (i ++; (i < m_count) && (m_characters[i] == ch); i ++); m_characters[m] = ch; m ++; } m_count = m; m_characters[m_count] = 0; } bool dChatertSetMap::ChatertSet::IsCharAMatch (int id) const { int i0 = 0; int i1 = m_count - 1; while ((i1 - i0) >= 4) { int i = (i1 + i0 + 1)>>1; if (id <= m_characters[i]) { i1 = i; } else { i0 = i; } } for (int i = i0; i <= i1; i ++) { if (id == m_characters[i]) { return true; } } return false; } int dChatertSetMap::ChatertSet::GetId() const { return m_id; } int dChatertSetMap::ChatertSet::GetLength () const { return m_count; } const char* dChatertSetMap::ChatertSet::GetSet () const { return m_characters; } int dChatertSetMap::ChatertSet::sort (const void* a, const void* b) { int ch0 = *((char*)a); int ch1 = *((char*)b); if (ch0 < ch1) { return -1; } else if (ch0 > ch1) { return 1; } else { return 0; } } dChatertSetMap::dChatertSetMap () :m_id (0) { } dChatertSetMap::~dChatertSetMap() { } const dTree<dList <dChatertSetMap::ChatertSet>::dListNode*, int>& dChatertSetMap::GetSets() const { return m_table; } const dChatertSetMap::ChatertSet* dChatertSetMap::FindSet (int id) const { dTree<dList <ChatertSet>::dListNode*, int>::dTreeNode* node = m_table.Find(id); return node ? &node->GetInfo()->GetInfo() : NULL; } int dChatertSetMap::AddSet (const char* const set, int count) { ChatertSet newSet (set, count, m_id); dCRCTYPE crc = dCRC64 (newSet.m_characters, 0); dTree<dList <ChatertSet>::dListNode*, dCRCTYPE>::dTreeNode* node = m_crcID.Find(crc); if (!node) { dList <ChatertSet>::dListNode* const setNode = m_sets.Append(newSet); m_table.Insert(setNode, newSet.m_id); m_id ++; node = m_crcID.Insert(setNode, crc); } dList <ChatertSet>::dListNode* const setNode = node->GetInfo(); return setNode->GetInfo().m_id; }
[ "[email protected]@b7a2f1d6-d59d-a8fe-1e9e-8d4888b32692" ]
[ [ [ 1, 123 ] ] ]
9a0d19bffa22f6d105bf838b69558d54c844b23a
a01b67b20207e2d31404262146763d3839ee833d
/trunk/Projet/tags/Monofin_20090407_0.1a/Ui/parametersdialog.h
1c6c796e410f40c75ba696e88a553f6dd961eb62
[]
no_license
BackupTheBerlios/qtfin-svn
49b59747b6753c72a035bf1e2e95601f91f5992c
ee18d9eb4f80a57a9121ba32dade96971196a3a2
refs/heads/master
2016-09-05T09:42:14.189410
2010-09-21T17:34:43
2010-09-21T17:34:43
40,801,620
0
0
null
null
null
null
UTF-8
C++
false
false
555
h
#ifndef PARAMETERSDIALOG_H #define PARAMETERSDIALOG_H #include "../ui_parametersDialog.h" class StrateFile; class ParametersDialog : public QDialog, public Ui::ParametersDialog { Q_OBJECT Q_DISABLE_COPY(ParametersDialog) public: explicit ParametersDialog(QWidget *parent = 0); protected slots: void chooseFile(); protected: virtual void changeEvent(QEvent *e); private: void setConnections(); void _retranslateUi(); private: QList<StrateFile*> m_strates; }; #endif // PARAMETERSDIALOG_H
[ "kryptos@314bda93-af5c-0410-b653-d297496769b1" ]
[ [ [ 1, 28 ] ] ]
0f7425c0b0d4d8d2882869be1340d2d2cc56fef8
c6dca462f8e982b2a327285cf084d08fa7f27dd8
/gendataset/gendataset.cpp
b7a92a310194209efa12d25977ad29b0cbe3ac83
[]
no_license
nagyistoce/liblearning
2a7e94344f15c5af105974207ece68822102524b
ac0a77dce09ad72f32b2cae067f4616e49d60697
refs/heads/master
2021-01-01T16:59:44.689918
2010-08-20T12:07:22
2010-08-20T12:07:22
32,806,608
0
0
null
null
null
null
GB18030
C++
false
false
3,537
cpp
// experimental_dataset_generator.cpp : 定义控制台应用程序的入口点。 // #include <liblearning\core\supervised_dataset.h> #include <iostream> #include <fstream> #include <algorithm> #include <string> using namespace std; #include <liblearning\core\experiment_datasets.h> #include <liblearning\core\data_splitter.h> #include <boost\program_options.hpp> #include <liblearning\core\platform.h> int main(int argc, char * argv[]) { platform::init(); namespace po = boost::program_options; // Declare the supported options. po::options_description desc("Allowed options"); desc.add_options() ("help", "produce help message") ("overall", po::value<string>(), "file path for overall datasets") ("train", po::value<string>(), "file path for training sets") ("test", po::value<string>(), "file path for testing sets") ("output", po::value<string>(), "file path for output file") ("folder", po::value<int>(), "the folder num of the experiment") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); if (vm.count("help")) { cout << desc << "\n"; return 1; } if (!vm.count("folder")) { cout << "error: the folder num must be set. " << endl; cout << desc <<endl; exit(1); } if (!vm.count("output")) { cout << "error: the output file path must be set. " << endl; cout << desc <<endl; exit(1); } if(!vm.count("overall") && !vm.count("train") && !vm.count("test")) { cout << "error: one of the path of overall dataset and the paths of training and testing sets must be set. " << endl; cout << desc <<endl; exit(1); } if(vm.count("overall") && ( vm.count("train") || vm.count("test"))) { cout << "error: overall cannot be set with train or test" << endl; cout << desc <<endl; exit(1); } if (vm.count("train") != vm.count("test")) { cout << "error: train and test must be set simultanously" << endl; cout << desc <<endl; exit(1); } experiment_datasets exp_sets; int folder_num = vm["folder"].as<int>(); string output_file_path = vm["output"].as<string>(); shared_ptr<dataset_splitter> splitter; if (vm.count("overall")) { string overall_file_path = vm["overall"].as<string>(); shared_ptr<dataset> overall_data = deserialize_from_file<dataset>(overall_file_path); if (shared_ptr<supervised_dataset> overall_sp_data = dynamic_pointer_cast<supervised_dataset>(overall_data)) { splitter.reset(new supervised_random_shuffer_dataset_splitter()); } else { splitter.reset(new random_shuffer_dataset_splitter()); } exp_sets.make_train_test_pairs(*overall_data ,*splitter, folder_num); } else { string train_file_path = vm["train"].as<string>(); string test_file_path = vm["test"].as<string>(); shared_ptr<dataset> train_data = deserialize_from_file<dataset>(train_file_path); shared_ptr<dataset> test_data = deserialize_from_file<dataset>(test_file_path); if (shared_ptr<supervised_dataset> train_sp_data = dynamic_pointer_cast<supervised_dataset>(train_data)) { splitter.reset(new supervised_random_shuffer_dataset_splitter()); } else { splitter.reset(new random_shuffer_dataset_splitter()); } exp_sets.set_one_train_test_pairs(*train_data, *test_data); } exp_sets.prepare_cross_validation(*splitter, folder_num); exp_sets.save(output_file_path); platform::finalize(); }
[ [ [ 1, 144 ] ] ]
af331c81f0de8d96c1874bf49ca396487f4fbfd3
f0da2c3ab8426f8bcdd8c3625c805a25f04aa89d
/armagic/Splash.cpp
2481750190ed6f444eb8ed278a690d63d15df8e3
[]
no_license
sanyaade-augmented-reality/armagic
81e557978936c396333be0261e45d869da680e6d
eb5132d280685e2f8db4ae1f3fbe624b1876bf73
refs/heads/master
2016-09-06T17:12:20.458558
2010-07-06T22:57:18
2010-07-06T22:57:18
34,191,493
0
0
null
null
null
null
UTF-8
C++
false
false
878
cpp
#include "Splash.h" #include <cassert> using namespace irrklang; using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; Splash::Splash(irr::IrrlichtDevice *device, irrklang::ISoundEngine *soundEngine, EventHandler *eventHandler) : device_(device), soundEngine_(soundEngine), eventHandler_(eventHandler) { driver_ = device->getVideoDriver(); guienv_ = device->getGUIEnvironment(); splash_ = driver_->getTexture("../data/menu/splash1024x768.jpg"); assert(splash_); } Splash::~Splash() { } void Splash::show() { driver_->beginScene(true, true, video::SColor(0, 0, 0, 0)); driver_->draw2DImage(splash_, core::position2di(0, 0), core::recti(0, 0, RESOLUTION_X, RESOLUTION_Y), 0, video::SColor(255, 255, 255, 255), true); guienv_->drawAll(); driver_->endScene(); }
[ "leochatain@22892e45-cd4f-0d29-0166-6a0decb81ae3" ]
[ [ [ 1, 30 ] ] ]
a3e4c74f611ff607171c8577a5d9ce35348689b2
8b0840f68733f5e6ca06ca53e6afcb66341cd4ef
/Include/IEventDispatcher.h
0c531bf504da2c18ae408d604f9658deb9cdd402
[]
no_license
adkoba/the-house-of-phthah
886ee45ee67953cfd67e676fbccb61a12a095e20
5be2084b49fe1fbafb22545c4d31d3b6458bf90f
refs/heads/master
2021-01-18T16:04:29.460707
2010-03-20T16:32:09
2010-03-20T16:32:09
32,143,404
0
0
null
null
null
null
ISO-8859-1
C++
false
false
1,157
h
#ifndef __I_EVENT_DISPATCHER__ #define __I_EVENT_DISPATCHER__ #include "IInputEventDispatcher.h" // Forward declaration namespace Ogre { class RenderWindow; class FrameListener; } namespace HOP { /** * \class IEventDispatcher * \brief Interface de gestion de l'enregistrement de FrameEvent listener * \author FransTreb * \date 22 nov. 2009 */ class IEventDispatcher : public IInputEventDispatcher { public: virtual ~IEventDispatcher() {} /** * \brief Initialise le module de gestion des evenements * \param[in] pWindow Window utilisee par l'application */ virtual void initialize(Ogre::RenderWindow* pWindow) = 0; /** * \brief Libère les ressources utilisées par le gestionnaire * \param[in] pWindow Window utilisee par l'application */ virtual void close(Ogre::RenderWindow* pWindow) = 0; /** * \brief Get the FrameListener interface * \return FrameListerner ptr */ virtual Ogre::FrameListener* getFrameListener() = 0; }; /* End of IEventDispatcher */ } /* End of namespace */ #endif /* __I_EVENT_DISPATCHER__ */
[ "franstreb@4d33156a-524b-11de-a3da-17e148e7a168" ]
[ [ [ 1, 48 ] ] ]
1e155cb7745d059883548362470e3f348a60b527
78fb44a7f01825c19d61e9eaaa3e558ce80dcdf5
/guceGUI/include/guceGUI_CConsole.h
a1610fce8a2235d0758e2412a3b3221685ec98d2
[]
no_license
LiberatorUSA/GUCE
a2d193e78d91657ccc4eab50fab06de31bc38021
a4d6aa5421f8799cedc7c9f7dc496df4327ac37f
refs/heads/master
2021-01-02T08:14:08.541536
2011-09-08T03:00:46
2011-09-08T03:00:46
41,840,441
0
0
null
null
null
null
UTF-8
C++
false
false
5,423
h
/* * guceGUI: GUCE module providing GUI functionality * Copyright (C) 2002 - 2007. Dinand Vanvelzen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef GUCE_GUI_CCONSOLE_H #define GUCE_GUI_CCONSOLE_H /*-------------------------------------------------------------------------// // // // INCLUDES // // // //-------------------------------------------------------------------------*/ #ifndef GUCEF_CORE_CSYSCONSOLECLIENT_H #include "CSysConsoleClient.h" #define GUCEF_CORE_CSYSCONSOLECLIENT_H #endif /* GUCEF_CORE_CSYSCONSOLECLIENT_H ? */ #ifndef GUCEF_CORE_CTEVENTHANDLERFUNCTOR_H #include "gucefCORE_CTEventHandlerFunctor.h" #define GUCEF_CORE_CTEVENTHANDLERFUNCTOR_H #endif /* GUCEF_CORE_CTEVENTHANDLERFUNCTOR_H ? */ #ifndef GUCE_GUI_CCONSOLEFORM_H #include "guceGUI_CConsoleForm.h" #define GUCE_GUI_CCONSOLEFORM_H #endif /* GUCE_GUI_CCONSOLEFORM_H ? */ /*-------------------------------------------------------------------------// // // // NAMESPACE // // // //-------------------------------------------------------------------------*/ namespace GUCE { namespace GUI { /*-------------------------------------------------------------------------// // // // CLASSES // // // //-------------------------------------------------------------------------*/ class GUCE_GUI_EXPORT_CPP CConsole : public GUCEF::CORE::CSysConsoleClient , GUCEF::CORE::CObserver { public: CConsole( void ); virtual ~CConsole(); void Show( void ); void ShowModal( void ); void Hide( void ); CConsoleForm& GetConsoleForm( void ); virtual const CString& GetClassTypeName( void ) const; private: typedef GUCEF::CORE::CTEventHandlerFunctor< CConsole > TEventCallback; CConsole( const CConsole& src ); /** not implemented */ CConsole& operator=( const CConsole& src ); /** not implemented */ void OnConsoleFormLayoutLoaded( GUCEF::CORE::CNotifier* notifier , const GUCEF::CORE::CEvent& eventid , GUCEF::CORE::CICloneable* eventdata ); void OnInputEditboxTextEntered( GUCEF::CORE::CNotifier* notifier , const GUCEF::CORE::CEvent& eventid , GUCEF::CORE::CICloneable* eventdata ); void OnInputEditboxKeyDown( GUCEF::CORE::CNotifier* notifier , const GUCEF::CORE::CEvent& eventid , GUCEF::CORE::CICloneable* eventdata ); void ProcessInput( const CString& input ); void ProcessFunctionInput( const CString& input ); void OnReturnData( const TStringVector& data ); private: CConsoleForm m_consoleForm; TStringVector::iterator m_inputIterator; TStringVector m_inputList; }; /*-------------------------------------------------------------------------// // // // NAMESPACE // // // //-------------------------------------------------------------------------*/ } /* namespace GUI */ } /* namespace GUCE */ /*-------------------------------------------------------------------------*/ #endif /* GUCE_GUI_CCONSOLE_H ? */ /*-------------------------------------------------------------------------// // // // Info & Changes // // // //-------------------------------------------------------------------------// - 08-04-2007 : - Initial implementation ---------------------------------------------------------------------------*/
[ [ [ 1, 132 ] ] ]
bb00b378fe23c2cafae7dc67a253ab43dac55b91
9a10a9d7886ce0ba9e85a0ed092e6eb6bafb2780
/inc/tiny.h
786de52a8e2edb2a1f67fab779e362cda1729eca
[ "BSD-3-Clause" ]
permissive
leok7v/kolobok
ccc51bbeef67739978d8465d328b4f93b4d7e833
30278ac53285912587db078e28205ea33a85143f
refs/heads/master
2020-06-04T08:37:01.952623
2010-01-07T06:23:38
2010-01-07T06:23:38
32,692,395
0
0
null
null
null
null
UTF-8
C++
false
false
92,922
h
#pragma once #ifdef _DEBUG #define _CRTDBG_MAP_ALLOC #endif #define STRICT #define WIN32_LEAN_AND_MEAN #pragma warning(disable: 4509) /* nonstandard extension used: use of SEH and 'Error' has destructor */ #pragma warning(disable: 4214) /* nonstandard extension used : bit field types other than int */ #pragma warning(disable: 4201) /* nonstandard extension used : nameless struct/union */ #pragma warning(disable: 4710) /* function not expanded */ #pragma warning(disable: 4996) /* This function or variable may be unsafe. */ #pragma warning(disable: 4291) /* no matching operator delete found; */ #include <Windows.h> #include <WindowsX.h> #include "ObjIdl.h" #pragma warning(disable: 4201) /* nonstandard extension used : nameless struct/union */ #include <winver.h> #include <WinSock2.h> #include <ShlObj.h> #include <ShellAPI.h> #include <CommCtrl.h> #include <CommDlg.h> #pragma warning(disable: 4701) /* local variable may be used without having been initialized */ #include <strsafe.h> #pragma warning(default: 4701) #include <Psapi.h> #include <DbgHelp.h> #include <stdlib.h> #include <rpc.h> #ifdef _DEBUG #ifndef _CRTDBG_MAP_ALLOC #error undefined _CRTDBG_MAP_ALLOC #endif #include <crtdbg.h> #endif #include <typeinfo.h> #pragma warning(disable: 4514) /* unreferenced inline function has been removed */ #pragma warning(disable: 4710) /* function not expanded */ #pragma warning(disable: 4711) /* function selected for automatic inline expansion */ #pragma warning(disable: 4100) /* unreferenced formal parameter */ #pragma warning(disable: 4505) /* unreferenced local function has been removed */ #pragma warning(disable: 4057) /* differs in indirection to slightly different base types */ #pragma warning(disable: 4512) /* assignment operator could not be generated */ #pragma warning(default: 4189) /* unreferenced local variable vc++ 5.0 does not support it */ #pragma intrinsic(memcpy, memset, memcmp, abs) #undef interface #define null NULL typedef __int64 longlong; typedef unsigned __int64 ulonglong; typedef unsigned char byte; typedef unsigned char u1; typedef unsigned short u2; typedef unsigned int u4; typedef unsigned _int64 u8; typedef WCHAR uchar; typedef unsigned short word; typedef unsigned int uint; typedef unsigned long dword; #define countof(a) (sizeof(a)/sizeof((a)[0])) #define interface struct __declspec(novtable) #define extends : public virtual #define implements : public virtual #define and_implements , public virtual #define unused(exp) (void)(exp) #define instanceof(exp, iface) (dynamic_cast<iface>(exp) != null) longlong getTimeInMicroseconds(); struct Object; void trace(const Object* o); void traceln(const Object* o); void trace(const Object& o); void traceln(const Object& o); void trace(const uchar* fmt, ...); void traceln(const uchar* fmt, ...); void trace(const char* fmt, ...); void traceln(const char* fmt, ...); void traceError(); #undef assert #ifdef _DEBUG #define assert(exp) (void)( (exp) || (_assert(#exp, __FILE__, __LINE__), 0) ) #else #define assert(exp) #endif int _assert(const char* exp, const char* file, int line); #define check(exp) (void)( (exp) || (_assert(#exp, __FILE__, __LINE__), 0) ) inline int ustrlen(const uchar* s) { return wcslen(s); } inline void ustrcpy(uchar* d, int dstsize, const uchar* s) { StringCbCopyW(d, dstsize, s); } inline int ustrcmp(const uchar* l, const uchar* r) { return wcscmp(l, r); } inline int ustricmp(const uchar* l, const uchar* r) { return wcsicmp(l, r); } inline const uchar* ustrchr(const uchar* s, uchar ch) { return wcschr(s, ch); } inline const uchar* ustrrchr(const uchar* s, uchar ch) { return wcsrchr(s, ch); } #ifdef _DEBUG void* operator new(unsigned int s, char* file, int line); #define THIS_FILE __FILE__ #define DEBUG_NEW new(THIS_FILE, __LINE__) #define new DEBUG_NEW #else void* operator new(unsigned int s); #endif // ----------------------------------------------------------------------------------- struct Object; struct String; struct ByteArray; interface Comparable { virtual int compareTo(const Object* right) const = 0; }; typedef void (*Runnable)(void* p); // ----------------------------------------------------------------------------------- struct Object { virtual ~Object() { } virtual int hashCode() const { return (int)this; } virtual Object* clone() const { __asm { int 3 }; return null; } // not supported virtual bool equals(const Object* o) const { return o == this; } virtual String* toString() const; static bool equals(const Object* o1, const Object* o2) { assert(o1 == null || o2 == null || !o1->equals(o2) || o1->hashCode() == o2->hashCode()); return o1 == null ? o2 == null : o1->equals(o2); } static bool equals(const Object& o1, const Object* o2) { return equals(&o1, o2); } static bool equals(const Object* o1, const Object& o2) { return equals(o1, &o2); } static bool equals(const Object& o1, const Object& o2) { return equals(&o1,&o2); } static inline Object* clone(const Object* o) { return o == null ? null : o->clone(); } static const Object* nil; // == null but typed }; // ----------------------------------------------------------------------------------- /* immutable string */ struct String extends Object and_implements Comparable { inline String() : len(0), val(new uchar[1]), hash(-1) { *(uchar*)val = 0; } inline String(const String* other) : len(other->len), val(new uchar[len + 1]), hash(other->hash) { memcpy((uchar*)val, other->val, len * sizeof(uchar)); } inline String(const String& other) : len(other.len), val(new uchar[len + 1]), hash(other.hash) { memcpy((uchar*)val, other.val, len * sizeof(uchar)); } inline String(const uchar* s) : len(ustrlen(s)), val(new uchar[len + 1]), hash(-1) { memcpy((uchar*)val, s, (len + 1) * sizeof(uchar)); } inline String(const uchar* s, int l) : len(l), val(new uchar[len + 1]), hash(-1) { memcpy((uchar*)val, s, len * sizeof(uchar)); } inline String(const char* s) : len(strlen(s)), val(new uchar[len + 1]), hash(-1) { for (int i = 0; i <= len; i++) ((uchar*)val)[i] = s[i]; } virtual ~String() { delete (uchar *)val; val = null; *((int*)&len) = 0; } inline int length() const { return len; } int hashCode() const { if (hash == -1) hash = hashCode(val, len); return hash; } static int hashCode(const uchar *val, int len) { int hash = -1; for (int i = 0; i < len; i++) hash = 31U * hash + val[i]; enum { mask = ((1U << (sizeof(int)*8-1)) - 1) }; hash = hash & (uint)mask; if (hash <= 0) hash = -hash; return hash; } Object* clone() const { return new String(val); } bool equals(const Object* o) const { return o == null ? false : (o == dynamic_cast<const Object*>(this) ? true : (instanceof(o, const String*) ? ustrcmp(val, dynamic_cast<const String*>(o)->val) == 0 : false)); } bool equals(const uchar* s) const { return s == null ? false : ustrcmp(val, s) == 0; } String* operator+(const uchar* s) const { assert(s != null); int n = ustrlen(s) + 1; uchar* buf = new uchar[len + n]; memcpy(buf, val, len * sizeof(uchar)); memcpy(buf + len, s, n * sizeof(uchar)); String* r = new String(buf); delete buf; return r; } String* operator+(const String* s) const { return operator+(*s); } bool equalsIgnoreCase(const Object* o) const { const String* s = dynamic_cast<const String*>(o); return o == null ? false : (this == s ? true : (s == null ? false : (s->len != len ? false : CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, val, len, s->val, len) == CSTR_EQUAL))); } bool equalsIgnoreCase(const uchar* s) const { return CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, val, len, s, ustrlen(s)) == CSTR_EQUAL; } int compareTo(const Object* s) const { if (s == null || !instanceof(s, const String*)) return +1; return ustrcmp(val, dynamic_cast<const String*>(s)->val); } int compareTo(const uchar* s) const { assert(CSTR_LESS_THAN == 1 && CSTR_EQUAL == 2 && CSTR_GREATER_THAN == 3); return s == null ? +1 : CompareString(LOCALE_USER_DEFAULT, 0, val, len, s, -1) - CSTR_EQUAL; } bool startsWith(const uchar* s) const { int n = ustrlen(s); return n <= len ? memcmp(val, s, n * sizeof(uchar)) == 0 : false; } bool startsWithIgnoreCase(const uchar* s) const { int n = ustrlen(s); return n > len ? false : CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, val, n, s, n) == CSTR_EQUAL; } bool endsWith(const uchar* s) const { int n = ustrlen(s); return n > len ? false : ustrcmp(val + len - n, s) == 0; } bool endsWithIgnoreCase(const uchar* s) const { int n = ustrlen(s); return n > len ? false : CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, val + len - n, n, s, n) == CSTR_EQUAL; } String* toString() const; // see StringBuffer.h for the implementation inline operator const uchar*() const { return val; } inline const uchar charAt(int i) const { assert(0 <= i && i < len); return val[i]; } static String* guid(); // generates new GUID on each call static String* fromUTF8(const byte* utf8); static String* fromUTF8(const char* utf8) { return fromUTF8((const byte*)utf8); } static ByteArray* toUTF8(const uchar* s, bool bom = false); // ByteArray is NOT zero terminated static ByteArray* toUTF8(const String& s, bool bom = false) { return toUTF8((const uchar*)s, bom); } static ByteArray* toUTF8(const String* s, bool bom = false) { return toUTF8(*s, bom); } static byte* toUTF8(const uchar *s, /*out*/int &len, bool bom = false); static String* toString(const Object*); static String* toString(const Object& o) { return toString(&o); } private: inline void operator=(const String& s) { assert(false); } const int len; uchar const* val; mutable int hash; }; /* inline String* operator+(const uchar* s1, const String& s2) { return String(s1) + s2; } */ inline String* Object::toString() const { uchar buf[16]; StringCchPrintf(buf, countof(buf), L"Obj0x%08X", this); return new String(buf); } // ----------------------------------------------------------------------------------- /* Mutable string. append operator+= and appending printf */ struct StringBuffer extends Object and_implements Comparable { StringBuffer() : len(0), val(new uchar[1]) { *val = 0; } StringBuffer(int n) : len(0), val(new uchar[n]) { *val = 0; } StringBuffer(const uchar* s) : len(ustrlen(s)), val(new uchar[len + 1]) { memcpy(val, s, (len + 1) * sizeof(uchar)); } virtual ~StringBuffer() { delete val; val = null; len = 0; } int length() const { return len; } void clear() { delete val; val = new uchar[1]; *val = 0; len = 0; } int hashCode() const { int hash = 0; for (int i = 0; i < len; i++) hash = 31U * hash + val[i]; enum { mask = ((1U << (sizeof(int)*8-1)) - 1) }; hash = hash & (uint)mask; return hash <= 0 ? -hash : hash; } Object* clone() const { return new StringBuffer(val); } bool equals(const Object* o) const { return o == null ? false : (o == dynamic_cast<const Object*>(this) ? true : (instanceof(o, const StringBuffer*) ? ustrcmp(val, dynamic_cast<const StringBuffer*>(o)->val) == 0 : false)); } String* toString() const { return new String(val); } uchar get(int i) const { assert(0 <= i && i < len); return val[i]; } void set(int i, uchar ch) { assert(0 <= i && i < len); val[i] = ch; } operator const uchar*() const { return val; } int compareTo(const Object* s) const { if (s == null || !instanceof(s, const StringBuffer*)) return +1; return ustrcmp(val, dynamic_cast<const StringBuffer*>(s)->val); } void operator +=(const uchar* s) { int n = ustrlen(s); uchar* v = new uchar[n + len + 1]; memcpy(v, val, len * sizeof(uchar)); memcpy(&v[len], s, (n + 1) * sizeof(uchar)); len += n; delete val; val = v; } void operator +=(const String& s) { *this += (const uchar*)s; } void operator +=(const String* s) { *this += (const uchar*)*s; } void operator +=(const uchar ch) { uchar s[2]; s[0] = ch; s[1] = 0; *this += (const uchar*)s; } void printf(const uchar* fmt, ...) { // always appends va_list vl; va_start(vl, fmt); vprintf(fmt, vl); va_end(vl); } void vprintf(const uchar* fmt, va_list vl) { // always appends int n = 64; uchar* buf = null; HRESULT hr = STRSAFE_E_INSUFFICIENT_BUFFER; while (hr == STRSAFE_E_INSUFFICIENT_BUFFER) { delete buf; n = n + n; buf = new uchar[n]; hr = StringCchVPrintf(buf, n, fmt, vl); } *this += buf; delete buf; } private: int len; uchar* val; }; inline String* String::toString() const { StringBuffer sb(L"\""); sb += val; sb += L"\""; return new String(sb); } // ----------------------------------------------------------------------------------- /* 32-bit signed integer value */ struct Int extends Object and_implements Comparable { enum { MAX_VALUE = 0x7FFFFFFF, MIN_VALUE = 0x80000000 }; inline Int(int v) : val(v) { } virtual ~Int() { } int hashCode() const { return val & 0x7FFFFFFF; // positive } Object* clone() const { return new Int(val); } bool equals(const Object* o) const { return o == null ? false : (instanceof(o, const Int*) ? val == dynamic_cast<const Int*>(o)->val : false); } String* toString() const { uchar buf[32]; StringCchPrintf(buf, countof(buf), L"%I64d", val); return new String(buf); } inline int intValue() const { return (int)val; } int compareTo(const Object* o) const { if (o == null || !instanceof(o, const Int*)) return +1; else { const Int* r = dynamic_cast<const Int*>(o); return val == r->val ? 0 : (val < r->val ? -1 : +1); } } static inline int decode(const uchar* s) { return _wtoi(s); } private: int val; }; // ----------------------------------------------------------------------------------- /* 64-bit signed integer value */ struct Long extends Object and_implements Comparable { inline Long(longlong v) : val(v) { } virtual ~Long() { } int hashCode() const { int i = (int)val + (int)((val >> 32) & 0xFFFFFFFF); return i < 0 ? -i : i; } Object* clone() const { return new Long(val); } bool equals(const Object* o) const { return o == null ? false : (instanceof(o, const Long*) ? val == dynamic_cast<const Long*>(o)->val : false); } String* toString() const { uchar buf[32]; StringCchPrintf(buf, countof(buf), L"%I64d", val); return new String(buf); } inline int intValue() const { return (int)val; } inline longlong longValue() const { return val; } int compareTo(const Object* o) const { if (o == null || !instanceof(o, const Long*)) return +1; else { const Long* r = dynamic_cast<const Long*>(o); return val == r->val ? 0 : (val < r->val ? -1 : +1); } } static inline longlong decode(const uchar* s) { return _wtoi64(s); } private: longlong val; }; // ----------------------------------------------------------------------------------- /* 64-bit signed rational value */ struct Rational extends Object and_implements Comparable { inline Rational(longlong _n, longlong _d) : n(_n), d(_d == 0 ? 1 : _d) { } virtual ~Rational() { } int hashCode() const { int i = (int)n + (int)((n >> 32) & 0xFFFFFFFF) + (int)d + (int)((d >> 32) & 0xFFFFFFFF); return i < 0 ? -i : i; } Object* clone() const { return new Rational(n, d); } bool equals(const Object* o) const { return o == null ? false : (instanceof(o, const Rational*) ? n == dynamic_cast<const Rational*>(o)->n && d == dynamic_cast<const Rational*>(o)->d : false); } String* toString() const { uchar buf[65]; StringCchPrintf(buf, countof(buf), L"%I64d/%I64d", n, d); return new String(buf); } inline double doubleValue() const { return (double)n / (double)d; } inline longlong numerator() const { return n; } inline longlong denominator() const { return d; } int compareTo(const Object* o) const { if (o == null || !instanceof(o, const Rational*)) return +1; else { const Rational* r = dynamic_cast<const Rational*>(o); if (n == r->n && d == r->d) return 0; return doubleValue() < r->doubleValue() ? -1 : +1; } } static Rational* decode(const uchar *s) { longlong num = 0; longlong den = 0; swscanf(s, L"%I64d/%I64d", &num, &den); return new Rational(num, den); } private: longlong n, d; }; // ----------------------------------------------------------------------------------- /* 64-bit double value */ struct Double extends Object and_implements Comparable { inline Double(double v) : val(v) { } virtual ~Double() { } int hashCode() const { longlong* v = (longlong*)&val; int i = (int)*v + (int)((*v >> 32) & 0xFFFFFFFF); return i < 0 ? -i : i; } Object* clone() const { return new Double(val); } bool equals(const Object* o) const { return o == null ? false : (instanceof(o, const Double*) ? val == dynamic_cast<const Double*>(o)->val : false); } String* toString() const { uchar buf[64]; StringCchPrintf(buf, countof(buf), L"%.13g", val); return new String(buf); } inline double doubleValue() const { return val; } int compareTo(const Object* o) const { if (o == null || !instanceof(o, const Double*)) return +1; else { const Double* r = dynamic_cast<const Double*>(o); return val == r->val ? 0 : (val < r->val ? -1 : +1); } } private: double val; }; // ----------------------------------------------------------------------------------- /* object wrapper for Win-32 POINT. MUTABLE! */ struct Point extends Object { #pragma pack(push, 1) public: LONG x; public: LONG y; #pragma pack(pop) inline Point() : x(0), y(0) { } inline Point(const Point& pt) : x(pt.x), y(pt.y) { } inline Point(int xc, int yc) : x(xc), y(yc) { } virtual ~Point() { } const Point& operator=(const Point& pt) { x = pt.x; y = pt.y; return *this; } int hashCode() const { int h = x; h += ~(h << 9U) + y; h ^= ((uint)h >> 14U); h += (h << 4U); h ^= ((uint)h >> 10U); return h < 0 ? -h : h; } Object* clone() const { return new Point(x, y); } bool equals(const Object* o) const { if (o == null || !instanceof(o, const Point*)) return false; const Point& pt = *dynamic_cast<const Point*>(o); return pt.x == x && pt.y == y; } String* toString() const { StringBuffer sb; sb.printf(L"Point@0x%08X(%d,%d)", this, x, y); return sb.toString(); } inline operator POINT*() const { return (POINT*)&x; } inline operator POINT() const { return *(POINT*)&x; } }; // ----------------------------------------------------------------------------------- struct Rect extends Object { #pragma pack(push, 1) public: LONG left; public: LONG top; public: LONG right; public: LONG bottom; #pragma pack(pop) inline Rect() : left(0), top(0), right(0), bottom(0) { } inline Rect(int l, int t, int r, int b) : left(l), top(t), right(r), bottom(b) { } inline Rect(const Rect& s) : left(s.left), top(s.top), right(s.right), bottom(s.bottom) { } inline void operator=(const Rect& s) { left = s.left; top = s.top; right = s.right; bottom = s.bottom; } virtual ~Rect() { } int hashCode() const { int h = left; h += ~(h << 9U) + top; h ^= ((uint)h >> 14U) + bottom; h += (h << 4U) + right; h ^= ((uint)h >> 10U); return h < 0 ? -h : h; } Object* clone() const { return new Rect(left, top, right, bottom); } bool equals(const Object* o) const { if (o == null || !instanceof(o, const Rect*)) return false; const Rect& rc = *dynamic_cast<const Rect*>(o); return rc.left == left && rc.top == top && rc.right == right && rc.bottom == bottom; } String* toString() const { StringBuffer sb; sb.printf(L"Rect@0x%08X(%d,%d,%d,%d)", this, left, top, right, bottom); return sb.toString(); } inline int getWidth() const { return right - left; } inline int getHeight() const { return bottom - top; } inline operator RECT*() const { return (RECT*)&left; } }; // ----------------------------------------------------------------------------------- /* object wrapper for Win-32 COLORREF */ struct Color extends Object and_implements Comparable { public: COLORREF c; inline Color() : c(0) { } inline Color(int r, int g, int b) : c(RGB(r, g, b)) { } inline Color(COLORREF other) : c(other) { } virtual ~Color() { } int hashCode() const { return c; } Object* clone() const { return new Color(getRed(), getGreen(), getBlue()); } inline int getRed() const { return GetRValue(c); } inline int getGreen() const { return GetGValue(c); } inline int getBlue() const { return GetBValue(c); } bool equals(const Object* o) const { if (o == null || !instanceof(o, const Color*)) return false; const Color& i = *dynamic_cast<const Color*>(o); return i.c == c; } String* toString() const { uchar buf[64]; StringCchPrintf(buf, countof(buf), L"Color(%d,%d,%d)", getRed(), getGreen(), getBlue()); return new String(buf); } int compareTo(const Object* o) const { if (o == null || !instanceof(o, const Color*)) return +1; else { const Color* r = dynamic_cast<const Color*>(o); return c == r->c ? 0 : (c < r->c ? -1 : +1); } } inline operator COLORREF() const { return c; } }; // ----------------------------------------------------------------------------------- /* LinkedList is deep cloning container. It always clones elements and deletes elements in destructor. TODO: implement other methods on as needed basis TODO: implement removeFirst, removeLast on as needed basis */ struct LinkedList extends Object { LinkedList() : count(0), head(null), modified(0) { } virtual ~LinkedList() { clear(); } private: struct Entry { Entry(const Object* d) : next(null), prev(null), data((Object*)d) { } Entry* next; Entry* prev; Object* data; }; public: struct Iterator { // failfast // TODO: implement remove() w/ concurent modification check Iterator(const LinkedList &list) : that(&list), mc(list.modified) { e = that->head; pos = 0; } Iterator(const LinkedList* list) : that(list), mc(list->modified) { e = that->head; pos = 0; } bool hasNext() const { return pos < that->count; } const Object* next() { assert(mc == that->modified); /* concurent modification? */ const Entry* r = e; e = e->next; pos++; return r->data; } private: const LinkedList* that; const Entry* e; mutable int pos; const int mc; }; void add(const Object* o) { // appends to list Entry* e = new Entry(Object::clone(o)); if (head == null) { e->next = e->prev = e; head = e; } else { e->next = head; e->prev = head->prev; e->prev->next = e; e->next->prev = e; } count++; modified++; } void add(int before, const Object* o) { // insert before pos if (before == count) { add(o); return; } Entry* p = getEntry(before); Entry* e = new Entry(Object::clone(o)); e->next = p; e->prev = p->prev; e->next->prev = e; e->prev->next = e; if (head == p) head = e; count++; modified++; } bool remove(const Object* o) { assert(o != null); Entry* e = head; int i; for (i = 0; i < count && !Object::equals(o, e->data); i++) { e = e->next; } if (i >= count) return false; removeEntry(e); return true; } // TODO: do we need it? we may be better of with removeFirst removeLast void removeAt(int ix) { assert(0 <= ix && ix < count); Entry* e = head; while (ix-- > 0) e = e->next; removeEntry(e); } void clear() { Entry* e = head; for (int i = 0; i < count; i++) { Entry* next = e->next; delete e->data; delete e; e = next; } head = null; count = 0; modified++; } const Object* get(int i) const { return getEntry(i)->data; } const void set(int i, const Object* o) const { Entry* e = getEntry(i); delete e->data; e->data = Object::clone(o); } inline int size() const { return count; } int hashCode() const { int hash = 0; Entry* e = head; for (int i = 0; i < count; i++) { hash += e->data != null ? e->data->hashCode() : 0; e = e->next; } return hash; } Object* clone() const { LinkedList* list = new LinkedList(); Entry* e = head; for (int i = 0; i < count; i++, e = e->next) { list->add(e->data); } return list; } bool equals(const Object* o) const { if (o == null) return false; const LinkedList* list = dynamic_cast<const LinkedList*>(o); if (list == null) return false; if (list == this) return true; if (count != list->count) return false; Entry* e1 = head; Entry* e2 = list->head; for (int i = 0; i < count; i++) { if (!Object::equals(e1->data, e2->data)) return false; e1 = e1->next; e2 = e2->next; } return true; } String* toString() const { StringBuffer sb; sb.printf(L"LinkedList@0x%08X{", this); Entry* e = head; for (int i = 0; i < count; i++) { String* s = String::toString(e->data); sb += s; delete s; if (i < count - 1) sb += L", "; e = e->next; } sb += L"}"; return sb.toString(); } void add(int n) { add(Int(n)); } void add(longlong n) { add(Long(n)); } void add(double d) { add(Double(d)); } void add(const uchar* s) { add(String(s)); } void add(const Object& o) { add(&o); } void add(int before, int n) { add(before, Long(n)); } void add(int before, longlong n) { add(before, Long(n)); } void add(int before, double d) { add(before, Double(d)); } void add(int before, const uchar* s) { add(before, String(s)); } void add(int before, const Object& o) { add(before, &o); } bool remove(const Object& o) { return remove(&o); } bool remove(const uchar* s) { return remove(String(s)); } bool remove(int n) { return remove(Int(n)); } bool remove(longlong n) { return remove(Long(n)); } bool remove(double d) { return remove(Double(d)); } private: Entry* getEntry(int ix) const { assert(0 <= ix && ix < count); Entry* e = head; for (int i = 0; i < ix; i++) e = e->next; return e; } void removeEntry(Entry* e) { if (count == 1) { clear(); return; } if (e == head) head = e->next; e->next->prev = e->prev; e->prev->next = e->next; delete e->data; delete e; count--; modified++; } friend Iterator; int count; Entry* head; int modified; }; // ----------------------------------------------------------------------------------- struct ByteArray extends Object { ByteArray() : len(0), capacity(0), data(null), modified(0) { } ByteArray(const byte* b, int size) : len(size), capacity(size), data(new byte[size]), modified(0) { memcpy(data, b, size); } ByteArray(const ByteArray &o) : len(o.len), capacity(o.len), data(new byte[o.len]), modified(0) { memcpy(data, o.data, len); } ByteArray(int size) : len(size), capacity(size), data(new byte[size]), modified(0) { } virtual ~ByteArray() { clear(); } void add(byte b) { if (len + 1 >= capacity) grow(); assert(len < capacity); data[len++] = b; modified++; } void insert(int index, byte b) { if (len + 1 >= capacity) grow(); assert(len < capacity); for (int i = len; i > index; i--) data[i] = data[i - 1]; data[index] = b; len++; modified++; } const byte get(int i) { assert(0 <= i && i < len); return data[i]; } void set(int i, byte b) { assert(0 <= i && i < len); data[i] = b; } void removeAt(int ix) { assert(0 <= ix && ix < len); memcpy(&data[ix], &data[ix+1], len - ix - 1); data[--len] = 0; modified++; if (len < capacity / 2) shrink(); } void clear() { delete data; data = null; len = 0; capacity = 0; modified++; } inline int size() const { return len; } int hashCode() const { int hash = 0; for (int i = 0; i < len; i++) hash = 31U * hash + data[i]; enum { mask = ((1U << (sizeof(int)*8-1)) - 1) }; return hash <= 0 ? -hash : hash; } Object* clone() const { ByteArray* a = new ByteArray(); a->data = new byte[len]; memcpy(a->data, data, len); a->len = a->capacity = len; return a; } bool equals(const Object* o) const { if (o == null) return false; const ByteArray* a = dynamic_cast<const ByteArray*>(o); if (a == null) return false; if (o == a) return true; if (len != a->len) return false; for (int i = 0; i < len; i++) { if (data[i] != a->data[i]) return false; } return true; } inline operator byte*() const { return data; } String* toString() const { StringBuffer sb(L"["); for (int i = 0; i < len; i++) { uchar s[8]; StringCchPrintf(s, countof(s), L"0x%02X", data[i]); sb += s; if (i < len - 1) sb += L", "; } sb += L"]"; return sb.toString(); } private: void grow() { capacity = capacity == 0 ? 4 : capacity * 2; reallocData(); } void shrink() { capacity = len; if (len == 0) clear(); else reallocData(); } void reallocData() { byte* d = new byte[capacity]; assert(len <= capacity); memcpy(d, data, len); delete[] data; data = d; } int len; int capacity; byte* data; int modified; }; // ----------------------------------------------------------------------------------- /* ArrayList is deep cloning container. It always clones elements. Note: 1. add(o) and a[i] = o clone the object passed as a parameter 2. a[i] returns access to the object not a clone Because of this correct code that implements e.g. swap is: const Object* o = a.get(i); Object* c = o->clone(); a.set(i, a.get(j)); // this will call delete and "o" is not valid after that! a.set(j, c); delete c; Exercise extreme caution. TODO: implement swap and possibly other methods on as needed basis */ struct ArrayList extends Object { ArrayList() : len(0), capacity(0), data(null), modified(0) { } virtual ~ArrayList() { clear(); } void add(const Object* o) { if (len + 1 >= capacity) grow(); assert(len < capacity); data[len++] = Object::clone(o); modified++; } void add(int before, const Object* o) { if (len + 1 >= capacity) grow(); assert(len < capacity); for (int i = len; i > before; i--) data[i] = data[i - 1]; data[before] = Object::clone(o); len++; modified++; } const Object* get(int i) const { assert(0 <= i && i < len); return data[i]; } void set(int i, const Object* o) { assert(0 <= i && i < len); delete data[i]; data[i] = Object::clone(o); } bool remove(const Object* o) { int i = 0; while (i < len && !Object::equals(o, data[i])) i++; if (i < len) { removeAt(i); return true; } return false; } void removeAt(int ix) { assert(0 <= ix && ix < len); Object* r = data[ix]; memcpy(&data[ix], &data[ix+1], (len - ix - 1) * sizeof(Object*)); data[--len] = null; delete r; modified++; if (len < capacity / 2) shrink(); } void clear() { for (int i = 0; i < len; i++) { delete data[i]; data[i] = null; } delete[] data; data = null; len = 0; capacity = 0; modified++; } inline int size() const { return len; } int hashCode() const { int hash = 0; for (int i = 0; i < len; i++) hash += data[i] == null ? 0 : data[i]->hashCode(); return hash; } Object* clone() const { ArrayList* a = new ArrayList(); a->data = new Object*[len]; for (int i = 0; i < len; i++) a->data[i] = Object::clone(data[i]); a->len = a->capacity = len; return a; } bool equals(const Object* o) const { if (o == null) return false; const ArrayList* a = dynamic_cast<const ArrayList*>(o); if (a == null) return false; if (a == this) return true; if (len != a->len) return false; for (int i = 0; i < len; i++) { if (!Object::equals(data[i], a->data[i])) return false; } return true; } String* toString() const { StringBuffer sb; sb.printf(L"ArrayList@0x%08X[", this); for (int i = 0; i < len; i++) { String* s = String::toString(data[i]); sb += s; delete s; if (i < len - 1) sb += L", "; } sb += L"]"; return sb.toString(); } void add(const Object& o) { add(&o); } void add(int n) { add(Int(n)); } void add(longlong n) { add(Long(n)); } void add(double d) { add(Double(d)); } void add(const uchar* s) { add(String(s)); } void add(int before, const Object& o) { add(before, o); } void add(int before, int n) { add(before, Int(n)); } void add(int before, longlong n) { add(before, Long(n)); } void add(int before, double d) { add(before, Double(d)); } void add(int before, const uchar* s) { add(before, String(s)); } void set(int i, const Object& o) { set(i, &o); } void set(int i, int n) { set(i, Int(n)); } void set(int i, longlong n) { set(i, Long(n)); } void set(int i, double d) { set(i, Double(d)); } void set(int i, const uchar* s) { set(i, String(s)); } bool remove(const Object& o) { return remove(&o); } bool remove(int n) { return remove(Int(n)); } bool remove(longlong n) { return remove(Long(n)); } bool remove(double d) { return remove(Double(d)); } bool remove(const uchar* s) { return remove(String(s)); } private: void grow() { capacity = capacity == 0 ? 4 : capacity * 2; reallocData(); } void shrink() { capacity = len; if (len == 0) clear(); else reallocData(); } void reallocData() { Object** d = new Object*[capacity]; assert(len <= capacity); memcpy(d, data, len * sizeof(Object*)); delete[] data; data = d; } int len; int capacity; Object** data; int modified; }; // ----------------------------------------------------------------------------------- /* HashMap is deep cloning hash table container. It always clones keys and values. Keys MUST be immutable. Singnificant difference from java.utils.HashMap (because of deep cloning): const Object* o = map.get("key"); if (o == null) map.put("key", o = new Object()); // here o does NOT points on what in the map!!! code above produces memory leak and any further operations with object do not modify object clone that resides in the map. Instead use: const Object* o = map.get("key"); if (o == null) o = map.put("key", Object()); this produces correct results. TODO: implement other methods on as needed basis */ struct HashMap extends Object { HashMap() : count(0), capacity(0), entries(null), modified(0) { } HashMap(const HashMap &o) : count(0), capacity(0), entries(null), modified(0) { for (EntryIterator i(o); i.hasNext(); ) { const Entry* e = i.nextEntry(); put(e->key, e->val); } } virtual ~HashMap() { clear(); } int size() const { return count; } struct EntryIterator; struct Entry { Entry(Object* k, Object* v, Entry* n) : key(k), val(v), next(n) { } virtual ~Entry() { key = val = null; next = null; } inline Object* getKey() const { return key; } inline Object* getVal() const { return val; } private: friend struct HashMap; friend struct EntryIterator; Object* key; Object* val; Entry* next; }; struct EntryIterator { // failfast // TODO: implement remove() w/ concurent modification check EntryIterator(const HashMap& map) : that(&map), pos(-1), mc(map.modified), i(null) { nextPos(); } EntryIterator(const HashMap* map) : that(map), pos(-1), mc(map->modified), i(null) { nextPos(); } virtual ~EntryIterator() { delete i; } bool hasNext() const { return i != null; } const Entry* nextEntry() { check(mc == that->modified); /* concurent modification? */ check(hasNext()); const Entry* e = i; nextPos(); return e; } private: void nextPos() { if (i != null) i = i->next; if (i == null && pos < that->capacity - 1) { do { pos++; } while (pos < that->capacity && that->entries[pos] == null); i = pos < that->capacity ? that->entries[pos] : null; } } const HashMap* that; int pos; Entry* i; const int mc; }; struct KeyIterator extends EntryIterator { KeyIterator(const HashMap& map) : EntryIterator(map) { } KeyIterator(const HashMap* map) : EntryIterator(map) { } const Object* next() { return EntryIterator::nextEntry()->getKey(); } }; struct ValueIterator extends EntryIterator { ValueIterator(const HashMap& map) : EntryIterator(map) { } ValueIterator(const HashMap* map) : EntryIterator(map) { } const Object* next() { return EntryIterator::nextEntry()->getVal(); } }; Object* put(const Object* key, const Object* val) { if (capacity < (count + 1) * 4 / 3) grow(); int h = hash(key) % capacity; Entry* e = count == 0 ? null : getEntry(key, h); if (e != null) { if (e->val == val) return e->val; // not modified delete e->val; e->val = Object::clone(val); modified++; return e->val; } entries[h] = new Entry(Object::clone(key), Object::clone(val), entries[h]); count++; modified++; return entries[h]->val; } // TODO: add put(double, ...) helpers if ever needed Entry* getEntry(const Object* key) const { if (count == 0) return null; int h = hash(key) % capacity; return getEntry(key, h); } bool containsKey(const Object* key) const { Entry* e = getEntry(key); return e != null; } const Object* get(const Object* key) const { if (count == 0) return null; Entry* e = getEntry(key); return e == null ? null : e->val; } bool remove(const Object* key) { if (count == 0) return false; int h = hash(key) % capacity; Entry** prev = &entries[h]; for (Entry* list = entries[h]; list != null; ) { Entry* next = list->next; if (Object::equals(list->key, key)) { *prev = list->next; deleteEntry(list); modified++; count--; if (capacity > 7 && count < capacity / 3) shrink(); return true; } prev = &list->next; list = next; } return false; } void clear() { for (int i = 0; i < capacity; i++) { for (Entry* list = entries[i]; list != null; ) { Entry* next = list->next; deleteEntry(list); list = next; } } delete[] entries; entries = null; count = capacity = 0; modified++; } Object* clone() const { HashMap* c = new HashMap(); for (EntryIterator i(this); i.hasNext(); ) { const Entry* e = i.nextEntry(); c->put(e->key, e->val); } return c; } bool equals(const Object* o) const { if (o == null || !instanceof(o, const HashMap*)) return false; const HashMap& map = *dynamic_cast<const HashMap*>(o); if (&map == this) return true; if (count != map.count) return false; for (EntryIterator i(this); i.hasNext(); ) { const Entry* e = i.nextEntry(); if (!Object::equals(map.get(e->key), e->val)) return false; } assert(hashCode() == map.hashCode()); return true; } int hashCode() const { return count; } String* toString() const { int k = 0; StringBuffer sb; sb.printf(L"HashMap@0x%08X{", this); for (EntryIterator i(this); i.hasNext(); ) { const Entry* e = i.nextEntry(); String* sk = String::toString(e->key); String* sv = String::toString(e->val); sb.printf((++k < count ? L"%s=%s, " : L"%s=%s"), (const uchar*)*sk, (const uchar*)*sv); delete sk; delete sv; } sb += L"}"; return sb.toString(); } // Convenient methods: inline bool containsKey(const uchar* k) const { return k != null ? containsKey(String(k)) : containsKey(Object::nil); } inline bool containsKey(const Object& k) const { return containsKey(&k); } inline bool containsKey(longlong k) const { return containsKey(Long(k)); } inline bool containsKey(int k) const { return containsKey(Int(k)); } const String* getString(const uchar *k) const { return dynamic_cast<const String*>(get(k)); } const String* getString(const Object *k) const { return dynamic_cast<const String*>(get(k)); } const String* getString(int k) const { return dynamic_cast<const String*>(get(k)); } const String* getString(longlong k) const { return dynamic_cast<const String*>(get(k)); } const HashMap* getMap(const uchar *k) const { return dynamic_cast<const HashMap*>(get(k)); } const HashMap* getMap(const Object *k) const { return dynamic_cast<const HashMap*>(get(k)); } const Int* getInt(const uchar *k) const { return dynamic_cast<const Int*>(get(k)); } const Int* getInt(const Object *k) const { return dynamic_cast<const Int*>(get(k)); } const Long* getLong(const uchar *k) const { return dynamic_cast<const Long*>(get(k)); } const Long* getLong(const Object *k) const { return dynamic_cast<const Long*>(get(k)); } const Double* getDouble(const uchar *k) const { return dynamic_cast<const Double*>(get(k)); } const Double* getDouble(const Object *k) const { return dynamic_cast<const Double*>(get(k)); } const Color* getColor(const uchar *k) const { return dynamic_cast<const Color*>(get(k)); } const Color* getColor(const Object *k) const { return dynamic_cast<const Color*>(get(k)); } const Object* get(const uchar* k) const { return k != null ? get(String(k)) : get(Object::nil); } const Object* get(const Object& k) const { return get(&k); } const Object* get(longlong k) const { return get(Long(k)); } const Object* get(int k) const { return get(Int(k)); } inline bool remove(const uchar* k) { return k != null ? remove(String(k)) : remove(Object::nil); } inline bool remove(const Object& k) { return remove(&k); } inline bool remove(longlong k) { return remove(Long(k)); } inline bool remove(int k) { return remove(Int(k)); } inline Object* put(const Object& k, const Object& v) { return put(&k, &v); } inline Object* put(const Object* k, const Object& v) { return put( k, &v); } inline Object* put(const Object& k, const Object* v) { return put(&k, v); } Object* put(const Object& k, const uchar* v) { return put(&k, v); } Object* put(const Object& k, longlong v) { return put(&k, v); } Object* put(const Object& k, double v) { return put(&k, v); } Object* put(const Object& k, int v) { return put(&k, v); } Object* put(const uchar* k, const Object& v) { return k != null ? put(k, &v) : put(Object::nil, &v); } Object* put(int k, const Object& v) { return put(k, &v); } Object* put(longlong k, const Object& v) { return put(k, &v); } Object* put(const Object* k, const uchar* v) { return v != null ? put(k, String(v)) : put(k, Object::nil); } Object* put(const Object* k, int v) { return put(k, Int(v)); } Object* put(const Object* k, longlong v) { return put(k, Long(v)); } Object* put(const Object* k, double v) { return put(k, Double(v)); } Object* put(const uchar* k, const uchar* v) { if (k == null && v == null) return put(Object::nil, Object::nil); else if (k == null) return put(Object::nil, String(v)); else if (v == null) return put(String(k), Object::nil); else return put(String(k), String(v)); } Object* put(const uchar* k, int v) { return put(k, Int(v)); } Object* put(const uchar* k, longlong v) { return k != null ? put(String(k), Long(v)) : put(Object::nil, Long(v)); } Object* put(const uchar* k, double v) { return k != null ? put(String(k), Double(v)) : put(Object::nil, Double(v)); } Object* put(const uchar* k, const Object* v) { return k != null ? put(String(k), v) : put(Object::nil, v); } Object* put(int k, const uchar* v) { return v != null ? put(Int(k), String(v)) : put(Int(k), Object::nil); } Object* put(int k, const Object* v) { return put(Int(k), v); } Object* put(longlong k, const uchar* v) { return v != null ? put(Long(k), String(v)) : put(Long(k), Object::nil); } Object* put(longlong k, int v) { return put(Long(k), Int(v)); } Object* put(longlong k, longlong v) { return put(Long(k), Long(v)); } Object* put(longlong k, double v) { return put(Long(k), Double(v)); } Object* put(longlong k, const Object* v) { return put(Long(k), v); } private: friend EntryIterator; Entry* getEntry(const Object* key, int h) const { assert(count > 0); for (Entry* list = entries[h]; list != null; list = list->next) { if (Object::equals(key, list->key)) return list; } return null; } void grow() { int n = capacity == 0 ? 5 : capacity * 2; reallocData(n); } void shrink() { int n = capacity * 3 / 4; if (n < count) n = count; if (count == 0) clear(); else reallocData(n); } void reallocData(int n) { assert(count <= capacity); Entry** e = new Entry*[n]; for (int i = 0; i < capacity; i++) { for (Entry* list = entries[i]; list != null; ) { Entry* next = list->next; int h = hash(list->key) % n; e[h] = new Entry(list->key, list->val, e[h]); delete list; list = next; } } delete[] entries; entries = e; capacity = n; assert(count <= capacity); } static int hash(const Object* x) { if (x == null) return 0; int h = x->hashCode(); h += ~(h << 9U); h ^= ((uint)h >> 14U); h += (h << 4U); h ^= ((uint)h >> 10U); return h < 0 ? -h : h; } static void deleteEntry(Entry* list) { delete list->key; delete list->val; delete list; } int count; int capacity; Entry** entries; int modified; static const Object* nil; }; // ----------------------------------------------------------------------------------- /* HashSet is deep cloning container. It always clones keys. keys MUST be immutable TODO: implement other methods on as needed basis */ struct HashSet extends Object { HashSet() { } virtual ~HashSet() { } // not KeyIterator because of compiler bug struct Iterator extends HashMap::EntryIterator { Iterator(const HashSet &set) : EntryIterator(set.map) { } Iterator(const HashSet* set) : EntryIterator(set->map) { } const Object* next() { return EntryIterator::nextEntry()->getKey(); } }; int size() const { return map.size(); } Object* add(const Object* e) { return map.put(e, Object::nil); } Object* add(const Object& e) { return add(&e); } Object* add(int n) { return add(Int(n)); } Object* add(longlong n) { return add(Long(n)); } Object* add(const uchar* s) { return add(String(s)); } bool remove(const Object* o) { return map.remove(o); } bool remove(const Object& o) { return remove(&o); } bool remove(int v) { return remove(Int(v)); } bool remove(longlong v) { return remove(Long(v)); } bool remove(const uchar* s) { return remove(String(s)); } bool contains(const Object* e) const { return map.containsKey(e); } bool contains(const Object& e) const { return contains(&e); } bool contains(const uchar* s) const { return contains(String(s)); } bool contains(int n) const { return contains(Int(n)); } bool contains(longlong n) const { return contains(Long(n)); } void clear() { map.clear(); } Object* clone() const { HashSet* c = new HashSet(); for (HashMap::KeyIterator i(map); i.hasNext(); ) c->add(i.next()); return c; } String* toString() const { int k = 0, count = map.size(); StringBuffer sb; sb.printf(L"HashSet@0x%08X{", this); for (HashMap::KeyIterator i(map); i.hasNext(); ) { String* key = String::toString(i.next()); sb.printf((++k < count ? L"%s, " : L"%s"), (const uchar*)*key); delete key; } sb += L"}"; return sb.toString(); } bool equals(const Object* o) const { if (o == null) return false; const HashSet* set = dynamic_cast<const HashSet*>(o); if (set == null) return false; if (set == this) return true; if (size() != set->size()) return false; return map.equals(&set->map); } int hashCode() const { return map.hashCode(); } private: friend Iterator; HashMap map; }; // ----------------------------------------------------------------------------------- struct InputStream extends Object { InputStream() { } virtual ~InputStream() { } virtual int available() const = 0; virtual void close() = 0; virtual int read(byte* b, int len) = 0; virtual void reset() = 0; virtual const String* getName() const = 0; }; // ----------------------------------------------------------------------------------- struct OutputStream extends Object { OutputStream() { } virtual ~OutputStream() { } virtual bool close() = 0; virtual int write(const byte* b, int len) = 0; virtual bool flush() = 0; virtual const String* getName() const = 0; }; // ----------------------------------------------------------------------------------- struct ByteArrayInputStream extends InputStream { ByteArrayInputStream(const ByteArray* ba, const uchar* n = null) : data(dynamic_cast<const ByteArray*>(ba->clone())), pos(0), name(null) { if (n != null) { name = new String(n); } else { StringBuffer sb; sb.printf(L"ByteArrayInputStream(0x%08X)", (const byte*)*ba); name = sb.toString(); } } virtual ~ByteArrayInputStream() { delete data; delete name; } int available() const { return data == null ? 0 : data->size() - pos; } void close() { delete data; data = null; pos = 0; } int read(byte* b, int len) { if (data == null || pos >= data->size()) return -1; int n = available(); if (n > len) n = len; memcpy(b, ((const byte*)*data) + pos, n); pos += n; return n; } void reset() { pos = 0; } const String* getName() const { return name; } const ByteArray* data; String* name; int pos; }; // ----------------------------------------------------------------------------------- /* LIMITATION: max file size 2GB-1 */ struct FileOutputStream extends OutputStream { FileOutputStream(HANDLE h, const uchar* fname) : handle(h), file(new String(fname)) { assert(handle != INVALID_HANDLE_VALUE); } FileOutputStream(const uchar* fname) : handle(INVALID_HANDLE_VALUE), file(new String(fname)) { handle = CreateFile(fname, GENERIC_WRITE, 0, null, CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, null); check(handle != INVALID_HANDLE_VALUE); } virtual ~FileOutputStream() { check(close()); delete file; } bool close() { bool b = true; if (handle != INVALID_HANDLE_VALUE) { b = flush() && CloseHandle(handle); } handle = INVALID_HANDLE_VALUE; return b; } int write(const byte* b, int len) { if (handle == INVALID_HANDLE_VALUE) return -1; dword res = (dword)-1; if (!WriteFile(handle, b, len, &res, null)) { return -1; } else { return (int)res; } } bool flush() { return FlushFileBuffers(handle) != FALSE; } const String* getName() const { return file; } private: HANDLE handle; private: String* file; }; // ----------------------------------------------------------------------------------- /* LIMITATION: max file size 2GB-1 */ struct FileInputStream extends InputStream { FileInputStream(HANDLE h, const uchar* fname) : handle(h), file(new String(fname)) { assert(handle != INVALID_HANDLE_VALUE); size = GetFileSize(h, null); } virtual ~FileInputStream() { close(); delete file; } int available() const { if (handle == INVALID_HANDLE_VALUE) return -1; dword pos = SetFilePointer(handle, 0, null, FILE_CURRENT); return size - (int)pos; } void close() { if (handle != INVALID_HANDLE_VALUE) CloseHandle(handle); handle = INVALID_HANDLE_VALUE; } int read(byte* b, int len) { if (handle == INVALID_HANDLE_VALUE) return -1; dword res = (dword)-1; if (!ReadFile(handle, b, len, &res, null)) { return -1; } else { return (int)res; } } void reset() { dword pos = SetFilePointer(handle, 0, null, FILE_BEGIN); assert(pos != 0xFFFFFFFF); unused(pos); } const String* getName() const { return file; } private: HANDLE handle; private: String* file; private: int size; }; // ----------------------------------------------------------------------------------- struct File extends Object and_implements Comparable { File(const uchar* fn) : file(fn) { } File(const String* fn) : file(fn) { } File(const String& fn) : file(fn) { } int length() const { return file.length(); } bool exists() const { return GetFileAttributes(file) != 0xFFFFFFFF; } longlong getSize() const { WIN32_FILE_ATTRIBUTE_DATA a = {0}; if (!GetFileAttributesEx(file, GetFileExInfoStandard, &a)) return -1; return (((longlong)a.nFileSizeHigh) << 32U) | a.nFileSizeLow; } bool isDirectory() const { WIN32_FILE_ATTRIBUTE_DATA a = {0}; if (!GetFileAttributesEx(file, GetFileExInfoStandard, &a)) return false; return (a.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; } operator const uchar*() const { return (const uchar*)file; } const uchar * getBasename() { const uchar *base_f = ustrrchr(file, '/'); const uchar *base_r = ustrrchr(file, '\\'); if (base_f != null && base_r != null) return (base_f > base_r ? base_r : base_f) + 1; else if (base_f != null) return base_f + 1; else if (base_r != null) return base_r + 1; else return file; } ByteArray* readBinary() const { HANDLE f = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, null, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, null); if (f == INVALID_HANDLE_VALUE) return null; FileInputStream s(f, file); int n = (int)getSize(); ByteArray* b = new ByteArray(n); if (s.read(*b, n) != n) { delete b; return null; } return b; } String* readUTF8() const { ByteArray* b = readBinary(); if (b == null) return null; String* s = String::fromUTF8((const char*)(byte*)*b); delete b; return s; } static String* File::getSpecialFolder(int csidl) { // CSIDL_MYPICTURES, CSIDL_APPDATA, CSIDL_PERSONAL, CSIDL_DESKTOP ITEMIDLIST* iil = null; if (FAILED(SHGetSpecialFolderLocation(::GetDesktopWindow(), csidl, &iil))) { return null; } assert(iil != null); uchar buf[16*1024]; if (!SHGetPathFromIDList(iil, buf)) return null; IMalloc* piMalloc = null; check(SUCCEEDED(SHGetMalloc(&piMalloc))); check(piMalloc != null); piMalloc->Free(iil); piMalloc->Release(); return new String(buf); } int hashCode() const { return file.hashCode(); } Object* clone() const { return new File(file); } bool equals(const Object* o) const { if (o == null || !instanceof(o, const File*)) return false; const File& f = *dynamic_cast<const File*>(o); return file.equals(&f.file); } int compareTo(const Object* o) const { if (o == null || !instanceof(o, const File*)) return +1; const File& f = *dynamic_cast<const File*>(o); return file.compareTo(&f.file); } String* toString() const { StringBuffer sb; sb.printf(L"File@0x%08X\"%s\"", this, (const uchar*)file); return sb.toString(); } private: String file; }; // ----------------------------------------------------------------------------------- struct XMLDecoder { static Object* decode(const String& s) { return decode(&s); } static Object* decode(const String* s) { int pos = 0; return decode(s, pos); } static Object* decode(const String* s, int &pos) { String* tag = nextTag(s, pos); bool b = tag->compareTo(L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>") == 0; check(b); // compiler bug: cannot use escaped string as assert macro param delete tag; tag = nextTag(s, pos); assert(tag->startsWith(L"<XMLEncoder")); delete tag; tag = nextTag(s, pos); Object* o = decodeObject(s, pos, tag); delete tag; tag = nextTag(s, pos); assert(tag->startsWith(L"</XMLEncoder")); delete tag; return o; } static Object* decodeObject(const String* s, int &pos, const String* tag) { Object* r = null; assert(tag->startsWith(L"<")); if (tag->compareTo(L"<object>") == 0) { String* t = nextValue(s, pos); assert(t->compareTo(L"null") == 0); delete t; checkEndTag(s, pos, L"</object>"); } else if (tag->compareTo(L"<int>") == 0) { String* t = nextValue(s, pos); int v = _wtoi((const uchar*)*t); delete t; r = new Int(v); checkEndTag(s, pos, L"</int>"); } else if (tag->compareTo(L"<long>") == 0) { String* t = nextValue(s, pos); longlong v = _wtoi64((const uchar*)*t); delete t; r = new Long(v); checkEndTag(s, pos, L"</long>"); } else if (tag->compareTo(L"<point>") == 0) { String* t = nextValue(s, pos); Point* pt = new Point(); swscanf((const uchar*)*t, L"%d,%d", &pt->x, &pt->y); delete t; r = pt; checkEndTag(s, pos, L"</point>"); } else if (tag->compareTo(L"<rect>") == 0) { String* t = nextValue(s, pos); Rect* rc = new Rect(); swscanf((const uchar*)*t, L"%d,%d,%d,%d", &rc->left, &rc->top, &rc->right, &rc->bottom); delete t; r = rc; checkEndTag(s, pos, L"</rect>"); } else if (tag->compareTo(L"<color>") == 0) { String* t = nextValue(s, pos); assert(t->startsWithIgnoreCase(L"0x")); const uchar* n = *t; Color* c = new Color(); swscanf(n + 2, L"%X", &c->c); delete t; r = c; checkEndTag(s, pos, L"</color>"); } else if (tag->compareTo(L"<double>") == 0) { String* t = nextValue(s, pos); uchar* last = null; double v = wcstod((const uchar*)*t, &last); delete t; r = new Double(v); checkEndTag(s, pos, L"</double>"); } else if (tag->compareTo(L"<string>") == 0) { String* t = nextValue(s, pos); if (t->compareTo(L"</string>") == 0) { // empty string delete t; r = new String(); } else { r = t; checkEndTag(s, pos, L"</string>"); } } else if (tag->compareTo(L"<file>") == 0) { String* t = nextValue(s, pos); if (t->compareTo(L"</file>") == 0) { // empty string r = new File(L""); } else { r = new File(t); checkEndTag(s, pos, L"</file>"); } delete t; } else if (tag->compareTo(L"<StringBuffer>") == 0) { String* t = nextValue(s, pos); if (t->compareTo(L"</StringBuffer>") == 0) { // empty string r = new StringBuffer(); } else { r = new StringBuffer((const uchar*)*t); checkEndTag(s, pos, L"</StringBuffer>"); } delete t; } else if (tag->compareTo(L"<rational>") == 0) { String* t = nextValue(s, pos); if (t->compareTo(L"</rational>") == 0) { r = new Rational(0, 1); } else { longlong n=0, d=1; swscanf((const uchar*)*t, L"%I64d/%I64d", &n, &d); r = new Rational(n, d == 0 ? 1 : d); checkEndTag(s, pos, L"</rational>"); } delete t; } else if (tag->compareTo(L"<list>") == 0) { LinkedList* list = new LinkedList(); String* t = nextTag(s, pos); while (t->compareTo(L"</list>") != 0) { Object* e = decodeObject(s, pos, t); list->add(e); delete e; e = null; delete t; t = null; t = nextTag(s, pos); } delete t; r = list; } else if (tag->compareTo(L"<array>") == 0) { ArrayList* array = new ArrayList(); String* t = nextTag(s, pos); while (t->compareTo(L"</array>") != 0) { Object* e = decodeObject(s, pos, t); array->add(e); delete e; e = null; delete t; t = null; t = nextTag(s, pos); } delete t; r = array; } else if (tag->compareTo(L"<set>") == 0) { HashSet* set = new HashSet(); String* t = nextTag(s, pos); while (t->compareTo(L"</set>") != 0) { Object* e = decodeObject(s, pos, t); set->add(e); delete e; e = null; delete t; t = null; t = nextTag(s, pos); } delete t; r = set; } else if (tag->compareTo(L"<map>") == 0) { HashMap* map = new HashMap(); String* k = nextTag(s, pos); while (k->compareTo(L"</map>") != 0) { Object* key = decodeObject(s, pos, k); String* v = nextTag(s, pos); Object* val = decodeObject(s, pos, v); delete v; v = null; map->put(key, val); delete key; key = null; delete val; val = null; delete k; k = null; k = nextTag(s, pos); } delete k; r = map; } else { trace(L"Unknown tag \"%s\" in pos %d\n", (const uchar*)*tag, pos); assert(false); // unknown tag } return r; } static void checkEndTag(const String* s, int &pos, const uchar* val) { String* close = nextTag(s, pos); assert(close->compareTo(val) == 0); delete close; } static String* nextTag(const String* s, int& pos) { skipBlank(s, pos); bool stop = false; uchar ch = decodeChar(s, pos, stop); if (ch == '<') { StringBuffer sb; sb += ch; do { ch = s->charAt(pos++); sb += ch; } while (ch != '>'); return sb.toString(); } else { return nextValue(s, pos, ch, true); } } static String* nextValue(const String* s, int& pos, uchar ch = 0, bool prepend = false) { StringBuffer sb; bool stop = false; if (!prepend) ch = decodeChar(s, pos, stop); while (!stop && pos < s->length()) { sb += ch; ch = decodeChar(s, pos, stop); } if (stop && ch == '<') pos--; return sb.toString(); } static void skipBlank(const String* s, int& pos) { uchar ch = s->charAt(pos); while (ch == L' ' || ch == L'\t' || ch == L'\r' || ch == L'\n') { pos++; ch = s->charAt(pos); } } static uchar decodeChar(const String* s, int& pos, bool &stop) { uchar ch = s->charAt(pos++); stop = ch == '<'; if (ch != L'&') return ch; int n = pos; while (s->charAt(n) != ';') n++; uchar buf[16] = {0}; assert(n - pos < countof(buf)); int i, j = 0; for (i = pos; i < n; i++) buf[j++] = s->charAt(i); pos = n + 1; if (ustrcmp(buf, L"amp") == 0) return L'&'; else if (ustrcmp(buf, L"lt") == 0) return L'<'; else if (ustrcmp(buf, L"gt") == 0) return L'>'; else if (ustrcmp(buf, L"apos") == 0) return L'\''; else if (ustrcmp(buf, L"quot") == 0) return L'\"'; else if (buf[0] == L'#') { uint c = 0; if (buf[1] == L'x') { for (i = 2; i < 6; i++) { uchar ch = towlower(buf[i]); assert(L'0' <= ch && ch <= '9' || L'a' <= ch && ch <= 'f'); c = c * 16U + (ch <= '9' ? (ch - L'0') : (ch - L'a' + 10)); } } else { for (i = 1; i < 5; i++) { uchar ch = towlower(buf[i]); assert(L'0' <= ch && ch <= '9'); c = c * 10U + (ch - L'0'); } } return (uchar)c; } else { assert(false); // don't know how to decode return ' '; } } }; // ----------------------------------------------------------------------------------- struct XMLEncoder { static String* encode(const Object& o) { return encode(&o); } static String* encode(const Object* o) { StringBuffer sb; sb += L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; sb += L"<XMLEncoder xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n"; encode(sb, o, 0); sb += L"</XMLEncoder>"; return sb.toString(); } private: static void encode(StringBuffer& sb, const Object* o, int depth) { if (depth >= 0) tabify(sb, depth); if (o == null) { sb += L"<object>null</object>"; } else if (instanceof(o, const String*)) { sb += L"<string>"; const String& s = *dynamic_cast<const String*>(o); encodeString(sb, (const uchar*)s, s.length()); sb += L"</string>"; } else if (instanceof(o, const StringBuffer*)) { sb += L"<StringBuffer>"; const StringBuffer& s = *dynamic_cast<const StringBuffer*>(o); encodeString(sb, (const uchar*)s, s.length()); sb += L"</StringBuffer>"; } else if (instanceof(o, const File*)) { sb += L"<file>"; const File& f = *dynamic_cast<const File*>(o); encodeString(sb, (const uchar*)f, f.length()); sb += L"</file>"; } else if (instanceof(o, const Int*)) { const Int& v = *dynamic_cast<const Int*>(o); sb.printf(L"<int>%d</int>", v.intValue()); } else if (instanceof(o, const Long*)) { const Long& v = *dynamic_cast<const Long*>(o); sb.printf(L"<long>%I64d</long>", v.longValue()); } else if (instanceof(o, const Double*)) { const Double& v = *dynamic_cast<const Double*>(o); sb.printf(L"<double>%.13g</double>", v.doubleValue()); } else if (instanceof(o, const Point*)) { const Point& v = *dynamic_cast<const Point*>(o); sb.printf(L"<point>%d,%d</point>", v.x, v.y); } else if (instanceof(o, const Rect*)) { const Rect& v = *dynamic_cast<const Rect*>(o); sb.printf(L"<rect>%d,%d,%d,%d</rect>", v.left, v.top, v.right, v.bottom); } else if (instanceof(o, const Rational*)) { const Rational& v = *dynamic_cast<const Rational*>(o); sb.printf(L"<rational>%I64d/%I64d</rational>", v.numerator(), v.denominator()); } else if (instanceof(o, const Color*)) { const Color& v = *dynamic_cast<const Color*>(o); sb.printf(L"<color>0x%08X</color>", v.c); } else if (instanceof(o, const LinkedList*)) { sb += L"<list>\r\n"; const LinkedList* list = dynamic_cast<const LinkedList*>(o); for (LinkedList::Iterator i(list); i.hasNext(); ) { append(sb, i.next(), depth + 1); } tabify(sb, depth, L"</list>\r\n"); } else if (instanceof(o, const ArrayList*)) { sb += L"<array>\r\n"; const ArrayList* array = dynamic_cast<const ArrayList*>(o); int n = array->size(); for (int i = 0; i < n; i++) { append(sb, array->get(i), depth + 1); } tabify(sb, depth, L"</array>\r\n"); } else if (instanceof(o, const HashSet*)) { sb += L"<set>\r\n"; const HashSet& set = *dynamic_cast<const HashSet*>(o); int k = 0, n = set.size(); Object** a = new Object*[n]; for (HashSet::Iterator i(set); i.hasNext(); ) a[k++] = (Object*)i.next(); sort(a, n); for (k = 0; k < n; k++) append(sb, a[k], depth + 1); delete[] a; tabify(sb, depth, L"</set>\r\n"); } else if (instanceof(o, const HashMap*)) { sb += L"<map>\r\n"; const HashMap& map = *dynamic_cast<const HashMap*>(o); int k = 0, n = map.size(); Object** a = new Object*[n]; for (HashMap::KeyIterator i(map); i.hasNext(); ) a[k++] = (Object*)i.next(); sort(a, n); for (k = 0; k < n; k++) { encode(sb, a[k], depth + 1); const Object* val = map.get(a[k]); if (!isCollection(val)) { encode(sb, val, -1); sb += L"\r\n"; } else { sb += L"\r\n"; encode(sb, val, depth+1); } } delete[] a; tabify(sb, depth, L"</map>\r\n"); } else { // Do not know how to encode, encode null object instead:- sb += L"<object>null</object>"; // assert(false); // do not know how to encode } } static void encodeString(StringBuffer &sb, const uchar* s, int len) { for (int i = 0; i < len; i++) { const uchar ch = s[i]; if (ch == L'&') sb += L"&amp;"; else if (ch == L'<') sb += L"&lt;"; else if (ch == L'>') sb += L"&gt;"; else if (ch == L'\'') sb += L"&apos;"; else if (ch == L'\"') sb += L"&quot;"; else if (ch <= 255 && (ch < 32 || ch > 127)) { uchar sc[16]; StringCchPrintf(sc, countof(sc), L"&#x%04X;", ch); sb += sc; } else { sb += ch; } } } static void append(StringBuffer& sb, const Object* o, int depth) { encode(sb, o, depth + 1); if (!isCollection(o)) sb += L"\r\n"; } static void tabify(StringBuffer &sb, int depth) { for (int d = 0; d < depth; d++) sb += L" "; } static void tabify(StringBuffer &sb, int depth, const uchar* close) { for (int d = 0; d < depth; d++) sb += L" "; sb += close; } static bool isCollection(const Object* o) { return instanceof(o, const LinkedList*) || instanceof(o, const ArrayList*) || instanceof(o, const HashMap*) || instanceof(o, const HashSet*); } static int __cdecl compareObjects(const void *e1, const void *e2) { Object* o1 = *(Object**)e1; Object* o2 = *(Object**)e2; if (o1 == null) { return o2 == null ? 0 : -1; } else if (o2 == null) { return o1 == null ? 0 : +1; } else if (instanceof(o1, Comparable*)) { return dynamic_cast<Comparable*>(o1)->compareTo(o2); } else if (instanceof(o2, Comparable*)) { return -dynamic_cast<Comparable*>(o2)->compareTo(o1); } else if (o1->equals(o2) || o1->hashCode() == o2->hashCode()) { return 0; } else { return o1->hashCode() < o2->hashCode() ? -1 : +1; } } static void sort(Object** a, int n) { if (n > 1) qsort(a, n, sizeof(Object*), compareObjects); } }; // ----------------------------------------------------------------------------------- struct Image extends Object { Image(); Image(const uchar* file); Image(InputStream* s); Image(int w, int h, int bits); virtual ~Image(); bool create(int w, int h, int bitcount); inline bool createRGBA(int w, int h) { return create(w, h, 32); } inline bool createBW(int w, int h) { return create(w, h, 1); } inline bool createRGB(int w, int h) { return create(w, h, 24); } Image* clone(const Rect& rc) const; Image* clone(const Rect* rc) const { return clone(*rc); } Object* clone() const; HDC getDC(); void releaseDC(); void alphaBlend(HDC hdc, int dx, int dy, int dw, int dh, int sx, int sy, int sw, int sh) const; void alphaBlend(Image& dst, int dx, int dy, int dw, int dh, int sx, int sy, int sw, int sh) const; void alphaBlend(Image* dst, int dx, int dy, int dw, int dh, int sx, int sy, int sw, int sh) const { alphaBlend(*dst, dx, dy, dw, dh, sx, sy, sw, sh); } void bitBlt(HDC hdc, int dx, int dy, int dw, int dh, int sx, int sy, int sw, int sh, int op = SRCCOPY) const; void bitBlt(Image& dst, int dx, int dy, int dw, int dh, int sx, int sy, int sw, int sh, int op = SRCCOPY) const; void bitBlt(Image* dst, int dx, int dy, int dw, int dh, int sx, int sy, int sw, int sh, int op = SRCCOPY) const { bitBlt(*dst, dx, dy, dw, dh, sx, sy, sw, sh, op); } bool load(const uchar* fname, int &w, int &h, bool headeronly = false); bool load(InputStream* stream, int &w, int &h, bool headeronly = false); bool save(const uchar* fname); // for .png only RGBA images inline const String* getError() const { return error; } inline const String* getFile() const { return file; } inline void setError(const uchar* s) { delete error; error = new String(s); } inline HBITMAP getBitmap() const { return bitmap; } inline int getWidth() const { return bi.bV4Width; } inline int getHeight() const { return bi.bV4Height; } inline byte* getLine(int y) const { return bits + (bi.bV4Height - 1 - y) * bytesPerLine; } inline Color getPixel(int x, int y) const { byte* line = getLine(y); return Color(line[2], line[1], line[0]); // BRG } inline operator BITMAPINFO*() { return (BITMAPINFO*)&bi; } inline operator BITMAPV4HEADER*() { return &bi; } inline HashMap& getProperties() { return properties; } inline const HashMap& getProperties() const { return properties; } private: bool loadjpg(bool headeronly, int &w, int &h, InputStream* input, OutputStream* output); bool loadpng(bool headeronly, int &w, int &h, InputStream* input, OutputStream* output); bool savepng(OutputStream* output); bool savejpg(OutputStream* output); HDC hdc; int getCount; int compression; int bytesPerLine; HashMap properties; String* file; String* error; byte* bits; HBITMAP bitmap; HBITMAP unselect; BITMAPV4HEADER bi; }; // ----------------------------------------------------------------------------------- extern const uint INVOKE_LATER; extern const uint BROADCAST; extern const dword DISPATCH_THREAD_ID; #define WM_SYSTIMER 0x0118 // selected text scroll http://support.microsoft.com/?id=108938 struct Message extends Object { public: const uchar* id; public: const Object* param; Message(const uchar* i, const Object* p) : id(i), param(p) { } virtual ~Message() { delete param; } virtual void dispatch(); // see implementation below /* special care should be taken to call broadcast ONLY with L"..." messages. Message itself and Object* param will be forcefully deleted after dispatching */ void post() { check(PostThreadMessage(DISPATCH_THREAD_ID, BROADCAST, null, (LPARAM)this)); } }; interface BroadcastListener { virtual void eventReceived(const Message &msg) = 0; }; struct MessageQueue { static LinkedList listeners; static HACCEL accel; static bool shutdown; static int shutdownDelay; static bool isDispatchThread() { return GetCurrentThreadId() == DISPATCH_THREAD_ID; } static void invokeLater(Runnable r, void* p) { check(PostThreadMessage(DISPATCH_THREAD_ID, INVOKE_LATER, (WPARAM)r, (LPARAM) p)); } /* special care should be taken to call broadcast ONLY with L"..." messages. Object* param will be forcefully deleted after dispatching */ static void post(const uchar* id) { (new Message(id, null))->post(); // compiler bug () around new are needed } static void post(const uchar* id, const Object* param) { (new Message(id, param))->post(); // compiler bug () around new are needed } static void addBroadcastListener(BroadcastListener* iface) { listeners.add((int)iface); } static void removeBroadcastListener(BroadcastListener* iface) { listeners.remove((int)iface); } static void setAcceleratorTable(HACCEL ha) { accel = ha; } static HWND getParentDialog(HWND hwnd) { while (hwnd != null) { if (GetProp(hwnd, L"dialog") != null) return hwnd; hwnd = GetParent(hwnd); } return null; } static inline int messageLoop() { MSG msg = {0}; while (GetMessage(&msg, null, 0, 0)) { // TODO: add __try _except and logging here HWND dialog = getParentDialog(msg.hwnd); if (dialog != null && IsDialogMessage(dialog, &msg)) { /* do nothing */ } else { if (msg.hwnd != null && !TranslateAccelerator(msg.hwnd, accel, &msg)) { TranslateMessage(&msg); } DispatchMessage(&msg); } // Make sure any pending messages get dispatched if (shutdown) { if (shutdownDelay > 0) { int milliseconds = shutdownDelay; shutdownDelay = 0; post(L"shutdown"); Sleep(milliseconds); // let background threads work } else { if (PeekMessage(&msg, null, 0, 0, PM_NOREMOVE) == 0) PostQuitMessage(0); } } } assert(msg.message == WM_QUIT); return msg.wParam; } static void notifyAll(const Message& msg) { LinkedList* clone = dynamic_cast<LinkedList*>(listeners.clone()); for (LinkedList::Iterator i(clone); i.hasNext(); ) { const Int* iface = dynamic_cast<const Int*>(i.next()); ((BroadcastListener*)iface->intValue())->eventReceived(msg); } delete clone; } static void initiateShutdown() { shutdown = true; post(L"shutdown"); } static void delayShutdown(int quantInMilliseconds) { shutdownDelay = max(shutdownDelay, max(quantInMilliseconds, 1)); } }; inline void Message::dispatch() { MessageQueue::notifyAll(*this); delete this; // will delete param } // ----------------------------------------------------------------------------------- struct Window { interface Listener { virtual void eventReceived(HWND hwnd, int msg, int wp, int lp) = 0; }; static HWND create(HWND parent, int styleEx, int style, WNDPROC, HBRUSH, void* that); static void notifyListeners(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam); static void notifyDestroy(HWND hwnd); static void addListener(HWND hwnd, Window::Listener* sink); static void addListener(HWND hwnd, Window::Listener& sink) { addListener(hwnd, &sink); } static void removeListener(HWND hwnd, Window::Listener* sink); static Rect getBounds(HWND hwnd); // return bounding rectangle inside parent static const Object* get(HWND hwnd, const uchar* id); static int getInt(HWND hwnd, const uchar* id) { return (int)dynamic_cast<const Int&>(*get(hwnd, id)).intValue(); } static int getInt(HWND hwnd, const uchar* id, int defvalue) { const Int* val = dynamic_cast<const Int*>(get(hwnd, id)); return val != null ? val->intValue() : defvalue; } static const uchar* getStr(HWND hwnd, const uchar* id) { const Object* s = get(hwnd, id); return s == null ? null : (const uchar*)dynamic_cast<const String&>(*s); } static void put(HWND hwnd, const uchar* id, const Object& o) { put(hwnd, id, &o); } static void put(HWND hwnd, const uchar* id, const Object* o); static void put(HWND hwnd, const uchar* id, const uchar* s); static void put(HWND hwnd, const uchar* id, int v); static String getText(HWND hwnd); /* returns arbitrary length text */ }; // ----------------------------------------------------------------------------------- class ObjectPipe { HANDLE pipe; OVERLAPPED overlapped_read; OVERLAPPED overlapped_write; char buf[0x1000]; int pos; int len; BOOL eof; BOOL readBuffer(); uchar readChar(); public: ObjectPipe(HANDLE pipe); String* readString(); Object* readObject(); void writeStr(const String* obj); void writeObject(const Object* obj); void error(); ~ObjectPipe(); }; // ----------------------------------------------------------------------------------- /* Ole DoDragDrop "swallows" messages. After extensive study of it the simplest solution is just to implement and use its' equvivalent that does not. At least for internal purposes. DropTargets that expect out-of-the application drop should still register with OLE32 */ struct DnD { static void init(); static HRESULT registerDragDrop(HWND hwnd, LPDROPTARGET pDropTarget); static HRESULT revokeDragDrop(HWND hwnd); static HRESULT doDragDrop(IDataObject *pDataObject, IDropSource* pDropSource, dword dwOKEffect, dword *pdwEffect); static void fini(); }; // ----------------------------------------------------------------------------------- class ApplicationTester implements BroadcastListener { HANDLE pipe; HANDLE pipe_reader; ObjectPipe object_pipe; HashMap str_map; void Tester(HANDLE pipe); void eventReceived(const Message& message); static dword WINAPI pipeReaderThread(void* arg); ApplicationTester(HANDLE h); public: static void init(); static void fini(); }; // ----------------------------------------------------------------------------------- struct Resources { static String* getString(int id) { ByteArray* data = getData(id); String* s = String::fromUTF8((const char*)(byte*)*data); delete data; return s; } static Image* getImage(int id) { ByteArray* data = getData(id); ByteArrayInputStream s(data); Image* i = new Image(&s); delete data; return i; } static ByteArray* getData(int id) { HINSTANCE instance = GetModuleHandle(null); HRSRC h = FindResource(instance, MAKEINTRESOURCE(id), RT_RCDATA); HGLOBAL g = LoadResource(instance, h); int size = (int)SizeofResource(instance, h); byte* rc = (byte*)LockResource(g); return new ByteArray(rc, size); } }; // ----------------------------------------------------------------------------------- struct HourglassCursor { HourglassCursor() { save = SetCursor(LoadCursor(null, IDC_WAIT)); } virtual ~HourglassCursor() { SetCursor(save); save = null; } private: HCURSOR save; }; // ----------------------------------------------------------------------------------- // These functions must be implemented by the application: HWND getApplicationMainWindow(); int winMain(HINSTANCE instance, int argc, uchar* argv[], uchar* env, int show);
[ "leo.kuznetsov@e731d3c6-f9ae-11de-973d-3ba8dba7af4f" ]
[ [ [ 1, 2894 ] ] ]
7717be660bf3132277a26bc77d956cf45dc8bc01
501b10e5d60b94df94391345cbb61893fdc09e0d
/Source/Transforms/itkBSplineSecondOrderDerivativeKernelFunction2.h
048867b91dfea527b1cadabae3a30c04ff32416f
[]
no_license
midas-journal/midas-journal-756
944187f60c294efc1bf17cd99791d7e8e01b6d7b
bdf6c3e99c074a6eb035e0941bffb265d2539514
refs/heads/master
2021-01-25T03:49:26.250649
2011-08-22T13:47:31
2011-08-22T13:47:31
2,248,740
0
0
null
null
null
null
UTF-8
C++
false
false
5,085
h
/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: itkBSplineSecondOrderDerivativeKernelFunction2.h,v $ Language: C++ Date: $Date: 2008-06-25 11:00:19 $ Version: $Revision: 1.7 $ Copyright (c) Insight Software Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __itkBSplineSecondOrderDerivativeKernelFunction2_h #define __itkBSplineSecondOrderDerivativeKernelFunction2_h #include "itkKernelFunction.h" #include "vnl/vnl_math.h" namespace itk { /** \class BSplineSecondOrderDerivativeKernelFunction2 * \brief Derivative of a BSpline kernel used for density estimation and * nonparametric regression. * * This class encapsulates the derivative of a B-spline kernel for * density estimation or nonparametric regression. * See documentation for KernelFunction for more details. * * This class is templated over the spline order. * \warning Evaluate is only implemented for spline order 1 to 4 * * \sa KernelFunction * * \ingroup Functions */ template <unsigned int VSplineOrder = 3> class ITK_EXPORT BSplineSecondOrderDerivativeKernelFunction2 : public KernelFunction { public: /** Standard class typedefs. */ typedef BSplineSecondOrderDerivativeKernelFunction2 Self; typedef KernelFunction Superclass; typedef SmartPointer<Self> Pointer; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Run-time type information (and related methods). */ itkTypeMacro(BSplineSecondOrderDerivativeKernelFunction2, KernelFunction); /** Enum of for spline order. */ itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder); // /** Evaluate the function. */ // inline double Evaluate( const double & u ) const // { // return ( m_KernelFunction->Evaluate( u + 0.5 ) - // m_KernelFunction->Evaluate( u - 0.5 ) ); // } /** Evaluate the function. */ inline double Evaluate( const double & u ) const { return this->Evaluate( Dispatch<VSplineOrder>(), u ); } protected: BSplineSecondOrderDerivativeKernelFunction2(){}; ~BSplineSecondOrderDerivativeKernelFunction2(){}; void PrintSelf(std::ostream& os, Indent indent) const { Superclass::PrintSelf( os, indent ); os << indent << "Spline Order: " << SplineOrder << std::endl; } private: BSplineSecondOrderDerivativeKernelFunction2(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented /** Structures to control overloaded versions of Evaluate */ struct DispatchBase {}; template<unsigned int> struct Dispatch : DispatchBase {}; /** Zeroth order spline. * inline double Evaluate (const Dispatch<0>&, const double & u) const { double absValue = vnl_math_abs( u ); if ( absValue < 0.5 ) { return 1.0; } else if ( absValue == 0.5 ) { return 0.5; } else { return 0.0; } }*/ /** First order spline * inline double Evaluate ( const Dispatch<1>&, const double& u) const { double absValue = vnl_math_abs( u ); if ( absValue < 1.0 ) { return -vnl_math_sgn( u ); } else if ( absValue == 1.0 ) { return -vnl_math_sgn( u ) / 2.0; } else { return 0.0; } }*/ /** Second order spline. */ inline double Evaluate ( const Dispatch<2>&, const double& u) const { double absValue = vnl_math_abs( u ); if ( absValue < 0.5 ) { return -2.0; } else if ( absValue == 0.5 ) { return -0.5; } else if ( absValue < 1.5 ) { return 1.0; } else if ( absValue == 1.5 ) { return 0.5; } else { return 0.0; } } /** Third order spline. */ inline double Evaluate ( const Dispatch<3>&, const double& u) const { const double absValue = vnl_math_abs( u ); if ( absValue < 1.0 ) { return vnl_math_sgn0( u ) * ( 3.0 * u ) - 2.0; } else if ( absValue < 2.0 ) { return -vnl_math_sgn( u ) * u + 2.0; } else { return 0.0; } } /** Unimplemented spline order */ inline double Evaluate ( const DispatchBase&, const double&) const { itkExceptionMacro("Evaluate not implemented for spline\ order " << SplineOrder); return 0.0; // This is to avoid compiler warning about missing // return statement. It should never be evaluated. } }; } // end namespace itk #endif
[ [ [ 1, 195 ] ] ]
46499fed7a79e2f5fc0270ba2704a11267ea690d
668dc83d4bc041d522e35b0c783c3e073fcc0bd2
/fbide-vs/Sdk/V8/v8-debug.h
b4b1f6dbc94764f23e2e396d6ba3b235a5fd5aa1
[]
no_license
albeva/fbide-old-svn
4add934982ce1ce95960c9b3859aeaf22477f10b
bde1e72e7e182fabc89452738f7655e3307296f4
refs/heads/master
2021-01-13T10:22:25.921182
2009-11-19T16:50:48
2009-11-19T16:50:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,761
h
// Copyright 2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef V8_V8_DEBUG_H_ #define V8_V8_DEBUG_H_ #include "v8.h" #ifdef _WIN32 typedef int int32_t; typedef unsigned int uint32_t; typedef unsigned short uint16_t; // NOLINT typedef long long int64_t; // NOLINT // Setup for Windows DLL export/import. See v8.h in this directory for // information on how to build/use V8 as a DLL. #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\ build configuration to ensure that at most one of these is set #endif #ifdef BUILDING_V8_SHARED #define EXPORT __declspec(dllexport) #elif USING_V8_SHARED #define EXPORT __declspec(dllimport) #else #define EXPORT #endif #else // _WIN32 // Setup for Linux shared library export. See v8.h in this directory for // information on how to build/use V8 as shared library. #if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED) #define EXPORT __attribute__ ((visibility("default"))) #else // defined(__GNUC__) && (__GNUC__ >= 4) #define EXPORT #endif // defined(__GNUC__) && (__GNUC__ >= 4) #endif // _WIN32 /** * Debugger support for the V8 JavaScript engine. */ namespace v8 { // Debug events which can occur in the V8 JavaScript engine. enum DebugEvent { Break = 1, Exception = 2, NewFunction = 3, BeforeCompile = 4, AfterCompile = 5, ScriptCollected = 6 }; class EXPORT Debug { public: /** * A client object passed to the v8 debugger whose ownership will be taken by * it. v8 is always responsible for deleting the object. */ class ClientData { public: virtual ~ClientData() {} }; /** * A message object passed to the debug message handler. */ class Message { public: /** * Check type of message. */ virtual bool IsEvent() const = 0; virtual bool IsResponse() const = 0; virtual DebugEvent GetEvent() const = 0; /** * Indicate whether this is a response to a continue command which will * start the VM running after this is processed. */ virtual bool WillStartRunning() const = 0; /** * Access to execution state and event data. Don't store these cross * callbacks as their content becomes invalid. These objects are from the * debugger event that started the debug message loop. */ virtual Handle<Object> GetExecutionState() const = 0; virtual Handle<Object> GetEventData() const = 0; /** * Get the debugger protocol JSON. */ virtual Handle<String> GetJSON() const = 0; /** * Get the context active when the debug event happened. Note this is not * the current active context as the JavaScript part of the debugger is * running in it's own context which is entered at this point. */ virtual Handle<Context> GetEventContext() const = 0; /** * Client data passed with the corresponding request if any. This is the * client_data data value passed into Debug::SendCommand along with the * request that led to the message or NULL if the message is an event. The * debugger takes ownership of the data and will delete it even if there is * no message handler. */ virtual ClientData* GetClientData() const = 0; virtual ~Message() {} }; /** * Debug event callback function. * * \param event the type of the debug event that triggered the callback * (enum DebugEvent) * \param exec_state execution state (JavaScript object) * \param event_data event specific data (JavaScript object) * \param data value passed by the user to SetDebugEventListener */ typedef void (*EventCallback)(DebugEvent event, Handle<Object> exec_state, Handle<Object> event_data, Handle<Value> data); /** * Debug message callback function. * * \param message the debug message handler message object * \param length length of the message * \param client_data the data value passed when registering the message handler * A MessageHandler does not take posession of the message string, * and must not rely on the data persisting after the handler returns. * * This message handler is deprecated. Use MessageHandler2 instead. */ typedef void (*MessageHandler)(const uint16_t* message, int length, ClientData* client_data); /** * Debug message callback function. * * \param message the debug message handler message object * A MessageHandler does not take posession of the message data, * and must not rely on the data persisting after the handler returns. */ typedef void (*MessageHandler2)(const Message& message); /** * Debug host dispatch callback function. */ typedef void (*HostDispatchHandler)(); /** * Callback function for the host to ensure debug messages are processed. */ typedef void (*DebugMessageDispatchHandler)(); // Set a C debug event listener. static bool SetDebugEventListener(EventCallback that, Handle<Value> data = Handle<Value>()); // Set a JavaScript debug event listener. static bool SetDebugEventListener(v8::Handle<v8::Object> that, Handle<Value> data = Handle<Value>()); // Break execution of JavaScript. static void DebugBreak(); // Message based interface. The message protocol is JSON. NOTE the message // handler thread is not supported any more parameter must be false. static void SetMessageHandler(MessageHandler handler, bool message_handler_thread = false); static void SetMessageHandler2(MessageHandler2 handler); static void SendCommand(const uint16_t* command, int length, ClientData* client_data = NULL); // Dispatch interface. static void SetHostDispatchHandler(HostDispatchHandler handler, int period = 100); /** * Register a callback function to be called when a debug message has been * received and is ready to be processed. For the debug messages to be * processed V8 needs to be entered, and in certain embedding scenarios this * callback can be used to make sure V8 is entered for the debug message to * be processed. Note that debug messages will only be processed if there is * a V8 break. This can happen automatically by using the option * --debugger-auto-break. */ static void SetDebugMessageDispatchHandler( DebugMessageDispatchHandler handler); /** * Run a JavaScript function in the debugger. * \param fun the function to call * \param data passed as second argument to the function * With this call the debugger is entered and the function specified is called * with the execution state as the first argument. This makes it possible to * get access to information otherwise not available during normal JavaScript * execution e.g. details on stack frames. The following example show a * JavaScript function which when passed to v8::Debug::Call will return the * current line of JavaScript execution. * * \code * function frame_source_line(exec_state) { * return exec_state.frame(0).sourceLine(); * } * \endcode */ static Local<Value> Call(v8::Handle<v8::Function> fun, Handle<Value> data = Handle<Value>()); /** * Returns a mirror object for the given object. */ static Local<Value> GetMirror(v8::Handle<v8::Value> obj); /** * Enable the V8 builtin debug agent. The debugger agent will listen on the * supplied TCP/IP port for remote debugger connection. * \param name the name of the embedding application * \param port the TCP/IP port to listen on */ static bool EnableAgent(const char* name, int port); }; } // namespace v8 #undef EXPORT #endif // V8_V8_DEBUG_H_
[ "vongodric@957c6b5c-1c3a-0410-895f-c76cfc11fbc7" ]
[ [ [ 1, 272 ] ] ]
7b4abebc3ba9f48ee12e7598573be3799a72bedb
e2e41b28ec8db552a4f2148089dc995050ef69e8
/src/bindings/luascript/cpp-scripts/guards/sc_guard_ironforge.cpp
98ba3bef9ffae5cead7d8f045f106b086a039ec3
[]
no_license
bing2008/mangos-luascript
951e6f8a4db96a0c67d85958264804993b6352a5
041593c330681705fc5e7fb7393c6c3a356892d5
refs/heads/master
2021-08-27T15:28:50.017479
2006-12-12T14:19:27
2006-12-12T14:19:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,518
cpp
/* * Copyright (C) 2005,2006 ScriptDev <https://opensvn.csie.org/ScriptDev/> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "sc_defines.h" bool GossipHello_guard_ironforge(Player *player, Creature *_Creature) { player->ADD_GOSSIP_ITEM( 1, "Auction House" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->ADD_GOSSIP_ITEM( 6, "Bank of Ironforge" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->ADD_GOSSIP_ITEM( 4, "Deeprun Tram" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->ADD_GOSSIP_ITEM( 2, "Gryphon Master" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); player->ADD_GOSSIP_ITEM( 0, "Guild Master" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); player->ADD_GOSSIP_ITEM( 1, "The Inn" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); player->ADD_GOSSIP_ITEM( 4, "Mailbox" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); player->ADD_GOSSIP_ITEM( 5, "Stable Master" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); player->ADD_GOSSIP_ITEM( 0, "Weapons Trainer" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); player->ADD_GOSSIP_ITEM( 8, "Battlemaster" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); player->ADD_GOSSIP_ITEM( 3, "Class Trainer" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); player->ADD_GOSSIP_ITEM( 3, "Profession Trainer" , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); player->SEND_GOSSIP_MENU(2760, _Creature->GetGUID()); return true; } /******************************************************* * Start of GOSSIP_MENU *******************************************************/ void SendDefaultMenu_guard_ironforge(Player *player, Creature *_Creature, uint32 action) { if (action == GOSSIP_ACTION_INFO_DEF + 1)//Auction House { player->SEND_POI(-4957.39, -911.6, 6, 6, 0, "Ironforge Auction House"); player->SEND_GOSSIP_MENU(3014, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 2)//Bank { player->SEND_POI(-4891.91, -991.47, 6, 6, 0, "The Vault"); player->SEND_GOSSIP_MENU(2761, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 3)//Tram { player->SEND_POI(-4835.27, -1294.69, 6, 6, 0, "Deeprun Tram"); player->SEND_GOSSIP_MENU(3814, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 4)//Gryphon Master { player->SEND_POI(-4821.52, -1152.3, 6, 6, 0, "Ironforge Gryphon Master"); player->SEND_GOSSIP_MENU(2762, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 5)//Guild Master { player->SEND_POI(-5021, -996.45, 6, 6, 0, "Ironforge Visitor's Center"); player->SEND_GOSSIP_MENU(2764, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 6)//Inn { player->SEND_POI(-4850.47, -872.57, 6, 6, 0, "Stonefire Tavern"); player->SEND_GOSSIP_MENU(2768, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 7)//Mailbox { player->SEND_POI(-4845.7, -880.55, 6, 6, 0, "Ironforge Mailbox"); player->SEND_GOSSIP_MENU(2769, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 8)//Stable Master { player->SEND_POI(-5010.2, -1262, 6, 6, 0, "Ulbrek Firehand"); player->SEND_GOSSIP_MENU(5986, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 9)//Weapons Trainer { player->SEND_POI(-5040, -1201.88, 6, 6, 0, "Bixi and Buliwyf"); player->SEND_GOSSIP_MENU(4518, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 10)//Battlemaster { player->ADD_GOSSIP_ITEM( 8, "Alterac Valley" , GOSSIP_SENDER_SEC_BATTLEINFO, GOSSIP_ACTION_INFO_DEF + 1); player->ADD_GOSSIP_ITEM( 8, "Arathi Basin" , GOSSIP_SENDER_SEC_BATTLEINFO, GOSSIP_ACTION_INFO_DEF + 2); player->ADD_GOSSIP_ITEM( 8, "Warsong Gulch" , GOSSIP_SENDER_SEC_BATTLEINFO, GOSSIP_ACTION_INFO_DEF + 3); player->SEND_GOSSIP_MENU(7529, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 11)//Class Trainer { player->ADD_GOSSIP_ITEM( 3, "Hunter" , GOSSIP_SENDER_SEC_CLASSTRAIN, GOSSIP_ACTION_INFO_DEF + 1); player->ADD_GOSSIP_ITEM( 3, "Mage" , GOSSIP_SENDER_SEC_CLASSTRAIN, GOSSIP_ACTION_INFO_DEF + 2); player->ADD_GOSSIP_ITEM( 3, "Paladin" , GOSSIP_SENDER_SEC_CLASSTRAIN, GOSSIP_ACTION_INFO_DEF + 3); player->ADD_GOSSIP_ITEM( 3, "Priest" , GOSSIP_SENDER_SEC_CLASSTRAIN, GOSSIP_ACTION_INFO_DEF + 4); player->ADD_GOSSIP_ITEM( 3, "Rogue" , GOSSIP_SENDER_SEC_CLASSTRAIN, GOSSIP_ACTION_INFO_DEF + 5); player->ADD_GOSSIP_ITEM( 3, "Warlock" , GOSSIP_SENDER_SEC_CLASSTRAIN, GOSSIP_ACTION_INFO_DEF + 6); player->ADD_GOSSIP_ITEM( 3, "Warrior" , GOSSIP_SENDER_SEC_CLASSTRAIN, GOSSIP_ACTION_INFO_DEF + 7); player->SEND_GOSSIP_MENU(2766, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 12)//Profession Trainer { player->ADD_GOSSIP_ITEM( 3, "Alchemy" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 1); player->ADD_GOSSIP_ITEM( 3, "Blacksmithing" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 2); player->ADD_GOSSIP_ITEM( 3, "Cooking" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 3); player->ADD_GOSSIP_ITEM( 3, "Enchanting" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 4); player->ADD_GOSSIP_ITEM( 3, "Engineering" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 5); player->ADD_GOSSIP_ITEM( 3, "First Aid" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 6); player->ADD_GOSSIP_ITEM( 3, "Fishing" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 7); player->ADD_GOSSIP_ITEM( 3, "Herbalism" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 8); player->ADD_GOSSIP_ITEM( 3, "Leatherworking" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 9); player->ADD_GOSSIP_ITEM( 3, "Mining" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 10); player->ADD_GOSSIP_ITEM( 3, "Skinning" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 11); player->ADD_GOSSIP_ITEM( 3, "Tailoring" , GOSSIP_SENDER_SEC_PROFTRAIN, GOSSIP_ACTION_INFO_DEF + 12); player->SEND_GOSSIP_MENU(2793, _Creature->GetGUID()); } } void SendBattleMasterMenu_guard_ironforge(Player *player, Creature *_Creature, uint32 action) { if (action == GOSSIP_ACTION_INFO_DEF + 1)//AV { player->SEND_POI(-5047.87, -1263.77, 6, 6, 0, "Glordrum Steelbeard"); player->SEND_GOSSIP_MENU(7483, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 2)//AB { player->SEND_POI(-5038.37, -1266.39, 6, 6, 0, "Donal Osgood"); player->SEND_GOSSIP_MENU(7649, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 3)//WSG { player->SEND_POI(-5037.24, -1274.82, 6, 6, 0, "Lylandris"); player->SEND_GOSSIP_MENU(7528, _Creature->GetGUID()); } } void SendClassTrainerMenu_guard_ironforge(Player *player, Creature *_Creature, uint32 action) { if (action == GOSSIP_ACTION_INFO_DEF + 1)//Hunter { player->SEND_POI(-5023, -1253.68, 6, 6, 0, "Hall of Arms"); player->SEND_GOSSIP_MENU(2770, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 2)//Mage { player->SEND_POI(-4627, -926.45, 6, 6, 0, "Hall of Mysteries"); player->SEND_GOSSIP_MENU(2771, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 3)//Paladin { player->SEND_POI(-4627.02, -926.45, 6, 6, 0, "Hall of Mysteries"); player->SEND_GOSSIP_MENU(2773, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 4)//Priest { player->SEND_POI(-4627, -926.45, 6, 6, 0, "Hall of Mysteries"); player->SEND_GOSSIP_MENU(2772, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 5)//Rogue { player->SEND_POI(-4647.83, -1124, 6, 6, 0, "Ironforge Rogue Trainer"); player->SEND_GOSSIP_MENU(2774, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 6)//Warlock { player->SEND_POI(-4605, -1110.45, 6, 6, 0, "Ironforge Warlock Trainer"); player->SEND_GOSSIP_MENU(2775, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 7)//Warrior { player->SEND_POI(-5023.08, -1253.68, 6, 6, 0, "Hall of Arms"); player->SEND_GOSSIP_MENU(2776, _Creature->GetGUID()); } } void SendProfTrainerMenu_guard_ironforge(Player *player, Creature *_Creature, uint32 action) { if (action == GOSSIP_ACTION_INFO_DEF + 1)//Alchemy { player->SEND_POI(-4858.5, -1241.83, 6, 6, 0, "Berryfizz's Potions and Mixed Drinks"); player->SEND_GOSSIP_MENU(2794, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 2)//Blacksmithing { player->SEND_POI(-4796.97, -1110.17, 6, 6, 0, "The Great Forge"); player->SEND_GOSSIP_MENU(2795, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 3)//Cooking { player->SEND_POI(-4767.83, -1184.59, 6, 6, 0, "The Bronze Kettle"); player->SEND_GOSSIP_MENU(2796, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 4)//Enchanting { player->SEND_POI(-4803.72, -1196.53, 6, 6, 0, "Thistlefuzz Arcanery"); player->SEND_GOSSIP_MENU(2797, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 5)//Engineering { player->SEND_POI(-4799.56, -1250.23, 6, 6, 0, "Springspindle's Gadgets"); player->SEND_GOSSIP_MENU(2798, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 6)//First Aid { player->SEND_POI(-4881.6, -1153.13, 6, 6, 0, "Ironforge Physician"); player->SEND_GOSSIP_MENU(2799, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 7)//Fishing { player->SEND_POI(-4597.91, -1091.93, 6, 6, 0, "Traveling Fisherman"); player->SEND_GOSSIP_MENU(2800, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 8)//Herbalism { player->SEND_POI(-4876.9, -1151.92, 6, 6, 0, "Ironforge Physician"); player->SEND_GOSSIP_MENU(2801, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 9)//Leatherworking { player->SEND_POI(-4745, -1027.57, 6, 6, 0, "Finespindle's Leather Goods"); player->SEND_GOSSIP_MENU(2802, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 10)//Minning { player->SEND_POI(-4705.06, -1116.43, 6, 6, 0, "Deepmountain Mining Guild"); player->SEND_GOSSIP_MENU(2804, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 11)//Skinning { player->SEND_POI(-4745, -1027.57, 6, 6, 0, "Finespindle's Leather Goods"); player->SEND_GOSSIP_MENU(2805, _Creature->GetGUID()); } if (action == GOSSIP_ACTION_INFO_DEF + 12)//Tailoring { player->SEND_POI(-4719.60, -1056.96, 6, 6, 0, "Stonebrow's Clothier"); player->SEND_GOSSIP_MENU(2807, _Creature->GetGUID()); } } bool GossipSelect_guard_ironforge(Player *player, Creature *_Creature, uint32 sender, uint32 action ) { if (sender == GOSSIP_SENDER_MAIN) SendDefaultMenu_guard_ironforge(player, _Creature, action); if (sender == GOSSIP_SENDER_SEC_CLASSTRAIN) SendClassTrainerMenu_guard_ironforge(player, _Creature, action); if (sender == GOSSIP_SENDER_SEC_PROFTRAIN) SendProfTrainerMenu_guard_ironforge(player, _Creature, action); if (sender == GOSSIP_SENDER_SEC_BATTLEINFO) SendBattleMasterMenu_guard_ironforge(player, _Creature, action); return true; } /******************************************************* * End of GOSSIP_MENU *******************************************************/ void AddSC_guard_ironforge() { Script *newscript; newscript = new Script; newscript->Name="guard_ironforge"; newscript->pGossipHello = &GossipHello_guard_ironforge; newscript->pGossipSelect = &GossipSelect_guard_ironforge; m_scripts[nrscripts++] = newscript; }
[ "Derex101@f2ff2d62-ea21-0410-8eb0-7b0e83e86450" ]
[ [ [ 1, 314 ] ] ]
13ca6f28b43b26a6837eb03290b9b5a895565a45
2b80036db6f86012afcc7bc55431355fc3234058
/src/cube/TracklistModel.cpp
31dab3f4308c11faa36770f051134a0673cadf0f
[ "BSD-3-Clause" ]
permissive
leezhongshan/musikcube
d1e09cf263854bb16acbde707cb6c18b09a0189f
e7ca6a5515a5f5e8e499bbdd158e5cb406fda948
refs/heads/master
2021-01-15T11:45:29.512171
2011-02-25T14:09:21
2011-02-25T14:09:21
null
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
7,318
cpp
////////////////////////////////////////////////////////////////////////////// // // License Agreement: // // The following are Copyright © 2007, Casey Langen // // Sources and Binaries of: mC2, win32cpp // // 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 author nor the names of other 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. // ////////////////////////////////////////////////////////////////////////////// #pragma once ////////////////////////////////////////////////////////////////////////////// #include "pch.hpp" #include <cube/TracklistModel.hpp> #include <cube/TracklistColumn.hpp> #include <cube/TracklistController.hpp> #include <win32cpp/Utility.hpp> #include <win32cpp/ApplicationThread.hpp> #include <core/LibraryFactory.h> #include <core/PlaybackQueue.h> #include <core/MetaKey.h> #include <core/tracklist/MultiLibraryList.h> using namespace musik::cube; ////////////////////////////////////////////////////////////////////////////// /*ctor*/ TracklistModel::TracklistModel(musik::core::Query::ListBase *connectedQuery,musik::core::tracklist::Ptr setTracklist,unsigned int options) : currentPosition(-1) , options(options) { this->tracklist = setTracklist; this->SetRowCount(0); this->tracklist->TracklistChanged.connect(this,&TracklistModel::OnTracks); this->tracklist->TrackMetadataUpdated.connect(this,&TracklistModel::OnTrackMeta); this->tracklist->PositionChanged.connect(this,&TracklistModel::OnPositionChanged); this->ConnectToQuery(connectedQuery); // In case there are tracks in the list already. if(this->tracklist->Size()){ this->OnTracks(true); } } uistring TracklistModel::CellValueToString(int rowIndex, ColumnRef column) { TracklistColumn *tracklistColumn = (TracklistColumn*)column.get(); typedef boost::basic_format<uichar> format; musik::core::TrackPtr track = this->tracklist->TrackWithMetadata(rowIndex); if(track){ const utfchar *value = track->GetValue(tracklistColumn->metaKey.c_str()); if(value){ switch(tracklistColumn->metaKeyType){ case musik::core::MetaKey::Duration: UINT64 duration = boost::lexical_cast<int>(value); UINT64 days(duration/86400); duration = duration%86400; UINT64 hours(duration/3600); duration = duration%3600; UINT64 minutes(duration/60); duration = duration%60; utfstring result; if (minutes < 10) result += _T("0"); result += boost::lexical_cast<utfstring>(minutes) + _T(":"); if (duration < 10) result += _T("0"); result += boost::lexical_cast<utfstring>(duration); return win32cpp::Escape(result); break; } if(rowIndex==this->currentPosition && this->options&TracklistController::HighlightActive){ return win32cpp::Escape(value)+_T("***"); } return win32cpp::Escape(value); } } return _T(""); } void TracklistModel::OnTrackMeta(std::vector<long> trackPositions){ if(!win32cpp::ApplicationThread::InMainThread()){ std::vector<long> positionCopy(trackPositions); win32cpp::ApplicationThread::Call1(this,&TracklistModel::OnTrackMeta,positionCopy); return; } for(std::vector<long>::iterator row=trackPositions.begin();row!=trackPositions.end();++row){ this->InvalidateData(*row); } } void TracklistModel::OnTracks(bool cleared){ if(cleared){ this->SetRowCount(0); } this->SetRowCount(this->tracklist->Size()); } void TracklistModel::OnRowActivated(int row){ this->tracklist->SetPosition(row); musik::core::PlaybackQueue::Instance().Play(*this->tracklist); } void TracklistModel::OnPlayNow(win32cpp::ListView::RowIndexList& selectedRows){ // Create a temporary tracklist to put into the "now playing" tracklist musik::core::tracklist::Ptr selectedTracklist(new musik::core::tracklist::MultiLibraryList()); for(win32cpp::ListView::RowIndexList::iterator row=selectedRows.begin();row!=selectedRows.end();++row){ musik::core::TrackPtr track( (*this->tracklist)[*row] ); if(track){ (*selectedTracklist) += track; } } musik::core::PlaybackQueue::Instance().Play(*selectedTracklist); } void TracklistModel::OnEnqueue(win32cpp::ListView::RowIndexList& selectedRows){ // Create a temporary tracklist to put into the "now playing" tracklist musik::core::tracklist::Ptr selectedTracklist(new musik::core::tracklist::MultiLibraryList()); for(win32cpp::ListView::RowIndexList::iterator row=selectedRows.begin();row!=selectedRows.end();++row){ musik::core::TrackPtr track( (*this->tracklist)[*row] ); if(track){ (*selectedTracklist) += track; } } musik::core::PlaybackQueue::Instance().Append(*selectedTracklist); } void TracklistModel::ConnectToQuery(musik::core::Query::ListBase *connectedQuery){ if(connectedQuery){ this->tracklist->ConnectToQuery(*connectedQuery); } } void TracklistModel::OnPositionChanged(long activeRow,long oldActiveRow){ if(!win32cpp::ApplicationThread::InMainThread()){ win32cpp::ApplicationThread::Call2(this,&TracklistModel::OnPositionChanged,activeRow,oldActiveRow); return; } if(activeRow!=-1){ this->InvalidateData(activeRow); } if(oldActiveRow!=-1){ this->InvalidateData(oldActiveRow); } this->currentPosition = activeRow; }
[ "onnerby@6a861d04-ae47-0410-a6da-2d49beace72e", "bjorn.olievier@6a861d04-ae47-0410-a6da-2d49beace72e", "[email protected]@6a861d04-ae47-0410-a6da-2d49beace72e", "bart.apella@6a861d04-ae47-0410-a6da-2d49beace72e" ]
[ [ [ 1, 10 ], [ 12, 16 ], [ 19, 20 ], [ 36, 50 ], [ 52, 53 ], [ 55, 67 ], [ 72, 72 ], [ 74, 74 ], [ 80, 83 ], [ 88, 113 ], [ 115, 116 ], [ 118, 119 ], [ 131, 131 ], [ 136, 136 ], [ 140, 140 ], [ 143, 146 ], [ 148, 151 ], [ 153, 154 ], [ 156, 159 ], [ 161, 164 ], [ 166, 167 ], [ 169, 176 ], [ 178, 190 ] ], [ [ 11, 11 ], [ 17, 18 ], [ 21, 35 ], [ 51, 51 ], [ 68, 69 ], [ 73, 73 ], [ 84, 87 ], [ 117, 117 ], [ 120, 121 ], [ 129, 130 ], [ 132, 135 ], [ 137, 139 ] ], [ [ 54, 54 ], [ 70, 71 ], [ 75, 79 ], [ 122, 128 ], [ 141, 142 ], [ 147, 147 ], [ 152, 152 ], [ 155, 155 ], [ 160, 160 ], [ 165, 165 ], [ 168, 168 ], [ 177, 177 ] ], [ [ 114, 114 ] ] ]
da9aef546a280493e8a01fef0c32dc1f3e7a5db7
f9ed86de48cedc886178f9e8c7ee4fae816ed42d
/src/scene.h
5b1b4416ecb39771f8eee4de5e637e1d75f279f3
[ "MIT" ]
permissive
rehno-lindeque/Flower-of-Persia
bf78d144c8e60a6f30955f099fe76e4a694ec51a
b68af415a09b9048f8b8f4a4cdc0c65b46bcf6d2
refs/heads/master
2021-01-25T04:53:04.951376
2011-01-29T11:41:38
2011-01-29T11:41:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
10,590
h
#ifndef __SCENE_H__ #define __SCENE_H__ class Scene { protected: GLuint staticGeometry; list<Cloth*> cloths; public: void build() { X_YZUVGenerator globalUVGenerator(1/4.0); uvMap0 = &globalUVGenerator; //*removed4debug: pool.build(); railing.build(railShader.tangentLocation, railShader.binormalLocation); roomFloor.build(); portal.build(); pillar.build(); pot.build(); walls.build(); roof.build(); steps.build(); arch.build(); singleDoor.build(); doubleDoor.build(); //pot.build(); cloth1.build(); cloth2.build(); cloth3.build(); cloth4.build(); cloth5.build(); cloth6.build(); /*staticGeometry = glGenLists(1); glNewList(staticGeometry, GL_COMPILE); glPushMatrix(); glBindTexture(GL_TEXTURE_2D, textures.get(0)); pool.render(); railing.render(); portal.render(); pillar.render(); walls.render(); roomFloor.render(); roof.render(); steps.render(); glPopMatrix(); glEndList();*/ cloths.push_back(&cloth1); cloths.push_back(&cloth2); cloths.push_back(&cloth3); cloths.push_back(&cloth4); cloths.push_back(&cloth5); cloths.push_back(&cloth6); } struct comp_model_distance : public binary_function <Cloth*, Cloth*, bool> { #ifdef __GNUC__ bool operator()(Cloth*& _Left, Cloth*& _Right) const #else bool operator()(const Cloth*& _Left, const Cloth*& _Right) const #endif { float leftDistance = (camera.position - _Left->position).getLength(); float rightDistance = (camera.position - _Right->position).getLength(); return leftDistance > rightDistance; return true; } }; void renderCloths() { //glDepthMask(GL_FALSE); clothShader.activate(); //glDisable(GL_TEXTURE_2D); glEnable(GL_BLEND); glDisable(GL_CULL_FACE); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(1.0f, 1.0f, 1.0f, 0.8f); if(enableTextures) glBindTexture(GL_TEXTURE_2D, textures.get(4)); clothShader.setCameraPosition(camera.position); glBegin(GL_QUADS); cloths.sort(comp_model_distance()); for(std::list<Cloth*>::iterator i = cloths.begin(); i != cloths.end(); i++) (*i)->render(); glEnd(); FragmentShader::restoreFixedFunction(); glEnable(GL_CULL_FACE); glDisable(GL_BLEND); //glDepthMask(GL_TRUE); } void renderEnv() { //*removed4debug: //glClearColor(0.0, 0.2, 1.0, 0.0); glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); //glDepthFunc(GL_GREATER); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // floor shader floorShader.activate(); floorShader.setTexture(0); // bind color texture to texture unit #0 floorShader.setShadowmap(2); // bind shadow map to texture unit #2 glActiveTexture(GL_TEXTURE2); glEnable(GL_TEXTURE_CUBE_MAP); glBindTexture(GL_TEXTURE_CUBE_MAP, light0Shadowmap.getTexture()); glActiveTexture(GL_TEXTURE0); pillar.render(); pot.render(); glBindTexture(GL_TEXTURE_2D, textures.get(0)); pool.render(); portal.render(); walls.render(); roomFloor.render(); steps.render(); roof.render(); arch.render(); singleDoor.render(); doubleDoor.render(); //* railShader.activate(); glActiveTexture(GL_TEXTURE1); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, textures.get(9)); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textures.get(5)); railShader.setCameraPosition(camera.position); railing.render();//*/ fogShader.activate(); pool.renderBottom(); //*/ shadowShader.activate(); shadowShader.setTexture(0); shadowShader.setShadowTexture(1); glActiveTexture(GL_TEXTURE0); //multi-texturing glBindTexture(GL_TEXTURE_2D, textures.get(7)); glActiveTexture(GL_TEXTURE1); //multi-texturing glBindTexture(GL_TEXTURE_2D, textures.get(8)); roomFloor.renderPlatforms(); renderCloths(); pool.renderWater(); //glDepthFunc(GL_LESS); } void render() { /* render shadow maps: */ // render ViewCube (temp) //*removed4debug: glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0, -5.0, 0.0); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); //glRotatef(180.0, 0.0, 0.0, 1.0); gluPerspective(90.0, 1.0, 0.01, 500.0); //glTranslatef(0.0, tempH, 0.0); glViewport(0, 0, 512, 512); //glMatrixMode(GL_MODELVIEW); viewCubeCubemap.bind(); viewCubeRenderFrame.bind(GL_TEXTURE_CUBE_MAP_POSITIVE_X); glRotatef(90.0, 0.0, 1.0, 0.0); renderEnv(); viewCubeRenderFrame.bind(GL_TEXTURE_CUBE_MAP_NEGATIVE_X); glRotatef(180.0, 0.0, 1.0, 0.0); renderEnv(); viewCubeRenderFrame.bind(GL_TEXTURE_CUBE_MAP_POSITIVE_Y); //glRotatef(180.0, 0.0, 1.0, 0.0); //glRotatef(90.0, 0.0, 1.0, 0.0); //glRotatef(90.0, 0.0, 0.0, 1.0); //glRotatef(-90.0, 0.0, 1.0, 0.0); glRotatef(-90.0, 0.0, 0.0, 1.0); glRotatef(90.0, 0.0, 1.0, 0.0); renderEnv(); viewCubeRenderFrame.bind(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y); glRotatef(180.0, 1.0, 0.0, 0.0); renderEnv(); viewCubeRenderFrame.bind(GL_TEXTURE_CUBE_MAP_POSITIVE_Z); glRotatef(90.0, 1.0, 0.0, 0.0); renderEnv(); viewCubeRenderFrame.bind(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z); glRotatef(180.0, 0.0, 1.0, 0.0); renderEnv(); viewCubeRenderFrame.unbind(); //glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, windowWidth, windowHeight); viewCubeShader.activate(); glTranslatef(0.0, 5.0, 0.0); viewCube.render(); glLoadIdentity(); Shader::restoreFixedFunction(); viewCubeCubemap.unbind(); // get the light at (0,0,0) /*glPushMatrix(); glLoadIdentity(); //??? glClear(GL_DEPTH_BUFFER_BIT); glTranslatef(-light0.position[0], -light0.position[1], -light0.position[2]); //todo: set up the projection??? // activate the shadow map render target light0renderFrame.bind(); // render depths shadowdepthShader.activate(); portal.render(); Shader::restoreFixedFunction(); // deactivate the shadow map render target light0renderFrame.unbind(); // reset world view glPopMatrix();*/ /* render scene */ // set uv mapping XZUVGenerator globalUVGenerator(1/8.0); uvMap0 = &globalUVGenerator; // render static geometry //glScalef(2.0f, 2.0f, 2.0f); //glCallList(staticGeometry); // Cloth railings if(enableTextures) glBindTexture(GL_TEXTURE_2D, textures.get(0)); glBegin(GL_QUADS); drawZCylinder(Vector3(-4.0f, 8.5f, -22.0f), 0.05f, 28.0f, 5); drawZCylinder(Vector3( 4.0f, 8.5f, -22.0f), 0.05f, 28.0f, 5); glEnd(); /* pillar.render(); glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); railing.render(); glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT); glColor3f(0.5f, 0.5f, 0.5f); glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); //pot.render();*/ /*if(enableTextures) glBindTexture(GL_TEXTURE_2D, textures.get(0));*/ //pool.render(); //portal.render(); /*if(enableTextures) glBindTexture(GL_TEXTURE_2D, textures.get(0));*/ //glDisable(GL_TEXTURE_2D); //perPixelDiffuseFragmentShader.activate(); //3621072 floorShader.activate(); // bind color texture to texture unit #0 floorShader.setTexture(0); // bind shadow map to texture unit #2 floorShader.setShadowmap(2); glActiveTexture(GL_TEXTURE2); glEnable(GL_TEXTURE_CUBE_MAP); glBindTexture(GL_TEXTURE_CUBE_MAP, light0Shadowmap.getTexture()); glActiveTexture(GL_TEXTURE0); pillar.render(); pot.render(); //if(enableTextures) glBindTexture(GL_TEXTURE_2D, textures.get(0)); pool.render(); portal.render(); walls.render(); roomFloor.render(); steps.render(); roof.render(); arch.render(); singleDoor.render(); doubleDoor.render(); railShader.activate(); glActiveTexture(GL_TEXTURE1); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, textures.get(9)); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textures.get(5)); railShader.setCameraPosition(camera.position); railing.render(); fogShader.activate(); pool.renderBottom(); shadowShader.activate(); shadowShader.setTexture(0); shadowShader.setShadowTexture(1); glActiveTexture(GL_TEXTURE0); //multi-texturing glBindTexture(GL_TEXTURE_2D, textures.get(7)); glActiveTexture(GL_TEXTURE1); //multi-texturing //glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, textures.get(8)); roomFloor.renderPlatforms(); //FragmentShader::restoreFixedFunction(); //steps.render(); //roof.render(); //arch.render(); //singleDoor.render(); //doubleDoor.render(); //pool.renderBottom(); if(camera.position(2) > -8.0) { // render cloths renderCloths(); pool.renderWater(); } else { FragmentShader::restoreFixedFunction(); pool.renderWater(); // render cloths renderCloths(); } /* render normals */ if(showNormals) { glDisable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); glColor3f(1.0f, 0.0f, 0.0f); pool.renderNormals(); railing.renderNormals(); portal.renderNormals(); pillar.renderNormals(); walls.renderNormals(); roomFloor.renderNormals(); steps.renderNormals(); roof.renderNormals(); arch.renderNormals(); singleDoor.renderNormals(); doubleDoor.renderNormals(); //pot.renderNormals glBegin(GL_LINES); cloth1.renderNormals(); cloth2.renderNormals(); cloth3.renderNormals(); cloth4.renderNormals(); cloth5.renderNormals(); cloth6.renderNormals(); glEnd(); glEnable(GL_LIGHTING); if(enableTextures) glEnable(GL_TEXTURE_2D); }//*/ } }; #endif
[ [ [ 1, 382 ] ] ]
88084e184f7f8055f34925d1b607462f7af1e6e9
d22b77645ee83ee72fed70cb2a3ca4fb268ada4a
/kennel/Kennel.cpp
eaaae037b637f2147b0166bed8fb5fbc65e1e5db
[]
no_license
catid/Splane
8f94f7d8983cf994955e599fc53ce6f763157486
c9f79f0034d1762948b7c26e42f50f58793067ac
refs/heads/master
2020-04-26T00:28:48.571474
2010-06-02T05:37:43
2010-06-02T05:37:43
628,653
1
0
null
null
null
null
UTF-8
C++
false
false
2,125
cpp
/* Copyright (c) 2009-2010 Christopher A. Taylor. 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 LibCat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "FormMain.hpp" using namespace cat; const char *SETTINGS_FILE_PATH = "Kennel.cfg"; int QtMain(char *arg) { int argc = 1; char *argv[1] = {arg}; QApplication app(argc, argv); FormMain *dialog = new FormMain; dialog->show(); return app.exec(); } //// Entrypoint int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { if (!InitializeFramework(SETTINGS_FILE_PATH)) { FatalStop("Unable to initialize framework!"); } QtMain(lpCmdLine); ShutdownFramework(true); return 0; }
[ "kuang@.(none)" ]
[ [ [ 1, 62 ] ] ]
3be8c479439094f0978cd7bc6d5e3f35e9ea7ffb
6c8c4728e608a4badd88de181910a294be56953a
/OgreRenderingModule/EC_OgreSky.cpp
7b0b2c2ef973522fe39d9671ebff7dab68b02cd9
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
caocao/naali
29c544e121703221fe9c90b5c20b3480442875ef
67c5aa85fa357f7aae9869215f840af4b0e58897
refs/heads/master
2021-01-21T00:25:27.447991
2010-03-22T15:04:19
2010-03-22T15:04:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
15,799
cpp
// For conditions of distribution and use, see copyright notice in license.txt #include "StableHeaders.h" #include "Foundation.h" #include "OgreRenderingModule.h" #include "Renderer.h" #include "EC_OgreSky.h" #include "ConversionUtils.h" #include <Ogre.h> namespace OgreRenderer { EC_OgreSky::EC_OgreSky(Foundation::ModuleInterface* module) : Foundation::ComponentInterface(module->GetFramework()), renderer_(checked_static_cast<OgreRenderingModule*>(module)->GetRenderer()), owner_(module), skyEnabled_(false), type_(SKYTYPE_BOX), currentSkyBoxImageCount_(0) { skyBoxImages_.resize(6); ///\todo GetSkyConfig() } EC_OgreSky::~EC_OgreSky() { DisableSky(); } /*void EC_OgreSky::CreateDefaultSkybox() { DisableSky(); Ogre::SceneManager* scene_mgr = renderer_->GetSceneManager(); try { scene_mgr->setSkyBox(true, genericSkyParameters.material, genericSkyParameters.distance); skyEnabled_ = true; } catch (Ogre::Exception& e) { OgreRenderingModule::LogError("Could not set skybox: " + std::string(e.what())); } }*/ void EC_OgreSky::CreateSky(bool show) { if (renderer_.expired()) return; RendererPtr renderer = renderer_.lock(); DisableSky(); Ogre::SceneManager* scene_mgr = renderer->GetSceneManager(); /*RexTypes::Vector3 v = genericSkyParameters.angleAxis; Ogre::Quaternion orientation(Ogre::Degree(genericSkyParameters.angle), Ogre::Vector3(v.x, v.y, v.z));*/ ///\todo Get the sky type and other parameters from the config file. switch(type_) { case SKYTYPE_BOX: { Ogre::MaterialPtr skyMaterial = Ogre::MaterialManager::getSingleton().getByName(skyBoxParameters.material); skyMaterial->setReceiveShadows(false); try { RexTypes::Vector3 v = skyBoxParameters.angleAxis; Ogre::Quaternion orientation(Ogre::Degree(skyBoxParameters.angle), Ogre::Vector3(v.x, v.y, v.z)); scene_mgr->setSkyBox(show, skyBoxParameters.material, skyBoxParameters.distance, skyBoxParameters.drawFirst, orientation); } catch (Ogre::Exception& e) { OgreRenderingModule::LogError("Could not set SkyBox: " + std::string(e.what())); return; } skyEnabled_ = true; break; } case SKYTYPE_DOME: try { RexTypes::Vector3 v = skyDomeParameters.angleAxis; Ogre::Quaternion orientation(Ogre::Degree(skyDomeParameters.angle), Ogre::Vector3(v.x, v.y, v.z)); scene_mgr->setSkyDome(show, skyDomeParameters.material, skyDomeParameters.curvature, skyDomeParameters.tiling, skyDomeParameters.distance, skyDomeParameters.drawFirst, orientation, skyDomeParameters.xSegments, skyDomeParameters.ySegments, skyDomeParameters.ySegmentsKeep); } catch (Ogre::Exception& e) { OgreRenderingModule::LogError("Could not set SkyDome: " + std::string(e.what())); return; } skyEnabled_ = true; break; case SKYTYPE_PLANE: try { ///\todo Ogre::Plane plane; plane.d = skyPlaneParameters.distance; plane.normal = Ogre::Vector3::NEGATIVE_UNIT_Z; scene_mgr->setSkyPlane(true, plane, skyPlaneParameters.material, skyPlaneParameters.scale, skyPlaneParameters.tiling, true, skyPlaneParameters.bow, skyPlaneParameters.xSegments, skyPlaneParameters.ySegments); } catch (Ogre::Exception& e) { OgreRenderingModule::LogError("Could not set SkyPlane: " + std::string(e.what())); return; } skyEnabled_ = true; break; case SKYTYPE_NONE: default: skyEnabled_ = false; break; } } /*bool EC_OgreSky::SetSkyBox(const std::string& material_name, Real distance) { if (renderer_.expired()) return false; RendererPtr renderer = renderer_.lock(); DisableSky(); Ogre::SceneManager* scene_mgr = renderer->GetSceneManager(); try { scene_mgr->setSkyBox(true, material_name, distance); } catch (Ogre::Exception& e) { OgreRenderingModule::LogError("Could not set SkyBox: " + std::string(e.what())); return false; } skyEnabled_ = true; return true; }*/ StringVector EC_OgreSky::GetMaterialTextureNames() { StringVector texture_names; Ogre::MaterialPtr skyMaterial; switch(type_) { case OgreRenderer::SKYTYPE_BOX: skyMaterial = Ogre::MaterialManager::getSingleton().getByName(skyBoxParameters.material); break; case OgreRenderer::SKYTYPE_DOME: skyMaterial = Ogre::MaterialManager::getSingleton().getByName(skyDomeParameters.material); break; case OgreRenderer::SKYTYPE_PLANE: skyMaterial = Ogre::MaterialManager::getSingleton().getByName(skyPlaneParameters.material); break; } if (!skyMaterial.isNull()) { Ogre::TextureUnitState *texture_state = skyMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0); if (texture_state) for(uint i = 0; i < texture_state->getNumFrames(); i++) texture_names.push_back(texture_state->getFrameTextureName(i)); //Ogre::String textures = texture_state->getTextureName(); //texture_names = Ogre::StringConverter::parseStringVector(textures); } return texture_names; } void EC_OgreSky::DisableSky() { if (renderer_.expired()) return; RendererPtr renderer = renderer_.lock(); Ogre::SceneManager* scene_mgr = renderer->GetSceneManager(); scene_mgr->setSkyBox(false, ""); scene_mgr->setSkyDome(false, ""); scene_mgr->setSkyPlane(false, Ogre::Plane(), ""); skyEnabled_ = false; } void EC_OgreSky::GetSkyConfig() { ///\todo Read different parameters from the config file. } void EC_OgreSky::SetSkyBoxMaterialTexture(int index, const char *texture_name, size_t image_count/*const SkyImageData *imageData*/) { type_ = SKYTYPE_BOX; //genericSkyParameters.disance = distance; // The SkyBox textures are upside down, because there is no easy way to flip cubemap textures vertically. // skyBoxImages_.resize(6); skyBoxImages_[index] = texture_name; ++currentSkyBoxImageCount_; if (currentSkyBoxImageCount_ == image_count) { Ogre::MaterialPtr skyMaterial = Ogre::MaterialManager::getSingleton().getByName(skyBoxParameters.material); if (!skyMaterial.isNull() && image_count == 6) { skyMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setCubicTextureName(&skyBoxImages_[0], false); //skyMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureScale(1, -1); CreateSky(); currentSkyBoxImageCount_ = 0; } else if(image_count < 6) // If all materials textures dont need to be changed, use code below. { for(uint i = 0; i < 6; i++) { if(skyBoxImages_[i] != "") skyMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setFrameTextureName(Ogre::String(skyBoxImages_[i]), i); } CreateSky(); currentSkyBoxImageCount_ = 0; } ///\todo /* // Lets create scaled down cubemap texture for water reflections. // We apparently need to create a separate cubemap texture for the environment map as // there's no way to use the existing ones. It's also good idea to scale the cubemap down since // it doesn't need to be very accurate. // For ease, we create scaled down versions of the skybox textures and then copy the new textures into // cubemap faces and afterwards remove the new scaled down textures. std::vector<Ogre::TexturePtr> scaledTextures; scaledTextures.reserve(skyBoxImageCount_); for (size_t n = 0; n < skyBoxImages_.size(); ++n) { Ogre::String defaultTextureName = skyBoxImages_[n]; if (!defaultTextureName.empty()) { Ogre::TexturePtr defaultTexture = Ogre::TextureManager::getSingleton().getByName(defaultTextureName); if (!defaultTexture.isNull()) { Ogre::uint width = std::max(defaultTexture->getWidth() / 2, (Ogre::uint)2); Ogre::uint height = std::max(defaultTexture->getHeight() / 2, (Ogre::uint)2); Ogre::TexturePtr newTexture = Ogre::TextureManager::getSingleton().createManual("scaled" + Ogre::StringConverter::toString(n), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, width, height, Ogre::MIP_UNLIMITED, defaultTexture->getBuffer()->getFormat()); defaultTexture->copyToTexture(newTexture); scaledTextures.push_back(newTexture); } } } Ogre::TexturePtr cubeTex = (Ogre::TexturePtr)Ogre::TextureManager::getSingleton().getByName("RexSkyboxCubic"); if (cubeTex.isNull()) { Ogre::TexturePtr tex = scaledTextures[0]; cubeTex = Ogre::TextureManager::getSingleton().createManual("RexSkyboxCubic", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_CUBE_MAP, tex->getWidth(), tex->getHeight(), tex->getDepth(), tex->getNumMipmaps(), tex->getBuffer()->getFormat()); } const int side[] = {3, 2, 4, 5, 0, 1}; for (int i = 0; i < skyBoxImageCount_; ++i) { size_t index = side[i]; if (index < scaledTextures.size()) { Ogre::TexturePtr face = scaledTextures[index]; Ogre::HardwarePixelBufferSharedPtr buffer = cubeTex->getBuffer(i); buffer->blit(face->getBuffer()); } } for(n = 0; n < scaledTextures.size(); ++n) Ogre::TextureManager::getSingleton().remove(static_cast<Ogre::ResourcePtr>(scaledTextures[n])); ///\todo Update water reflection Ogre::MaterialPtr waterMaterial = Ogre::MaterialManager::getSingleton().getByName(mWaterMaterial); if (!waterMaterial.isNull()) { llinfos << "Updating water material..." << llendl; Ogre::TextureUnitState* state = waterMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(1); state->setCubicTextureName("RexSkyboxCubic", true); state->setTextureCoordSet(1); }*/ } } void EC_OgreSky::SetSkyDomeMaterialTexture(const char *texture_name) { type_ = SKYTYPE_DOME; Ogre::MaterialPtr skyMaterial = Ogre::MaterialManager::getSingleton().getByName(skyDomeParameters.material); if (!skyMaterial.isNull()) { skyMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(texture_name); skyMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureAddressingMode(Ogre::TextureUnitState::TAM_WRAP); CreateSky(); } } void EC_OgreSky::SetSkyPlaneMaterialTexture(const char *texture_name) { type_ = SKYTYPE_PLANE; // const Ogre::String &texture = src_vi->getOgreTexture()->getName(); Ogre::MaterialPtr skyMaterial = Ogre::MaterialManager::getSingleton().getByName(skyPlaneParameters.material); if (!skyMaterial.isNull()) { skyMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(texture_name); skyMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureAddressingMode(Ogre::TextureUnitState::TAM_WRAP); CreateSky(); } } void EC_OgreSky::SetSkyDomeParameters(const SkyDomeParameters &params, bool update_sky) { skyDomeParameters.material = params.material; skyDomeParameters.curvature = params.curvature; skyDomeParameters.tiling = params.tiling; skyDomeParameters.distance = params.distance; skyDomeParameters.xSegments = params.xSegments; skyDomeParameters.ySegments = params.ySegments; skyDomeParameters.ySegmentsKeep = params.ySegmentsKeep; skyDomeParameters.drawFirst = params.drawFirst; skyDomeParameters.angle = params.angle; skyDomeParameters.angleAxis = params.angleAxis; if(update_sky) { type_ = SKYTYPE_DOME; CreateSky(); } } void EC_OgreSky::SetSkyPlaneParameters(const SkyPlaneParameters &params, bool update_sky) { skyPlaneParameters.material = params.material; skyPlaneParameters.bow = params.bow; skyPlaneParameters.scale = params.scale; skyPlaneParameters.tiling = params.tiling; skyPlaneParameters.distance = params.distance; skyPlaneParameters.xSegments = params.xSegments; skyPlaneParameters.ySegments = params.ySegments; skyPlaneParameters.drawFirst = params.drawFirst; if(update_sky) { type_ = SKYTYPE_PLANE; CreateSky(); } } void EC_OgreSky::SetSkyBoxParameters(const SkyBoxParameters &params, bool update_sky) { skyBoxParameters.material = params.material; skyBoxParameters.angle = params.angle; skyBoxParameters.angleAxis = params.angleAxis; skyBoxParameters.distance = params.distance; skyBoxParameters.drawFirst = params.drawFirst; if(update_sky) { type_ = SKYTYPE_BOX; CreateSky(); } } RexTypes::RexAssetID EC_OgreSky::GetSkyDomeTextureID() const { RexTypes::RexAssetID textureID = ""; Ogre::MaterialPtr skyMaterial = Ogre::MaterialManager::getSingleton().getByName(skyDomeParameters.material); if (!skyMaterial.isNull()) { textureID = skyMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->getFrameTextureName(0); } return textureID; } RexTypes::RexAssetID EC_OgreSky::GetSkyPlaneTextureID() const { RexTypes::RexAssetID textureID = ""; Ogre::MaterialPtr skyMaterial = Ogre::MaterialManager::getSingleton().getByName(skyPlaneParameters.material); if (!skyMaterial.isNull()) { textureID = skyMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->getFrameTextureName(0); } return textureID; } RexTypes::RexAssetID EC_OgreSky::GetSkyBoxTextureID(uint texuture_index) const { if(texuture_index >= 6) texuture_index = 5; RexTypes::RexAssetID textureID = ""; Ogre::MaterialPtr skyMaterial = Ogre::MaterialManager::getSingleton().getByName(skyBoxParameters.material); if (!skyMaterial.isNull()) { textureID = skyMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->getFrameTextureName(texuture_index); } return textureID; } SkyBoxParameters EC_OgreSky::GetBoxSkyParameters() const { return skyBoxParameters; } SkyDomeParameters EC_OgreSky::GetSkyDomeParameters() const { return skyDomeParameters; } SkyPlaneParameters EC_OgreSky::GetSkyPlaneParameters() const { return skyPlaneParameters; } bool EC_OgreSky::IsSkyEnabled() const { return skyEnabled_; } SkyType EC_OgreSky::GetSkyType() const { return type_; } void EC_OgreSky::SetSkyType(SkyType type, bool update_sky) { type_ = type; if(update_sky) CreateSky(); } } //namespace OgreRenderer
[ "cadaver@5b2332b8-efa3-11de-8684-7d64432d61a3", "[email protected]@5b2332b8-efa3-11de-8684-7d64432d61a3", "jaakkoallander@5b2332b8-efa3-11de-8684-7d64432d61a3", "toni.alatalo@5b2332b8-efa3-11de-8684-7d64432d61a3", "Stinkfist0@5b2332b8-efa3-11de-8684-7d64432d61a3" ]
[ [ [ 1, 3 ], [ 5, 7 ], [ 9, 13 ], [ 39, 39 ], [ 42, 42 ], [ 44, 44 ], [ 46, 46 ], [ 51, 53 ], [ 56, 56 ], [ 63, 63 ], [ 68, 69 ], [ 74, 76 ], [ 93, 93 ], [ 124, 124 ], [ 129, 131 ], [ 133, 134 ], [ 137, 137 ], [ 139, 139 ], [ 181, 182 ], [ 185, 185 ] ], [ [ 4, 4 ], [ 58, 59 ], [ 66, 66 ], [ 70, 73 ], [ 79, 79 ], [ 87, 91 ], [ 107, 110 ], [ 127, 127 ], [ 148, 148 ], [ 151, 151 ], [ 153, 169 ], [ 171, 178 ], [ 183, 184 ], [ 208, 209 ], [ 214, 224 ], [ 292, 292 ], [ 296, 296 ], [ 310, 310 ], [ 317, 432 ] ], [ [ 8, 8 ], [ 14, 38 ], [ 40, 41 ], [ 43, 43 ], [ 45, 45 ], [ 47, 50 ], [ 54, 55 ], [ 57, 57 ], [ 60, 62 ], [ 64, 65 ], [ 67, 67 ], [ 77, 78 ], [ 80, 86 ], [ 92, 92 ], [ 94, 106 ], [ 111, 123 ], [ 125, 126 ], [ 128, 128 ], [ 132, 132 ], [ 135, 136 ], [ 138, 138 ], [ 140, 147 ], [ 149, 149 ], [ 179, 180 ], [ 186, 207 ], [ 210, 213 ], [ 225, 291 ], [ 293, 295 ], [ 297, 309 ], [ 311, 316 ], [ 433, 435 ] ], [ [ 150, 150 ] ], [ [ 152, 152 ], [ 170, 170 ] ] ]
34a8bda2d51db5051510deef81fb8ac7411ab436
2fdbf2ba994ba3ed64f0e2dc75cd2dfce4936583
/gpt/test100.cpp
8756da0b07dd9ea629da1378632bb401f9de9718
[]
no_license
TERRANZ/terragraph
36219a4e512e15a925769512a6b60637d39830bf
ea8c36070f532ad0a4af08e46b19f4ee1b85f279
refs/heads/master
2020-05-25T10:31:26.994233
2011-01-29T21:23:04
2011-01-29T21:23:04
1,047,237
0
0
null
null
null
null
UTF-8
C++
false
false
112
cpp
#include "test100.h" namespace { /*$GPBS$$!globals!*/ // put global variables and funcs here /*$GPBS$*/ }
[ [ [ 1, 7 ] ] ]
c2a1c9fec2544606b90ab92b5146b6dc1793a273
2d4221efb0beb3d28118d065261791d431f4518a
/OIDE源代码/OLIDE/Controls/scintilla/scintilla/include/Scintilla.h
b8b1f344ecc8d122485219a2e46bdaabc1828473
[ "LicenseRef-scancode-scintilla" ]
permissive
ophyos/olanguage
3ea9304da44f54110297a5abe31b051a13330db3
38d89352e48c2e687fd9410ffc59636f2431f006
refs/heads/master
2021-01-10T05:54:10.604301
2010-03-23T11:38:51
2010-03-23T11:38:51
48,682,489
1
0
null
null
null
null
UTF-8
C++
false
false
26,236
h
// Scintilla source code edit control /** @file Scintilla.h ** Interface to the edit control. **/ // Copyright 1998-2003 by Neil Hodgson <[email protected]> // The License.txt file describes the conditions under which this software may be distributed. // Most of this file is automatically generated from the Scintilla.iface interface definition // file which contains any comments about the definitions. HFacer.py does the generation. #ifndef SCINTILLA_H #define SCINTILLA_H #if LCCWIN typedef BOOL bool; #endif #if PLAT_WIN // Return false on failure: bool Scintilla_RegisterClasses(void *hInstance); bool Scintilla_ReleaseResources(); #endif int Scintilla_LinkLexers(); // Here should be placed typedefs for uptr_t, an unsigned integer type large enough to // hold a pointer and sptr_t, a signed integer large enough to hold a pointer. // May need to be changed for 64 bit platforms. #if _MSC_VER >= 1300 #include <BaseTsd.h> #endif #ifdef MAXULONG_PTR typedef ULONG_PTR uptr_t; typedef LONG_PTR sptr_t; #else typedef unsigned long uptr_t; typedef long sptr_t; #endif typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); //++Autogenerated -- start of section automatically generated from Scintilla.iface #define INVALID_POSITION -1 #define SCI_START 2000 #define SCI_OPTIONAL_START 3000 #define SCI_LEXER_START 4000 #define SCI_ADDTEXT 2001 #define SCI_ADDSTYLEDTEXT 2002 #define SCI_INSERTTEXT 2003 #define SCI_CLEARALL 2004 #define SCI_CLEARDOCUMENTSTYLE 2005 #define SCI_GETLENGTH 2006 #define SCI_GETCHARAT 2007 #define SCI_GETCURRENTPOS 2008 #define SCI_GETANCHOR 2009 #define SCI_GETSTYLEAT 2010 #define SCI_REDO 2011 #define SCI_SETUNDOCOLLECTION 2012 #define SCI_SELECTALL 2013 #define SCI_SETSAVEPOINT 2014 #define SCI_GETSTYLEDTEXT 2015 #define SCI_CANREDO 2016 #define SCI_MARKERLINEFROMHANDLE 2017 #define SCI_MARKERDELETEHANDLE 2018 #define SCI_GETUNDOCOLLECTION 2019 #define SCWS_INVISIBLE 0 #define SCWS_VISIBLEALWAYS 1 #define SCWS_VISIBLEAFTERINDENT 2 #define SCI_GETVIEWWS 2020 #define SCI_SETVIEWWS 2021 #define SCI_POSITIONFROMPOINT 2022 #define SCI_POSITIONFROMPOINTCLOSE 2023 #define SCI_GOTOLINE 2024 #define SCI_GOTOPOS 2025 #define SCI_SETANCHOR 2026 #define SCI_GETCURLINE 2027 #define SCI_GETENDSTYLED 2028 #define SC_EOL_CRLF 0 #define SC_EOL_CR 1 #define SC_EOL_LF 2 #define SCI_CONVERTEOLS 2029 #define SCI_GETEOLMODE 2030 #define SCI_SETEOLMODE 2031 #define SCI_STARTSTYLING 2032 #define SCI_SETSTYLING 2033 #define SCI_GETBUFFEREDDRAW 2034 #define SCI_SETBUFFEREDDRAW 2035 #define SCI_SETTABWIDTH 2036 #define SCI_GETTABWIDTH 2121 #define SC_CP_UTF8 65001 #define SC_CP_DBCS 1 #define SCI_SETCODEPAGE 2037 #define SCI_SETUSEPALETTE 2039 #define MARKER_MAX 31 #define SC_MARK_CIRCLE 0 #define SC_MARK_ROUNDRECT 1 #define SC_MARK_ARROW 2 #define SC_MARK_SMALLRECT 3 #define SC_MARK_SHORTARROW 4 #define SC_MARK_EMPTY 5 #define SC_MARK_ARROWDOWN 6 #define SC_MARK_MINUS 7 #define SC_MARK_PLUS 8 #define SC_MARK_VLINE 9 #define SC_MARK_LCORNER 10 #define SC_MARK_TCORNER 11 #define SC_MARK_BOXPLUS 12 #define SC_MARK_BOXPLUSCONNECTED 13 #define SC_MARK_BOXMINUS 14 #define SC_MARK_BOXMINUSCONNECTED 15 #define SC_MARK_LCORNERCURVE 16 #define SC_MARK_TCORNERCURVE 17 #define SC_MARK_CIRCLEPLUS 18 #define SC_MARK_CIRCLEPLUSCONNECTED 19 #define SC_MARK_CIRCLEMINUS 20 #define SC_MARK_CIRCLEMINUSCONNECTED 21 #define SC_MARK_BACKGROUND 22 #define SC_MARK_DOTDOTDOT 23 #define SC_MARK_ARROWS 24 #define SC_MARK_PIXMAP 25 #define SC_MARK_FULLRECT 26 #define SC_MARK_LEFTRECT 27 #define SC_MARK_CHARACTER 10000 #define SC_MARKNUM_FOLDEREND 25 #define SC_MARKNUM_FOLDEROPENMID 26 #define SC_MARKNUM_FOLDERMIDTAIL 27 #define SC_MARKNUM_FOLDERTAIL 28 #define SC_MARKNUM_FOLDERSUB 29 #define SC_MARKNUM_FOLDER 30 #define SC_MARKNUM_FOLDEROPEN 31 #define SC_MASK_FOLDERS 0xFE000000 #define SCI_MARKERDEFINE 2040 #define SCI_MARKERSETFORE 2041 #define SCI_MARKERSETBACK 2042 #define SCI_MARKERADD 2043 #define SCI_MARKERDELETE 2044 #define SCI_MARKERDELETEALL 2045 #define SCI_MARKERGET 2046 #define SCI_MARKERNEXT 2047 #define SCI_MARKERPREVIOUS 2048 #define SCI_MARKERDEFINEPIXMAP 2049 #define SCI_MARKERADDSET 2466 #define SCI_MARKERSETALPHA 2476 #define SC_MARGIN_SYMBOL 0 #define SC_MARGIN_NUMBER 1 #define SC_MARGIN_BACK 2 #define SC_MARGIN_FORE 3 #define SCI_SETMARGINTYPEN 2240 #define SCI_GETMARGINTYPEN 2241 #define SCI_SETMARGINWIDTHN 2242 #define SCI_GETMARGINWIDTHN 2243 #define SCI_SETMARGINMASKN 2244 #define SCI_GETMARGINMASKN 2245 #define SCI_SETMARGINSENSITIVEN 2246 #define SCI_GETMARGINSENSITIVEN 2247 #define STYLE_DEFAULT 32 #define STYLE_LINENUMBER 33 #define STYLE_BRACELIGHT 34 #define STYLE_BRACEBAD 35 #define STYLE_CONTROLCHAR 36 #define STYLE_INDENTGUIDE 37 #define STYLE_CALLTIP 38 #define STYLE_LASTPREDEFINED 39 #define STYLE_MAX 255 #define SC_CHARSET_ANSI 0 #define SC_CHARSET_DEFAULT 1 #define SC_CHARSET_BALTIC 186 #define SC_CHARSET_CHINESEBIG5 136 #define SC_CHARSET_EASTEUROPE 238 #define SC_CHARSET_GB2312 134 #define SC_CHARSET_GREEK 161 #define SC_CHARSET_HANGUL 129 #define SC_CHARSET_MAC 77 #define SC_CHARSET_OEM 255 #define SC_CHARSET_RUSSIAN 204 #define SC_CHARSET_CYRILLIC 1251 #define SC_CHARSET_SHIFTJIS 128 #define SC_CHARSET_SYMBOL 2 #define SC_CHARSET_TURKISH 162 #define SC_CHARSET_JOHAB 130 #define SC_CHARSET_HEBREW 177 #define SC_CHARSET_ARABIC 178 #define SC_CHARSET_VIETNAMESE 163 #define SC_CHARSET_THAI 222 #define SC_CHARSET_8859_15 1000 #define SCI_STYLECLEARALL 2050 #define SCI_STYLESETFORE 2051 #define SCI_STYLESETBACK 2052 #define SCI_STYLESETBOLD 2053 #define SCI_STYLESETITALIC 2054 #define SCI_STYLESETSIZE 2055 #define SCI_STYLESETFONT 2056 #define SCI_STYLESETEOLFILLED 2057 #define SCI_STYLERESETDEFAULT 2058 #define SCI_STYLESETUNDERLINE 2059 #define SC_CASE_MIXED 0 #define SC_CASE_UPPER 1 #define SC_CASE_LOWER 2 #define SCI_STYLEGETFORE 2481 #define SCI_STYLEGETBACK 2482 #define SCI_STYLEGETBOLD 2483 #define SCI_STYLEGETITALIC 2484 #define SCI_STYLEGETSIZE 2485 #define SCI_STYLEGETFONT 2486 #define SCI_STYLEGETEOLFILLED 2487 #define SCI_STYLEGETUNDERLINE 2488 #define SCI_STYLEGETCASE 2489 #define SCI_STYLEGETCHARACTERSET 2490 #define SCI_STYLEGETVISIBLE 2491 #define SCI_STYLEGETCHANGEABLE 2492 #define SCI_STYLEGETHOTSPOT 2493 #define SCI_STYLESETCASE 2060 #define SCI_STYLESETCHARACTERSET 2066 #define SCI_STYLESETHOTSPOT 2409 #define SCI_SETSELFORE 2067 #define SCI_SETSELBACK 2068 #define SCI_GETSELALPHA 2477 #define SCI_SETSELALPHA 2478 #define SCI_GETSELEOLFILLED 2479 #define SCI_SETSELEOLFILLED 2480 #define SCI_SETCARETFORE 2069 #define SCI_ASSIGNCMDKEY 2070 #define SCI_CLEARCMDKEY 2071 #define SCI_CLEARALLCMDKEYS 2072 #define SCI_SETSTYLINGEX 2073 #define SCI_STYLESETVISIBLE 2074 #define SCI_GETCARETPERIOD 2075 #define SCI_SETCARETPERIOD 2076 #define SCI_SETWORDCHARS 2077 #define SCI_BEGINUNDOACTION 2078 #define SCI_ENDUNDOACTION 2079 #define INDIC_PLAIN 0 #define INDIC_SQUIGGLE 1 #define INDIC_TT 2 #define INDIC_DIAGONAL 3 #define INDIC_STRIKE 4 #define INDIC_HIDDEN 5 #define INDIC_BOX 6 #define INDIC_ROUNDBOX 7 #define INDIC_MAX 31 #define INDIC_CONTAINER 8 #define INDIC0_MASK 0x20 #define INDIC1_MASK 0x40 #define INDIC2_MASK 0x80 #define INDICS_MASK 0xE0 #define SCI_INDICSETSTYLE 2080 #define SCI_INDICGETSTYLE 2081 #define SCI_INDICSETFORE 2082 #define SCI_INDICGETFORE 2083 #define SCI_INDICSETUNDER 2510 #define SCI_INDICGETUNDER 2511 #define SCI_SETWHITESPACEFORE 2084 #define SCI_SETWHITESPACEBACK 2085 #define SCI_SETSTYLEBITS 2090 #define SCI_GETSTYLEBITS 2091 #define SCI_SETLINESTATE 2092 #define SCI_GETLINESTATE 2093 #define SCI_GETMAXLINESTATE 2094 #define SCI_GETCARETLINEVISIBLE 2095 #define SCI_SETCARETLINEVISIBLE 2096 #define SCI_GETCARETLINEBACK 2097 #define SCI_SETCARETLINEBACK 2098 #define SCI_STYLESETCHANGEABLE 2099 #define SCI_AUTOCSHOW 2100 #define SCI_AUTOCSHOWEX 2109 #define SCI_AUTOCCANCEL 2101 #define SCI_AUTOCACTIVE 2102 #define SCI_AUTOCPOSSTART 2103 #define SCI_AUTOCCOMPLETE 2104 #define SCI_AUTOCSTOPS 2105 #define SCI_AUTOCSETSEPARATOR 2106 #define SCI_AUTOCGETSEPARATOR 2107 #define SCI_AUTOCSELECT 2108 #define SCI_AUTOCSETCANCELATSTART 2110 #define SCI_AUTOCGETCANCELATSTART 2111 #define SCI_AUTOCSETFILLUPS 2112 #define SCI_AUTOCSETCHOOSESINGLE 2113 #define SCI_AUTOCGETCHOOSESINGLE 2114 #define SCI_AUTOCSETIGNORECASE 2115 #define SCI_AUTOCGETIGNORECASE 2116 #define SCI_USERLISTSHOW 2117 #define SCI_AUTOCSETAUTOHIDE 2118 #define SCI_AUTOCGETAUTOHIDE 2119 #define SCI_AUTOCSETDROPRESTOFWORD 2270 #define SCI_AUTOCGETDROPRESTOFWORD 2271 #define SCI_REGISTERIMAGE 2405 #define SCI_CLEARREGISTEREDIMAGES 2408 #define SCI_AUTOCGETTYPESEPARATOR 2285 #define SCI_AUTOCSETTYPESEPARATOR 2286 #define SCI_AUTOCSETMAXWIDTH 2208 #define SCI_AUTOCGETMAXWIDTH 2209 #define SCI_AUTOCSETMAXHEIGHT 2210 #define SCI_AUTOCGETMAXHEIGHT 2211 #define SCI_SETINDENT 2122 #define SCI_GETINDENT 2123 #define SCI_SETUSETABS 2124 #define SCI_GETUSETABS 2125 #define SCI_SETLINEINDENTATION 2126 #define SCI_GETLINEINDENTATION 2127 #define SCI_GETLINEINDENTPOSITION 2128 #define SCI_GETCOLUMN 2129 #define SCI_SETHSCROLLBAR 2130 #define SCI_GETHSCROLLBAR 2131 #define SC_IV_NONE 0 #define SC_IV_REAL 1 #define SC_IV_LOOKFORWARD 2 #define SC_IV_LOOKBOTH 3 #define SCI_SETINDENTATIONGUIDES 2132 #define SCI_GETINDENTATIONGUIDES 2133 #define SCI_SETHIGHLIGHTGUIDE 2134 #define SCI_GETHIGHLIGHTGUIDE 2135 #define SCI_GETLINEENDPOSITION 2136 #define SCI_GETCODEPAGE 2137 #define SCI_GETCARETFORE 2138 #define SCI_GETUSEPALETTE 2139 #define SCI_GETREADONLY 2140 #define SCI_SETCURRENTPOS 2141 #define SCI_SETSELECTIONSTART 2142 #define SCI_GETSELECTIONSTART 2143 #define SCI_SETSELECTIONEND 2144 #define SCI_GETSELECTIONEND 2145 #define SCI_SETPRINTMAGNIFICATION 2146 #define SCI_GETPRINTMAGNIFICATION 2147 #define SC_PRINT_NORMAL 0 #define SC_PRINT_INVERTLIGHT 1 #define SC_PRINT_BLACKONWHITE 2 #define SC_PRINT_COLOURONWHITE 3 #define SC_PRINT_COLOURONWHITEDEFAULTBG 4 #define SCI_SETPRINTCOLOURMODE 2148 #define SCI_GETPRINTCOLOURMODE 2149 #define SCFIND_WHOLEWORD 2 #define SCFIND_MATCHCASE 4 #define SCFIND_WORDSTART 0x00100000 #define SCFIND_REGEXP 0x00200000 #define SCFIND_POSIX 0x00400000 #define SCI_FINDTEXT 2150 #define SCI_FORMATRANGE 2151 #define SCI_GETFIRSTVISIBLELINE 2152 #define SCI_GETLINE 2153 #define SCI_GETLINECOUNT 2154 #define SCI_SETMARGINLEFT 2155 #define SCI_GETMARGINLEFT 2156 #define SCI_SETMARGINRIGHT 2157 #define SCI_GETMARGINRIGHT 2158 #define SCI_GETMODIFY 2159 #define SCI_SETSEL 2160 #define SCI_GETSELTEXT 2161 #define SCI_GETTEXTRANGE 2162 #define SCI_HIDESELECTION 2163 #define SCI_POINTXFROMPOSITION 2164 #define SCI_POINTYFROMPOSITION 2165 #define SCI_LINEFROMPOSITION 2166 #define SCI_POSITIONFROMLINE 2167 #define SCI_LINESCROLL 2168 #define SCI_SCROLLCARET 2169 #define SCI_REPLACESEL 2170 #define SCI_SETREADONLY 2171 #define SCI_NULL 2172 #define SCI_CANPASTE 2173 #define SCI_CANUNDO 2174 #define SCI_EMPTYUNDOBUFFER 2175 #define SCI_UNDO 2176 #define SCI_CUT 2177 #define SCI_COPY 2178 #define SCI_PASTE 2179 #define SCI_CLEAR 2180 #define SCI_SETTEXT 2181 #define SCI_GETTEXT 2182 #define SCI_GETTEXTLENGTH 2183 #define SCI_GETDIRECTFUNCTION 2184 #define SCI_GETDIRECTPOINTER 2185 #define SCI_SETOVERTYPE 2186 #define SCI_GETOVERTYPE 2187 #define SCI_SETCARETWIDTH 2188 #define SCI_GETCARETWIDTH 2189 #define SCI_SETTARGETSTART 2190 #define SCI_GETTARGETSTART 2191 #define SCI_SETTARGETEND 2192 #define SCI_GETTARGETEND 2193 #define SCI_REPLACETARGET 2194 #define SCI_REPLACETARGETRE 2195 #define SCI_SEARCHINTARGET 2197 #define SCI_SETSEARCHFLAGS 2198 #define SCI_GETSEARCHFLAGS 2199 #define SCI_CALLTIPSHOW 2200 #define SCI_CALLTIPCANCEL 2201 #define SCI_CALLTIPACTIVE 2202 #define SCI_CALLTIPPOSSTART 2203 #define SCI_CALLTIPSETHLT 2204 #define SCI_CALLTIPSETBACK 2205 #define SCI_CALLTIPSETFORE 2206 #define SCI_CALLTIPSETFOREHLT 2207 #define SCI_CALLTIPUSESTYLE 2212 #define SCI_VISIBLEFROMDOCLINE 2220 #define SCI_DOCLINEFROMVISIBLE 2221 #define SCI_WRAPCOUNT 2235 #define SC_FOLDLEVELBASE 0x400 #define SC_FOLDLEVELWHITEFLAG 0x1000 #define SC_FOLDLEVELHEADERFLAG 0x2000 #define SC_FOLDLEVELBOXHEADERFLAG 0x4000 #define SC_FOLDLEVELBOXFOOTERFLAG 0x8000 #define SC_FOLDLEVELCONTRACTED 0x10000 #define SC_FOLDLEVELUNINDENT 0x20000 #define SC_FOLDLEVELNUMBERMASK 0x0FFF #define SCI_SETFOLDLEVEL 2222 #define SCI_GETFOLDLEVEL 2223 #define SCI_GETLASTCHILD 2224 #define SCI_GETFOLDPARENT 2225 #define SCI_SHOWLINES 2226 #define SCI_HIDELINES 2227 #define SCI_GETLINEVISIBLE 2228 #define SCI_SETFOLDEXPANDED 2229 #define SCI_GETFOLDEXPANDED 2230 #define SCI_TOGGLEFOLD 2231 #define SCI_ENSUREVISIBLE 2232 #define SC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 #define SC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 #define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 #define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 #define SC_FOLDFLAG_LEVELNUMBERS 0x0040 #define SC_FOLDFLAG_BOX 0x0001 #define SCI_SETFOLDFLAGS 2233 #define SCI_ENSUREVISIBLEENFORCEPOLICY 2234 #define SCI_SETTABINDENTS 2260 #define SCI_GETTABINDENTS 2261 #define SCI_SETBACKSPACEUNINDENTS 2262 #define SCI_GETBACKSPACEUNINDENTS 2263 #define SC_TIME_FOREVER 10000000 #define SCI_SETMOUSEDWELLTIME 2264 #define SCI_GETMOUSEDWELLTIME 2265 #define SCI_WORDSTARTPOSITION 2266 #define SCI_WORDENDPOSITION 2267 #define SC_WRAP_NONE 0 #define SC_WRAP_WORD 1 #define SC_WRAP_CHAR 2 #define SCI_SETWRAPMODE 2268 #define SCI_GETWRAPMODE 2269 #define SC_WRAPVISUALFLAG_NONE 0x0000 #define SC_WRAPVISUALFLAG_END 0x0001 #define SC_WRAPVISUALFLAG_START 0x0002 #define SCI_SETWRAPVISUALFLAGS 2460 #define SCI_GETWRAPVISUALFLAGS 2461 #define SC_WRAPVISUALFLAGLOC_DEFAULT 0x0000 #define SC_WRAPVISUALFLAGLOC_END_BY_TEXT 0x0001 #define SC_WRAPVISUALFLAGLOC_START_BY_TEXT 0x0002 #define SCI_SETWRAPVISUALFLAGSLOCATION 2462 #define SCI_GETWRAPVISUALFLAGSLOCATION 2463 #define SCI_SETWRAPSTARTINDENT 2464 #define SCI_GETWRAPSTARTINDENT 2465 #define SC_CACHE_NONE 0 #define SC_CACHE_CARET 1 #define SC_CACHE_PAGE 2 #define SC_CACHE_DOCUMENT 3 #define SCI_SETLAYOUTCACHE 2272 #define SCI_GETLAYOUTCACHE 2273 #define SCI_SETSCROLLWIDTH 2274 #define SCI_GETSCROLLWIDTH 2275 #define SCI_SETSCROLLWIDTHTRACKING 2516 #define SCI_GETSCROLLWIDTHTRACKING 2517 #define SCI_TEXTWIDTH 2276 #define SCI_SETENDATLASTLINE 2277 #define SCI_GETENDATLASTLINE 2278 #define SCI_TEXTHEIGHT 2279 #define SCI_SETVSCROLLBAR 2280 #define SCI_GETVSCROLLBAR 2281 #define SCI_APPENDTEXT 2282 #define SCI_GETTWOPHASEDRAW 2283 #define SCI_SETTWOPHASEDRAW 2284 #define SCI_TARGETFROMSELECTION 2287 #define SCI_LINESJOIN 2288 #define SCI_LINESSPLIT 2289 #define SCI_SETFOLDMARGINCOLOUR 2290 #define SCI_SETFOLDMARGINHICOLOUR 2291 #define SCI_LINEDOWN 2300 #define SCI_LINEDOWNEXTEND 2301 #define SCI_LINEUP 2302 #define SCI_LINEUPEXTEND 2303 #define SCI_CHARLEFT 2304 #define SCI_CHARLEFTEXTEND 2305 #define SCI_CHARRIGHT 2306 #define SCI_CHARRIGHTEXTEND 2307 #define SCI_WORDLEFT 2308 #define SCI_WORDLEFTEXTEND 2309 #define SCI_WORDRIGHT 2310 #define SCI_WORDRIGHTEXTEND 2311 #define SCI_HOME 2312 #define SCI_HOMEEXTEND 2313 #define SCI_LINEEND 2314 #define SCI_LINEENDEXTEND 2315 #define SCI_DOCUMENTSTART 2316 #define SCI_DOCUMENTSTARTEXTEND 2317 #define SCI_DOCUMENTEND 2318 #define SCI_DOCUMENTENDEXTEND 2319 #define SCI_PAGEUP 2320 #define SCI_PAGEUPEXTEND 2321 #define SCI_PAGEDOWN 2322 #define SCI_PAGEDOWNEXTEND 2323 #define SCI_EDITTOGGLEOVERTYPE 2324 #define SCI_CANCEL 2325 #define SCI_DELETEBACK 2326 #define SCI_TAB 2327 #define SCI_BACKTAB 2328 #define SCI_NEWLINE 2329 #define SCI_FORMFEED 2330 #define SCI_VCHOME 2331 #define SCI_VCHOMEEXTEND 2332 #define SCI_ZOOMIN 2333 #define SCI_ZOOMOUT 2334 #define SCI_DELWORDLEFT 2335 #define SCI_DELWORDRIGHT 2336 #define SCI_DELWORDRIGHTEND 2518 #define SCI_LINECUT 2337 #define SCI_LINEDELETE 2338 #define SCI_LINETRANSPOSE 2339 #define SCI_LINEDUPLICATE 2404 #define SCI_LOWERCASE 2340 #define SCI_UPPERCASE 2341 #define SCI_LINESCROLLDOWN 2342 #define SCI_LINESCROLLUP 2343 #define SCI_DELETEBACKNOTLINE 2344 #define SCI_HOMEDISPLAY 2345 #define SCI_HOMEDISPLAYEXTEND 2346 #define SCI_LINEENDDISPLAY 2347 #define SCI_LINEENDDISPLAYEXTEND 2348 #define SCI_HOMEWRAP 2349 #define SCI_HOMEWRAPEXTEND 2450 #define SCI_LINEENDWRAP 2451 #define SCI_LINEENDWRAPEXTEND 2452 #define SCI_VCHOMEWRAP 2453 #define SCI_VCHOMEWRAPEXTEND 2454 #define SCI_LINECOPY 2455 #define SCI_MOVECARETINSIDEVIEW 2401 #define SCI_LINELENGTH 2350 #define SCI_BRACEHIGHLIGHT 2351 #define SCI_BRACEBADLIGHT 2352 #define SCI_BRACEMATCH 2353 #define SCI_GETVIEWEOL 2355 #define SCI_SETVIEWEOL 2356 #define SCI_GETDOCPOINTER 2357 #define SCI_SETDOCPOINTER 2358 #define SCI_SETMODEVENTMASK 2359 #define EDGE_NONE 0 #define EDGE_LINE 1 #define EDGE_BACKGROUND 2 #define SCI_GETEDGECOLUMN 2360 #define SCI_SETEDGECOLUMN 2361 #define SCI_GETEDGEMODE 2362 #define SCI_SETEDGEMODE 2363 #define SCI_GETEDGECOLOUR 2364 #define SCI_SETEDGECOLOUR 2365 #define SCI_SEARCHANCHOR 2366 #define SCI_SEARCHNEXT 2367 #define SCI_SEARCHPREV 2368 #define SCI_LINESONSCREEN 2370 #define SCI_USEPOPUP 2371 #define SCI_SELECTIONISRECTANGLE 2372 #define SCI_SETZOOM 2373 #define SCI_GETZOOM 2374 #define SCI_CREATEDOCUMENT 2375 #define SCI_ADDREFDOCUMENT 2376 #define SCI_RELEASEDOCUMENT 2377 #define SCI_GETMODEVENTMASK 2378 #define SCI_SETFOCUS 2380 #define SCI_GETFOCUS 2381 #define SCI_SETSTATUS 2382 #define SCI_GETSTATUS 2383 #define SCI_SETMOUSEDOWNCAPTURES 2384 #define SCI_GETMOUSEDOWNCAPTURES 2385 #define SC_CURSORNORMAL -1 #define SC_CURSORWAIT 4 #define SCI_SETCURSOR 2386 #define SCI_GETCURSOR 2387 #define SCI_SETCONTROLCHARSYMBOL 2388 #define SCI_GETCONTROLCHARSYMBOL 2389 #define SCI_WORDPARTLEFT 2390 #define SCI_WORDPARTLEFTEXTEND 2391 #define SCI_WORDPARTRIGHT 2392 #define SCI_WORDPARTRIGHTEXTEND 2393 #define VISIBLE_SLOP 0x01 #define VISIBLE_STRICT 0x04 #define SCI_SETVISIBLEPOLICY 2394 #define SCI_DELLINELEFT 2395 #define SCI_DELLINERIGHT 2396 #define SCI_SETXOFFSET 2397 #define SCI_GETXOFFSET 2398 #define SCI_CHOOSECARETX 2399 #define SCI_GRABFOCUS 2400 #define CARET_SLOP 0x01 #define CARET_STRICT 0x04 #define CARET_JUMPS 0x10 #define CARET_EVEN 0x08 #define SCI_SETXCARETPOLICY 2402 #define SCI_SETYCARETPOLICY 2403 #define SCI_SETPRINTWRAPMODE 2406 #define SCI_GETPRINTWRAPMODE 2407 #define SCI_SETHOTSPOTACTIVEFORE 2410 #define SCI_GETHOTSPOTACTIVEFORE 2494 #define SCI_SETHOTSPOTACTIVEBACK 2411 #define SCI_GETHOTSPOTACTIVEBACK 2495 #define SCI_SETHOTSPOTACTIVEUNDERLINE 2412 #define SCI_GETHOTSPOTACTIVEUNDERLINE 2496 #define SCI_SETHOTSPOTSINGLELINE 2421 #define SCI_GETHOTSPOTSINGLELINE 2497 #define SCI_PARADOWN 2413 #define SCI_PARADOWNEXTEND 2414 #define SCI_PARAUP 2415 #define SCI_PARAUPEXTEND 2416 #define SCI_POSITIONBEFORE 2417 #define SCI_POSITIONAFTER 2418 #define SCI_COPYRANGE 2419 #define SCI_COPYTEXT 2420 #define SC_SEL_STREAM 0 #define SC_SEL_RECTANGLE 1 #define SC_SEL_LINES 2 #define SCI_SETSELECTIONMODE 2422 #define SCI_GETSELECTIONMODE 2423 #define SCI_GETLINESELSTARTPOSITION 2424 #define SCI_GETLINESELENDPOSITION 2425 #define SCI_LINEDOWNRECTEXTEND 2426 #define SCI_LINEUPRECTEXTEND 2427 #define SCI_CHARLEFTRECTEXTEND 2428 #define SCI_CHARRIGHTRECTEXTEND 2429 #define SCI_HOMERECTEXTEND 2430 #define SCI_VCHOMERECTEXTEND 2431 #define SCI_LINEENDRECTEXTEND 2432 #define SCI_PAGEUPRECTEXTEND 2433 #define SCI_PAGEDOWNRECTEXTEND 2434 #define SCI_STUTTEREDPAGEUP 2435 #define SCI_STUTTEREDPAGEUPEXTEND 2436 #define SCI_STUTTEREDPAGEDOWN 2437 #define SCI_STUTTEREDPAGEDOWNEXTEND 2438 #define SCI_WORDLEFTEND 2439 #define SCI_WORDLEFTENDEXTEND 2440 #define SCI_WORDRIGHTEND 2441 #define SCI_WORDRIGHTENDEXTEND 2442 #define SCI_SETWHITESPACECHARS 2443 #define SCI_SETCHARSDEFAULT 2444 #define SCI_AUTOCGETCURRENT 2445 #define SCI_ALLOCATE 2446 #define SCI_TARGETASUTF8 2447 #define SCI_SETLENGTHFORENCODE 2448 #define SCI_ENCODEDFROMUTF8 2449 #define SCI_FINDCOLUMN 2456 #define SCI_GETCARETSTICKY 2457 #define SCI_SETCARETSTICKY 2458 #define SCI_TOGGLECARETSTICKY 2459 #define SCI_SETPASTECONVERTENDINGS 2467 #define SCI_GETPASTECONVERTENDINGS 2468 #define SCI_SELECTIONDUPLICATE 2469 #define SC_ALPHA_TRANSPARENT 0 #define SC_ALPHA_OPAQUE 255 #define SC_ALPHA_NOALPHA 256 #define SCI_SETCARETLINEBACKALPHA 2470 #define SCI_GETCARETLINEBACKALPHA 2471 #define CARETSTYLE_INVISIBLE 0 #define CARETSTYLE_LINE 1 #define CARETSTYLE_BLOCK 2 #define SCI_SETCARETSTYLE 2512 #define SCI_GETCARETSTYLE 2513 #define SCI_SETINDICATORCURRENT 2500 #define SCI_GETINDICATORCURRENT 2501 #define SCI_SETINDICATORVALUE 2502 #define SCI_GETINDICATORVALUE 2503 #define SCI_INDICATORFILLRANGE 2504 #define SCI_INDICATORCLEARRANGE 2505 #define SCI_INDICATORALLONFOR 2506 #define SCI_INDICATORVALUEAT 2507 #define SCI_INDICATORSTART 2508 #define SCI_INDICATOREND 2509 #define SCI_SETPOSITIONCACHE 2514 #define SCI_GETPOSITIONCACHE 2515 #define SCI_COPYALLOWLINE 2519 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 #define SCI_GETLEXER 4002 #define SCI_COLOURISE 4003 #define SCI_SETPROPERTY 4004 #define KEYWORDSET_MAX 8 #define SCI_SETKEYWORDS 4005 #define SCI_SETLEXERLANGUAGE 4006 #define SCI_LOADLEXERLIBRARY 4007 #define SCI_GETPROPERTY 4008 #define SCI_GETPROPERTYEXPANDED 4009 #define SCI_GETPROPERTYINT 4010 #define SCI_GETSTYLEBITSNEEDED 4011 #define SC_MOD_INSERTTEXT 0x1 #define SC_MOD_DELETETEXT 0x2 #define SC_MOD_CHANGESTYLE 0x4 #define SC_MOD_CHANGEFOLD 0x8 #define SC_PERFORMED_USER 0x10 #define SC_PERFORMED_UNDO 0x20 #define SC_PERFORMED_REDO 0x40 #define SC_MULTISTEPUNDOREDO 0x80 #define SC_LASTSTEPINUNDOREDO 0x100 #define SC_MOD_CHANGEMARKER 0x200 #define SC_MOD_BEFOREINSERT 0x400 #define SC_MOD_BEFOREDELETE 0x800 #define SC_MULTILINEUNDOREDO 0x1000 #define SC_STARTACTION 0x2000 #define SC_MOD_CHANGEINDICATOR 0x4000 #define SC_MOD_CHANGELINESTATE 0x8000 #define SC_MODEVENTMASKALL 0xFFFF #define SCEN_CHANGE 768 #define SCEN_SETFOCUS 512 #define SCEN_KILLFOCUS 256 #define SCK_DOWN 300 #define SCK_UP 301 #define SCK_LEFT 302 #define SCK_RIGHT 303 #define SCK_HOME 304 #define SCK_END 305 #define SCK_PRIOR 306 #define SCK_NEXT 307 #define SCK_DELETE 308 #define SCK_INSERT 309 #define SCK_ESCAPE 7 #define SCK_BACK 8 #define SCK_TAB 9 #define SCK_RETURN 13 #define SCK_ADD 310 #define SCK_SUBTRACT 311 #define SCK_DIVIDE 312 #define SCK_WIN 313 #define SCK_RWIN 314 #define SCK_MENU 315 #define SCMOD_NORM 0 #define SCMOD_SHIFT 1 #define SCMOD_CTRL 2 #define SCMOD_ALT 4 #define SCN_STYLENEEDED 2000 #define SCN_CHARADDED 2001 #define SCN_SAVEPOINTREACHED 2002 #define SCN_SAVEPOINTLEFT 2003 #define SCN_MODIFYATTEMPTRO 2004 #define SCN_KEY 2005 #define SCN_DOUBLECLICK 2006 #define SCN_UPDATEUI 2007 #define SCN_MODIFIED 2008 #define SCN_MACRORECORD 2009 #define SCN_MARGINCLICK 2010 #define SCN_NEEDSHOWN 2011 #define SCN_PAINTED 2013 #define SCN_USERLISTSELECTION 2014 #define SCN_URIDROPPED 2015 #define SCN_DWELLSTART 2016 #define SCN_DWELLEND 2017 #define SCN_ZOOM 2018 #define SCN_HOTSPOTCLICK 2019 #define SCN_HOTSPOTDOUBLECLICK 2020 #define SCN_CALLTIPCLICK 2021 #define SCN_AUTOCSELECTION 2022 #define SCN_INDICATORCLICK 2023 #define SCN_INDICATORRELEASE 2024 //--Autogenerated -- end of section automatically generated from Scintilla.iface // These structures are defined to be exactly the same shape as the Win32 // CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. // So older code that treats Scintilla as a RichEdit will work. #ifdef SCI_NAMESPACE namespace Scintilla { #endif struct CharacterRange { long cpMin; long cpMax; }; struct TextRange { struct CharacterRange chrg; char *lpstrText; }; struct TextToFind { struct CharacterRange chrg; char *lpstrText; struct CharacterRange chrgText; }; #ifdef PLATFORM_H // This structure is used in printing and requires some of the graphics types // from Platform.h. Not needed by most client code. struct RangeToFormat { SurfaceID hdc; SurfaceID hdcTarget; PRectangle rc; PRectangle rcPage; CharacterRange chrg; }; #endif struct NotifyHeader { // Compatible with Windows NMHDR. // hwndFrom is really an environment specific window handle or pointer // but most clients of Scintilla.h do not have this type visible. void *hwndFrom; uptr_t idFrom; unsigned int code; }; struct SCNotification { struct NotifyHeader nmhdr; int position; // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND int ch; // SCN_CHARADDED, SCN_KEY int modifiers; // SCN_KEY int modificationType; // SCN_MODIFIED const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION int length; // SCN_MODIFIED int linesAdded; // SCN_MODIFIED int message; // SCN_MACRORECORD uptr_t wParam; // SCN_MACRORECORD sptr_t lParam; // SCN_MACRORECORD int line; // SCN_MODIFIED int foldLevelNow; // SCN_MODIFIED int foldLevelPrev; // SCN_MODIFIED int margin; // SCN_MARGINCLICK int listType; // SCN_USERLISTSELECTION int x; // SCN_DWELLSTART, SCN_DWELLEND int y; // SCN_DWELLSTART, SCN_DWELLEND }; #ifdef SCI_NAMESPACE } #endif // Deprecation section listing all API features that are deprecated and will // will be removed completely in a future version. // To enable these features define INCLUDE_DEPRECATED_FEATURES #ifdef INCLUDE_DEPRECATED_FEATURES #define SCI_SETCARETPOLICY 2369 #define CARET_CENTER 0x02 #define CARET_XEVEN 0x08 #define CARET_XJUMPS 0x10 #define SCN_POSCHANGED 2012 #define SCN_CHECKBRACE 2007 #endif #endif
[ [ [ 1, 845 ] ] ]
a6a81add33f65de79394540eb7162ae76306e264
b14d5833a79518a40d302e5eb40ed5da193cf1b2
/cpp/extern/xercesc++/2.6.0/src/xercesc/util/Compilers/OS400SetDefs.cpp
fe4552a1d267dd6d00a039022f0bd44325d1334e
[ "Apache-2.0" ]
permissive
andyburke/bitflood
dcb3fb62dad7fa5e20cf9f1d58aaa94be30e82bf
fca6c0b635d07da4e6c7fbfa032921c827a981d6
refs/heads/master
2016-09-10T02:14:35.564530
2011-11-17T09:51:49
2011-11-17T09:51:49
2,794,411
1
0
null
null
null
null
UTF-8
C++
false
false
2,458
cpp
/* * Copyright 1999-2000,2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Log: OS400SetDefs.cpp,v $ * Revision 1.2 2004/09/08 13:56:32 peiyongz * Apache License Version 2.0 * * Revision 1.1.1.1 2002/02/01 22:22:18 peiyongz * sane_include * * Revision 1.3 2000/03/02 19:55:08 roddey * This checkin includes many changes done while waiting for the * 1.1.0 code to be finished. I can't list them all here, but a list is * available elsewhere. * * Revision 1.2 2000/02/06 07:48:18 rahulj * Year 2K copyright swat. * */ // --------------------------------------------------------------------------- // Includes // --------------------------------------------------------------------------- #include <sys/types.h> #include <ctype.h> int strcasecmp (const char *string1,const char * string2) { char *s1, *s2; int result; s1 = (char *)string1; s2 = (char *)string2; while ((result = tolower (*s1) - tolower (*s2)) == 0) { if (*s1++ == '\0') return 0; s2++; } return (result); } int strncasecmp (const char *string1,const char *string2,size_t count) { register char *s1, *s2; register int r; register unsigned int rcount; rcount = (unsigned int) count; if (rcount > 0) { s1 = (char *)string1; s2 = (char *)string2; do { if ((r = tolower (*s1) - tolower (*s2)) != 0) return r; if (*s1++ == '\0') break; s2++; } while (--rcount != 0); } return (0); } /* des not appear as though the following is needed */ #ifndef __OS400__ int stricmp(const char* str1, const char* str2) { return strcasecmp(str1, str2); } int strnicmp(const char* str1, const char* str2, const unsigned int count) { if (count == 0) return 0; return strncasecmp( str1, str2, (size_t)count); } #endif
[ [ [ 1, 95 ] ] ]
b4d7df0ed270837116a4f8c85dfe5aff68b6bd68
719fe2a61e87af92fe7beeb499fe39cd467be1b5
/main.cpp
9ba04e737b1f1f517dd80082fa06d65168e0599f
[]
no_license
qpalzz/lab1
7e71e998790b3efa0f6e2f934543748f8597d5a2
6849292dbbc21d8cb071f9221e7a142266187b92
refs/heads/master
2021-01-19T16:56:35.468561
2011-10-02T13:02:42
2011-10-02T13:02:42
2,454,570
0
0
null
null
null
null
UTF-8
C++
false
false
2,410
cpp
#include <fstream> #include "polinom.h" void readme() { ifstream in; in.open("README"); string str; while (getline(in,str)) { cout << str << endl; } cout << endl; in.close(); } int Menu() { cout << "Введите номер пункта меню:" << endl; cout << "1. Сумма многочленов;" << endl; cout << "2. Разность многочленов;" << endl; cout << "3. Произведение многочленов;" << endl; cout << "0. Выход" << endl; int pt = 0; cin >> pt; return pt; } int main() { readme(); srand(time(NULL)); while (int pt = Menu()) { int n = 0; switch (pt) { case 1: { cout << "Введите степень первого многочлена: "; cin >> n; Polinom a(n); a.output(); cout << "Введите степень второго многочлена: "; cin >> n; Polinom b(n); b.output(); Polinom c = a + b; cout << "C = A + B : "; c.output(); break; } case 2: { cout << "Введите степень первого многочлена: "; cin >> n; Polinom a(n); a.output(); cout << "Введите степень второго многочлена: "; cin >> n; Polinom b(n); b.output(); Polinom c = a - b; cout << "C = A - B : "; c.output(); break; } case 3: { cout << "Введите степень первого многочлена: "; cin >> n; Polinom a(n); a.output(); cout << "Введите степень второго многочлена: "; cin >> n; Polinom b(n); b.output(); Polinom c = a * b; cout << "C = A * B : "; c.output(); break; } default: cout << "Пункта меню с таким номером нет"; } } }
[ [ [ 1, 85 ] ] ]
ff08f65df16c0a324dad5452b318fe49620bcb0d
1e976ee65d326c2d9ed11c3235a9f4e2693557cf
/CommonSources/LastFMServices.cpp
812bff98d9a022997c2d0dd725086ed94a74162d
[]
no_license
outcast1000/Jaangle
062c7d8d06e058186cb65bdade68a2ad8d5e7e65
18feb537068f1f3be6ecaa8a4b663b917c429e3d
refs/heads/master
2020-04-08T20:04:56.875651
2010-12-25T10:44:38
2010-12-25T10:44:38
19,334,292
3
0
null
null
null
null
UTF-8
C++
false
false
11,808
cpp
// /* // * // * Copyright (C) 2003-2010 Alexandros Economou // * // * This file is part of Jaangle (http://www.jaangle.com) // * // * 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, 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 GNU Make; see the file COPYING. If not, write to // * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // * http://www.gnu.org/copyleft/gpl.html // * // */ #include "StdAfx.h" #include "LastFMServices.h" #include "cMD5.h" #include "SystemTimeFunctions.h" #include "WebPageUtilities.h" #include "stlStringUtils.h" LPCTSTR sProtocolVer = _T("1.2.1"); LPCTSTR sClientID = _T("tsp"); LPCTSTR sClientVer = _T("1.0"); const INT sMaxTracksOnQueue = 10; LastFMServices::LastFMServices(void): m_state(ST_UnInitialized), m_error(ERR_None), m_hNet(0), m_pThread(NULL), m_bExitThread(FALSE), m_lastHandShakeTickCount(0) { } LastFMServices::~LastFMServices(void) { m_bExitThread = TRUE; if (m_pThread != NULL) { LeaveThread(m_pThread->m_hThread, 500); } } void LastFMServices::Init(HINTERNET hNet) { ASSERT(hNet != NULL); m_hNet = hNet; m_state = ST_Idle; } void LastFMServices::SetUserName(LPCTSTR username) { ASSERT(username != NULL); if (username != NULL) m_username = username; else m_username.clear(); } void LastFMServices::SetMD5Password(LPCTSTR MD5password) { ASSERT(MD5password != NULL); if (MD5password != NULL) m_MD5password = MD5password; else m_MD5password.clear(); } BOOL LastFMServices::CheckLogin() { ASSERT(!m_username.empty()); ASSERT(!m_MD5password.empty()); if (m_username.empty() || m_MD5password.empty()) return FALSE; std::basic_string<TCHAR> ses, now, sub; if (HandShake(ses, now, sub)) { ASSERT(!ses.empty()); return TRUE; } return FALSE; } void LastFMServices::Submit(LastFMSubmitTrack& track) { ASSERT(m_state != ST_UnInitialized); //Check the track if (track.IsValid() && track.length >= 30) { if (track.unixTimeStamp == 0) // Automatically fix the "start playing" date if needed { track.unixTimeStamp = GetCurrentUnixTimeStamp(); if (track.length < 480) track.unixTimeStamp -= (track.length/2); else track.unixTimeStamp -= 240; } CSingleLock lock(&m_cs); if (sMaxTracksOnQueue > m_jobs.size()) m_jobs.push_back(track); if (m_pThread == NULL) m_pThread = AfxBeginThread(LastFMServices::WorkingThreadST, this, THREAD_PRIORITY_BELOW_NORMAL); } } BOOL LastFMServices::IsTrackAvailable() { CSingleLock lock(&m_cs); return m_jobs.size() > 0; } //BOOL LastFM::GetTrack(LastFMSubmitTrack& track) //{ // CSingleLock lock(&m_cs); // if (m_jobs.size() > 0) // { // track = *m_jobs.begin(); // return TRUE; // } // return FALSE; //} //void LastFM::PopTrack() //{ // CSingleLock lock(&m_cs); // if (m_jobs.begin() != m_jobs.end()) // m_jobs.erase(m_jobs.begin()); //} //BOOL LastFM::PushTrack(LastFMSubmitTrack& track) //{ // CSingleLock lock(&m_cs); // if (sMaxTracksOnQueue > m_jobs.size()) // { // m_jobs.push_back(track); // return TRUE; // } // return FALSE; //} UINT LastFMServices::WorkingThreadST(LPVOID pParam) { ASSERT(pParam != NULL); return ((LastFMServices*)pParam)->WorkingThread(); } UINT LastFMServices::WorkingThread() { std::basic_string<TCHAR> sessionID; std::basic_string<TCHAR> nowPlayingURL; std::basic_string<TCHAR> submissionURL; INT failCounter = 0; UINT lastTickCheck = 0; while (m_bExitThread == FALSE) { if (GetTickCount() - lastTickCheck > 1000) { if (IsTrackAvailable()) { if (sessionID.empty()) { if (GetTickCount() - m_lastHandShakeTickCount > 30000) { HandShake(sessionID, nowPlayingURL, submissionURL); m_lastHandShakeTickCount = GetTickCount(); } } if (!sessionID.empty()) { if (SubmitTracks(sessionID.c_str(), submissionURL.c_str())) { failCounter = 0; CSingleLock lock(&m_cs); m_jobs.clear(); } else { failCounter++; if (failCounter == 3) sessionID.clear(); } } } lastTickCheck = GetTickCount(); } Sleep(10); } TRACE(_T("LastFM::WorkingThread. Exit\r\n")); return 0; } BOOL LastFMServices::HandShake(std::basic_string<TCHAR>& sessionID, std::basic_string<TCHAR>& nowPlayingURL, std::basic_string<TCHAR>& submissionURL) { sessionID.clear(); nowPlayingURL.clear(); submissionURL.clear(); if (m_username.empty() || m_MD5password.empty()) { //TRACE(_T("@4 LastFMServices::HandShake. Empty Authorization.\r\n")); m_error = ERR_BadAuth; return FALSE; } SYSTEMTIME st; GetSystemTime(&st); UINT ts = SystemTime2UnixTimeStamp(st); LPCTSTR auth = _T("auth"); cMD5 md5; CHAR authStr[100]; _snprintf(authStr, 100, "%s%u", (LPCSTR)CT2CA(m_MD5password.c_str()), ts); //http://post.audioscrobbler.com/?hs=true&p=1.2.1&c=<client-id>&v=<client-ver>&u=<user>&t=<timestamp>&a=<auth> TCHAR url[2000]; _sntprintf(url, 2000, _T("http://post.audioscrobbler.com/?hs=true&p=%s&c=%s&v=%s&u=%s&t=%u&a=%.32s"), sProtocolVer, sClientID, sClientVer, m_username.c_str(), ts, (LPCTSTR)CA2CT(_strlwr(md5.CalcMD5FromString(authStr)))); TRACE(_T("About to request: '%s'\r\n"), url); m_state = ST_Connecting; std::string page; if (DownloadWebPage(page, m_hNet, url)) { std::string delimiter = "\n"; std::string line; INT pos = getToken(page, 0, delimiter, line); INT count = 0; while (pos != -1) { switch (count) { case 0: m_errorString = line; if (line == "OK") m_error = ERR_None; else if (line == "BANNED") m_error = ERR_Banned; else if (line == "BADAUTH") m_error = ERR_BadAuth; else if (line == "BADTIME") m_error = ERR_BadTime; else m_error = ERR_Failed; break; case 1: sessionID = (LPCTSTR)CA2CT(line.c_str()); break; case 2: nowPlayingURL = (LPCTSTR)CA2CT(line.c_str()); break; case 3: submissionURL = (LPCTSTR)CA2CT(line.c_str()); break; default: break; } if (m_error != ERR_None) break; count++; pos = getToken(page, pos, delimiter, line); } if (m_error == ERR_None) { TRACE(_T("@4 LastFMServices::HandShake. success.\r\n")); m_state = ST_Idle; } else { TRACE(_T("@4 LastFMServices::HandShake. fail: '%s'.\r\n"), CA2CT(GetErrorString())); m_state = ST_Error; } } else //---Download page failed { m_error = ERR_CommunicationError; m_state = ST_Error; TRACE(_T("@4 LastFMServices::HandShake. fail: Communication Error.\r\n")); } return m_state == ST_Idle; } BOOL LastFMServices::ConvertString(LPCTSTR src, LPSTR bf, UINT bfLen) { std::tstring temp = src; replace(temp, _T("&"), _T("%26")); INT ret = WideCharToMultiByte(CP_UTF8, 0, temp.c_str(), (INT)temp.size() + 1, bf, bfLen, NULL, NULL); return ret > 0; } BOOL LastFMServices::SubmitTracks(LPCTSTR sessionID, LPCTSTR submissionURL) { ASSERT(sessionID != NULL && submissionURL != NULL); if (!(sessionID != NULL && submissionURL != NULL)) return FALSE; ASSERT(sessionID[0] != 0 && submissionURL[0]); if (!(sessionID[0] != 0 && submissionURL[0])) return FALSE; TRACEST(_T("LastFMServices::SubmitTracks")); std::string postData; const INT bfSize = 1000; postData.reserve(bfSize); CHAR bf[bfSize]; CHAR utf8bf[bfSize]; //s=<sessionID> //The Session ID string returned by the handshake request. Required _snprintf(bf, bfSize, "s=%s&", CT2CA(sessionID)); postData = bf; { CSingleLock lock(&m_cs); std::list<LastFMSubmitTrack>::const_iterator it = m_jobs.begin(); UINT i = 0; for (;it != m_jobs.end(); it++) { const LastFMSubmitTrack& track = *it; //a[0]=<artist> //The artist name. Required. ConvertString(track.artist.c_str(), utf8bf, bfSize); _snprintf(bf, bfSize, "a[%d]=%s&", i, utf8bf); bf[bfSize - 1] = 0; postData += bf; //t[0]=<track> //The track title. Required. ConvertString(track.track.c_str(), utf8bf, bfSize); _snprintf(bf, bfSize, "t[%d]=%s&", i, utf8bf); bf[bfSize - 1] = 0; postData += bf; //i[0]=<time> //The time the track started playing, in UNIX timestamp format. //This must be in the UTC time zone, and is required. _snprintf(bf, bfSize, "i[%d]=%u&", i, track.unixTimeStamp); bf[bfSize - 1] = 0; postData += bf; //o[0]=<source> //The source of the track. Required _snprintf(bf, bfSize, "o[%d]=P&", i); postData += bf; //r[0]=<rating> //A single character denoting the rating of the track _snprintf(bf, bfSize, "r[%d]=&", i); bf[bfSize - 1] = 0; postData += bf; //l[0]=<secs> //The length of the track in seconds. Required when the source is P, optional otherwise. _snprintf(bf, bfSize, "l[%d]=%d&", i, track.length); bf[bfSize - 1] = 0; postData += bf; //b[0]=<album> //The album title, or an empty string if not known. ConvertString(track.album.c_str(), utf8bf, bfSize); _snprintf(bf, bfSize, "b[%d]=%s&", i, utf8bf); bf[bfSize - 1] = 0; postData += bf; //n[0]=<tracknumber> //The position of the track on the album, or an empty string if not known. _snprintf(bf, bfSize, "n[%d]=%d&", i, track.trackNo); bf[bfSize - 1] = 0; postData += bf; //m[0]=<mb-trackid> //The MusicBrainz Track ID, or an empty string if not known. _snprintf(bf, bfSize, "m[%d]=&", i); bf[bfSize - 1] = 0; postData += bf; i++; } } postData.erase(postData.size() - 1); TRACE(_T("@4 LastFMServices::SubmitTracks. postingData '%s'\n"), CA2CT(postData.c_str())); std::string page; if (DownloadWebPagePost(page, m_hNet, submissionURL, postData.c_str())) { m_errorString = page; if (strncmp(page.c_str(), "OK", 2) == 0) { //TRACE(_T("@4 LastFMServices::SubmitTracks. Track Succesfully submitted.\n")); m_error = ERR_None; m_state = ST_Idle; } else { m_state = ST_Error; if (strncmp(page.c_str(), "BADSESSION", 10) == 0) m_error = ERR_BadSession; else m_error = ERR_Failed; TRACE(_T("@1 LastFMServices::SubmitTracks. Track Failed (%d):'%s'.\n"), m_error, CA2CT(GetErrorString())); TRACE(_T("@1 ... postedData '%s'.\n"), CA2CT(postData.c_str())); } } else { m_state = ST_Error; m_error = ERR_CommunicationError; TRACE(_T("@4 LastFMServices::SubmitTracks. DownloadWebPage Failed\n")); } if (m_state == ST_Error) return FALSE; return TRUE; } BOOL LastFMServices::LeaveThread(HANDLE hThread, UINT timeOut) { BOOL ret = TRUE; DWORD exitCode = 0; GetExitCodeThread(hThread, &exitCode); SetThreadPriority(hThread, THREAD_PRIORITY_NORMAL); DWORD tickCount = GetTickCount(); while (exitCode == STILL_ACTIVE) { Sleep(0); if (GetTickCount() - tickCount > timeOut) { TRACE(_T("@0 LeaveThread: Terminating Thread: %d\r\n"), (INT)hThread); TerminateThread(hThread, -1); return FALSE; } if (!GetExitCodeThread(hThread, &exitCode)) return FALSE; } return TRUE; }
[ "outcast1000@dc1b949e-fa36-4f9e-8e5c-de004ec35678" ]
[ [ [ 1, 455 ] ] ]
6f6eafcb535dcedcff9d1395692229c3b4edad2b
bf9ca8636584e8112c392d6ca5cd85b6be4f6ebf
/src/Game.cpp
0da3382f296c88fe72db5a55f930572606c3bb26
[]
no_license
RileyA/LD19_Aquatic
34e8e08a450ee9f53365d98ebef505341869dfb5
c30e1f8e3304428e7077cb2042b4169450a35db9
refs/heads/master
2020-05-18T08:49:05.084811
2011-02-17T07:36:14
2011-02-17T07:36:14
1,377,029
0
0
null
null
null
null
UTF-8
C++
false
false
10,321
cpp
#include "stdafx.h" #include "Game.h" #include "State.h" #include "Bucket.h" // define this here Game* Game::mInstance = 0; Game::Game() :mInitialized(false), mShutdown(false), mEndState(false), mLog(true), mFileLog(true), mLogFile("LD19.log"), mLastTime(0), mDeltaTime(0.f), mTimeSpeed(1.f), mGraphicsManager(0) { assert(!mInstance);// only one of these should ever exist... mInstance = this; mConsoleIn = 0; mConsoleActive = false; mHistoryPos = 0; srand(time(0)); } //--------------------------------------------------------------------------- Game::~Game() { deinit(); } //--------------------------------------------------------------------------- Game* Game::getPtr() { return mInstance; } //--------------------------------------------------------------------------- Game& Game::getRef() { return *mInstance; } //--------------------------------------------------------------------------- void Game::init() { if(!mInitialized) { if(!mLogFile.is_open()) { mFileLog = false; } else if(mLogFile.is_open()&&!mFileLog) { mLogFile.close(); } mPhysicsManager = new PhysicsManager(); mGraphicsManager = new GraphicsManager(); mGraphicsManager->init(1024,768,true,false); mAudio = irrklang::createIrrKlangDevice(); registerType<GraphicsManager>("GraphicsManager"); registerFunction(&GraphicsManager::setFog,"setFog"); registerType<Game>("Game"); registerFunction(&Game::getPtr,"getGame"); registerFunction(&Game::log,"log"); registerFunction(&Game::getGraphicsManager,"getGfx"); registerType<Signal>("Signal"); registerType<Slot>("Slot"); registerType<State>("State"); registerFunction(&State::getSignal,"getSignal"); registerFunction(&State::getSlot,"getSlot"); runString("getGame().log(\"Scripting system functional!\");"); mInputMgr = InputManager::getSingletonPtr(); mInputMgr->initialise(mGraphicsManager->getWindow()); mInputMgr->addKeyListener(this,"GameKeyListener"); mInputMgr->addMouseListener(this,"GameMouseListener"); //mInputMgr->addJoystickListener( this, "ListenerName" ); Gorilla::Rectangle* rect = mGraphicsManager->getLayer(14)->createRectangle(0,570,1024,727-530); rect->background_colour(Ogre::ColourValue(0.4,0.4,0.4,0.6)); rect = mGraphicsManager->getLayer(14)->createRectangle(0,727,1024,30); rect->background_colour(Ogre::ColourValue(0.4,0.4,0.4,0.8)); mConsoleIn = mGraphicsManager->getLayer(15)->createMarkupText(14,10,730,"%6> "); for(uint i=1;i<8;++i) { mConsoleOut.push_back(mGraphicsManager->getLayer(15)->createMarkupText(14,10,720-i*20,"~")); } mGraphicsManager->getLayer(14)->hide(); mGraphicsManager->getLayer(15)->hide(); createBucket("Default"); log("Basic subsystems initialized!"); mInitialized = true; } } //--------------------------------------------------------------------------- void Game::deinit() { if(mInitialized) { mConsoleOut.clear(); mConsoleIn = 0; delete mGraphicsManager; mGraphicsManager = 0; mAudio->drop(); log("Basic subsystems deinitialized!"); mInitialized = false; } } //--------------------------------------------------------------------------- void Game::go() { if(mInitialized) { while(!mStates.empty()&&!mShutdown) { mEndState = false; mStates[0]->init(); mInputMgr->addKeyListener(mStates[0],"CurrentStateKeyListener"); mInputMgr->addMouseListener(mStates[0],"CurrentStateMouseListener"); mLastTime = clock(); while(mStates[0]->update(mDeltaTime)&&!mEndState&&!mShutdown) { long now = clock(); long delta = now - mLastTime; mLastTime = now; mDeltaTime = static_cast<float>(delta)/1000.f; std::map<String,Bucket*>::iterator it = mBuckets.begin(); for(it;it!=mBuckets.end();++it) it->second->update(mDeltaTime*mTimeSpeed); mInputMgr->capture(); mPhysicsManager->update(mDeltaTime*mTimeSpeed); mGraphicsManager->update(); } mStates[0]->deinit(); mInputMgr->removeKeyListener("CurrentStateKeyListener"); mInputMgr->removeMouseListener("CurrentStateMouseListener"); std::map<String,Bucket*>::iterator i = mBuckets.begin(); for(i;i!=mBuckets.end();++i) delete i->second; mBuckets.clear(); createBucket("Default"); delete mStates[0]; mStates.erase(mStates.begin()); mGraphicsManager->endState(); mPhysicsManager->deinit(); } for(uint i=0;i<mStates.size();++i) { delete mStates[i]; } mStates.clear(); } } //--------------------------------------------------------------------------- void Game::log(String message) { if(mLog) { String timeStamp = getTimeStamp(); std::cout<<timeStamp<<": "<<message<<"\n"; if(mFileLog&&mLogFile.is_open()) { mLogFile<<timeStamp<<": "<<message<<"\n"; mLogFile.flush(); } } pushConsole(message); } //--------------------------------------------------------------------------- Real Game::getDeltaTime() { return mDeltaTime; } //--------------------------------------------------------------------------- Real Game::getTimeSpeed() { return mTimeSpeed; } //--------------------------------------------------------------------------- void Game::setTimeSpeed(Real speed) { if(speed>=0.f) { mTimeSpeed = speed; } } //--------------------------------------------------------------------------- String Game::getTimeStamp() { uint now = clock() / 1000; uint hours = now / 3600; now = now % 3600; uint minutes = now / 60; now = now % 60; uint seconds = now; // format = "HH:MM:SS" std::stringstream stamp; if(hours<10) stamp<<"0"; stamp<<hours<<":"; if(minutes<10) stamp<<"0"; stamp<<minutes<<":"; if(seconds<10) stamp<<"0"; stamp<<seconds; String out; stamp>>out; return out; } //--------------------------------------------------------------------------- void Game::runString(String script) { try { mChai.eval(script); } catch(chaiscript::Eval_Error e) { Game::getPtr()->log(String("Script Error: ")+e.what()); } } //--------------------------------------------------------------------------- void Game::runFile(String filename) { try { mChai.eval_file(filename); } catch(chaiscript::Eval_Error e) { Game::getPtr()->log(String("Script Error: ")+e.what()); } } //--------------------------------------------------------------------------- void Game::addState(State* state) { mStates.push_back(state); } //--------------------------------------------------------------------------- GraphicsManager* Game::getGraphicsManager() { return mGraphicsManager; } //--------------------------------------------------------------------------- bool Game::keyPressed(const OIS::KeyEvent &evt) { if(mConsoleIn&&mConsoleActive&&evt.key!=OIS::KC_RETURN) { char key = translateWin32Text(evt.key); String str = std::string(&key); mConsoleIn->text(mConsoleIn->text()+str); if(evt.key==OIS::KC_BACK&&mConsoleIn->text().length()>5) mConsoleIn->text(mConsoleIn->text().substr(0,mConsoleIn->text().length()-2)); } return true; } //--------------------------------------------------------------------------- bool Game::keyReleased(const OIS::KeyEvent &evt) { //if (evt.key == OIS::KC_ESCAPE) // mShutdown = true; if(evt.key==OIS::KC_END) mEndState = true; else if(evt.key==OIS::KC_GRAVE) { mConsoleActive = !mConsoleActive; if(mConsoleActive) { mGraphicsManager->getLayer(14)->show(); mGraphicsManager->getLayer(15)->show(); } else { mGraphicsManager->getLayer(14)->hide(); mGraphicsManager->getLayer(15)->hide(); } } else if(evt.key == OIS::KC_RETURN&&mConsoleActive) { String script = mConsoleIn->text().substr(4,mConsoleIn->text().length()-1); if(mHistoryPos!=mConsoleHistory.size()-1) { mConsoleHistory.push_back(mConsoleIn->text()); } mHistoryPos = -1; pushConsole("%6"+script); runString(script); mConsoleIn->text("%6> "); } else if(evt.key == OIS::KC_UP&&mConsoleActive&&mConsoleHistory.size()>0) { if(mHistoryPos==-1) { mHistoryPos = mConsoleHistory.size()-1; mConsoleIn->text(mConsoleHistory[mHistoryPos]); } else { if(mHistoryPos==0) { mHistoryPos = -1; mConsoleIn->text("%6> "); } else { --mHistoryPos; mConsoleIn->text(mConsoleHistory[mHistoryPos]); } } } else if(evt.key == OIS::KC_DOWN&&mConsoleActive&&mConsoleHistory.size()>0) { if(mHistoryPos==mConsoleHistory.size()-1) { mHistoryPos = -1; mConsoleIn->text("%6> "); } else { mHistoryPos++; mConsoleIn->text(mConsoleHistory[mHistoryPos]); } } return true; } //--------------------------------------------------------------------------- bool Game::mouseMoved(const OIS::MouseEvent &evt) { return true; } //--------------------------------------------------------------------------- bool Game::mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID btn) { return true; } //--------------------------------------------------------------------------- bool Game::mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID btn) { return true; } //--------------------------------------------------------------------------- void Game::pushConsole(String out) { if(mConsoleIn) { String temp = mConsoleOut[0]->text(); mConsoleOut[0]->text(out); for(uint i=1;i<mConsoleOut.size();++i) { String temp2 = mConsoleOut[i]->text(); mConsoleOut[i]->text(temp); temp = temp2; } } } void Game::registerObject(GameObject* obj,String name,String bucket) { if(mBuckets.find(bucket)!=mBuckets.end()) { mBuckets[bucket]->pushObject(obj,name); } } void Game::createBucket(String name) { mBuckets[name] = new Bucket(name); }
[ [ [ 1, 422 ] ] ]
f5b410fe5b9ddf20972f3406bae29f72a30378b6
172e5e180659a6a7242f95a367f5a879114bc38d
/SlideList/SlideList.cpp
8ace73a996267b6c0855388bb2b7ce91e70d8807
[]
no_license
urere/mfcslidelist
1e66fc1a7b34f7832f5d09d278d2dd145d30adec
7c7eb47122c6b7c3b52a93145ec8b2d6f2476519
refs/heads/master
2021-01-10T02:06:44.884376
2008-03-27T21:25:09
2008-03-27T21:25:09
47,465,994
0
0
null
null
null
null
UTF-8
C++
false
false
4,409
cpp
// SlideList.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "SlideList.h" #include "MainFrm.h" #include "SlideListDoc.h" #include "SlideListView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CSlideListApp BEGIN_MESSAGE_MAP(CSlideListApp, CWinApp) //{{AFX_MSG_MAP(CSlideListApp) ON_COMMAND(ID_APP_ABOUT, OnAppAbout) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAP // Standard file based document commands ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) // Standard print setup command ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CSlideListApp construction CSlideListApp::CSlideListApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only CSlideListApp object CSlideListApp theApp; ///////////////////////////////////////////////////////////////////////////// // CSlideListApp initialization BOOL CSlideListApp::InitInstance() { AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your company or organization. SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CSlideListDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CSlideListView)); AddDocTemplate(pDocTemplate); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; // The one and only window has been initialized, so show and update it. m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) // No message handlers //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() // App command to run the dialog void CSlideListApp::OnAppAbout() { CAboutDlg aboutDlg; aboutDlg.DoModal(); } ///////////////////////////////////////////////////////////////////////////// // CSlideListApp message handlers
[ "ratcliffe.gary@e6454d50-7149-0410-9942-4ffd99bf3498" ]
[ [ [ 1, 161 ] ] ]
d7a134efbbba5a6c629b218a77b454d8edbf15ae
27d5670a7739a866c3ad97a71c0fc9334f6875f2
/CPP/Targets/MapLib/Symbian/src/MLSymbianHolder.cpp
e6a1c7a5797fc62fbb17f497e8f4b5f91a7554b3
[ "BSD-3-Clause" ]
permissive
ravustaja/Wayfinder-S60-Navigator
ef506c418b8c2e6498ece6dcae67e583fb8a4a95
14d1b729b2cea52f726874687e78f17492949585
refs/heads/master
2021-01-16T20:53:37.630909
2010-06-28T09:51:10
2010-06-28T09:51:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,868
cpp
/* Copyright (c) 1999 - 2010, Vodafone Group Services Ltd All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "MLSymbianHolder.h" #include "MLMapInterface.h" #include "MLConfigurator.h" #include "MapDrawingInterface.h" #include "MapMovingInterface.h" #include "MapLib.h" #include "SymbianMapLib.h" #include "SymbianMapControl.h" #include "Cursor.h" #include "MC2Coordinate.h" #include "MC2Point.h" // To be removed #include "SymbianTCPConnectionHandler.h" #include "HttpClientConnection.h" #include "SharedHttpDBufRequester.h" namespace { /** * Better name, please */ class MLMapLibConfigurator : public MLConfigurator { public: MLMapLibConfigurator( MapLib* mapLib ) { m_mapLib = mapLib; } const char* setLanguageAsISO639( const char* isoStr ) { return m_mapLib->setLanguageAsISO639( isoStr ); } void setDPICorrectionFactor( uint32 factor ) { m_mapLib->setDPICorrectionFactor( factor ); } int addDiskCache( const char* path, uint32 maxSize ) { return m_mapLib->addDiskCache( path, maxSize ); } int setDiskCacheSize( uint32 nbrBytes ) { return m_mapLib->setDiskCacheSize( nbrBytes ); } int clearDiskCache() { return m_mapLib->clearDiskCache(); } private: MapLib* m_mapLib; }; /** * This class should be platform independent * but a better name would be nice. */ class MapLibMLMapInterface : public MLMapInterface { public: MapLibMLMapInterface( MapLib* mapLib, Cursor* cursor ) { m_mapLib = mapLib; m_cursor = cursor; m_lastBitMapID = 0; } MapMovingInterface* mm() const { return m_mapLib->getMapMovingInterface(); } MapDrawingInterface* md() { return m_mapLib->getMapDrawingInterface(); } void rr() { md()->requestRepaint(); } void setCenter( const MC2Coordinate& center ) { mm()->setCenter( center ); rr(); } void setWorldBox( const MC2Coordinate& oneCorner, const MC2Coordinate& otherCorner ) { mm()->setWorldBox( oneCorner, otherCorner ); rr(); } void setScale( double scale ) { mm()->setScale( scale ); rr(); } MC2Coordinate getCoord() const { MC2Coordinate retval; mm()->inverseTransform( retval, m_cursor->getCursorPos() ); return retval; } const char* getServerString() const { const ClickInfo& cl = mm()->getInfoForFeatureAt( m_cursor->getCursorPos(), true ); return cl.getServerString(); } void setGPSPosition( const MC2Coordinate& gpsPos, int angle ) { setCenter( gpsPos ); mm()->setAngle( angle ); rr(); } int addUserDefBitmap( const char* bitmap, const MC2Coordinate& coord, const char* info = "" ) { return 0; } int removeUserDefBitmap( int id ) { return -1; } void clearUserDefBitmaps() { } private: MapLib* m_mapLib; Cursor* m_cursor; uint32 m_lastBitMapID; }; class MLSymbianHolderStorage { private: friend class MLSymbianHolder; MLSymbianHolderStorage( CCoeControl& parent, DBufConnection* mapConn ) { if ( mapConn == NULL ) { mapConn = new SharedHttpDBufRequesterDBufConnection( new HttpClientConnection( "oss-xml.services.wayfinder.com", 80, NULL, new SymbianTCPConnectionHandler()), "/TMap", "" ); // FIXME: Remove this when implemented by Indians } m_control = CSymbianMapControl::NewL( parent, mapConn ); m_mapInterface = new MapLibMLMapInterface( m_control->getMapLib(), m_control ); m_configurator = new MLMapLibConfigurator( m_control->getMapLib() ); } ~MLSymbianHolderStorage() { delete m_mapInterface; delete m_configurator; delete m_control; } CSymbianMapControl* m_control; MLConfigurator* m_configurator; MapLibMLMapInterface* m_mapInterface; }; } MLSymbianHolder* MLSymbianHolder::NewL( CCoeControl& parent, DBufConnection* mapConn ) { return new MLSymbianHolder( parent, mapConn ); } MLSymbianHolder::MLSymbianHolder( CCoeControl& parent, DBufConnection* mapConn ) { m_storage = new MLSymbianHolderStorage( parent, mapConn ); } MLSymbianHolder::~MLSymbianHolder() { delete m_storage; } CCoeControl* MLSymbianHolder::getControl() const { return m_storage->m_control; } MLConfigurator* MLSymbianHolder::getConfigurator() const { return m_storage->m_configurator; } MLMapInterface* MLSymbianHolder::getMapInterface() const { return m_storage->m_mapInterface; }
[ [ [ 1, 217 ] ] ]
1eac188099f2a345053c60fbdc538fd367a5dad3
59957e5aa42be6037a8539d299ca741086b81761
/friendlisthandler.cpp
d44114d2950db4f40da8d90ea7d73ab560f9e4bd
[]
no_license
thiagomg/twithiago
4a1144ab904ba26b53a09e454f7d9c709984aefe
60b5f8da1a3bcc426916949a7e50944163874a28
refs/heads/master
2020-04-16T07:15:46.909318
2010-04-12T13:06:02
2010-04-12T13:06:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,477
cpp
#include "friendlisthandler.h" FriendListHandler::FriendListHandler() { _timeline = new Timeline(); } FriendListHandler::~FriendListHandler() { delete _timeline; } bool FriendListHandler::startDocument() { _inStatus = false; _inUser = false; _level = 0; _pMapStatus = NULL; return true; } bool FriendListHandler::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts) { if( localName == "statuses" || localName == "direct-messages" ) return true; if( localName == "status" || localName == "direct_message" ) { _pMapStatus = new Timeline::MapStatus(); _timeline->pushMap( _pMapStatus ); } else { _currentTagList.append(localName); } return true; } bool FriendListHandler::endElement( const QString &namespaceURI, const QString &localName, const QString &qName) { if( localName == "statuses" || localName == "direct-messages" ) return true; QString currentTag = _currentTagList.join("_"); if( _pMapStatus != NULL ) { if( currentTag.size() > 0 ) { _pMapStatus->insert( currentTag, _currentText ); } } _currentText = ""; if( localName != "status" && localName != "direct_message" ) { _currentTagList.pop_back(); } return true; } bool FriendListHandler::characters(const QString& ch) { _currentText += ch; return true; } bool FriendListHandler::endDocument() { //_timeline->dump(); return true; }
[ "thiedri@8854fccc-d45e-11de-bff8-d51c198f79d0" ]
[ [ [ 1, 68 ] ] ]
32ee07a13ec7198e81db056138a44f03d38f4826
fbe2cbeb947664ba278ba30ce713810676a2c412
/iptv_root/iptv_kernel/include/iptv_kernel/MediaProcessorNotify.h
8da5e2fa17a26f9fdb13f9cb4922567c4b5c1e1a
[]
no_license
abhipr1/multitv
0b3b863bfb61b83c30053b15688b070d4149ca0b
6a93bf9122ddbcc1971dead3ab3be8faea5e53d8
refs/heads/master
2020-12-24T15:13:44.511555
2009-06-04T17:11:02
2009-06-04T17:11:02
41,107,043
0
0
null
null
null
null
UTF-8
C++
false
false
1,019
h
#ifndef MEDIA_PROCESSOR_NOTIFY_H #define MEDIA_PROCESSOR_NOTIFY_H enum MediaProcessorNotifyCode{ MPNC_READ_PACKET, // Parameter class: MediaProcessorParam MPCN_WRITE_PACKET, // Parameter class: Unknown MPCN_VIDEO_ALIVE, // Parameter class: MediaProcessorParam MPCN_AUDIO_ALIVE, // Parameter class: MediaProcessorParam MPCN_BUFFERING_START, // Parameter class: Unknown MPCN_BUFFERING_STOP, // Parameter class: Unknown MPCN_ERROR}; // Parameter class: Unknown /** @brief Base structure to send MediaProcessor notifications. * */ struct MediaProcessorParam { MediaProcessorNotifyCode m_code; unsigned long m_mediaID; }; /** @brief Receives notifications from MediaProcessor class. * * Any class that needs to receive MediaProcessor notifications should * be derived of this class. * */ class MediaProcessorNotify { public: virtual bool OnMediaProcessorNotify(MediaProcessorParam &param) = 0; }; #endif
[ "heineck@c016ff2c-3db2-11de-a81c-fde7d73ceb89" ]
[ [ [ 1, 34 ] ] ]
9b915ba0c7d157677dd1d209e74b7fc76f68ee05
7347ab0d3daab6781af407d43ac29243daeae438
/src/utilities/math.h
df87e2619633f8fc152b197e337210d703c5982c
[]
no_license
suprafun/smalltowns
e096cdfc11e329674a7f76486452f4cd58ddaace
c722da7dd3a1d210d07f22a6c322117b540e63da
refs/heads/master
2021-01-10T03:09:47.664318
2011-06-03T01:22:29
2011-06-03T01:22:29
50,808,558
0
0
null
null
null
null
UTF-8
C++
false
false
2,171
h
/********************************************* * * Author: David Athay * * License: New BSD License * * Copyright (c) 2008, CT Games * 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 CT Games 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. * * * Date of file creation: 08-10-05 * * $Id$ * ********************************************/ /** * The math file provides mathematical functions */ #ifndef _ST_MATH_HEADER #define _ST_MATH_HEADER #include "types.h" namespace ST { /** * Check Inside * Tells whether point p is inside rectangle r * @param p The point * @param r The rectangle * @return Returns true if p is inside r */ bool checkInside(Point &p, Rectangle &r); } #endif
[ "ko2fan@2ae5cb60-8703-11dd-9899-c7ba65f7c4c7" ]
[ [ [ 1, 61 ] ] ]
d3ce346226b2e16ed30400d29394c6a943979840
f55665c5faa3d79d0d6fe91fcfeb8daa5adf84d0
/Depend/MyGUI/Plugins/Plugin_AwesomiumWidget/AwesomiumWidgetFactory.h
514d8ded712f357d23ceae911afff8d839bcd954
[]
no_license
lxinhcn/starworld
79ed06ca49d4064307ae73156574932d6185dbab
86eb0fb8bd268994454b0cfe6419ffef3fc0fc80
refs/heads/master
2021-01-10T07:43:51.858394
2010-09-15T02:38:48
2010-09-15T02:38:48
47,859,019
2
1
null
null
null
null
UTF-8
C++
false
false
752
h
/*! @file @author Albert Semenov @date 10/2009 */ #ifndef __AWESOMIUM_WIDGET_FACTORY_H__ #define __AWESOMIUM_WIDGET_FACTORY_H__ #include "MyGUI_Prerequest.h" #include "WebCore.h" #include "KeyboardHook.h" namespace Awesomium { class AwesomiumWidgetFactory : public HookListener { public: AwesomiumWidgetFactory(); virtual ~AwesomiumWidgetFactory(); static Awesomium::WebCore* getCore() { return msCore; } private: void notifyFrameStart(float _time); virtual void handleKeyMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); private: static Awesomium::WebCore* msCore; KeyboardHook* mKeyboardHook; }; } // namespace Awesomium #endif // __AWESOMIUM_WIDGET_FACTORY_H__
[ "albertclass@a94d7126-06ea-11de-b17c-0f1ef23b492c" ]
[ [ [ 1, 38 ] ] ]
fee39a689c890a79f0994f88cf9b87cf25fdf113
672d939ad74ccb32afe7ec11b6b99a89c64a6020
/Graph/Graph3/MainFrm.h
db059b09616a04edfb3131e17ec51bf54eb3d6f4
[]
no_license
cloudlander/legacy
a073013c69e399744de09d649aaac012e17da325
89acf51531165a29b35e36f360220eeca3b0c1f6
refs/heads/master
2022-04-22T14:55:37.354762
2009-04-11T13:51:56
2009-04-11T13:51:56
256,939,313
1
0
null
null
null
null
UTF-8
C++
false
false
1,639
h
// MainFrm.h : interface of the CMainFrame class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_MAINFRM_H__5C65CE72_0E79_4FA4_A5FC_60E86F5E7496__INCLUDED_) #define AFX_MAINFRM_H__5C65CE72_0E79_4FA4_A5FC_60E86F5E7496__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "ChildView.h" class CMainFrame : public CFrameWnd { public: CMainFrame(); protected: DECLARE_DYNAMIC(CMainFrame) // Attributes public: // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMainFrame) virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo); //}}AFX_VIRTUAL // Implementation public: virtual ~CMainFrame(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif CChildView m_wndView; // Generated message map functions protected: //{{AFX_MSG(CMainFrame) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnSetFocus(CWnd *pOldWnd); // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MAINFRM_H__5C65CE72_0E79_4FA4_A5FC_60E86F5E7496__INCLUDED_)
[ "xmzhang@5428276e-be0b-f542-9301-ee418ed919ad" ]
[ [ [ 1, 60 ] ] ]
35fad4f53ba14ee23ce78e30aac815102b05270f
f8b364974573f652d7916c3a830e1d8773751277
/emulator/allegrex/instructions/BNE.h
1f2dd8712f595fe33aa3ab8f8d74cc0516fb4097
[]
no_license
lemmore22/pspe4all
7a234aece25340c99f49eac280780e08e4f8ef49
77ad0acf0fcb7eda137fdfcb1e93a36428badfd0
refs/heads/master
2021-01-10T08:39:45.222505
2009-08-02T11:58:07
2009-08-02T11:58:07
55,047,469
0
0
null
null
null
null
UTF-8
C++
false
false
1,028
h
template< > struct AllegrexInstructionTemplate< 0x14000000, 0xfc000000 > : AllegrexInstructionUnknown { static AllegrexInstructionTemplate &self() { static AllegrexInstructionTemplate insn; return insn; } static AllegrexInstruction *get_instance() { return &AllegrexInstructionTemplate::self(); } virtual AllegrexInstruction *instruction(u32 opcode) { return this; } virtual char const *opcode_name() { return "BNE"; } virtual void interpret(Processor &processor, u32 opcode); virtual void disassemble(u32 address, u32 opcode, char *opcode_name, char *operands, char *comment); protected: AllegrexInstructionTemplate() {} }; typedef AllegrexInstructionTemplate< 0x14000000, 0xfc000000 > AllegrexInstruction_BNE; namespace Allegrex { extern AllegrexInstruction_BNE &BNE; } #ifdef IMPLEMENT_INSTRUCTION AllegrexInstruction_BNE &Allegrex::BNE = AllegrexInstruction_BNE::self(); #endif
[ [ [ 1, 41 ] ] ]
b6402f570d39f9ce80df5e8586fdd42763ba103b
96fefafdfbb413a56e0a2444fcc1a7056afef757
/MQ2Main/MQ2PluginHandler.cpp
5435f0ea149dd39a6d4bcb984797e990ab79eb00
[]
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
14,497
cpp
/***************************************************************************** MQ2Main.dll: MacroQuest2's extension DLL for EverQuest Copyright (C) 2002-2003 Plazmic, 2003-2005 Lax This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, 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. ******************************************************************************/ #if !defined(ISXEQ) && !defined(ISXEQ_LEGACY) #if !defined(CINTERFACE) #error /DCINTERFACE #endif #define DBG_SPEW //#define DEBUG_PLUGINS #ifdef DEBUG_PLUGINS #define PluginDebug DebugSpew #else #define PluginDebug // #endif #include "MQ2Main.h" CRITICAL_SECTION gPluginCS; BOOL bPluginCS=0; DWORD checkme(char *module) { char *p; PIMAGE_DOS_HEADER pd = (PIMAGE_DOS_HEADER)module; PIMAGE_FILE_HEADER pf; p = module + pd->e_lfanew; p += 4; //skip sig pf = (PIMAGE_FILE_HEADER) p; return pf->TimeDateStamp; } static unsigned int mq2mainstamp = 0; DWORD LoadMQ2Plugin(const PCHAR pszFilename) { CHAR Filename[MAX_PATH]={0}; strcpy(Filename,pszFilename); strlwr(Filename); PCHAR Temp=strstr(Filename,".dll"); if (Temp) Temp[0]=0; if (!stricmp(Filename,"mq2warp")) // ^_^ { return 0; } CAutoLock Lock(&gPluginCS); DebugSpew("LoadMQ2Plugin(%s)",Filename); CHAR FullFilename[MAX_STRING]={0}; sprintf(FullFilename,"%s\\%s.dll",gszINIPath,Filename); if (!mq2mainstamp) { mq2mainstamp = checkme((char*)GetModuleHandle("mq2main.dll")); } HMODULE hmod=LoadLibrary(FullFilename); if (!hmod) { DebugSpew("LoadMQ2Plugin(%s) Failed",Filename); return 0; } if (mq2mainstamp > checkme((char*)hmod)) { char tmpbuff[MAX_PATH]; sprintf(tmpbuff, "Please recompile %s -- it is out of date with respect to mq2main (%d>%d)", FullFilename, mq2mainstamp, checkme((char*)hmod)); DebugSpew(tmpbuff); MessageBoxA(NULL, tmpbuff, "Plugin Load Failed", MB_OK); FreeLibrary(hmod); return 0; } PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (hmod==pPlugin->hModule) { DebugSpew("LoadMQ2Plugin(%s) already loaded",Filename); // LoadLibrary count must match FreeLibrary count for unloading to work. FreeLibrary(hmod); return 2; // already loaded } pPlugin=pPlugin->pNext; } pPlugin = new MQPLUGIN; memset(pPlugin,0,sizeof(MQPLUGIN)); pPlugin->hModule=hmod; strcpy(pPlugin->szFilename,Filename); pPlugin->Initialize=(fMQInitializePlugin)GetProcAddress(hmod,"InitializePlugin"); pPlugin->Shutdown=(fMQShutdownPlugin)GetProcAddress(hmod,"ShutdownPlugin"); pPlugin->IncomingChat=(fMQIncomingChat)GetProcAddress(hmod,"OnIncomingChat"); pPlugin->Pulse=(fMQPulse)GetProcAddress(hmod,"OnPulse"); pPlugin->WriteChatColor=(fMQWriteChatColor)GetProcAddress(hmod,"OnWriteChatColor"); pPlugin->Zoned=(fMQZoned)GetProcAddress(hmod,"OnZoned"); pPlugin->CleanUI=(fMQCleanUI)GetProcAddress(hmod,"OnCleanUI"); pPlugin->ReloadUI=(fMQReloadUI)GetProcAddress(hmod,"OnReloadUI"); pPlugin->DrawHUD=(fMQDrawHUD)GetProcAddress(hmod,"OnDrawHUD"); pPlugin->SetGameState=(fMQSetGameState)GetProcAddress(hmod,"SetGameState"); pPlugin->AddSpawn=(fMQSpawn)GetProcAddress(hmod,"OnAddSpawn"); pPlugin->RemoveSpawn=(fMQSpawn)GetProcAddress(hmod,"OnRemoveSpawn"); pPlugin->AddGroundItem=(fMQGroundItem)GetProcAddress(hmod,"OnAddGroundItem"); pPlugin->RemoveGroundItem=(fMQGroundItem)GetProcAddress(hmod,"OnRemoveGroundItem"); pPlugin->BeginZone=(fMQBeginZone)GetProcAddress(hmod,"OnBeginZone"); pPlugin->EndZone=(fMQEndZone)GetProcAddress(hmod,"OnEndZone"); float *ftmp = (float*) GetProcAddress(hmod,"?MQ2Version@@3MA"); if (ftmp) pPlugin->fpVersion = *ftmp; else pPlugin->fpVersion = 1.0; if (pPlugin->Initialize) pPlugin->Initialize(); PluginCmdSort(); if (pPlugin->SetGameState) pPlugin->SetGameState(gGameState); if (pPlugin->AddSpawn && gGameState==GAMESTATE_INGAME) { PSPAWNINFO pSpawn=(PSPAWNINFO)pSpawnList; while(pSpawn) { pPlugin->AddSpawn(pSpawn); pSpawn=pSpawn->pNext; } } if (pPlugin->AddGroundItem && gGameState==GAMESTATE_INGAME) { PGROUNDITEM pItem=(PGROUNDITEM)pItemList; while(pItem) { pPlugin->AddGroundItem(pItem); pItem=pItem->pNext; } } pPlugin->pLast=0; pPlugin->pNext=pPlugins; if (pPlugins) pPlugins->pLast=pPlugin; pPlugins=pPlugin; sprintf(FullFilename,"%s-AutoExec",Filename); LoadCfgFile(FullFilename,false); return 1; } BOOL UnloadMQ2Plugin(const PCHAR pszFilename) { DebugSpew("UnloadMQ2Plugin"); CHAR Filename[MAX_PATH]={0}; strcpy(Filename,pszFilename); strlwr(Filename); PCHAR Temp=strstr(Filename,".dll"); if (Temp) Temp[0]=0; // find plugin in list CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (!stricmp(Filename,pPlugin->szFilename)) { if (pPlugin->pLast) pPlugin->pLast->pNext=pPlugin->pNext; else pPlugins=pPlugin->pNext; if (pPlugin->pNext) pPlugin->pNext->pLast=pPlugin->pLast; if (pPlugin->CleanUI) pPlugin->CleanUI(); if (pPlugin->Shutdown) pPlugin->Shutdown(); FreeLibrary(pPlugin->hModule); delete pPlugin; return 1; } pPlugin=pPlugin->pNext; } return 0; } VOID RewriteMQ2Plugins(VOID) { CAutoLock Lock(&gPluginCS); WritePrivateProfileSection("Plugins","",gszINIFilename); PMQPLUGIN pLoop = pPlugins; if (!pLoop) return; // start from the end, we're writing this the order they were added. while (pLoop->pNext) pLoop=pLoop->pNext; while (pLoop) { WritePrivateProfileString("Plugins",pLoop->szFilename,pLoop->szFilename,gszINIFilename); pLoop = pLoop->pLast; } } VOID InitializeMQ2Plugins() { DebugSpew("Initializing plugins"); bmWriteChatColor=AddMQ2Benchmark("WriteChatColor"); bmPluginsIncomingChat=AddMQ2Benchmark("PluginsIncomingChat"); bmPluginsPulse=AddMQ2Benchmark("PluginsPulse"); bmPluginsOnZoned=AddMQ2Benchmark("PluginsOnZoned"); bmPluginsCleanUI=AddMQ2Benchmark("PluginsCleanUI"); bmPluginsReloadUI=AddMQ2Benchmark("PluginsReloadUI"); bmPluginsDrawHUD=AddMQ2Benchmark("PluginsDrawHUD"); bmPluginsSetGameState=AddMQ2Benchmark("PluginsSetGameState"); bmCalculate=AddMQ2Benchmark("Calculate"); bmBeginZone=AddMQ2Benchmark("BeginZone"); bmEndZone=AddMQ2Benchmark("EndZone"); InitializeCriticalSection(&gPluginCS); bPluginCS=1; CHAR PluginList[MAX_STRING*10] = {0}; CHAR szBuffer[MAX_STRING] = {0}; CHAR MainINI[MAX_STRING] = {0}; sprintf(MainINI,"%s\\macroquest.ini",gszINIPath); GetPrivateProfileString("Plugins",NULL,"",PluginList,MAX_STRING*10,MainINI); PCHAR pPluginList = PluginList; while (pPluginList[0]!=0) { GetPrivateProfileString("Plugins",pPluginList,"",szBuffer,MAX_STRING,MainINI); if (szBuffer[0]!=0) { LoadMQ2Plugin(szBuffer); } pPluginList+=strlen(pPluginList)+1; } } VOID UnloadMQ2Plugins() { CAutoLock Lock(&gPluginCS); while(pPlugins) { DebugSpew("%s->Unload()",pPlugins->szFilename); UnloadMQ2Plugin(pPlugins->szFilename); } } VOID ShutdownMQ2Plugins() { bPluginCS=0; { CAutoLock Lock(&gPluginCS); while(pPlugins) { DebugSpew("%s->Unload()",pPlugins->szFilename); UnloadMQ2Plugin(pPlugins->szFilename); } } DeleteCriticalSection(&gPluginCS); } VOID WriteChatColor(std::string text) { char szTemp[MAX_STRING] = {0}; strcpy(szTemp, text.c_str()); WriteChatColor(szTemp); } VOID WriteChatColor(PCHAR Line, DWORD Color, DWORD Filter) { if (!bPluginCS) return; if (gFilterMQ) return; PluginDebug("Begin WriteChatColor()"); EnterMQ2Benchmark(bmWriteChatColor); CHAR PlainText[MAX_STRING]={0}; StripMQChat(Line,PlainText); CheckChatForEvent(PlainText); DebugSpew("WriteChatColor(%s)",Line); CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (pPlugin->WriteChatColor) { pPlugin->WriteChatColor(Line,Color,Filter); } pPlugin=pPlugin->pNext; } ExitMQ2Benchmark(bmWriteChatColor); } BOOL PluginsIncomingChat(PCHAR Line, DWORD Color) { PluginDebug("PluginsIncomingChat()"); if (!bPluginCS) return 0; if(!Line[0]) return 0; CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; BOOL Ret=0; while(pPlugin) { if (pPlugin->IncomingChat) { Ret|=pPlugin->IncomingChat(Line,Color); } pPlugin=pPlugin->pNext; } return Ret; } VOID PulsePlugins() { PluginDebug("PulsePlugins()"); if (!bPluginCS) return; CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (pPlugin->Pulse) { // DebugSpew("%s->Pulse()",pPlugin->szFilename); pPlugin->Pulse(); } pPlugin=pPlugin->pNext; } } VOID PluginsZoned() { PluginDebug("PluginsZoned()"); if (!bPluginCS) return; CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (pPlugin->Zoned) { DebugSpew("%s->Zoned()",pPlugin->szFilename); pPlugin->Zoned(); } pPlugin=pPlugin->pNext; } } VOID PluginsCleanUI() { PluginDebug("PluginsCleanUI()"); if (!bPluginCS) return; CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; DeleteMQ2NewsWindow(); while(pPlugin) { if (pPlugin->CleanUI) { DebugSpew("%s->CleanUI()",pPlugin->szFilename); pPlugin->CleanUI(); } pPlugin=pPlugin->pNext; } } VOID PluginsReloadUI() { PluginDebug("PluginsReloadUI()"); if (!bPluginCS) return; CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (pPlugin->ReloadUI) { DebugSpew("%s->ReloadUI()",pPlugin->szFilename); pPlugin->ReloadUI(); } pPlugin=pPlugin->pNext; } } VOID PluginsSetGameState(DWORD GameState) { PluginDebug("PluginsSetGameState()"); static bool AutoExec=false; static bool CharSelect=true; DrawHUDParams[0]=0; if (!bPluginCS) return; gGameState=GameState; if (GameState==GAMESTATE_INGAME) { gZoning=false; gbDoAutoRun=TRUE; if (!AutoExec) { AutoExec=true; LoadCfgFile("AutoExec",false); } if (CharSelect) { CharSelect=false; CHAR szBuffer[MAX_STRING]={0}; if (PCHARINFO pCharInfo=GetCharInfo()) { sprintf(szBuffer,"%s_%s",EQADDR_SERVERNAME,pCharInfo->Name); LoadCfgFile(szBuffer,false); } if (PCHARINFO2 pCharInfo2=GetCharInfo2()) { sprintf(szBuffer,"%s",GetClassDesc(pCharInfo2->Class)); LoadCfgFile(szBuffer,false); } } } else if (GameState==GAMESTATE_CHARSELECT) { if (!AutoExec) { AutoExec=true; LoadCfgFile("AutoExec",false); } CharSelect=true; LoadCfgFile("CharSelect",false); } CAutoLock Lock(&gPluginCS); DebugSpew("PluginsSetGameState(%d)",GameState); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (pPlugin->SetGameState) { DebugSpew("%s->SetGameState(%d)",pPlugin->szFilename,GameState); pPlugin->SetGameState(GameState); } pPlugin=pPlugin->pNext; } } VOID PluginsDrawHUD() { PluginDebug("PluginsDrawHUD()"); if (!bPluginCS) return; CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (pPlugin->DrawHUD) { pPlugin->DrawHUD(); } pPlugin=pPlugin->pNext; } } VOID PluginsAddSpawn(PSPAWNINFO pNewSpawn) { DWORD BodyType=GetBodyType(pNewSpawn); PluginDebug("PluginsAddSpawn(%s,%d,%d)",pNewSpawn->Name,pNewSpawn->Race,BodyType); if (!bPluginCS) return; if (gGameState>GAMESTATE_CHARSELECT) SetNameSpriteState(pNewSpawn,1); if (GetBodyTypeDesc(BodyType)[0]=='*') { if (BodyType != 63) WriteChatf("Spawn '%s' has unknown bodytype %d",pNewSpawn->Name,BodyType); } CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (pPlugin->AddSpawn) { pPlugin->AddSpawn(pNewSpawn); } pPlugin=pPlugin->pNext; } } VOID PluginsRemoveSpawn(PSPAWNINFO pSpawn) { PluginDebug("PluginsRemoveSpawn(%s)",pSpawn->Name); SpawnByName.erase(pSpawn->Name); if (!bPluginCS) return; CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (pPlugin->RemoveSpawn) { pPlugin->RemoveSpawn(pSpawn); } pPlugin=pPlugin->pNext; } } VOID PluginsAddGroundItem(PGROUNDITEM pNewGroundItem) { PluginDebug("PluginsAddGroundItem()"); if (!bPluginCS) return; CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; DebugSpew("PluginsAddGroundItem(%s) %.1f,%.1f,%.1f",pNewGroundItem->Name,pNewGroundItem->X,pNewGroundItem->Y,pNewGroundItem->Z); while(pPlugin) { if (pPlugin->AddGroundItem) { pPlugin->AddGroundItem(pNewGroundItem); } pPlugin=pPlugin->pNext; } } VOID PluginsRemoveGroundItem(PGROUNDITEM pGroundItem) { PluginDebug("PluginsRemoveGroundItem()"); if (!bPluginCS) return; CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (pPlugin->RemoveGroundItem) { pPlugin->RemoveGroundItem(pGroundItem); } pPlugin=pPlugin->pNext; } } VOID PluginsBeginZone() { PluginDebug("PluginsBeginZone()"); if (!bPluginCS) return; gbInZone=false; CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (pPlugin->BeginZone) { DebugSpew("%s->BeginZone()",pPlugin->szFilename); pPlugin->BeginZone(); } pPlugin=pPlugin->pNext; } } VOID PluginsEndZone() { PluginDebug("PluginsEndZone()"); if (!bPluginCS) return; gbInZone=true; CAutoLock Lock(&gPluginCS); PMQPLUGIN pPlugin=pPlugins; while(pPlugin) { if (pPlugin->EndZone) { DebugSpew("%s->EndZone()",pPlugin->szFilename); pPlugin->EndZone(); } pPlugin=pPlugin->pNext; } LoadCfgFile("zoned",true); LoadCfgFile(((PZONEINFO)pZoneInfo)->ShortName,true); } #endif
[ "[email protected]@39408780-f958-9dab-a28b-4b240efc9052" ]
[ [ [ 1, 595 ] ] ]
98966270180e3b09831843c5e62e2f41fbd67c99
0b66a94448cb545504692eafa3a32f435cdf92fa
/tags/0.8/cbear.berlios.de/c/traits.hpp
2ea81b134a0bcc04732a80e0a0a3164a2d333654
[ "MIT" ]
permissive
BackupTheBerlios/cbear-svn
e6629dfa5175776fbc41510e2f46ff4ff4280f08
0109296039b505d71dc215a0b256f73b1a60b3af
refs/heads/master
2021-03-12T22:51:43.491728
2007-09-28T01:13:48
2007-09-28T01:13:48
40,608,034
0
0
null
null
null
null
UTF-8
C++
false
false
1,465
hpp
#ifndef CBEAR_BERLIOS_DE_C_TRAITS_HPP_INCLUDED #define CBEAR_BERLIOS_DE_C_TRAITS_HPP_INCLUDED #include <boost/type_traits/is_class.hpp> namespace cbear_berlios_de { namespace c { template<class T> class class_traits { public: // pointer or value. typedef typename T::c_in_t in_t; // pointer. typedef typename T::c_out_t out_t; // pointer. typedef typename T::c_in_out_t in_out_t; static in_t in(const T &X) throw() { return X.c_in(); } static out_t out(T &X) throw() { return X.c_out(); } static in_out_t in_out(T &X) throw() { return X.c_in_out(T); } static const T &cpp_in(const in_t &X) throw() { return T::cpp_in(X); } static T &cpp_out(out_t X) throw() { return T::cpp_out(X); } static T &cpp_in_out(in_out_t X) throw() { return T::cpp_in_out(X); } }; template<class T> class value_traits { public: typedef T in_t; typedef T *out_t; typedef T *in_out_t; static in_t in(const T &X) { return X; } static out_t out(T &X) { X = T(); return &X; } static in_out_t in_out(T &X) { return &X; } static const T &cpp_in(const in_t &X) { return X; } static T &cpp_out(out_t X) { return *X; } static T &cpp_in_out(in_out_t X) { return *X; } }; template<class T> class traits: public meta::if_< ::boost::is_class<T>, class_traits<T>, value_traits<T> >::type { }; } } #endif
[ "sergey_shandar@e6e9985e-9100-0410-869a-e199dc1b6838" ]
[ [ [ 1, 96 ] ] ]
253cc296962707a00c839548c90231006e7da229
e776dbbd4feab1ce37ad62e5608e22a55a541d22
/MMOGame/Engine/PropertySet.h
5b746e2ce3c23f8e3dc6ef6dea64708f71c010f2
[]
no_license
EmuxEvans/sailing
80f2e2b0ae0f821ce6da013c3f67edabc8ca91ec
6d3a0f02732313f41518839376c5c0067aea4c0f
refs/heads/master
2016-08-12T23:47:57.509147
2011-04-06T03:39:19
2011-04-06T03:39:19
43,952,647
0
0
null
null
null
null
UTF-8
C++
false
false
3,805
h
#pragma once #define PROPERTY_TYPE_CHAR 1 #define PROPERTY_TYPE_SHORT 2 #define PROPERTY_TYPE_INT 3 #define PROPERTY_TYPE_BYTE 4 #define PROPERTY_TYPE_WORD 5 #define PROPERTY_TYPE_DWORD 6 #define PROPERTY_TYPE_FLOAT 7 #define PROPERTY_TYPE_STRING 8 #define PROPERTY_TYPE_STRUCT 9 class IProperty; class IPropertySet; class IProperty { public: virtual ~IProperty() { } virtual const char* GetName() = 0; virtual int GetType() = 0; virtual IPropertySet* GetTypeDefine() = 0; virtual unsigned int GetOffset() = 0; virtual unsigned int GetSize() = 0; virtual unsigned int GetCount() = 0; virtual const char* GetDesc() = 0; }; class IPropertySet { public: virtual ~IPropertySet() { } virtual const char* GetName() = 0; virtual const char* GetDesc() = 0; virtual unsigned int GetSize() = 0; virtual int PropertyCount() = 0; virtual IProperty* GetProperty(int nIndex) = 0; int GetPropertyIndex(const char* pName); char GetCHAR(const void* pData, int nIndex); short GetSHORT(const void* pData, int nIndex); int GetINT(const void* pData, int nIndex); unsigned char GetBYTE(const void* pData, int nIndex); unsigned short GetWORD(const void* pData, int nIndex); unsigned int GetDWORD(const void* pData, int nIndex); float GetFLOAT(const void* pData, int nIndex); const char* GetSTRING(const void* pData, int nIndex); bool SetValue(void* pData, int nIndex, char Value); bool SetValue(void* pData, int nIndex, short Value); bool SetValue(void* pData, int nIndex, int Value); bool SetValue(void* pData, int nIndex, unsigned char Value); bool SetValue(void* pData, int nIndex, unsigned short Value); bool SetValue(void* pData, int nIndex, unsigned int Value); bool SetValue(void* pData, int nIndex, float Value); bool SetValue(void* pData, int nIndex, const char* Value); char GetCHAR(const void* pData, const char* pName) { return GetCHAR(pData, GetPropertyIndex(pName)); } short GetSHORT(const void* pData, const char* pName) { return GetSHORT(pData, GetPropertyIndex(pName)); } int GetINT(const void* pData, const char* pName) { return GetINT(pData, GetPropertyIndex(pName)); } unsigned char GetBYTE(const void* pData, const char* pName) { return GetBYTE(pData, GetPropertyIndex(pName)); } unsigned short GetWORD(const void* pData, const char* pName) { return GetWORD(pData, GetPropertyIndex(pName)); } unsigned int GetDWORD(const void* pData, const char* pName) { return GetDWORD(pData, GetPropertyIndex(pName)); } float GetFLOAT(const void* pData, const char* pName) { return GetFLOAT(pData, GetPropertyIndex(pName)); } const char* GetSTRING(const void* pData, const char* pName) { return GetSTRING(pData, GetPropertyIndex(pName)); } bool SetValue(void* pData, const char* pName, char Value) { return SetValue(pData, GetPropertyIndex(pName), Value); } bool SetValue(void* pData, const char* pName, short Value) { return SetValue(pData, GetPropertyIndex(pName), Value); } bool SetValue(void* pData, const char* pName, int Value) { return SetValue(pData, GetPropertyIndex(pName), Value); } bool SetValue(void* pData, const char* pName, unsigned char Value) { return SetValue(pData, GetPropertyIndex(pName), Value); } bool SetValue(void* pData, const char* pName, unsigned short Value) { return SetValue(pData, GetPropertyIndex(pName), Value); } bool SetValue(void* pData, const char* pName, unsigned int Value) { return SetValue(pData, GetPropertyIndex(pName), Value); } bool SetValue(void* pData, const char* pName, float Value) { return SetValue(pData, GetPropertyIndex(pName), Value); } bool SetValue(void* pData, const char* pName, const char* Value) { return SetValue(pData, GetPropertyIndex(pName), Value); } };
[ "gamemake@74c81372-9d52-0410-afc2-f743258a769a" ]
[ [ [ 1, 79 ] ] ]
fcae01bbad170cbae565d782e62911c765ebd42a
155c4955c117f0a37bb9481cd1456b392d0e9a77
/Tessa/TessaInstructions/ConstructSuperInstruction.h
ae30cd3f60eefabd4da4b71f9db4f3ddc1201d32
[]
no_license
zwetan/tessa
605720899aa2eb4207632700abe7e2ca157d19e6
940404b580054c47f3ced7cf8995794901cf0aaa
refs/heads/master
2021-01-19T19:54:00.236268
2011-08-31T00:18:24
2011-08-31T00:18:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
612
h
namespace TessaInstructions { class ConstructSuperInstruction : public ConstructInstruction { private: MethodInfo* _methodInfo; public: ConstructSuperInstruction(TessaInstruction *receiverObject, Traits* receiverTraits, ArrayOfInstructions* arguments, MethodInfo* methodInfo, TessaVM::BasicBlock* insertAtEnd); void print(); bool isConstructSuper(); bool isSuper(); void visit(TessaVisitorInterface* tessaVisitor); MethodInfo* getMethodInfo(); ConstructSuperInstruction* clone(MMgc::GC* gc, MMgc::GCHashtable* originalToCloneMap, TessaVM::BasicBlock* insertCloneAtEnd); }; }
[ [ [ 1, 16 ] ] ]
522441266531e9899fdb2c6275a93e1d42c5ce21
dda0d7bb4153bcd98ad5e32e4eac22dc974b8c9d
/tests/stdafx.h
b3585dcb2f986205245c842a90bf0b13b70713e9
[ "BSD-3-Clause" ]
permissive
systembugtj/crash-report
abd45ceedc08419a3465414ad9b3b6a5d6c6729a
205b087e79eb8ed7a9b6a7c9f4ac580707e9cb7e
refs/heads/master
2021-01-19T07:08:04.878028
2011-04-05T04:03:54
2011-04-05T04:03:54
35,228,814
1
0
null
null
null
null
UTF-8
C++
false
false
5,141
h
/************************************************************************************* This file is a part of CrashRpt library. Copyright (c) 2003, Michael Carruth 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 author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************************/ // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once // Change these values to use different versions #define WINVER 0x0501 #define _WIN32_WINNT 0x0501 #define _WIN32_IE 0x0600 #define _RICHEDIT_VER 0x0200 #include <errno.h> #include <winsock2.h> #include <ws2tcpip.h> #include <atldef.h> #if ( _ATL_VER < 0x0710 ) #define _WTL_SUPPORT_SDK_ATL3 // Support of VC++ Express 2005 and ATL 3.0 #endif // Support for VS2005 Express & SDK ATL #ifdef _WTL_SUPPORT_SDK_ATL3 #define _CRT_SECURE_NO_DEPRECATE #define _CRT_NON_CONFORMING_SWPRINTFS #pragma conform(forScope, off) #pragma comment(linker, "/NODEFAULTLIB:atlthunk.lib") #endif // _WTL_SUPPORT_SDK_ATL3 #include <atlbase.h> // Support for VS2005 Express & SDK ATL #if defined(_WTL_SUPPORT_SDK_ATL3) && !defined(_WTLSUP_INCLUDED) #define _WTLSUP_INCLUDED namespace ATL { inline void * __stdcall __AllocStdCallThunk() { return ::HeapAlloc(::GetProcessHeap(), 0, sizeof(_stdcallthunk)); } inline void __stdcall __FreeStdCallThunk(void *p) { ::HeapFree(::GetProcessHeap(), 0, p); } }; #endif // _WTL_SUPPORT_SDK_ATL3 #include <atlapp.h> extern CAppModule _Module; #include <atlwin.h> #include <atlframe.h> #include <atlctrls.h> #include <atldlgs.h> #include <set> #include <map> #include <string> #include <vector> #include <stdio.h> #include <conio.h> #define _WTL_USE_CSTRING #include <atlmisc.h> #if _MSC_VER<1400 #define _TCSCPY_S(strDestination, numberOfElements, strSource) _tcscpy(strDestination, strSource) #define _TCSNCPY_S(strDest, sizeInBytes, strSource, count) _tcsncpy(strDest, strSource, count) #define STRCPY_S(strDestination, numberOfElements, strSource) strcpy(strDestination, strSource) #define _TFOPEN_S(_File, _Filename, _Mode) _File = _tfopen(_Filename, _Mode); #else #define _TCSCPY_S(strDestination, numberOfElements, strSource) _tcscpy_s(strDestination, numberOfElements, strSource) #define _TCSNCPY_S(strDest, sizeInBytes, strSource, count) _tcsncpy_s(strDest, sizeInBytes, strSource, count) #define STRCPY_S(strDestination, numberOfElements, strSource) strcpy_s(strDestination, numberOfElements, strSource) #define _TFOPEN_S(_File, _Filename, _Mode) _tfopen_s(&(_File), _Filename, _Mode); #endif #if _MSC_VER>=1400 #if defined _M_IX86 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") #elif defined _M_IA64 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") #elif defined _M_X64 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") #else #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #endif #endif
[ "[email protected]@9307afbf-8b4c-5d34-949b-c69a0924eb0b" ]
[ [ [ 1, 125 ] ] ]
f18f9d71c993d608ae5b2513bd7131f247956443
2ca3ad74c1b5416b2748353d23710eed63539bb0
/Pilot/Lokapala_Neverdie/Operator/stdafx.cpp
92bde0eaa07831cc42661dc611529ef2dc01e7b7
[]
no_license
sjp38/lokapala
5ced19e534bd7067aeace0b38ee80b87dfc7faed
dfa51d28845815cfccd39941c802faaec9233a6e
refs/heads/master
2021-01-15T16:10:23.884841
2009-06-03T14:56:50
2009-06-03T14:56:50
32,124,140
0
0
null
null
null
null
UHC
C++
false
false
1,381
cpp
// stdafx.cpp : source file that includes just the standard includes // Operator.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" /**@brief instance들의 초기값을 null로 잡아준다. */ #include "CBFMediator.h" #include "DataAdminFacade.h" #include "DecisionFacade.h" #include "DCDataAdminSD.h" #include "DCLogSD.h" #include "DCCommunicationSD.h" #include "LogFacade.h" #include "CommunicationFacade.h" #include "CCDecisionSD.h" #include "CCMessengerSD.h" #include "MessengerFacade.h" #include "MSCommunicationSD.h" #include "MSLogSD.h" //CBFMediator CCBFMediator *CCBFMediator::m_instance = NULL; //Facade CDataAdminFacade *CDataAdminFacade::m_instance = NULL; CDecisionFacade *CDecisionFacade::m_instance = NULL; CLogFacade *CLogFacade::m_instance = NULL; CCommunicationFacade *CCommunicationFacade::m_instance = NULL; CMessengerFacade *CMessengerFacade::m_instance = NULL; //Service Delegate CDCDataAdminSD *CDCDataAdminSD::m_instance = NULL; CDCCommunicationSD *CDCCommunicationSD::m_instance = NULL; CDCLogSD *CDCLogSD::m_instance = NULL; CCCDecisionSD *CCCDecisionSD::m_instance = NULL; CCCMessengerSD *CCCMessengerSD::m_instance = NULL; CMSLogSD *CMSLogSD::m_instance = NULL; CMSCommunicationSD *CMSCommunicationSD::m_instance = NULL;
[ "nilakantha38@b9e76448-5c52-0410-ae0e-a5aea8c5d16c" ]
[ [ [ 1, 49 ] ] ]
7f77f6762957378de763ce99e05131ec9bbba986
4797c7058b7157e3d942e82cf8ad94b58be488ae
/EnemyShipStation.cpp
2034b76dcdde802242e8e3053e8093c7c4041949
[]
no_license
koguz/DirectX-Space-Game
2d1d8179439870fd1427beb9624f1c5452546c39
be672051fd0009cbd5851c92bd344d3b23645474
refs/heads/master
2020-05-18T02:11:47.963185
2011-05-25T14:35:26
2011-05-25T14:35:26
1,799,267
0
0
null
null
null
null
UTF-8
C++
false
false
527
cpp
#include "EnemyShipStation.h" EnemyShipStation::EnemyShipStation():EnemyShipBase() { speed = 0.0f; lastShot = 0; } bool EnemyShipStation::Init(IDirect3DDevice9* d, IDirectSound8 *s) { ((MyMesh*)(this))->Init(d, "station.x"); Sound = s; Engine.Init(Sound, "station.wav"); Fire.Init(Sound, "EnemyAFire.wav"); Fire.SetLoop(false); HitSound.Init(Sound, "hitship.wav"); HitSound.SetLoop(false); Engine.Play(); state = HOLD; type = STATION; health = 5000; rotAngle = 0.1f; return true; }
[ [ [ 1, 26 ] ] ]
9cf80c106b8b7e9305f223a2bf41700bc9f0801a
871585f3c45603024488cabd14184610af7a081f
/common_lib/commandlineparser.cpp
e5011b82f840e4b686ed066c2c00e820a9f1ea18
[]
no_license
davideanastasia/ORIP
9ac6fb8c490d64da355d34804d949b85ea17dbff
54c180b442a02a202076b8072ceb573f5e345871
refs/heads/master
2016-09-06T14:17:22.765343
2011-11-05T16:23:23
2011-11-05T16:23:23
null
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
12,680
cpp
/* ORIP_v2 –> Op Ref Im Proc -> Oper Refin Imag Process -> Operational Refinement of Image Processing * * Copyright Davide Anastasia and Yiannis Andreopoulos, University College London * * http://www.ee.ucl.ac.uk/~iandreop/ORIP.html * If you have not retrieved this source code via the above link, please contact [email protected] and [email protected] * */ #include "commandlineparser.h" using namespace std; command_line_parser::command_line_parser(void) { _help = false; _input_file = DEFAULT_IN_FILE; _output_file = DEFAULT_OUT_FILE; _num_frame = 300; _frame_width = 352; // CIF (352x288) _frame_height = 288; _bitplane = BIT_SAMPLE; // all bitplane _prog_pattern = "3,3,2"; _kernel_max_value = 16; _conv_width = 8; _conv_height = 8; _block_size = 16; _search_range = 16; _time = 20; _time_jitter = 0; _mode = 0; _last_perc = 1.0; // 2009.07.20 _spiral_size = (int)(0.5625*_search_range); _kernel_file = DEFAULT_KERNEL_FILE; } command_line_parser::~command_line_parser(void) { } void command_line_parser::parse_line(int ac, char* av[]) { for ( int w = 1; w < ac; ++w ) { if ( av[w][0] != '-' ) { //if ( filein[0] == 1 ) //{ // strcpy(filein, av[w]); //} //else if ( fileout[0] == 1 ) //{ // strcpy(fileout, av[w]); //} //else; // In any other case the entry is garbage => do nothing } else { // we have a flag if ( strlen(av[w]) == 1 ) break; /// Just a dash => do nothing switch ( av[w][1] ) { case 'i': { _input_file = av[(++w)]; break; } case 'o': { _output_file = av[(++w)]; break; } case 'f': { from_string<int>(_num_frame, av[(++w)], std::dec); break; } case 'w': { from_string<int>(_frame_width, av[(++w)], std::dec); break; } case 'h': { from_string<int>(_frame_height, av[(++w)], std::dec); break; } case 'b': { from_string<int>(_bitplane, av[(++w)], std::dec); // error testing if ( _bitplane <= 0 || _bitplane > BIT_SAMPLE ) { _bitplane = BIT_SAMPLE; } break; } case 'p': { _prog_pattern = av[(++w)]; break; } case 'z': { from_string<int>(_spiral_size, av[(++w)], std::dec); if ( _spiral_size < 1 ) _spiral_size = 300000; // something very large to ensure it will be set at the end break; } case 'k': { from_string<int>(_kernel_max_value, av[(++w)], std::dec); break; } case 'm': { from_string<int>(_conv_width, av[(++w)], std::dec); break; } case 'n': { from_string<int>(_conv_height, av[(++w)], std::dec); break; } case 'd': { from_string<int>(_block_size, av[(++w)], std::dec); break; } case 's': { from_string<int>(_search_range, av[(++w)], std::dec); break; } case 't': { from_string<int>(_mode, av[(++w)], std::dec); break; } case 'q': { _kernel_file = av[(++w)]; break; } case 'c': //clock time { from_string<int>(_time, av[(++w)], std::dec); // error testing if ( _time <= 0 ) { _time = 20; // set default value } break; } case 'j': // clock time jitter { from_string<int>(_time_jitter, av[(++w)], std::dec); if ( _time < 0 ) { _time_jitter = 0; } break; } case 'l': // last step percentage (0.0 ~ 1.0) { from_string<double>(_last_perc, av[(++w)], std::dec); if ( _last_perc < 0 || _last_perc > 1) { _last_perc = 1.0; } break; } case 'x': { _help = true; ++w; break; } default: ++w; break; } } } if ( _spiral_size > _search_range ) _spiral_size = _search_range; parse_progression_pattern(); } bool command_line_parser::check_constrains(bool file_check) { bool result = true; if ( file_check == true ) { if ( !is_set_input_filename() ) { std::cerr << "[!] Input filename (-i) not defined" << std::endl; result = false; } } if ( get_mode() == 4 && !is_set_kernel_filename() ) { std::cerr << "[!] Kernel filename (-q) not defined" << std::endl; result = false; } // checking constraints if ( _frame_height <= 0 ) { std::cerr << "[!] Invalid frame height (-h)" << std::endl; result = false; } if ( _frame_width <= 0 ) { std::cerr << "[!] Invalid frame width (-w)" << std::endl; result = false; } if ( _num_frame <= 0 ) { std::cerr << "[!] Invalid number of frame to be processed (-f)" << std::endl; result = false; } if ( _num_frame <= 0 ) { std::cerr << "[!] Invalid number of frame to be processed (-f)" << std::endl; result = false; } return result; } bool command_line_parser::is_set_help() { return _help; } const void command_line_parser::get_help() { cout << endl; cout << "Copyright Davide Anastasia and Yiannis Andreopoulos, University College London, 2009" << endl; cout << "See README.pdf for details of usage" << endl; cout << "Options: " << endl; cout << setw(6) << "-i : " << "Input file name" << endl; cout << setw(6) << "-o : " << "Output file name" << endl; // (see below for OLPC) cout << setw(6) << "-f : " << "Total frames of the input to be processed" << endl; // (see below for OLPC) cout << setw(6) << "-w : " << "Width of the frame" << endl; cout << setw(6) << "-h : " << "Height of the frame" << endl; cout << setw(6) << "-b : " << "Number of bitplanes" << endl; cout << setw(6) << "-p : " << "Scanning pattern (for incremental version only)" << endl; cout << setw(6) << "-l : " << "Last step percentage (for incremental version only) (0.0 ~ 1.0)" << endl; cout << endl << "Options (Transform Only)" << endl; cout << setw(6) << "-t : " << "Mode (0: Random kernel; 1: 4x4 AVC; 2: 8x8 BinDCT; 3: 8x8 FreXT)" << endl; cout << setw(6) << "-k : " << "Dynamic range of transform kernel (only for random kernel)" << endl; cout << setw(6) << "-n : " << "Transform block size (only for random kernel)" << endl; cout << endl << "Options (Convolution only)" << endl; cout << setw(6) << "-t : " << "Mode (0: Random kernel; 1: 12x12 Gaussian; 2: 18x18 Gaussian; 3: 6x6 Gaussian; 4: Read from file)" << endl; cout << setw(6) << "-d : " << "Kernel File Name" << endl; cout << setw(6) << "-m : " << "Width of filtering kernel (only for random kernel)" << endl; cout << setw(6) << "-n : " << "Height of filtering kernel (only for random kernel)" << endl; cout << setw(6) << "-k : " << "Dynamic range of filtering kernel (only for random kernel)" << endl; cout << endl << "Options (Block Matching only)" << endl; cout << setw(6) << "-d : " << "Block size" << endl; cout << setw(6) << "-s : " << "Search range" << endl; cout << setw(6) << "-z : " << "Spiral size (W)" << endl; #ifdef _OPENMP cout << endl << "Options (Only for scheduled versions)" << endl; cout << setw(6) << "-c : " << "Clock time interrupt" << endl; cout << setw(6) << "-j : " << "Clock jitter" << endl; #endif } bool command_line_parser::is_set_input_filename() { if ( _input_file == DEFAULT_IN_FILE ) return false; return true; } string command_line_parser::get_input_filename() { return _input_file; } bool command_line_parser::is_set_output_filename() { if ( _output_file == DEFAULT_OUT_FILE ) return false; return true; } string command_line_parser::get_output_filename() { return _output_file; } string command_line_parser::get_output_filename_wout_ext() { string::size_type pos = _input_file.find_last_of(".", 0); return _input_file.substr(0, pos); } string command_line_parser::get_kernel_filename() { return _kernel_file; } bool command_line_parser::is_set_kernel_filename() { if ( _kernel_file == DEFAULT_KERNEL_FILE ) return false; return true; } int command_line_parser::get_height() { return _frame_height; } int command_line_parser::get_width() { return _frame_width; } int command_line_parser::get_height_conv() { return _conv_height; } int command_line_parser::get_width_conv() { return _conv_width; } int command_line_parser::get_bitplane() { return _bitplane; } int command_line_parser::get_frame_num() { return _num_frame; } int command_line_parser::get_kernel_max_value() { return _kernel_max_value; } int command_line_parser::get_mode() { return _mode; } vector<int> command_line_parser::get_progression_pattern() { return _prog_vector; } void command_line_parser::parse_progression_pattern() { int const bits2parse = get_bitplane(); int bits_sum = 0; int bits_curr = 0; int bits_index = NUM_BITPLANE; // Parsing the input string string::size_type lastPos = _prog_pattern.find_first_not_of(",", 0); // Skip delimiters at beginning string::size_type pos = _prog_pattern.find_first_of(",", lastPos); // Find first "non-delimiter" while (string::npos != pos || string::npos != lastPos) { from_string<int>(bits_curr, _prog_pattern.substr(lastPos, pos - lastPos), std::dec ); // Found a token, add it to the vector. // limit check if ( bits_curr <= 0 ) bits_curr = 1; else if ( bits_curr > bits2parse ) bits_curr = bits2parse; // --- if ( bits_sum + bits_curr >= bits2parse ) { bits_curr = bits2parse - bits_sum; _prog_vector.push_back(bits_curr); _prog_steps.push_back(bits_index); break; } else { _prog_vector.push_back(bits_curr); _prog_steps.push_back(bits_index); bits_sum += bits_curr; } bits_index -= bits_curr; lastPos = _prog_pattern.find_first_not_of(",", pos); // Skip delimiters. Note the "not_of" pos = _prog_pattern.find_first_of(",", lastPos); // Find next "non-delimiter" } // check trail, find number of steps and find max step bits_sum = 0; _num_prog_step = 0; _max_prog_step = 1; for (unsigned int i = 0; i < _prog_vector.size(); i++) { bits_sum += _prog_vector[i]; _max_prog_step = max(_max_prog_step, _prog_vector[i]); _num_prog_step++; } while ( bits_sum < bits2parse ) { _prog_vector.push_back(1); _prog_steps.push_back(bits_index); _num_prog_step++; bits_sum++; bits_index--; } // return _prog_vector; } void command_line_parser::set_progression_pattern(std::string pp) { _prog_pattern = pp; _prog_vector.erase(_prog_vector.begin(), _prog_vector.end()); _prog_steps.erase(_prog_steps.begin(), _prog_steps.end()); parse_progression_pattern(); } int command_line_parser::get_progression_steps() { return _num_prog_step; } int command_line_parser::get_max_progression_step() { return _max_prog_step; } vector<int> command_line_parser::get_progression_indexes() { return _prog_steps; } void command_line_parser::print_progression_pattern() { cout << " Progression pattern: "; for (unsigned int i = 0; i < _prog_vector.size(); i++) { cout << _prog_vector[i] << " "; } cout << "- Steps: " << _num_prog_step; cout << " - Max step: " << _max_prog_step; cout << endl; } int command_line_parser::get_block_dim() { int b_dim = _block_size; if ( b_dim != 4 && b_dim != 8 && b_dim != 16 && b_dim != 32 ) { return 8; } return _block_size; } int command_line_parser::get_search_range() { int s_dim = _search_range; if ( s_dim != 4 && s_dim != 8 && s_dim != 16 && s_dim != 32 ) { return 8; } return _search_range; } int command_line_parser::get_time() { return _time; } int command_line_parser::get_time_jitter() { return _time_jitter; }
[ [ [ 1, 493 ] ] ]
e539b8d7a822d793e783f39349d6b243e98b4493
3464482d0516fe967133bce6e374b4993d426f35
/DragDropTutorial/dropsource/dataobject.cpp
21cb817712561daf19982a094847a174f77c6f03
[]
no_license
dannydraper/CedeCryptPortable
75fc2cc0b17546469b9da7d0e82dcc150c6e24ab
e848915107597d1ada0c7de18a8ede46e9a44de1
refs/heads/master
2021-01-09T20:03:52.722661
2010-09-27T18:49:42
2010-09-27T18:49:42
63,583,875
0
0
null
null
null
null
UTF-8
C++
false
false
6,808
cpp
// // DATAOBJECT.CPP // // Implementation of the IDataObject COM interface // // By J Brown 2004 // // www.catch22.net // #define STRICT #include <windows.h> // defined in enumformat.cpp HRESULT CreateEnumFormatEtc(UINT nNumFormats, FORMATETC *pFormatEtc, IEnumFORMATETC **ppEnumFormatEtc); class CDataObject : public IDataObject { public: // // IUnknown members // HRESULT __stdcall QueryInterface (REFIID iid, void ** ppvObject); ULONG __stdcall AddRef (void); ULONG __stdcall Release (void); // // IDataObject members // HRESULT __stdcall GetData (FORMATETC *pFormatEtc, STGMEDIUM *pMedium); HRESULT __stdcall GetDataHere (FORMATETC *pFormatEtc, STGMEDIUM *pMedium); HRESULT __stdcall QueryGetData (FORMATETC *pFormatEtc); HRESULT __stdcall GetCanonicalFormatEtc (FORMATETC *pFormatEct, FORMATETC *pFormatEtcOut); HRESULT __stdcall SetData (FORMATETC *pFormatEtc, STGMEDIUM *pMedium, BOOL fRelease); HRESULT __stdcall EnumFormatEtc (DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc); HRESULT __stdcall DAdvise (FORMATETC *pFormatEtc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection); HRESULT __stdcall DUnadvise (DWORD dwConnection); HRESULT __stdcall EnumDAdvise (IEnumSTATDATA **ppEnumAdvise); // // Constructor / Destructor // CDataObject(FORMATETC *fmt, STGMEDIUM *stgmed, int count); ~CDataObject(); private: int LookupFormatEtc(FORMATETC *pFormatEtc); // // any private members and functions // LONG m_lRefCount; FORMATETC *m_pFormatEtc; STGMEDIUM *m_pStgMedium; LONG m_nNumFormats; }; // // Constructor // CDataObject::CDataObject(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count) { m_lRefCount = 1; m_nNumFormats = count; m_pFormatEtc = new FORMATETC[count]; m_pStgMedium = new STGMEDIUM[count]; for(int i = 0; i < count; i++) { m_pFormatEtc[i] = fmtetc[i]; m_pStgMedium[i] = stgmed[i]; } } // // Destructor // CDataObject::~CDataObject() { // cleanup if(m_pFormatEtc) delete[] m_pFormatEtc; if(m_pStgMedium) delete[] m_pStgMedium; OutputDebugString("oof\n"); } // // IUnknown::AddRef // ULONG __stdcall CDataObject::AddRef(void) { // increment object reference count return InterlockedIncrement(&m_lRefCount); } // // IUnknown::Release // ULONG __stdcall CDataObject::Release(void) { // decrement object reference count LONG count = InterlockedDecrement(&m_lRefCount); if(count == 0) { delete this; return 0; } else { return count; } } // // IUnknown::QueryInterface // HRESULT __stdcall CDataObject::QueryInterface(REFIID iid, void **ppvObject) { // check to see what interface has been requested if(iid == IID_IDataObject || iid == IID_IUnknown) { AddRef(); *ppvObject = this; return S_OK; } else { *ppvObject = 0; return E_NOINTERFACE; } } HGLOBAL DupMem(HGLOBAL hMem) { // lock the source memory object DWORD len = GlobalSize(hMem); PVOID source = GlobalLock(hMem); // create a fixed "global" block - i.e. just // a regular lump of our process heap PVOID dest = GlobalAlloc(GMEM_FIXED, len); memcpy(dest, source, len); GlobalUnlock(hMem); return dest; } int CDataObject::LookupFormatEtc(FORMATETC *pFormatEtc) { for(int i = 0; i < m_nNumFormats; i++) { if((pFormatEtc->tymed & m_pFormatEtc[i].tymed) && pFormatEtc->cfFormat == m_pFormatEtc[i].cfFormat && pFormatEtc->dwAspect == m_pFormatEtc[i].dwAspect) { return i; } } return -1; } // // IDataObject::GetData // HRESULT __stdcall CDataObject::GetData (FORMATETC *pFormatEtc, STGMEDIUM *pMedium) { int idx; // // try to match the requested FORMATETC with one of our supported formats // if((idx = LookupFormatEtc(pFormatEtc)) == -1) { return DV_E_FORMATETC; } // // found a match! transfer the data into the supplied storage-medium // pMedium->tymed = m_pFormatEtc[idx].tymed; pMedium->pUnkForRelease = 0; switch(m_pFormatEtc[idx].tymed) { case TYMED_HGLOBAL: pMedium->hGlobal = DupMem(m_pStgMedium[idx].hGlobal); //return S_OK; break; default: return DV_E_FORMATETC; } return S_OK; } // // IDataObject::GetDataHere // HRESULT __stdcall CDataObject::GetDataHere (FORMATETC *pFormatEtc, STGMEDIUM *pMedium) { // GetDataHere is only required for IStream and IStorage mediums // It is an error to call GetDataHere for things like HGLOBAL and other clipboard formats // // OleFlushClipboard // return DATA_E_FORMATETC; } // // IDataObject::QueryGetData // // Called to see if the IDataObject supports the specified format of data // HRESULT __stdcall CDataObject::QueryGetData (FORMATETC *pFormatEtc) { return (LookupFormatEtc(pFormatEtc) == -1) ? DV_E_FORMATETC : S_OK; } // // IDataObject::GetCanonicalFormatEtc // HRESULT __stdcall CDataObject::GetCanonicalFormatEtc (FORMATETC *pFormatEct, FORMATETC *pFormatEtcOut) { // Apparently we have to set this field to NULL even though we don't do anything else pFormatEtcOut->ptd = NULL; return E_NOTIMPL; } // // IDataObject::SetData // HRESULT __stdcall CDataObject::SetData (FORMATETC *pFormatEtc, STGMEDIUM *pMedium, BOOL fRelease) { return E_NOTIMPL; } // // IDataObject::EnumFormatEtc // HRESULT __stdcall CDataObject::EnumFormatEtc (DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc) { if(dwDirection == DATADIR_GET) { // for Win2k+ you can use the SHCreateStdEnumFmtEtc API call, however // to support all Windows platforms we need to implement IEnumFormatEtc ourselves. return CreateEnumFormatEtc(m_nNumFormats, m_pFormatEtc, ppEnumFormatEtc); } else { // the direction specified is not support for drag+drop return E_NOTIMPL; } } // // IDataObject::DAdvise // HRESULT __stdcall CDataObject::DAdvise (FORMATETC *pFormatEtc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection) { return OLE_E_ADVISENOTSUPPORTED; } // // IDataObject::DUnadvise // HRESULT __stdcall CDataObject::DUnadvise (DWORD dwConnection) { return OLE_E_ADVISENOTSUPPORTED; } // // IDataObject::EnumDAdvise // HRESULT __stdcall CDataObject::EnumDAdvise (IEnumSTATDATA **ppEnumAdvise) { return OLE_E_ADVISENOTSUPPORTED; } // // Helper function // HRESULT CreateDataObject (FORMATETC *fmtetc, STGMEDIUM *stgmeds, UINT count, IDataObject **ppDataObject) { if(ppDataObject == 0) return E_INVALIDARG; *ppDataObject = new CDataObject(fmtetc, stgmeds, count); return (*ppDataObject) ? S_OK : E_OUTOFMEMORY; }
[ "ddraper@06f4e086-0d69-e349-ad0a-cc76533d4475" ]
[ [ [ 1, 302 ] ] ]
a65777e5b71546a4a7e99081ad8ea42b7b1a4e9f
7b7a3f9e0cac33661b19bdfcb99283f64a455a13
/Engine/dll/Core/flx_graph.h
70b0ad94b62e09d17d9d9c0e4306c2b29fc09daf
[]
no_license
grimtraveller/fluxengine
62bc0169d90bfe656d70e68615186bd60ab561b0
8c967eca99c2ce92ca4186a9ca00c2a9b70033cd
refs/heads/master
2021-01-10T10:58:56.217357
2009-09-01T15:07:05
2009-09-01T15:07:05
55,775,414
0
0
null
null
null
null
UTF-8
C++
false
false
843
h
/*--------------------------------------------------------------------------- This source file is part of the FluxEngine. Copyright (c) 2008 - 2009 Marvin K. (starvinmarvin) This program is free software. ---------------------------------------------------------------------------*/ #ifndef _GRAPH_H #define _GRAPH_H #include <vector> class Graph { public: Graph(int _historyLimit, float _posx = 0, float _posy = 0, float _offsetx = 1, float _offsety = 1); virtual ~Graph(); void update(float _value); void render(); void setColor(float _r, float _g, float _b); private: std::vector<float> m_dataHistory; unsigned int m_maxHistory; float m_positionX; float m_positionY; float m_offsetX; float m_offsetY; float m_colorR; float m_colorG; float m_colorB; }; #endif
[ "marvin.kicha@e13029a8-578f-11de-8abc-d1c337b90d21" ]
[ [ [ 1, 37 ] ] ]
73ee2279bf3c737735a46d3419f98bfe64248d7f
5f3ccb6cb140b203c048e173693a081cbd8abf13
/source/lowlevel.h
f1a9f4abab861d7b80e25c2b2816ce3ad75512ff
[]
no_license
sndae/casimir-companion
6380483968fb5002447d4e5d8155fec998421527
e7ce8bce3b6cdc38141e00bfa4d4f5b1457a5758
refs/heads/master
2021-01-25T07:08:28.877173
2010-09-10T13:09:45
2010-09-10T13:09:45
38,293,398
0
0
null
null
null
null
UTF-8
C++
false
false
9,216
h
#ifndef LOWLEVEL_H #define LOWLEVEL_H #include <QByteArray> #include <QString> #include <QStringList> #include <vector> #define _WIN32_WINNT 0x0501 #include <windows.h> #include <stdio.h> #include <winbase.h> #include <Ntsecapi.h> #include <winioctl.h> typedef struct _OBJECT_DIRECTORY_INFORMATION { UNICODE_STRING Name; UNICODE_STRING TypeName; } OBJECT_DIRECTORY_INFORMATION, *POBJECT_DIRECTORY_INFORMATION; typedef struct _IO_STATUS_BLOCK { union { NTSTATUS Status; PVOID Pointer; }; ULONG_PTR Information; } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; /*typedef struct _DISK_EXTENT { DWORD DiskNumber; LARGE_INTEGER StartingOffset; LARGE_INTEGER ExtentLength; } DISK_EXTENT, *PDISK_EXTENT; typedef struct _VOLUME_DISK_EXTENTS { DWORD NumberOfDiskExtents; DISK_EXTENT Extents[1]; } VOLUME_DISK_EXTENTS, *PVOLUME_DISK_EXTENTS; typedef struct _PARTITION_INFORMATION { LARGE_INTEGER StartingOffset; LARGE_INTEGER PartitionLength; DWORD HiddenSectors; DWORD PartitionNumber; BYTE PartitionType; BOOLEAN BootIndicator; BOOLEAN RecognizedPartition; BOOLEAN RewritePartition; } PARTITION_INFORMATION, *PPARTITION_INFORMATION; typedef struct _DISK_GEOMETRY_EX { DISK_GEOMETRY Geometry; LARGE_INTEGER DiskSize; BYTE Data[1]; } DISK_GEOMETRY_EX, *PDISK_GEOMETRY_EX; */ extern "C" { /*WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointA( LPCSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength ); WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointW( LPCWSTR lpszRootPathName, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength ); WINBASEAPI HANDLE WINAPI FindFirstVolumeA( LPSTR lpszVolumeName, DWORD cchBufferLength ); WINBASEAPI HANDLE WINAPI FindFirstVolumeW( LPWSTR lpszVolumeName, DWORD cchBufferLength ); WINBASEAPI BOOL WINAPI FindNextVolumeA( HANDLE hFindVolume, LPSTR lpszVolumeName, DWORD cchBufferLength ); WINBASEAPI BOOL WINAPI FindNextVolumeW( HANDLE hFindVolume, LPWSTR lpszVolumeName, DWORD cchBufferLength ); WINBASEAPI BOOL WINAPI FindVolumeClose( HANDLE hFindVolume ); WINBASEAPI BOOL WINAPI FindVolumeMountPointClose( HANDLE hFindVolumeMountPoint ); WINBASEAPI BOOL WINAPI GetVolumeNameForVolumeMountPointA( LPCSTR lpszVolumeMountPoint, LPSTR lpszVolumeName, DWORD cchBufferLength ); WINBASEAPI BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR lpszVolumeMountPoint, LPWSTR lpszVolumeName, DWORD cchBufferLength );*/ /*NTSTATUS NtCreateFile( PHANDLE FileHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock, PLARGE_INTEGER AllocationSize OPTIONAL, ULONG FileAttributes, ULONG ShareAccess, ULONG CreateDisposition, ULONG CreateOptions, PVOID EaBuffer OPTIONAL, ULONG EaLength ); extern NTSTATUS WINAPI (*NtOpenFile)( PHANDLE FileHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock, ULONG ShareAccess, ULONG OpenOptions); */ /* extern NTSTATUS WINAPI (*NtQueryDirectoryObject)( HANDLE DirectoryHandle, PVOID Buffer, ULONG Length, BOOLEAN ReturnSingleEntry, BOOLEAN RestartScan, PULONG Context, PULONG ReturnLength); extern NTSTATUS WINAPI (*NtOpenSymbolicLinkObject)( PHANDLE SymLinkObjHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes); extern NTSTATUS WINAPI (*NtQuerySymbolicLinkObject)( HANDLE SymLinkObjHandle, PUNICODE_STRING LinkName, PULONG DataWritten); extern void (*RtlInitUnicodeString)(PUNICODE_STRING,PCWSTR); extern NTSTATUS WINAPI (*NtOpenDirectoryObject)( PHANDLE DirObjHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes);*/ } #ifdef UNICODE #define FindFirstVolumeMountPoint FindFirstVolumeMountPointW #else #define FindFirstVolumeMountPoint FindFirstVolumeMountPointA #endif // !UNICODE #ifdef UNICODE #define FindFirstVolume FindFirstVolumeW #else #define FindFirstVolume FindFirstVolumeA #endif // !UNICODE #ifdef UNICODE #define FindNextVolume FindNextVolumeW #else #define FindNextVolume FindNextVolumeA #endif // !UNICODE #ifdef UNICODE #define GetVolumeNameForVolumeMountPoint GetVolumeNameForVolumeMountPointW #else #define GetVolumeNameForVolumeMountPoint GetVolumeNameForVolumeMountPointA #endif // !UNICODE #define OBJ_INHERIT 0x00000002 #define OBJ_PERMANENT 0x00000010 #define OBJ_EXCLUSIVE 0x00000020 #define OBJ_CASE_INSENSITIVE 0x00000040 #define OBJ_OPENIF 0x00000080 #define OBJ_OPENLINK 0x00000100 #define OBJ_VALID_ATTRIBUTES 0x000001F2 #define DIRECTORY_QUERY 0x0001 #define SYMBOLIC_LINK_QUERY 0x0001 //#define FILE_DEVICE_DISK 0x00000007 //#define IOCTL_VOLUME_BASE 86 //#define IOCTL_DISK_BASE FILE_DEVICE_DISK /*#define METHOD_BUFFERED 0 #define METHOD_IN_DIRECT 1 #define METHOD_OUT_DIRECT 2 #define METHOD_NEITHER 3 #define FILE_ANY_ACCESS 0x00 #define FILE_READ_ACCESS 0x01 // file & pipe #define FILE_WRITE_ACCESS 0x02 // file & pipe */ #define Media_Type_Unknown 0 // Format is unknown #define Media_Type_F5_1Pt2_512 1 // 5.25", 1.2MB, 512 bytes/sector #define Media_Type_F3_1Pt44_512 2 // 3.5", 1.44MB, 512 bytes/sector #define Media_Type_F3_2Pt88_512 3 // 3.5", 2.88MB, 512 bytes/sector #define Media_Type_F3_20Pt8_512 4 // 3.5", 20.8MB, 512 bytes/sector #define Media_Type_F3_720_512 5 // 3.5", 720KB, 512 bytes/sector #define Media_Type_F5_360_512 6 // 5.25", 360KB, 512 bytes/sector #define Media_Type_F5_320_512 7 // 5.25", 320KB, 512 bytes/sector #define Media_Type_F5_320_1024 8 // 5.25", 320KB, 1024 bytes/sector #define Media_Type_F5_180_512 9 // 5.25", 180KB, 512 bytes/sector #define Media_Type_F5_160_512 10 // 5.25", 160KB, 512 bytes/sector #define Media_Type_RemovableMedia 11 // Removable media other than floppy #define Media_Type_FixedMedia 12 // Fixed hard disk media #define DiskGeometryGetPartition(Geometry)\ ((PDISK_PARTITION_INFO)((Geometry)->Data)) #define DiskGeometryGetDetect(Geometry)\ ((PDISK_DETECTION_INFO)(((DWORD_PTR)DiskGeometryGetPartition(Geometry)+\ DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo))) /* volume: \\?\Volume{GUID}\ */ typedef struct { QByteArray volumeName; /* \\?\Volume{GUID}\ */ QByteArray fileSystem; /* String indicating the file system */ QByteArray mountPoint; /* a:\ */ QByteArray volumeLink; /* \Device\HarddiskVolume6 */ QByteArray Name; /* User name of the device. From GetVolumeInformation */ DWORD dwSysFlags; /* From GetVolumeInformation */ DWORD serialNumber; /* From GetVolumeInformation */ int driveType; /* From GetDriveType */ // Return from GetDiskGeometryEx int MediaType; int TracksPerCylinder,SectorsPerTrack,BytesPerSector; long long Cylinders,DiskSize; // Alternative way to estimate disk size long long DiskSize2; } VOLUMEDEF; bool NativeInit(); std::vector<VOLUMEDEF> GetListOfMountPoints(QStringList List); bool NativeDir(QString Dir,QStringList &List); void ParseNativeDir(QStringList List); //std::vector<VOLUMEDEF> GetListOfVolumes(); std::vector<VOLUMEDEF> GetListOfVolumes(std::vector<int> AllowedDriveType,std::vector<std::string> AllowedLinkName); bool GetGeometry(QByteArray DeviceName,QByteArray Description); bool GetGeometryEx(QByteArray DeviceName,int &MediaType,long long int &Cylinders,int &TracksPerCylinder,int &SectorsPerTrack, int &BytesPerSector,long long &DiskSize); bool GetSizeHandle(HANDLE h,long long &len,int &method); bool GetSize(QByteArray DeviceName,long long &size,int &method); bool GetDiskExtents(HANDLE hFile,QByteArray &Device,uint64_t &Offset, uint64_t &Len); bool GetPartitionSize(HANDLE h,long long &len); HANDLE NTCreateFile(QByteArray FileName,DWORD dwDesiredAccess,DWORD dwShareMode,PSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,HANDLE hTemplateFile); class LowLevelFile { HANDLE h; QByteArray fileName; public: LowLevelFile(QByteArray _fn); ~LowLevelFile(); bool open(); bool close(); bool read(int size,unsigned char *buffer,int &read); bool seek(unsigned long long pos,unsigned long long &newpos); }; #endif // LOWLEVEL_H
[ "droggen@1fa3586f-ae1d-b4ea-cc5f-ffa2b2774cd0" ]
[ [ [ 1, 274 ] ] ]
1ffbc7d1ab561e3d185f10a237fc89dff9778144
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/WORLDSERVER/MiniGameArithmetic.cpp
31d14a25e92cb6ec5f23db55c53ad4a27dec3426
[]
no_license
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
UHC
C++
false
false
4,224
cpp
#include "stdafx.h" #if __VER >= 13 // __RAINBOW_RACE #include ".\minigamearithmetic.h" CMiniGameArithmetic::CMiniGameArithmetic(void) { InitPrimeNumber(); } CMiniGameArithmetic::CMiniGameArithmetic( CMiniGameBase* pMiniGame ) : m_nResult( 0 ), m_nCorrectCount( 0 ) { CMiniGameArithmetic* pMiniGameArithmetic = static_cast<CMiniGameArithmetic*>( pMiniGame ); m_vecnPrimeNumber.assign( pMiniGameArithmetic->m_vecnPrimeNumber.begin(), pMiniGameArithmetic->m_vecnPrimeNumber.end() ); } CMiniGameArithmetic::~CMiniGameArithmetic(void) { } BOOL CMiniGameArithmetic::Excute( CUser* pUser, __MINIGAME_PACKET* pMiniGamePacket ) { BOOL bReturn = FALSE; __MINIGAME_EXT_PACKET MP( pMiniGamePacket->wNowGame ); if( pMiniGamePacket->nState == MP_OPENWND || pMiniGamePacket->nState == MP_FAIL ) { MP.nState = pMiniGamePacket->nState; if( pMiniGamePacket->nState == MP_OPENWND ) m_nCorrectCount = 0; // 창을 새로 열면 정답수 초기화.. MP.nParam1 = m_nCorrectCount; MP.vecszData.push_back( MakeQuestion() ); SendExtPacket( pUser, MP ); return bReturn; } if( pMiniGamePacket->nParam1 == m_nResult ) { m_nCorrectCount++; if( m_nCorrectCount == 5 ) // 5문제 정답을 완료!! { MP.nState = MP_FINISH; bReturn = TRUE; } else { MP.nState = MP_TRUE; MP.vecszData.push_back( MakeQuestion() ); } } else { MP.nState = MP_FALSE; MP.vecszData.push_back( MakeQuestion() ); m_nCorrectCount = 0; } MP.nParam1 = m_nCorrectCount; SendExtPacket( pUser, MP ); return bReturn; } void CMiniGameArithmetic::InitPrimeNumber() { for( int i=0; i<1000; i++ ) { int nCount = 0; for( int j = 2; j <= i; j++ ) { if( (float)i / (float)j == i / j ) nCount++; if( nCount > 1 ) break; } if( nCount == 1 ) m_vecnPrimeNumber.push_back( i ); } } int CMiniGameArithmetic::GetDivisor( int nDivided ) { vector<int> vDivisors; vDivisors.push_back( 1 ); int nFound = 0; BOOL bLoop = TRUE; while( bLoop ) { for( int i = 0; i < (int)( m_vecnPrimeNumber.size() ); ++i ) { if( m_vecnPrimeNumber[i] > nDivided ) { bLoop = FALSE; break; } if( (float)nDivided / (float)m_vecnPrimeNumber[i] == nDivided / m_vecnPrimeNumber[i] ) { vDivisors.push_back( m_vecnPrimeNumber[i] ); nDivided /= m_vecnPrimeNumber[i]; break; } } // if( nFound == 0 ) // bLoop = FALSE; } int n = xRandom( vDivisors.size() ) + 1; int nDivisor =1; while( n-- > 0 ) { int iIndex = xRandom( vDivisors.size() ); nDivisor *= vDivisors[iIndex]; vector<int>::iterator it = vDivisors.begin(); it += iIndex; vDivisors.erase( it ); } return nDivisor; } string CMiniGameArithmetic::MakeQuestion() { int nNum[3] = {0,}; int nOper[3] = {0,}; char szQuestion[20] = {0,}; for( int i=0; i<3; i++ ) { nNum[i] = xRandom( 1, 1000 ); nOper[i] = xRandom( 4 ); } int nResult = 0; if( nOper[2] > 1 ) // 숫자가 3개인 경우다. { if( (nOper[0] < 2) && (nOper[1] > 1) ) // 뒤쪽 연산자가 우선인 경우( *, / ) { nResult = Calculate( nNum[1], nNum[2], nOper[1] ); nResult = Calculate( nNum[0], nResult, nOper[0] ); } else { nResult = Calculate( nNum[0], nNum[1], nOper[0] ); nResult = Calculate( nResult, nNum[2], nOper[1] ); } sprintf( szQuestion, "%d %c %d %c %d", nNum[0], GetOperatorCh( nOper[0] ), nNum[1], GetOperatorCh( nOper[1] ), nNum[2] ); } else { nResult = Calculate( nNum[0], nNum[1], nOper[0] ); sprintf( szQuestion, "%d %c %d", nNum[0], GetOperatorCh( nOper[0] ), nNum[1] ); } m_nResult = nResult; return szQuestion; } int CMiniGameArithmetic::Calculate( int n1, int& n2, int nOper ) { switch( nOper ) { case 0: return n1 + n2; case 1: return n1 - n2; case 2: return n1 * n2; case 3: n2 = GetDivisor( n1 ); return n1 / n2; } return -1; } char CMiniGameArithmetic::GetOperatorCh( int nOper ) { switch( nOper ) { case 0: return '+'; case 1: return '-'; case 2: return '*'; case 3: return '/'; } return '+'; } #endif // __RAINBOW_RACE
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 187 ] ] ]
fa086bcb031b965331e852c6a30bc5fd3ae643a7
ea12fed4c32e9c7992956419eb3e2bace91f063a
/zombie/code/zombie/gameplay/src/nastar/nastar.cc
c1bfe5ff823a010e0ec988f093574dc6aea07177
[]
no_license
ugozapad/TheZombieEngine
832492930df28c28cd349673f79f3609b1fe7190
8e8c3e6225c2ed93e07287356def9fbdeacf3d6a
refs/heads/master
2020-04-30T11:35:36.258363
2011-02-24T14:18:43
2011-02-24T14:18:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,479
cc
#include "precompiled/pchgameplay.h" //------------------------------------------------------------------------------ // npathfinder.cc // (C) 2005 Conjurer Services, S.A. //------------------------------------------------------------------------------ #include "nastar/nastar.h" #include "nnavmesh/nnavmesh.h" #include "ncnavmesh/ncnavmeshnode.h" #include "nnavmesh/nnavutils.h" #include "entity/nentity.h" #include "ncaistate/ncaistate.h" #include "variable/nvariableserver.h" #include "mathlib/polygon.h" #include "gfx2/ngfxserver2.h" nNebulaClass(nAStar, "nobject"); nAStar* nAStar::Singleton = 0; //------------------------------------------------------------------------------ /** Constructor */ nAStar::nAStar() { n_assert(0==Singleton); Singleton = this; } //------------------------------------------------------------------------------ /** Destructor */ nAStar::~nAStar() { Singleton = 0; } //------------------------------------------------------------------------------ /** InitSearch */ void nAStar::InitSearch (const vector3& start, const vector3& goal, ncNavNode* startNode, ncNavNode *goalNode) { this->start = start; nNavUtils::GetGroundHeight( this->start, this->start.y ); n_assert( goalNode ); goalNode->GetClosestNavigablePoint( goal, this->goal ); this->startNode = startNode; this->goalNode = goalNode; this->openList.Clear(); this->closedList.Clear(); this->pathNode.Clear(); this->path.Clear(); } //------------------------------------------------------------------------------ /** FindPath */ bool nAStar::FindPath (const vector3& start, const vector3& goal, nArray<vector3>* path, nArray<bool>* smoothable) // nEntityObject* entity) { ncNavNode* startNode = this->mesh->GetClosestNode( start ); ncNavNode* goalNode = this->mesh->GetClosestNode( goal ); bool existPath = startNode != 0 && goalNode != 0; if ( existPath ) { this->InitSearch (start, goal, startNode, goalNode); existPath = this->CalculatePath (startNode, goalNode); if ( existPath && path ) { path->Clear(); smoothable->Clear(); for ( int i=this->path.Size()-1; i>=0; i-- ) { path->Append (this->path[i]); smoothable->Append (this->smoothable[i]); } } } // else // { // @todo Test if going straight to the goal is valid for those cases where // no nodes are found for some of the given points // } return existPath; } //------------------------------------------------------------------------------ /** CalculatePath */ bool nAStar::CalculatePath (ncNavNode* start, ncNavNode* goal) { n_assert(start&&goal); const float MaxAllowedTime = nVariableServer::Instance()->GetGlobalVariable("MaxPathFindingTime")->GetFloat(); nTime maxAllowedTime = nTimeServer::Instance()->GetTime() + MaxAllowedTime; bool existPath = false; AStarValues values; // Let's search! start->SetParent( NULL ); this->CalculateValues (start, start, goal, &values); this->InsertAtOpenList(start); start->SetG (values.g); start->SetH (values.h); start->SetF (values.f); ncNavNode* current; do { current = this->GetBestF(); if ( current && current != goal ) { this->MoveToClosedList (current); // For all links of the current node for ( int i=0; i<current->GetLinksNumber(); i++ ) { ncNavNode* neightbour = current->GetLink(i); n_assert(neightbour); if ( neightbour && !this->IsClosed (neightbour) ) { this->CalculateValues (current, neightbour, goal, &values); if ( !this->IsOpen (neightbour) ) { this->InsertAtOpenList (neightbour); neightbour->SetParent (current); neightbour->SetG (values.g); neightbour->SetH (values.h); neightbour->SetF (values.f); } else if ( neightbour->GetG() > values.g ) { neightbour->SetParent (current); neightbour->SetG (values.g); neightbour->SetH (values.h); neightbour->SetF (values.f); } } } } } while ( current != goal && this->openList.Size() > 0 && nTimeServer::Instance()->GetTime() < maxAllowedTime ); // Now, we must build the path if ( current == goal ) { this->BuildFinalPath(); existPath = true; } return existPath; } //------------------------------------------------------------------------------ /** InsertAtOpenList */ void nAStar::InsertAtOpenList (ncNavNode* node) { n_assert(node); if ( node && this->openList.FindIndex(node) == -1 ) { this->openList.Append (node); } } //------------------------------------------------------------------------------ /** MoveToClosedList */ void nAStar::MoveToClosedList (ncNavNode* node) { if ( this->closedList.FindIndex (node) == -1 ) { this->closedList.Append (node); // delete from the open list int index = this->openList.FindIndex (node); this->openList.Erase (index); } } //------------------------------------------------------------------------------ /** IsConsidered */ bool nAStar::IsConsidered (ncNavNode* node) const { n_assert(node); bool exist = false; if ( node ) { exist = this->openList.FindIndex (node) != -1 || this->closedList.FindIndex(node) != -1; } return exist; } //------------------------------------------------------------------------------ /** IsClosed */ bool nAStar::IsClosed (ncNavNode* node) const { n_assert(node); bool closed = false; if ( node ) { closed = this->closedList.FindIndex (node) > -1; } return closed; } //------------------------------------------------------------------------------ /** IsOpen */ bool nAStar::IsOpen (ncNavNode* node) const { n_assert(node); bool open = false; if ( node ) { open = this->openList.FindIndex (node) > -1; } return open; } //------------------------------------------------------------------------------ /** CalculateValues */ void nAStar::CalculateValues (ncNavNode* current, ncNavNode* candidate, ncNavNode* goal, AStarValues* values) { n_assert(current&&candidate&&goal&&values); if ( current && candidate && goal && values ) { vector3 posCandidate; candidate->GetMidpoint( posCandidate ); vector3 posCurrent; current->GetMidpoint( posCurrent ); vector3 posGoal; goal->GetMidpoint( posGoal ); values->g = (int)(posCurrent - posCandidate).lensquared(); values->h = (int)(posGoal - posCandidate).lensquared(); values->f = values->g + values->h; } } //------------------------------------------------------------------------------ /** GetBestF */ ncNavNode* nAStar::GetBestF() const { ncNavNode* bestNode =0 ; int bestF = INT_MAX; for ( int i=0; i<this->openList.Size(); i++ ) { ncNavNode* element = this->openList[i]; n_assert(element); if ( element ) { int f = element->GetF(); if ( f < bestF ) { bestNode = element; bestF = f; } } } return bestNode; } //------------------------------------------------------------------------------ /** IsValidGoal */ bool nAStar::IsValidGoal (const vector3& goal, nEntityObject* entity) const { n_assert(this->mesh); return this->IsValidPosition (goal, entity); } //------------------------------------------------------------------------------ /** IsValidPosition */ bool nAStar::IsValidPosition (const vector3& position, nEntityObject* /*entity*/) const { n_assert(this->mesh); // Project given point on ground vector3 groundPosition( position ); if ( !nNavUtils::GetGroundHeight( position, groundPosition.y ) ) { // No ground found, so it's not a valid position return false; } // Position is valid if there's a node that allows to reach the given position return this->mesh->GetNavNode( groundPosition ) != NULL; // @todo Check if the agent physically fits in the given position depending on its height and size } //------------------------------------------------------------------------------ /** BuildFinalPath */ void nAStar::BuildFinalPath() { ncNavNode* node; this->path.Clear(); this->smoothable.Clear(); this->path.Append (this->goal); this->smoothable.Append (false); for (node = this->goalNode; node && node != this->startNode; node = node->GetParent() ) { n_assert(node); if ( node ) { vector3 subgoal; node->GetMidpoint( subgoal ); nNavUtils::GetGroundHeight( subgoal, subgoal.y ); this->path.Append( subgoal ); this->smoothable.Append( node->GetComponent<ncNavMeshNode>() != NULL ); } } this->path.Append (this->start); this->smoothable.Append (false); }
[ "magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91" ]
[ [ [ 1, 383 ] ] ]
a7ead7de677f65d87337bb0a87bdb480660c2fed
0f457762985248f4f6f06e29429955b3fd2c969a
/irrlicht/src/proto_carace/GameFrame.cpp
a55f26ef1a861f74120fd00642e7343bcede268d
[]
no_license
tk8812/ukgtut
f19e14449c7e75a0aca89d194caedb9a6769bb2e
3146ac405794777e779c2bbb0b735b0acd9a3f1e
refs/heads/master
2021-01-01T16:55:07.417628
2010-11-15T16:02:53
2010-11-15T16:02:53
37,515,002
0
0
null
null
null
null
UHC
C++
false
false
18,279
cpp
//#include "StdAfx.h" #include "bycle.h" #include "GameFrame.h" using namespace std; using namespace irr; #include "irr_utill.h" void recursivePhysicsReg(irr::scene::ISceneManager *pSmgr,irr::s32 worldID,irr::scene::ISceneNode *pStartNode) { if(pStartNode == 0) { pStartNode = pSmgr->getRootSceneNode(); } irr::core::list<irr::scene::ISceneNode *>::ConstIterator it = pStartNode->getChildren().begin(); for(;it != pStartNode->getChildren().end();it++) { recursivePhysicsReg(pSmgr,worldID,*it); switch( (*it)->getType()) { case irr::scene::jz3d::CCollusionMngNode::TypeID: { } break; case irr::scene::jz3d::CBulletPhysicsObjectNode::TypeID: { irr::scene::CBulletAnimatorManager *ani_factory = static_cast<irr::scene::CBulletAnimatorManager *>(ggf::util::findAnimatorFactory(pSmgr, irr::scene::ESNAT_BULLET_OBJECT)); irr::scene::jz3d::CBulletPhysicsObjectNode *pNode = irr::scene::jz3d::CBulletPhysicsObjectNode::upcast((*it)); pNode->register2BulletPhysicsWorld(ani_factory->getBulletWorldByID(worldID)->getWorld()); } break; case irr::scene::ESNT_MESH: case irr::scene::jz3d::CTiledPlaneNode::TypeID: break; } } } CGameFrame::CGameFrame(void) :CEsenFrame(), m_pmsGroundSelecter(0), m_pmsRoadSelecter(0), m_pmsWallSelecter(0) { m_pmsGroundSelecter = 0; m_pmsRoadSelecter = 0; m_pmsWallSelecter = 0; //m_pTsFinishLine = 0; } CGameFrame::CGameFrame(LPCSTR strName) : CEsenFrame(strName), m_pmsGroundSelecter(0), m_pmsRoadSelecter(0), m_pmsWallSelecter(0) //m_pTsFinishLine(0) { } CGameFrame::~CGameFrame(void) { if(m_bEnable) Release(); } void CGameFrame::Init() { m_bEnable = true; m_bCollGround = false; m_bPauseKey = false; m_bResume = false; SetPhase(PH_READY,NULL); } void CGameFrame::Release() { if(m_pmsGroundSelecter) { m_pmsGroundSelecter->drop(); m_pmsRoadSelecter->drop(); if(m_pmsWallSelecter) m_pmsWallSelecter->drop(); //if(m_pTsFinishLine) // m_pTsFinishLine->drop(); } irr::scene::ISceneManager *pSmgr = CBycleApp::Get().m_System.m_pSmgr; pSmgr->clear(); //월드를 물리 관리자겸 펙토리에서 일단 제거해주고 CBycleApp::GetPtr()->m_pBulletPhysicsFactory->removeWorld(m_pWorldAnimator); //월드를 제거한다. m_pWorldAnimator->drop(); m_bEnable = false; } void CGameFrame::Apply(irr::u32 timeMs) { if(!m_bEnable) return; irr::scene::ISceneManager *pSmgr = CBycleApp::Get().m_System.m_pSmgr; switch(m_nPhase) { case PH_READY: switch(m_nStep) { case 0: LoadRes(); // 배경음악 시작 CBycleApp::Get().playBgm(); CBycleApp::Get().hideAllMenu(); SetPhase(PH_PLAY,NULL); break; } break; case PH_PLAY: { switch(m_nStep) { case 0: if(m_bResume == true) { m_nStep = 10; } else { m_ThisBycle.SetStatus(CObj_ThisBycle::ST_READY); m_nStep = 5; } break; case 5: if(m_ThisBycle.GetStatus() == CObj_ThisBycle::ST_RACE) // 출발 신호떨어지면 { m_nStep = 10; } break; case 10: if(m_bPauseKey) { SetPhase(PH_PAUSE,NULL); } break; } //물리 스탭 CBycleApp::GetPtr()->m_pBulletPhysicsFactory->OnUpdate(timeMs*1000); //플래이어 컨트롤 m_ThisBycle.Apply(timeMs); if(m_ThisBycle.IsMissionComplete()) { m_ThisBycle.CompleteRace(); SetPhase(PH_END,NULL); } } break; case PH_PAUSE: switch(m_nStep) { case 0: if(m_bPauseKey == false) //플릭킹방지 { //배경음악 정지 CBycleApp::Get().stopBgm(); //게임 종료버튼활성화 CBycleApp::Get().activateGameResultTab(); m_nStep++; } break; case 1: if(m_bPauseKey == true) //플릭킹방지 { m_nStep++; } break; case 2: if(m_bPauseKey == false) //플릭킹방지 { CBycleApp::Get().DeactivateGameResultTab(); SetPhase(PH_PLAY,NULL); m_bResume = true; } break; } break; case PH_END: switch(m_nStep) { case 0: if(m_bPauseKey == false) //플릭킹방지 { //배경음악 정지 CBycleApp::Get().stopBgm(); //게임 종료버튼활성화 CBycleApp::Get().activateGameResultTab(); m_nStep++; } break; case 1: if(m_bPauseKey == true) //플릭킹방지 { m_nStep++; } break; case 2: //if(m_bPauseKey == false) //플릭킹방지 //{ // CBycleApp::Get().DeactivateGameResultTab(); // SetPhase(PH_PLAY,NULL); // m_bResume = true; //} break; } break; case PH_TESTPLAY: break; } } void CGameFrame::Render() { if(!m_bEnable) return; CBycleApp::Get().m_System.m_pSmgr->drawAll(); CBycleApp::Get().m_System.m_pDevice->getGUIEnvironment()->drawAll(); switch(m_nPhase) { case PH_READY: break; case PH_PLAY: m_ThisBycle.Render(); { irr::video::IVideoDriver *pVideo = CBycleApp::Get().m_System.m_pDevice->getVideoDriver(); //pVideo->D char szBuf[256]; float speedkmh = m_ThisBycle.getSpeedKmh(); sprintf_s(szBuf,"%d",(int)speedkmh); irr::core::stringw strw = szBuf; CBycleApp::Get().m_pFont_Arial36->draw(strw.c_str(), irr::core::rect<irr::s32>(20,500,100,600), irr::video::SColor(255,255,255,0)); //경과시간표시 irr::u32 tick = (irr::u32)m_ThisBycle.getRecord(); sprintf_s(szBuf,"%02d:%02d",tick/60,tick%60); strw = szBuf; CBycleApp::Get().m_pFont_Arial36->draw(strw.c_str(), irr::core::rect<irr::s32>(400-42,0,500,36), irr::video::SColor(255,255,255,0)); } break; case PH_END: { irr::video::IVideoDriver *pVideo = CBycleApp::Get().m_System.m_pDevice->getVideoDriver(); char szBuf[256]; float speedkmh = m_ThisBycle.getSpeedKmh(); sprintf_s(szBuf,"result: %f",m_ThisBycle.getRecord()); irr::core::stringw strw = szBuf; CBycleApp::Get().m_pFont_Arial36->draw(strw.c_str(), irr::core::rect<irr::s32>(200,100,200+100,100+60), irr::video::SColor(255,255,255,0)); } break; case PH_TESTPLAY: break; } } void CGameFrame::Octree2Bullet(irr::scene::ISceneNode *pRoadRoot) { //irr::scene::ISceneNode *pRoadRoot = CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName(stageRes.m_strRoad.c_str()); irr::scene::ISceneManager *pSmgr = CBycleApp::Get().m_System.m_pDevice->getSceneManager(); irr::io::IFileSystem* ifs = CBycleApp::Get().m_System.m_pDevice->getFileSystem(); irr::core::list<irr::scene::ISceneNode*>::ConstIterator it = pRoadRoot->getChildren().begin(); for (; it != pRoadRoot->getChildren().end(); ++it) { if((*it)->getType() == irr::scene::ESNT_OCT_TREE || (*it)->getType() == irr::scene::ESNT_MESH ) { irr::scene::ISceneNode *pNode = (*it); { irr::io::IAttributes* attribs = ifs->createEmptyAttributes(); if (attribs) { pNode->serializeAttributes(attribs); // get the mesh name out irr::core::stringc name = attribs->getAttributeAsString("Mesh"); attribs->drop(); // get the animated mesh for the object irr::scene::IAnimatedMesh* mesh = pSmgr->getMesh(name.c_str()); irr::scene::CBulletObjectAnimatorGeometry geom; irr::scene::CBulletObjectAnimatorParams physicsParams; //pNode->setMaterialFlag(irr::video::EMF_WIREFRAME,true); // add level static mesh geom.type = scene::CBPAGT_CONCAVE_MESH; geom.mesh.irrMesh = NULL;//pNode->getMesh();////pMesh->getMesh(0); geom.meshFile = name; physicsParams.mass = 0.0f; scene::CBulletObjectAnimator* levelAnim = CBycleApp::GetPtr()->m_pBulletPhysicsFactory->createBulletObjectAnimator( pSmgr, pNode, m_pWorldAnimator->getID(), &geom, &physicsParams ); pNode->addAnimator(levelAnim); levelAnim->drop(); } } } else if((*it)->getType() == irr::scene::ESNT_TERRAIN) { } } } void CGameFrame::LoadRes() { CConfigData *pConfig = &(CBycleApp::Get().m_System.m_ConfigData); CStage_Res stageRes = pConfig->m_vtStageRes[CBycleApp::Get().m_nStage]; CBycleApp::Get().m_System.m_pSmgr->clear(); //씬로딩 { std::string strPath = CBycleApp::GetPtr()->m_System.m_ConfigData.m_strResFolder; strPath += "/res/"; std::string strOldPath; strOldPath = CBycleApp::GetPtr()->m_System.m_pDevice->getFileSystem()->getWorkingDirectory(); CBycleApp::GetPtr()->m_System.m_pDevice->getFileSystem()->changeWorkingDirectoryTo(strPath.c_str()); CBycleApp::Get().m_System.m_pSmgr->loadScene(stageRes.m_strFile.c_str()); //"../res/stage02.xml"); CBycleApp::GetPtr()->m_System.m_pDevice->getFileSystem()->changeWorkingDirectoryTo(strOldPath.c_str()); } m_pSpawnNode = CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName(stageRes.m_strSpawnPoint.c_str()); if(!m_pSpawnNode) { ggf::irr_util::DebugOutputFmt(NULL,"not found node %s\n",stageRes.m_strSpawnPoint.c_str()); } irr::scene::ISceneManager *pSmgr = CBycleApp::Get().m_System.m_pSmgr; irr::video::IVideoDriver *pVideo = CBycleApp::Get().m_System.m_pDevice->getVideoDriver(); irr::scene::ICameraSceneNode *pCam; pCam = (irr::scene::ICameraSceneNode *)CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName( pConfig->m_strCamNode.c_str() ); CBycleApp::Get().m_System.m_pSmgr->setActiveCamera(pCam); //샐랙터 처리 관련 초기화 { //전체 씬노드 모두 샐랙터생성 ggf::irr_util::ISceneManager_assignTriangleSelectors( CBycleApp::Get().m_System.m_pSmgr, CBycleApp::Get().m_System.m_pDevice->getFileSystem() ); //지상대물용 통합삼각선택자만들기 m_pmsGroundSelecter = CBycleApp::Get().m_System.m_pSmgr->createMetaTriangleSelector(); m_pmsRoadSelecter = CBycleApp::Get().m_System.m_pSmgr->createMetaTriangleSelector(); m_pmsWallSelecter = CBycleApp::Get().m_System.m_pSmgr->createMetaTriangleSelector(); irr::scene::ISceneNode *pNode; pNode = CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName(stageRes.m_strTerrain.c_str()); if(pNode) { ggf::irr_util::ISceneNode_gatherTriangleSelectors( pNode, m_pmsGroundSelecter ); } pNode = CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName(stageRes.m_strRoad.c_str()); if(pNode) { ggf::irr_util::ISceneNode_gatherTriangleSelectors( pNode, m_pmsRoadSelecter ); } pNode = CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName(stageRes.m_strWall.c_str()); if(pNode) { ggf::irr_util::ISceneNode_gatherTriangleSelectors( pNode, m_pmsWallSelecter ); } irr::scene::ISceneNode *pTrigerGroup = pSmgr->getSceneNodeFromName("triger"); if(pTrigerGroup) { pNode = CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName( stageRes.m_strFinishLine.c_str() ); if(pNode) { m_pColMFinishLine = (irr::scene::jz3d::CCollusionMngNode *)pNode; } else { ggf::irr_util::DebugOutputFmt(NULL,"cant found %s node for finish line \n",stageRes.m_strFinishLine.c_str() ); } } else { ggf::irr_util::DebugOutputFmt(NULL,"cant found triger group\n"); } } //물리충돌정보 만들기 { // Initialize bullet physics world(discret dynamics) { m_pWorldNode = pSmgr->addEmptySceneNode(); m_pWorldNode->setName("WorldNode"); // 기본중력 -9.8f irr::scene::CBulletWorldAnimatorParams worldParams; worldParams.bSoft = false; //루트애니매이터 //irr::scene::CBulletWorldAnimator* bulletWorldAnimator = m_pWorldAnimator = CBycleApp::GetPtr()->m_pBulletPhysicsFactory->createBulletWorldAnimator( pSmgr, m_pWorldNode, &worldParams ); //중력은 기본으로 y 축으로 -9.8 //m_pWorldAnimator->setGravity(irr::core::vector3df(0,-9.8,0)); m_pWorldNode->addAnimator(m_pWorldAnimator); } //길 { irr::scene::ISceneNode *pRoadRoot = CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName(stageRes.m_strRoad.c_str()); if(pRoadRoot) { Octree2Bullet(pRoadRoot); //물리 씬노드 등록해주기 irr::core::list<irr::scene::ISceneNode *>::ConstIterator it = pRoadRoot->getChildren().begin(); recursivePhysicsReg(pSmgr,m_pWorldAnimator->getID(),(*it)); } } //벽옥트리 { irr::scene::ISceneNode *pRoot = CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName(stageRes.m_strWall.c_str()); if(pRoot) Octree2Bullet(pRoot); } //그라운드 옥트리 { irr::scene::ISceneNode *pRoot = CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName(stageRes.m_strTerrain.c_str()); if(pRoot) Octree2Bullet(pRoot); } } m_ThisBycle.Init(this); } bool CGameFrame::OnEvent(irr::SEvent ev) { if(ev.EventType == EET_KEY_INPUT_EVENT) { if(ev.KeyInput.PressedDown == true) { switch(ev.KeyInput.Key) { case irr::KEY_KEY_W: //pCam->setPosition(pCam->getPosition() + vfront); //m_ThisBycle.ChangeSpeed(0.1f); g_Buttons[2] = 1; break; case irr::KEY_KEY_S: g_Buttons[3] = 1; //m_ThisBycle.ChangeSpeed(-0.1f); break; case irr::KEY_SPACE: g_Buttons[4] = 1; //m_ThisBycle.ChangeSpeed(-0.1f); break; case irr::KEY_KEY_A: m_ThisBycle.IncreaseTurn(-0.1f); break; case irr::KEY_KEY_D: m_ThisBycle.IncreaseTurn(0.1f); break; case irr::KEY_F1: //m_ThisBycle.SetCamYaw(90.f); //SetPhase(PH_TESTPLAY,NULL); break; case irr::KEY_F2: //m_ThisBycle.SetCamYaw(-90.f); //SetPhase(PH_TESTPLAY,NULL); break; case irr::KEY_F3: //m_ThisBycle.SetCamYaw(180.f); //SetPhase(PH_TESTPLAY,NULL); break; case irr::KEY_F4: //m_ThisBycle.SetCamYaw(0.f); //SetPhase(PH_PAUSE,NULL); break; case irr::KEY_F5: { CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName("DebugWheelRoot")->setVisible( !CBycleApp::Get().m_System.m_pSmgr->getSceneNodeFromName( "DebugWheelRoot")->isVisible() ); //DebugWheelRoot /* m_ThisBycle.SetCamYaw(0.f); SetPhase(PH_PAUSE,NULL); */ break; } case irr::KEY_F6: { m_ThisBycle.HideVehicle(); } break; case irr::KEY_ESCAPE: m_bPauseKey = true; //SetPhase(PH_TESTPLAY,NULL); break; } } else { switch(ev.KeyInput.Key) { case irr::KEY_ESCAPE: m_bPauseKey = false; break; case irr::KEY_KEY_W: g_Buttons[2] = 0; break; case irr::KEY_KEY_S: g_Buttons[3] = 0; break; case irr::KEY_SPACE: g_Buttons[4] = 0; //m_ThisBycle.ChangeSpeed(-0.1f); break; } } } else if(ev.EventType == EET_MOUSE_INPUT_EVENT) { if(ev.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN) { } } else if(ev.EventType == irr::EET_GUI_EVENT) { irr::gui::IGUIEnvironment *pEnv = CBycleApp::Get().m_System.m_pDevice->getGUIEnvironment(); int hID = ev.GUIEvent.Caller->getID(); switch(ev.GUIEvent.EventType) { case irr::gui::EGET_BUTTON_CLICKED: { switch(hID) { case GUIID_BTN_FINISH: { //irr::gui::IGUIElement *pguiEm = pEnv->getRootGUIElement()->getElementFromId(GUIID_BTN_FINISH,true); //pguiEm->setVisible(false); CBycleApp::Get().hideAllMenu(); CBycleApp::Get().SaveRecord(m_ThisBycle.getRecord()); CBycleApp::Get().m_System.m_pFrameMng->SetActiveFrame("frame_menu"); } break; case GUIID_BTN_FINISH_NOTSAVE: { CBycleApp::Get().hideAllMenu(); CBycleApp::Get().m_System.m_pFrameMng->SetActiveFrame("frame_menu"); } } } } } return true; } void CGameFrame::DecodePacket(irr::s32 nCode,void *pBuf) { } bool CGameFrame::GetCollisionHeight(float x, float z, float &y) { irr::core::triangle3df triangle; irr::core::line3df Ray = irr::core::line3df(irr::core::vector3df(x,500,z),irr::core::vector3df(x,-500,z)); irr::core::vector3df vColl; if(CBycleApp::Get().m_System.m_pSmgr->getSceneCollisionManager()->getCollisionPoint( Ray,m_pmsRoadSelecter, vColl, m_triIntersecGround )) { y = vColl.Y; m_bCollGround = true; m_nCollType = COLT_ROAD; } else if(CBycleApp::Get().m_System.m_pSmgr->getSceneCollisionManager()->getCollisionPoint( Ray,m_pmsGroundSelecter, vColl, m_triIntersecGround )) { y = vColl.Y; m_bCollGround = true; m_nCollType = COLT_GROUND; } else { m_bCollGround = false; } return m_bCollGround; } //vtRayPosDiff 충돌광선 모 오브잭트 위치에서 변위차 // bool CGameFrame::GetCollisionWall(irr::scene::ISceneNode *pNode,irr::core::vector3df vtRayPosDiff,irr::f32 fRayLength, irr::f32 fYaw, irr::f32 &fDist, irr::core::triangle3df *pTri) { irr::f32 fPosX = pNode->getPosition().X; irr::f32 fPosY = pNode->getPosition().Y; irr::f32 fPosZ = pNode->getPosition().Z; irr::core::vector3df vtStart(fPosX,fPosY,fPosZ); irr::core::vector3df vtDir(0,0,1); //vtStart += vtRayPosDiff; vtDir.rotateXZBy(0-fYaw,irr::core::vector3df(0,0,0)); //irr::core::triangle3df triangle; irr::core::line3df Ray = irr::core::line3df(vtStart,vtStart+(vtDir*fRayLength) ); bool bColl = false; if(CBycleApp::Get().m_System.m_pSmgr->getSceneCollisionManager()->getCollisionPoint( Ray,m_pmsWallSelecter, Ray.end, m_triIntersecWall )) { fDist = Ray.getLength(); //y = vColl.Y; //m_bCollGround = true; //m_nCollType = COLT_ROAD; bColl = true; if(pTri != NULL) { *pTri = m_triIntersecWall; } } else { //m_bCollGround = false; } m_RayfrontColl = Ray; return bColl; }
[ "gbox3d@58f0f68e-7603-11de-abb5-1d1887d8974b" ]
[ [ [ 1, 758 ] ] ]
9778d4f8ed5c4c45a9d0392078aab6033903f9a8
335783c9e5837a1b626073d1288b492f9f6b057f
/source/fbxcmd/ViewScene/GetPosition.cxx
6e6f4f16a20392d09969fe1057faf9f020df6e01
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause" ]
permissive
code-google-com/fbx4eclipse
110766ee9760029d5017536847e9f3dc09e6ebd2
cc494db4261d7d636f8c4d0313db3953b781e295
refs/heads/master
2016-09-08T01:55:57.195874
2009-12-03T20:35:48
2009-12-03T20:35:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,804
cxx
/************************************************************************************** Copyright (C) 2001 - 2009 Autodesk, Inc. and/or its licensors. All Rights Reserved. The coded instructions, statements, computer programs, and/or related material (collectively the "Data") in these files contain unpublished information proprietary to Autodesk, Inc. and/or its licensors, which is protected by Canada and United States of America federal copyright law and by international treaties. The Data may not be disclosed or distributed to third parties, in whole or in part, without the prior written consent of Autodesk, Inc. ("Autodesk"). THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY. ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE. **************************************************************************************/ ///////////////////////////////////////////////////////////////////////// // // This file contains the functions to get the local and the global // position of a node for a given time in the current take. // ///////////////////////////////////////////////////////////////////////// #include <fbxsdk.h> #include <math.h> #include <fbxfilesdk/fbxfilesdk_nsuse.h> #include "GetPosition.h" // Get the global position. // Do not take in account the geometric transform. KFbxXMatrix GetGlobalPosition(KFbxNode* pNode, KTime& pTime, KFbxXMatrix* pParentGlobalPosition) { // Ideally this function would use parent global position and local position to // compute the global position. // Unfortunately the equation // lGlobalPosition = pParentGlobalPosition * lLocalPosition // does not hold when inheritance type is other than "Parent" (RSrs). To compute // the parent rotation and scaling is tricky in the RrSs and Rrs cases. // This is why GetGlobalFromCurrentTake() is used: it always computes the right // global position. return pNode->GetGlobalFromCurrentTake(pTime); } // Get the global position of the node for the current pose. // If the specified node is not part of the pose, get its // global position at the current time. KFbxXMatrix GetGlobalPosition(KFbxNode* pNode, KTime& pTime, KFbxPose* pPose, KFbxXMatrix* pParentGlobalPosition) { KFbxXMatrix lGlobalPosition; bool lPositionFound = false; if (pPose) { int lNodeIndex = pPose->Find(pNode); if (lNodeIndex > -1) { // The bind pose is always a global matrix. // If we have a rest pose, we need to check if it is // stored in global or local space. if (pPose->IsBindPose() || !pPose->IsLocalMatrix(lNodeIndex)) { lGlobalPosition = GetPoseMatrix(pPose, lNodeIndex); } else { // We have a local matrix, we need to convert it to // a global space matrix. KFbxXMatrix lParentGlobalPosition; if (pParentGlobalPosition) { lParentGlobalPosition = *pParentGlobalPosition; } else { if (pNode->GetParent()) { lParentGlobalPosition = GetGlobalPosition(pNode->GetParent(), pTime, pPose); } } KFbxXMatrix lLocalPosition = GetPoseMatrix(pPose, lNodeIndex); lGlobalPosition = lParentGlobalPosition * lLocalPosition; } lPositionFound = true; } } if (!lPositionFound) { // There is no pose entry for that node, get the current global position instead lGlobalPosition = GetGlobalPosition(pNode, pTime, pParentGlobalPosition); } return lGlobalPosition; } // Get the matrix of the given pose KFbxXMatrix GetPoseMatrix(KFbxPose* pPose, int pNodeIndex) { KFbxXMatrix lPoseMatrix; KFbxMatrix lMatrix = pPose->GetMatrix(pNodeIndex); memcpy((double*)lPoseMatrix, (double*)lMatrix, sizeof(lMatrix.mData)); return lPoseMatrix; } // Get the geometry deformation local to a node. It is never inherited by the // children. KFbxXMatrix GetGeometry(KFbxNode* pNode) { KFbxVector4 lT, lR, lS; KFbxXMatrix lGeometry; lT = pNode->GetGeometricTranslation(KFbxNode::eSOURCE_SET); lR = pNode->GetGeometricRotation(KFbxNode::eSOURCE_SET); lS = pNode->GetGeometricScaling(KFbxNode::eSOURCE_SET); lGeometry.SetT(lT); lGeometry.SetR(lR); lGeometry.SetS(lS); return lGeometry; }
[ "tazpn314@ccf8930c-dfc1-11de-9043-17b7bd24f792" ]
[ [ [ 1, 151 ] ] ]
db8026cf8348b175e3d726c9ac23d4ed55cd39a5
57574cc7192ea8564bd630dbc2a1f1c4806e4e69
/Poker/Cliente/OpUIClienteGetCantFichas.h
99c6b3eb688e6d92d083c543dbca5da2689115a4
[]
no_license
natlehmann/taller-2010-2c-poker
3c6821faacccd5afa526b36026b2b153a2e471f9
d07384873b3705d1cd37448a65b04b4105060f19
refs/heads/master
2016-09-05T23:43:54.272182
2010-11-17T11:48:00
2010-11-17T11:48:00
32,321,142
0
0
null
null
null
null
UTF-8
C++
false
false
500
h
#ifndef _OPERACION_UI_CLIENTE_GETCANTFICHAS_H_ #define _OPERACION_UI_CLIENTE_GETCANTFICHAS_H_ #include "OperacionUICliente.h" using namespace std; class OpUIClienteGetCantFichas : public OperacionUICliente { protected: int cantidadFichas; public: OpUIClienteGetCantFichas(vector<string> parametros); virtual ~OpUIClienteGetCantFichas(void); virtual bool ejecutarAccion(Ventana* ventana); int getCantidadFichas(); }; #endif //_OPERACION_UI_CLIENTE_GETCANTFICHAS_H_
[ "[email protected]@a9434d28-8610-e991-b0d0-89a272e3a296" ]
[ [ [ 1, 23 ] ] ]
0e4dcf84b1805704c55d85344c88baaed6281fd1
e7c45d18fa1e4285e5227e5984e07c47f8867d1d
/Common/Models/CONTROL1/SetTagList.h
0661da6c47481ec6724184be8f0959f4df6c0e7f
[]
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,733
h
//================== SysCAD - Copyright Kenwalt (Pty) Ltd =================== // $Nokeywords: $ //=========================================================================== #ifndef __SETTAGLIST_H #define __SETTAGLIST_H #ifndef __SC_DEFS_H #include "sc_defs.h" #endif #ifndef __FLWNODE_H #include "flwnode.h" #endif #ifndef __MODELS_H #include "xrefs.h" #endif #ifndef __MODELS_H #include "models.h" #endif #ifdef __SETTAGLIST_CPP #define DllImportExport #elif !defined(Control1) #define DllImportExport DllImport #else #define DllImportExport #endif #define SKIPIT 0 #if SKIPIT #pragma message ("---------------------------------------SKIPPED") #else //-------------------------------------------------------------------------- class CTagListCon; class TagListFileHelper { public: flag bValid:1; byte eLogSetTags; Strng sStatus; Strng sPath; Strng sPathForView; Strng sFile; HANDLE hProcess; //process handle for the editor DWORD dwProcessId; //process ID for the editor CTagListCon* pParent; TagListFileHelper(CTagListCon* Parent); virtual ~TagListFileHelper(); bool LoadAndSetTags(bool TestParamStopped); }; //-------------------------------------------------------------------------- DEFINE_TAGOBJ(CTagListCon); class CTagListCon : public FlwNode { public: flag bOn; flag bSetBeforeStart; flag bSetAtStart; TagListFileHelper TLH; // flag bAboutToStart:1; //flag set True for first iteration when run is pressed CTagListCon(pTagObjClass pClass_, pchar TagIn, pTaggedObject pAttach, TagObjAttachment eAttach); virtual ~CTagListCon(); virtual void ResetData(flag Complete); private: public: virtual void BuildDataDefn(DataDefnBlk & DDB); virtual flag DataXchg(DataChangeBlk & DCB); virtual flag ValidateData(ValidateDataBlk & VDB); virtual flag PreStartCheck(); virtual void EvalCtrlInitialise(eScdCtrlTasks Tasks=CO_All); virtual void EvalCtrlStrategy(eScdCtrlTasks Tasks=CO_All); virtual int ChangeTag(pchar pOldTag, pchar pNewTag); virtual int DeleteTag(pchar pDelTag); virtual int FilesUsed(CFilesUsedArray & Files); virtual void SetState(eScdMdlStateActs RqdState); virtual void EvalProducts(CNodeEvalIndex & NEI); virtual dword ModelStatus(); DEFINE_CI(CTagListCon, FlwNode, 4); }; //=========================================================================== #endif #undef DllImportExport #endif
[ [ [ 1, 41 ], [ 43, 78 ], [ 81, 85 ], [ 87, 99 ] ], [ [ 42, 42 ] ], [ [ 79, 80 ], [ 86, 86 ] ] ]
56a6259844832bea8d57ebb3940c1edb5cfa1eb3
6c8c4728e608a4badd88de181910a294be56953a
/InWorldChatModule/InWorldChatModule.cpp
f5e91e3d27108a803eb01d417d8ef0326408cd7d
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
caocao/naali
29c544e121703221fe9c90b5c20b3480442875ef
67c5aa85fa357f7aae9869215f840af4b0e58897
refs/heads/master
2021-01-21T00:25:27.447991
2010-03-22T15:04:19
2010-03-22T15:04:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
12,075
cpp
/** * For conditions of distribution and use, see copyright notice in license.txt * * @file InWorldChatModule.cpp * @brief Simple OpenSim world chat module. Listens for ChatFromSimulator packets and shows the chat on the UI. * Outgoing chat sent using ChatFromViewer packets. Manages EC_ChatBubbles. * @note Depends on RexLogicModule so don't create dependency to this module. */ #include "StableHeaders.h" #include "InWorldChatModule.h" #include "EC_ChatBubble.h" #include "EC_Billboard.h" #include "WorldStream.h" #include "SceneManager.h" #include "EventManager.h" #include "ModuleManager.h" #include "RealXtend/RexProtocolMsgIDs.h" #include "NetworkMessages/NetInMessage.h" #include "CoreStringUtils.h" #include "GenericMessageUtils.h" #include "UiModule.h" #include "ConfigurationManager.h" #include "EntityComponent/EC_OpenSimPresence.h" #include "EntityComponent/EC_OpenSimPrim.h" #include <QColor> namespace Naali { InWorldChatModule::InWorldChatModule() : ModuleInterfaceImpl(NameStatic()), networkStateEventCategory_(0), networkInEventCategory_(0), frameworkEventCategory_(0), showChatBubbles_(true) { } InWorldChatModule::~InWorldChatModule() { } void InWorldChatModule::Load() { DECLARE_MODULE_EC(EC_Billboard); DECLARE_MODULE_EC(EC_ChatBubble); } void InWorldChatModule::PostInitialize() { frameworkEventCategory_ = framework_->GetEventManager()->QueryEventCategory("Framework"); if (frameworkEventCategory_ == 0) LogError("Failed to query \"Framework\" event category"); uiModule_ = framework_->GetModuleManager()->GetModule<UiServices::UiModule>(Foundation::Module::MT_UiServices); RegisterConsoleCommand(Console::CreateCommand("bbtest", "Adds a billboard to each entity in the scene.", Console::Bind(this, &InWorldChatModule::TestAddBillboard))); RegisterConsoleCommand(Console::CreateCommand("chat", "Sends a chat message. Usage: \"chat(message)\"", Console::Bind(this, &InWorldChatModule::ConsoleChat))); showChatBubbles_ = framework_->GetDefaultConfig().DeclareSetting("InWorldChatModule", "ShowChatBubbles", true); } void InWorldChatModule::Update(f64 frametime) { } bool InWorldChatModule::HandleEvent( event_category_id_t category_id, event_id_t event_id, Foundation::EventDataInterface *data) { if (category_id == frameworkEventCategory_) { if (event_id == Foundation::NETWORKING_REGISTERED) { ProtocolUtilities::NetworkingRegisteredEvent *event_data = dynamic_cast<ProtocolUtilities::NetworkingRegisteredEvent *>(data); if (event_data) SubscribeToNetworkEvents(event_data->currentProtocolModule); return false; } if(event_id == Foundation::WORLD_STREAM_READY) { ProtocolUtilities::WorldStreamReadyEvent *event_data = dynamic_cast<ProtocolUtilities::WorldStreamReadyEvent *>(data); if (event_data) currentWorldStream_ = event_data->WorldStream; //if (chatWindow_) // chatWindow_->SetWorldStreamPtr(current_world_stream_); networkInEventCategory_ = framework_->GetEventManager()->QueryEventCategory("NetworkIn"); if (networkInEventCategory_ == 0) LogError("Failed to query \"NetworkIn\" event category"); return false; } } if (category_id == networkStateEventCategory_) { // Connected to server. Create chat UI. if (event_id == ProtocolUtilities::Events::EVENT_SERVER_CONNECTED) { if (!uiModule_.expired()) { //uiModule_.lock()-> } } // Disconnected from server. Delete chat UI. if (event_id == ProtocolUtilities::Events::EVENT_SERVER_DISCONNECTED) { if (!uiModule_.expired()) { //uiModule_.lock()-> } } } if (category_id == networkInEventCategory_) { if (event_id != RexNetMsgGenericMessage && event_id != RexNetMsgChatFromSimulator && event_id != RexNetMsgObjectUpdate) return false; using namespace ProtocolUtilities; NetworkEventInboundData *netdata = checked_static_cast<NetworkEventInboundData *>(data); assert(netdata); if (!netdata) return false; ProtocolUtilities::NetInMessage &msg = *netdata->message; switch(event_id) { case RexNetMsgGenericMessage: { std::string method = ParseGenericMessageMethod(msg); StringVector params = ParseGenericMessageParameters(msg); if (method == "RexEmotionIcon") HandleRexEmotionIconMessage(params); return false; } case RexNetMsgChatFromSimulator: { HandleChatFromSimulatorMessage(msg); return false; } default: return false; } } return false; } void InWorldChatModule::SubscribeToNetworkEvents(ProtocolUtilities::ProtocolWeakPtr currentProtocolModule) { networkStateEventCategory_ = framework_->GetEventManager()->QueryEventCategory("NetworkState"); if (networkStateEventCategory_ == 0) LogError("Failed to query \"NetworkState\" event category"); networkInEventCategory_ = framework_->GetEventManager()->QueryEventCategory("NetworkIn"); if (networkInEventCategory_ == 0) LogError("Failed to query \"NetworkIn\" event category"); } const std::string InWorldChatModule::moduleName = std::string("InWorldChatModule"); const std::string &InWorldChatModule::NameStatic() { return moduleName; } void InWorldChatModule::SendChatFromViewer(const QString &msg) { if (currentWorldStream_) currentWorldStream_->SendChatFromViewerPacket(msg.toStdString()); } Console::CommandResult InWorldChatModule::TestAddBillboard(const StringVector &params) { Scene::ScenePtr scene = GetFramework()->GetDefaultWorldScene(); /// If/when there are multiple scenes at some day, have the SceneManager know the currently active one /// instead of RexLogicModule, so no dependency to it is needed. for(Scene::SceneManager::iterator iter = scene->begin(); iter != scene->end(); ++iter) { Scene::EntityPtr entity = *iter; entity->AddComponent(framework_->GetComponentManager()->CreateComponent("EC_Billboard")); EC_Billboard *billboard = entity->GetComponent<EC_Billboard>().get(); assert(billboard); billboard->Show(Vector3df(0.f, 0.f, 1.5f), 10.f, "bubble.png"); } return Console::ResultSuccess(); } Console::CommandResult InWorldChatModule::ConsoleChat(const StringVector &params) { if (params.size() == 0) return Console::ResultFailure("Can't send empty chat message!"); SendChatFromViewer(params[0].c_str()); return Console::ResultSuccess(); } void InWorldChatModule::ApplyDefaultChatBubble(Scene::Entity &entity, const QString &message) { Foundation::ComponentInterfacePtr component = entity.GetOrCreateComponent(EC_ChatBubble::NameStatic()); assert(component.get()); EC_ChatBubble &chatBubble = *(checked_static_cast<EC_ChatBubble *>(component.get())); chatBubble.ShowMessage(message); } void InWorldChatModule::ApplyBillboard(Scene::Entity &entity, const std::string &texture, float timeToShow) { boost::shared_ptr<EC_Billboard> ec_bb = entity.GetComponent<EC_Billboard>(); // If we didn't have the billboard component yet, create one now. if (!ec_bb) { entity.AddComponent(framework_->GetComponentManager()->CreateComponent("EC_Billboard")); ec_bb = entity.GetComponent<EC_Billboard>(); assert(ec_bb.get()); } ec_bb->Show(Vector3df(0.f, 0.f, 1.5f), timeToShow, texture.c_str()); } Scene::Entity *InWorldChatModule::GetEntityWithId(const RexUUID &id) { Scene::ScenePtr scene = GetFramework()->GetDefaultWorldScene(); for(Scene::SceneManager::iterator iter = scene->begin(); iter != scene->end(); ++iter) { Scene::Entity &entity = **iter; boost::shared_ptr<RexLogic::EC_OpenSimPresence> ec_presence = entity.GetComponent<RexLogic::EC_OpenSimPresence>(); boost::shared_ptr<RexLogic::EC_OpenSimPrim> ec_prim = entity.GetComponent<RexLogic::EC_OpenSimPrim>(); if (ec_presence) { if (ec_presence->FullId == id) return &entity; } else if (ec_prim) { if (ec_prim->FullId == id) return &entity; } } return 0; } void InWorldChatModule::HandleRexEmotionIconMessage(StringVector &params) { // Param 0: avatar UUID // Param 1: texture ID // Param 2: timeout (remember to replace any , with . before parsing) if (params.size() < 3) throw Exception("Failed to parse RexEmotionIcon message!"); LogInfo("Received RexEmotionIcon: " + params[0] + " " + params[1] + " " + params[2]); ReplaceCharInplace(params[2], ',', '.'); if (!RexUUID::IsValid(params[0])) throw Exception("Invalid Entity UUID passed in RexEmotionIcon message!"); RexUUID entityUUID(params[0]); if (entityUUID.IsNull()) throw Exception("Null Entity UUID passed in RexEmotionIcon message!"); Scene::Entity *entity = GetEntityWithId(entityUUID); if (!entity) throw Exception("Received RexEmotionIcon message for a nonexisting entity!"); // timeToShow: value of [-1, 0[ denotes "infinite". // a positive value between [0, 86400] denotes the number of seconds to show. (max roughly one day) float timeToShow = atof(params[2].c_str()); if (!(timeToShow >= -2.f && timeToShow <= 86401.f)) // Checking through negation due to possible NaNs and infs. (being lax and also allowing off-by-one) throw Exception("Invalid time-to-show passed in RexEmotionIcon message!"); if (RexUUID::IsValid(params[1])) { RexUUID textureID(params[1]); // We've been passed a texture UUID to show on the billboard. ///\todo request the asset and show that on the billboard. } else // We've been passed a string URL or a filename on the local computer. { ///\todo Request a download from that URL and show the resulting image on the billboard. // Now assuming that the textureID points to a local file, just to get a proof-of-concept something showing in the UI. ApplyBillboard(*entity, params[1], timeToShow); } } void InWorldChatModule::HandleChatFromSimulatorMessage(ProtocolUtilities::NetInMessage &msg) { msg.ResetReading(); std::string fromName = msg.ReadString(); RexUUID sourceId = msg.ReadUUID(); msg.SkipToFirstVariableByName("Message"); std::string message = msg.ReadString(); if (message.size() < 1) return; /* std::stringstream ss; ss << "[" << GetLocalTimeString() << "] " << fromName << ": " << message; LogDebug(ss.str()); */ if (showChatBubbles_) { Scene::Entity *entity = GetEntityWithId(sourceId); if (entity) ApplyDefaultChatBubble(*entity, QString::fromUtf8(message.c_str())); } // Connect chat ui to this modules ChatReceived // emit ChatReceived() //if (chatWindow_) // chatWindow_->CharReceived(name, msg); } extern "C" void POCO_LIBRARY_API SetProfiler(Foundation::Profiler *profiler); void SetProfiler(Foundation::Profiler *profiler) { Foundation::ProfilerSection::SetProfiler(profiler); } } using namespace Naali; POCO_BEGIN_MANIFEST(Foundation::ModuleInterface) POCO_EXPORT_CLASS(InWorldChatModule) POCO_END_MANIFEST
[ "Stinkfist0@5b2332b8-efa3-11de-8684-7d64432d61a3", "jujjyl@5b2332b8-efa3-11de-8684-7d64432d61a3", "loorni@5b2332b8-efa3-11de-8684-7d64432d61a3" ]
[ [ [ 1, 12 ], [ 17, 17 ], [ 25, 26 ], [ 29, 49 ], [ 51, 60 ], [ 62, 62 ], [ 65, 143 ], [ 145, 147 ], [ 149, 150 ], [ 153, 189 ], [ 193, 194 ], [ 207, 351 ] ], [ [ 13, 16 ], [ 18, 22 ], [ 24, 24 ], [ 27, 28 ], [ 50, 50 ], [ 61, 61 ], [ 63, 64 ], [ 190, 192 ], [ 195, 206 ] ], [ [ 23, 23 ], [ 144, 144 ], [ 148, 148 ], [ 151, 152 ] ] ]
417681798fd913321fa788aaeb13a67497f5a1bd
3971d26cbdfd1ca41e84754bdf21ff6fbc53182e
/trunk/include/Engine.h
cdf484bd2730a0d941192c60710e86079f8dc440
[]
no_license
ppershing/mosaic-from-images
bd998004de1555f76777047000ac0642ace0c860
54a2f6c9cd3c37f118a133d4fce1eaf5678581d2
refs/heads/master
2020-04-25T00:26:40.707089
2011-01-06T17:59:11
2011-01-06T17:59:11
32,278,829
0
0
null
null
null
null
UTF-8
C++
false
false
648
h
// created and maintained by ppershing // please report any bug or suggestion to ppershing<>fks<>sk #ifndef H_ENGINE #define H_ENGINE #include "Project.h" #include "Preferences.h" #include "Cache.h" #include "Timer.h" class Engine{ public: void initialize(); void finalize(); void runMainLoop(); private: void handleEvents(); int doWork(); void saveWork(); Project* project; Preferences preferences; Cache cache; int run; int tick; Timer timer; double lastSaveTime; double saveTime; }; #endif
[ "ppershing@967e5cf6-af39-6869-9469-1a2409c1b03c" ]
[ [ [ 1, 31 ] ] ]
be1555d3dc69f2eba896a4411b37a6c8e4c49d52
eda410906c2ec64689d8c0b84f3c2862f469144b
/DropSendCore/data/dao/remoteserver/remoteserveraccountdao.h
eb24220b15ea28bed43d7d3c9779891c19e4d474
[]
no_license
redbox/Dropsend
640ea157a2caec88aa145f5bdc7fa85db95203a5
8fe4b4478616b9850b55011a506653026a28f7da
refs/heads/master
2020-06-02T20:54:18.301786
2010-09-06T16:16:05
2010-09-06T16:16:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,139
h
#ifndef REMOTESERVERACCOUNTDAO_H #define REMOTESERVERACCOUNTDAO_H #include <QList> #include "./../iaccountdao.h" #include "./../../entities/account.h" namespace dropsend { namespace data { namespace dao { namespace remoteserver { /** * @class RemoteServerAccountDAO * @brief DAO which is used to obtain information from remote service. * Contains API requests. Implements IAccountDAO. * @see dropsend::data::dao::IAccountDAO **/ class RemoteServerAccountDAO : public IAccountDAO { public: /** * @brief Initializes a new instance of the dropsend::data::dao::remoteserver::RemoteServerAccountDAO class. **/ RemoteServerAccountDAO(); //Implements dropsend::data::dao::IEntityDAO<Account>. Account* getById(int id) const; }; } } } } #endif // REMOTESERVERACCOUNTDAO_H
[ [ [ 1, 35 ] ] ]
36519fb024481e6433f58541eddeda81bbecf1f9
21dd1ece27a68047f93bac2bdf9e6603827b1990
/CppUTest/examples/ApplicationLib/HelloTest.cpp
2e23bb1741939c70a48a4e38c8e6623d93e46f8b
[]
no_license
LupusDei/8LU-DSP
c626ce817b6b178c226c437537426f25597958a5
65860326bb89a36ff71871b046642b7dd45d5607
refs/heads/master
2021-01-17T21:51:19.971505
2010-09-24T15:08:01
2010-09-24T15:08:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
659
cpp
extern "C" { #include "hello.h" } #include <stdio.h> #include <stdarg.h> #include "CppUTest/TestHarness.h" static SimpleString* buffer; TEST_GROUP(HelloWorld) { static int output_method(const char* output, ...) { va_list arguments; va_start(arguments, output); *buffer = VStringFromFormat(output, arguments); va_end(arguments); return 1; } void setup() { buffer = new SimpleString(); UT_PTR_SET(PrintFormated, &output_method); } void teardown() { delete buffer; } }; TEST(HelloWorld, PrintOk) { printHelloWorld(); STRCMP_EQUAL("Hello World!\n", buffer->asCharString()); }
[ [ [ 1, 38 ] ] ]
57b118b85ed3d67581a02ff56a36d0b17e17e616
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/os/shortlinksrv/Bluetooth/T_BTSockAddrAPI/inc/T_TBTSockAddrChild.h
698e3d67a8bce0c578dd2298a4a6788d60bb524a
[]
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
968
h
/* * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ #if (!defined __T_BTSOCKADDR_CHILD_H__) #define __T_BTSOCKADDR_CHILD_H__ #include <es_sock.h> // TSockAddr address #include <bt_sock.h> // Bluetooth address classes class T_TBTSockAddrChild : public TBTSockAddr { public: T_TBTSockAddrChild(); T_TBTSockAddrChild(const TSockAddr &aSockAddr); static T_TBTSockAddrChild& Cast(const TSockAddr &aAddr); void T_SetUserLen(TInt aLen); TUint8* T_UserPtr(); TAny * T_EndBTSockAddrPtr(); }; #endif /* __T_BTSOCKADDR_CHILD_H__ */
[ "none@none" ]
[ [ [ 1, 39 ] ] ]
8d0b6cb71cbc858a78663c5e5ea4e6843e524f47
61bcb936a14064e2a819269d25b5c09b92dad45f
/Reference/EDK_project/code/GUI/HeliosLibrary/ImageUtilities.cpp
89b7aca3e6eea52606bdebe8ee763d6e0495ad54
[]
no_license
lanxinwoaini/robotic-vision-631
47fe73588a5b51296b9ac7fbacd4a553e4fd8e34
fdb160a8498ec668a32116c655368d068110aba7
refs/heads/master
2021-01-10T08:06:58.829618
2011-04-20T15:19:06
2011-04-20T15:19:06
47,861,917
1
0
null
null
null
null
UTF-8
C++
false
false
10,914
cpp
#include "StdAfx.h" #include "ImageUtilities.h" bool ImageUtilities::BufferToImage(HeliosPacketHeader* header, void* buffer, IplImage* image, int image_type) { unsigned int val, left, right, W,R,G,B,num; int k = 0; int end = image->width * image->height; unsigned int* dest = (unsigned int*) image->imageData; bool return_value = true; unsigned char* buf = (unsigned char*) buffer; unsigned int frame_count = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; unsigned int camera_id = (buf[4] << 8) | buf[5]; image->alphaChannel = frame_count; image->align = camera_id; buf+=6; switch(image_type){ /*case PKT_IMG_NULL:// cvSet(image, cvScalar(128)); // Set Image to all Blue // return_value = false; // break; case PKT_IMG_GRAYSCALE8: for(int i = 0 ; i < end ;i++) { val = buf[k++]; dest[i] = val << 16 | val << 8 | val; } break; */ /*case PKT_IMG_GRAYSCALE16: cvSet(image, cvScalar(128)); // Set Image to all Blue break;*/ case PKT_IMG_NULL: case PKT_IMG_RGB565: /*RGB565*/ for(int i = 0 ; i < end ;i++) { left = buf[k++]; right = buf[k++]; R = left & 0x000000F8; G = (left & 0x07) << 5 | (right & 0x00E0) >> 3; B = (right << 3) & 0x000000FF; dest[i] = R << 16 | G << 8 | B; } break; case PKT_IMG_BINARY: /*Binary 0,1*/ for(int i = 0 ; i < end ;i++) { if(buf[k++] > 0) dest[i] = 0x00FFFFFF; else dest[i] = 0x00000000; } break; case PKT_IMG_COLOR_SEGMENTED: /*8-bit Segmented image (each bit represents a color threshold match)*/ for(int i = 0 ; i < end ;i++) { switch(buf[k++]){ default: case 0x00: dest[i] = 0x00808080; break; // No match grey case 0x01: dest[i] = 0x00000000; break; // Black case 0x02: dest[i] = 0x00FF0000; break; // Red case 0x04: dest[i] = 0x00FFFF00; break; // Yellow case 0x08: dest[i] = 0x0000FF00; break; // Green case 0x10: dest[i] = 0x0000FFFF; break; // Cyan case 0x20: dest[i] = 0x000000FF; break; // Blue case 0x40: dest[i] = 0x00FF00FF; break; // Purple case 0x80: dest[i] = 0x00FFFFFF; break; // White } } break; case PKT_IMG_FEATURE8: /* Feature Image 8-bit greyscale*/ for(int i = 0 ; i < end ; i++) { val = buf[k++]; dest[i] = val << 16 | val << 8 | val; } break; case PKT_IMG_FEATURE16: /* Feature image 16-bit greyscale*/ for(int i = 0 ; i < end ; i++) { val = buf[k] << 8 | buf[k+1]; k+=2; W = (val >> 8) & 0x00F0; R = (val >> 4) & 0x00F0; G = (val ) & 0x00F0; B = (val << 4) & 0x00F0; if(W != 0) dest[i] = W << 16 | W << 8 | W; else if(R != 0) dest[i] = R << 16; else if(G != 0) dest[i] = G << 8; else dest[i] = B; } break; case PKT_IMG_HSV1688: cvSet(image, cvScalar(128)); // Set Image to all Blue break; case PKT_IMG_YUV: cvSet(image, cvScalar(128)); // Set Image to all Blue break; case PKT_IMG_FEATURE8_LIST: cvSet(image, cvScalar(128)); // Set Image to all Blue break; case PKT_IMG_FEATURE16_LIST: cvSet(image, cvScalar(0)); // Clear image. set to black num = (header->buffer_size-6) / 8; // number of features in list for(uint32 i = 0 ; i < num ; i++) { uint32 y = buf[k+0] << 8 | buf[k+1]; uint32 x = buf[k+2] << 8 | buf[k+3]; uint32 v = buf[k+4] << 8 | buf[k+5]; k+=8; W = (v >> 8) & 0x00F0; R = (v >> 4) & 0x00F0; G = (v ) & 0x00F0; B = (v << 4) & 0x00F0; if (W != 0) dest[y*640+x] = W << 16 | W << 8 | W; else if(R != 0) dest[y*640+x] = R << 16; else if(G != 0) dest[y*640+x] = G << 8; else dest[y*640+x] = B; } break; case PKT_IMG_RANK_6_BIT: /* 6-Bit grayscale image */ for(int i = 0 ; i < end ; i++) { val = buf[k++] << 2; dest[i] = val << 16 | val << 8 | val; } break; case PKT_IMG_RANK_8_BIT: /* 8-Bit grayscale image */ for(int i = 0 ; i < end ; i++) { val = buf[k++]; dest[i] = val << 16 | val << 8 | val; } break; case PKT_IMG_CCSTREAK_LIST: cvSet(image, cvScalar(128,128,128,0)); // Set Image to all gray num = (header->buffer_size-6) / 8; // number of streaks in list for(uint32 i = 0 ; i < num ; i++) { uint32 y = buf[k+0] << 8 | buf[k+1]; uint32 xstart = buf[k+2] << 8 | buf[k+3]; uint32 xend = buf[k+4] << 8 | buf[k+5]; k+=8; for( ; xstart <= xend ; xstart++) dest[y*640+xstart] = 0x00ffffff; // just set to white } break; case PKT_IMG_CCSTREAK0_LIST: cvSet(image, cvScalar(128,128,128,0)); // Set Image to all Gray num = (header->buffer_size-6) / 8; // number of streaks in list for(uint32 i = 0 ; i < num ; i++) { uint32 y = buf[k+0] << 8 | buf[k+1]; uint32 xstart = buf[k+2] << 8 | buf[k+3]; uint32 xend = buf[k+4] << 8 | buf[k+5]; k+=8; for( ; xstart <= xend ; xstart++) dest[y*640+xstart] = 0x00000000; // just set to Black } break; case PKT_IMG_CCSTREAK1_LIST: cvSet(image, cvScalar(128,128,128,0)); // Set Image to all Gray num = (header->buffer_size-6) / 8; // number of streaks in list for(uint32 i = 0 ; i < num ; i++) { uint32 y = buf[k+0] << 8 | buf[k+1]; uint32 xstart = buf[k+2] << 8 | buf[k+3]; uint32 xend = buf[k+4] << 8 | buf[k+5]; k+=8; for( ; xstart <= xend ; xstart++) dest[y*640+xstart] = 0x00FF0000; // just set to Red } break; case PKT_IMG_CCSTREAK2_LIST: cvSet(image, cvScalar(128,128,128,0)); // Set Image to all Gray num = (header->buffer_size-6) / 8; // number of streaks in list for(uint32 i = 0 ; i < num ; i++) { uint32 y = buf[k+0] << 8 | buf[k+1]; uint32 xstart = buf[k+2] << 8 | buf[k+3]; uint32 xend = buf[k+4] << 8 | buf[k+5]; k+=8; for( ; xstart <= xend ; xstart++) dest[y*640+xstart] = 0x00FFFF00; // just set to Yellow } break; case PKT_IMG_CCSTREAK3_LIST: cvSet(image, cvScalar(128,128,128,0)); // Set Image to all Gray num = (header->buffer_size-6) / 8; // number of streaks in list for(uint32 i = 0 ; i < num ; i++) { uint32 y = buf[k+0] << 8 | buf[k+1]; uint32 xstart = buf[k+2] << 8 | buf[k+3]; uint32 xend = buf[k+4] << 8 | buf[k+5]; k+=8; for( ; xstart <= xend ; xstart++) dest[y*640+xstart] = 0x0000FF00; // just set to Green } break; case PKT_IMG_CCSTREAK4_LIST: cvSet(image, cvScalar(128,128,128,0)); // Set Image to all Gray num = (header->buffer_size-6) / 8; // number of streaks in list for(uint32 i = 0 ; i < num ; i++) { uint32 y = buf[k+0] << 8 | buf[k+1]; uint32 xstart = buf[k+2] << 8 | buf[k+3]; uint32 xend = buf[k+4] << 8 | buf[k+5]; k+=8; for( ; xstart <= xend ; xstart++) dest[y*640+xstart] = 0x0000FFFF; // just set to Cyan } break; case PKT_IMG_CCSTREAK5_LIST: cvSet(image, cvScalar(128,128,128,0)); // Set Image to all Gray num = (header->buffer_size-6) / 8; // number of streaks in list for(uint32 i = 0 ; i < num ; i++) { uint32 y = buf[k+0] << 8 | buf[k+1]; uint32 xstart = buf[k+2] << 8 | buf[k+3]; uint32 xend = buf[k+4] << 8 | buf[k+5]; k+=8; for( ; xstart <= xend ; xstart++) dest[y*640+xstart] = 0x000000FF; // just set to Blue } break; case PKT_IMG_CCSTREAK6_LIST: cvSet(image, cvScalar(128,128,128,0)); // Set Image to all Gray num = (header->buffer_size-6) / 8; // number of streaks in list for(uint32 i = 0 ; i < num ; i++) { uint32 y = buf[k+0] << 8 | buf[k+1]; uint32 xstart = buf[k+2] << 8 | buf[k+3]; uint32 xend = buf[k+4] << 8 | buf[k+5]; k+=8; for( ; xstart <= xend ; xstart++) dest[y*640+xstart] = 0x00FF00FF; // just set to Purple } break; case PKT_IMG_CCSTREAK7_LIST: cvSet(image, cvScalar(128,128,128,0)); // Set Image to all Gray num = (header->buffer_size-6) / 8; // number of streaks in list for(uint32 i = 0 ; i < num ; i++) { uint32 y = buf[k+0] << 8 | buf[k+1]; uint32 xstart = buf[k+2] << 8 | buf[k+3]; uint32 xend = buf[k+4] << 8 | buf[k+5]; k+=8; for( ; xstart <= xend ; xstart++) dest[y*640+xstart] = 0x00ffffff; // just set to white } break; default: cvSet(image, cvScalar(0)); // Set Image to all Black return_value = false; break; } return return_value; } bool ImageUtilities::DrawCorrelations(IplImage* image, CvMat* mat) { int side = 2; CvScalar colorred = CV_RGB(255, 0, 0); CvScalar colorgreen = CV_RGB(00, 255, 0); for(int i = 0 ; i < mat->rows ; i++) { int x = (int) cvmGet(mat,i,0); int y = (int) cvmGet(mat,i,1); int tx = (int) cvmGet(mat,i,2); int ty = (int) cvmGet(mat,i,3); //Draw source location cvLine( image, cvPoint( x , y-side ), cvPoint( x , y+side ), colorred); cvLine( image, cvPoint( x-side, y ), cvPoint( x+side, y ), colorred); //Draw destination location cvLine( image, cvPoint( tx , ty-side ), cvPoint( tx , ty+side ), colorgreen); cvLine( image, cvPoint( tx-side, ty ), cvPoint( tx+side, ty ), colorgreen); } return true; }
[ [ [ 1, 325 ] ] ]
bad88daec10af5cfc4402e4a4222a8b0cd9608a4
b08e948c33317a0a67487e497a9afbaf17b0fc4c
/Bastion/Bastion.cpp
ac8117290031bbf3ea64a5d742dc731ec17b0c1e
[]
no_license
15831944/bastionlandscape
e1acc932f6b5a452a3bd94471748b0436a96de5d
c8008384cf4e790400f9979b5818a5a3806bd1af
refs/heads/master
2023-03-16T03:28:55.813938
2010-05-21T15:00:07
2010-05-21T15:00:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,663
cpp
// Bastion.cpp : Defines the entry point for the application. // #include "stdafx.h" #include <vld.h> //#ifdef _DEBUG //#include <crtdbg.h> //#endif #include "../Bastion/Bastion.h" #include "../Application/Application.h" using namespace BastionGame; #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; // current instance TCHAR szTitle[MAX_LOADSTRING]; // The title bar text TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name HACCEL hAccelTable; // Forward declarations of functions included in this code module: ATOM MyRegisterClass(HINSTANCE hInstance); HWND InitInstance(GraphicConfigDataRef _rConfig); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData); HWND MyCreateWindow(GraphicConfigDataRef _rConfig); int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); //#ifdef _DEBUG // _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // //_CrtSetBreakAlloc(227); //#endif GraphicConfigData m_oGraphicConfig; Application* pApp = new Application; // default values m_oGraphicConfig.m_pCreateWindow = MyCreateWindow; m_oGraphicConfig.m_hInstance = hInstance; m_oGraphicConfig.m_hPrevInstance = hPrevInstance; m_oGraphicConfig.m_lpCmdLine = lpCmdLine; m_oGraphicConfig.m_nCmdShow = nCmdShow; m_oGraphicConfig.m_oClientRect.left = 0; m_oGraphicConfig.m_oClientRect.right = 0; m_oGraphicConfig.m_oClientRect.right = 640; m_oGraphicConfig.m_oClientRect.bottom = 480; m_oGraphicConfig.m_uDXColorFormat = D3DFMT_A8R8G8B8; m_oGraphicConfig.m_uDXDepthFormat = D3DFMT_D24S8; m_oGraphicConfig.m_uDXGBufferFormat = D3DFMT_A8R8G8B8; m_oGraphicConfig.m_uDXGBufferCount = 1; m_oGraphicConfig.m_fZNear = 1.0f; m_oGraphicConfig.m_fZFar = 1000.0f; m_oGraphicConfig.m_bFullScreen = false; if (false != pApp->Create(boost::any(&m_oGraphicConfig))) { do { pApp->Update(); } while (Application::EStateMode_QUIT != pApp->GetStateMode()); } CoreObject::ReleaseDeleteReset(pApp); return 0; } HWND MyCreateWindow(GraphicConfigDataRef _rConfig) { // Initialize global strings LoadString(_rConfig.m_hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(_rConfig.m_hInstance, IDC_BASTION, szWindowClass, MAX_LOADSTRING); MyRegisterClass(_rConfig.m_hInstance); // Perform application initialization: InitInstance(_rConfig); if (NULL != _rConfig.m_hWnd) { _rConfig.m_hAccelTable = LoadAccelerators(_rConfig.m_hInstance, MAKEINTRESOURCE(IDC_BASTION)); } return _rConfig.m_hWnd; } // // FUNCTION: MyRegisterClass() // // PURPOSE: Registers the window class. // // COMMENTS: // // This function and its usage are only necessary if you want this code // to be compatible with Win32 systems prior to the 'RegisterClassEx' // function that was added to Windows 95. It is important to call this function // so that the application will get 'well formed' small icons associated // with it. // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_BASTION)); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = MAKEINTRESOURCE(IDC_BASTION); wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); return RegisterClassEx(&wcex); } // // FUNCTION: InitInstance(GraphicConfigData) // // PURPOSE: Saves instance handle and creates main window // // COMMENTS: // // In this function, we save the instance handle in a global variable and // create and display the main program window. // HWND InitInstance(GraphicConfigDataRef _rConfig) { hInst = _rConfig.m_hInstance; // Store instance handle in our global variable WINDOWINFO oDesktopWI; GetWindowInfo( GetDesktopWindow(), &oDesktopWI ); _rConfig.m_oGraphicConfigRect = _rConfig.m_oClientRect; // Resizes window so that client size has the specified video width/height. AdjustWindowRect( &_rConfig.m_oGraphicConfigRect, WS_OVERLAPPEDWINDOW, TRUE ); _rConfig.m_oGraphicConfigRect.right -= _rConfig.m_oGraphicConfigRect.left; _rConfig.m_oGraphicConfigRect.bottom -= _rConfig.m_oGraphicConfigRect.top; // Set window positions in the middle of the first monitor. EnumDisplayMonitors( NULL, NULL, MonitorEnumProc, LPARAM(&_rConfig.m_oGraphicConfigRect) ); _rConfig.m_hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, _rConfig.m_oGraphicConfigRect.left, _rConfig.m_oGraphicConfigRect.top, _rConfig.m_oGraphicConfigRect.right, _rConfig.m_oGraphicConfigRect.bottom, NULL, NULL, _rConfig.m_hInstance, NULL); if (!_rConfig.m_hWnd) { return NULL; } ShowWindow(_rConfig.m_hWnd, _rConfig.m_nCmdShow); UpdateWindow(_rConfig.m_hWnd); return _rConfig.m_hWnd; } // // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; case WM_MOUSEMOVE: { ApplicationPtr pApp = (ApplicationPtr)GetWindowLongPtr(hWnd, GWLP_USERDATA); if (NULL != pApp) { pApp->SetMousePos(float(GET_X_LPARAM(lParam)), float(GET_Y_LPARAM(lParam))); } } break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } // Message handler for about box. INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; } break; } return (INT_PTR)FALSE; } BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { // search for the first monitor if ( ( 0 == lprcMonitor->left ) && ( 0 == lprcMonitor->top ) ) { LPRECT pRect = LPRECT(dwData); pRect->left += ( lprcMonitor->right - pRect->right ) / 2; pRect->top += ( lprcMonitor->bottom - pRect->bottom ) / 2; return FALSE; } return TRUE; }
[ "voodoohaust@97c0069c-804f-11de-81da-11cc53ed4329" ]
[ [ [ 1, 274 ] ] ]
5129af450c68857011b6feb4f9560b530c071010
eafa9c8d8ab765faea768c1a89bdeb586d629591
/Multiplayer Bomberman/BaseEntity.cpp
27a60bf35bef54c3ad4e85426b30ad4e235300ce
[]
no_license
Norcinu/Demo
1f5ec338ae9de269eb9dbfda7c787271eddfea9c
bf8f61d194b7f1435356a67671772692144ef27c
refs/heads/master
2020-06-04T00:21:00.729640
2011-07-13T20:11:38
2011-07-13T20:11:38
2,043,916
0
0
null
null
null
null
UTF-8
C++
false
false
2,099
cpp
#include "BaseEntity.h" #include "EntityImpl.h" #include "Visualisation.h" #include "Level.h" #include "AIState.h" BaseEntity::BaseEntity() : impl(new EntityImpl_t) { } BaseEntity::BaseEntity(const EntityImpl_t& ei) : impl(new EntityImpl_t(ei)) { } BaseEntity::BaseEntity(Level * l) : impl(new EntityImpl_t(l)) { } BaseEntity::~BaseEntity(void) { } void BaseEntity::DropBomb() { } void BaseEntity::Move(const math::Vector2& dir) { if (dir.x == 4) impl->direction = RIGHT; else if (dir.x == -4) impl->direction = LEFT; else if (dir.y == 4) impl->direction = BACKWARD; else impl->direction = FORWARD; // do world collision here. math :: Vector2 checker; checker.x = impl->position.x + dir.x; checker.y = impl->position.y + dir.y; if (impl->level_copy->CheckTile(checker, impl->collision_box)) { impl->previous_position = impl->position; impl->position += dir; } } bool BaseEntity::GetActive() const { return impl->active; } void BaseEntity::SetActive(const bool ac) { impl->active = ac; } math::Vector2& BaseEntity::GetPosition() const { return impl->position; } int BaseEntity::GetID() const { return impl->id; } int BaseEntity::GetGraphicID() const { return impl->id; } void BaseEntity::SetGraphicID(const int gid) { impl->graphic_id = gid; } void BaseEntity::SetID(const int id) { impl->id = id; } rec::Rectangle& BaseEntity::GetCollisionBox() const { return impl->collision_box; } void BaseEntity::SetCollisionBox(const rec::Rectangle& other) { impl->collision_box = other; } void BaseEntity::SetPosition(const math::Vector2& position) { impl->position = position; } void BaseEntity::SetSide(const EntitySide side) { impl->side = side; } EntitySide BaseEntity::GetSide() const { return impl->side; } math::Vector2& BaseEntity::GetDestination() const { return impl->destination; } void BaseEntity::SetMoving(const bool moving) { impl->moving = moving; } bool BaseEntity::GetMoving() const { return impl->moving; }
[ [ [ 1, 123 ] ] ]
e1e7ec95cbd7959139023455d80a2c0864a50334
27651c3f5f829bff0720d7f835cfaadf366ee8fa
/QBluetooth/BTTypes/QBtDevice.h
b98fed003a18ed89f228eae9fa5600666c6cbb98
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
cpscotti/Push-Snowboarding
8883907e7ee2ddb9a013faf97f2d9673b9d0fad5
cc3cc940292d6d728865fe38018d34b596943153
refs/heads/master
2021-05-27T16:35:49.846278
2011-07-08T10:25:17
2011-07-08T10:25:17
1,395,155
1
1
null
null
null
null
UTF-8
C++
false
false
3,277
h
/* * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef QBTDEVICE_H #define QBTDEVICE_H #include <QList> #include <QString> #include <QBtGlobal.h> #include <QBtService.h> #include <QBtAddress.h> /** * The class that contains all the information needed about any bluetooth device. * Its main feilds are 4. * * a) QBtAddress address: It is the device's bluetooth address. * Any communication between remote devices is made using this feild * so it is an essential information. No communication can be done * without this. * * b) QString name: The name of the device. By default this feild is equal to QBtAddress.toString(). * The actual name is retrieved from the device discovery * and is set by the remote device as an identification string ID. * * c) DeviceMajor type: an enumeration feild characterizing the device type. * * d) QBtService::List supportedServices: this field is updated after calling * QBtServiceDiscoverer::startDiscovery(QBtDevice*) * (if any services are found through SDP) */ class DLL_EXPORT QBtDevice { public: typedef QList<QBtDevice> List; enum DeviceMajor { Uncategorized, //Uncategorized device Computer, //Computer device Phone, //Phone device LANAccess, //Some form of a local area network router AudioVideo, //Audio / Video device Peripheral, //Mouse, Joystick, Keyboard Imaging, //Camera or Scanner device Wearable, //Wearable Device Toy, //Toy device Miscellaneous //Miscellaneous device }; public: QBtDevice(); QBtDevice(const QBtDevice& dev); QBtDevice (const QString & devName, const QBtAddress & devAddress, DeviceMajor devType); ~QBtDevice(); void addNewService (const QBtService& newService); void setName (const QString & newName); void setAddress (const QBtAddress& newAddress); void setType(DeviceMajor newType); void setSupportedServices (const QBtService::List& newSupportedServices); bool serviceListUpdated() const; QString getName() const; QBtAddress getAddress() const; DeviceMajor getType() const; QString getTypeAsString() const; QBtService::List getSupportedServices() const; // really needed? does not require special processing to copy the members //QBtDevice& operator= (const QBtDevice& dev); private: QString _name; QBtAddress _address; DeviceMajor _type; QBtService::List _supportedServices; bool _serviceListUpdated; }; #endif // QBTDEVICE_H
[ "cpscotti@c819a03f-852d-4de4-a68c-c3ac47756727" ]
[ [ [ 1, 97 ] ] ]
9c90ebd82b908577af3a4d89118f0c3c08a2ebb6
4e708256396ac2e5374286018174f01497c9a7e9
/phonetheater/QAreaList.cpp
f975f5e27c1060b82b23c0803ac1cb0819692c43
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
momofarm/MobileTheater
8bcea21e178077cebe2683422e9869cca14df374
921f60b6ea520fa23d46c3f9d6b16f7955f12514
refs/heads/master
2021-01-10T20:44:23.134327
2010-09-29T07:27:36
2010-09-29T07:27:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,415
cpp
#include "QAreaList.h" #include "QTextCodec" #include "Constants.h" #include <parser.h> #include <QVariant> QAreaList::QAreaList(QObject *pParent, QString strParm): QUrlFactory(pParent, strParm) { setParent(pParent); strAreaName = strParm; } QString QAreaList::GetParm() { QString strPath(PATH_AREA_LIST); QString strPathAndParm = strPath; QByteArray ar = strPathAndParm.toAscii(); QTextCodec *codec = QTextCodec::codecForName("BIG5"); QString encoded = codec->toUnicode(ar); return encoded; } void QAreaList::DealResult(QByteArray &result) { //handle this part is important QTextCodec *codec = QTextCodec::codecForName("UTF-8"); QString encoded = codec->toUnicode(result); encoded.replace(QString("&quot"), QString("\"")); encoded.replace(QString(";"), QString("")); QByteArray json; json.append(encoded.toUtf8()); QJson::Parser parser; bool ok; QVariant result2 = parser.parse(json, &ok); QVariantList list = result2.toList(); if (list.size() > 0) { for (int i = 0; i < list.size(); i++) { QString str = list.at(i).toString(); arList.push_back(str); } } else { return; } } QStringList QAreaList::GetAreaList() { return arList; }
[ [ [ 1, 83 ] ] ]
76d6e6eaa44fcabfe8c71c19db57500511ab0461
c5534a6df16a89e0ae8f53bcd49a6417e8d44409
/trunk/Dependencies/Xerces/include/xercesc/util/regx/BlockRangeFactory.cpp
918e2d693ecf71fc06244aa689debd66f983991b
[]
no_license
svn2github/ngene
b2cddacf7ec035aa681d5b8989feab3383dac012
61850134a354816161859fe86c2907c8e73dc113
refs/heads/master
2023-09-03T12:34:18.944872
2011-07-27T19:26:04
2011-07-27T19:26:04
78,163,390
2
0
null
null
null
null
UTF-8
C++
false
false
24,999
cpp
/* * Copyright 2001-2002,2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: BlockRangeFactory.cpp 191054 2005-06-17 02:56:35Z jberry $ */ // --------------------------------------------------------------------------- // Includes // --------------------------------------------------------------------------- #include <xercesc/util/regx/BlockRangeFactory.hpp> #include <xercesc/util/regx/RangeToken.hpp> #include <xercesc/util/regx/RegxDefs.hpp> #include <xercesc/util/regx/TokenFactory.hpp> #include <xercesc/util/regx/RangeTokenMap.hpp> #include <xercesc/util/XMLString.hpp> XERCES_CPP_NAMESPACE_BEGIN // --------------------------------------------------------------------------- // Local static data // --------------------------------------------------------------------------- const int BLOCKNAMESIZE = 93; // Block Names IsX // only define Specials as FEFF..FEFF, missing Specials as FFF0..FFFD, add manually // only define private use as E000..F8FF, // missing 2 private use (F0000..FFFFD and 100000..10FFFD), add manually const XMLCh fgBlockNames[][BLOCKNAMESIZE] = { { chLatin_I, chLatin_s, chLatin_B, chLatin_a, chLatin_s, chLatin_i, chLatin_c, chLatin_L, chLatin_a, chLatin_t, chLatin_i, chLatin_n, chNull }, { chLatin_I, chLatin_s, chLatin_L, chLatin_a, chLatin_t, chLatin_i, chLatin_n, chDash, chDigit_1, chLatin_S, chLatin_u, chLatin_p, chLatin_p, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull }, { chLatin_I, chLatin_s, chLatin_L, chLatin_a, chLatin_t, chLatin_i, chLatin_n, chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chDash, chLatin_A, chNull }, { chLatin_I, chLatin_s, chLatin_L, chLatin_a, chLatin_t, chLatin_i, chLatin_n, chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chDash, chLatin_B, chNull }, { chLatin_I, chLatin_s, chLatin_I, chLatin_P, chLatin_A, chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_s, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_S, chLatin_p, chLatin_a, chLatin_c, chLatin_i, chLatin_n, chLatin_g, chLatin_M, chLatin_o, chLatin_d, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_r, chLatin_L, chLatin_e, chLatin_t, chLatin_t, chLatin_e, chLatin_r, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_o, chLatin_m, chLatin_b, chLatin_i, chLatin_n, chLatin_i, chLatin_n, chLatin_g, chLatin_D, chLatin_i, chLatin_a, chLatin_c, chLatin_r, chLatin_i, chLatin_t, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_M, chLatin_a, chLatin_r, chLatin_k, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_G, chLatin_r, chLatin_e, chLatin_e, chLatin_k, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_y, chLatin_r, chLatin_i, chLatin_l, chLatin_l, chLatin_i, chLatin_c, chNull }, { chLatin_I, chLatin_s, chLatin_A, chLatin_r, chLatin_m, chLatin_e, chLatin_n, chLatin_i, chLatin_a, chLatin_n, chNull }, { chLatin_I, chLatin_s, chLatin_H, chLatin_e, chLatin_b, chLatin_r, chLatin_e, chLatin_w, chNull }, { chLatin_I, chLatin_s, chLatin_A, chLatin_r, chLatin_a, chLatin_b, chLatin_i, chLatin_c, chNull }, { chLatin_I, chLatin_s, chLatin_S, chLatin_y, chLatin_r, chLatin_i, chLatin_a, chLatin_c, chNull }, { chLatin_I, chLatin_s, chLatin_T, chLatin_h, chLatin_a, chLatin_a, chLatin_n, chLatin_a, chNull }, { chLatin_I, chLatin_s, chLatin_D, chLatin_e, chLatin_v, chLatin_a, chLatin_n, chLatin_a, chLatin_g, chLatin_a, chLatin_r, chLatin_i, chNull }, { chLatin_I, chLatin_s, chLatin_B, chLatin_e, chLatin_n, chLatin_g, chLatin_a, chLatin_l, chLatin_i, chNull }, { chLatin_I, chLatin_s, chLatin_G, chLatin_u, chLatin_r, chLatin_m, chLatin_u, chLatin_k, chLatin_h, chLatin_i, chNull }, { chLatin_I, chLatin_s, chLatin_G, chLatin_u, chLatin_j, chLatin_a, chLatin_r, chLatin_a, chLatin_t, chLatin_i, chNull }, { chLatin_I, chLatin_s, chLatin_O, chLatin_r, chLatin_i, chLatin_y, chLatin_a, chNull }, { chLatin_I, chLatin_s, chLatin_T, chLatin_a, chLatin_m, chLatin_i, chLatin_l, chNull }, { chLatin_I, chLatin_s, chLatin_T, chLatin_e, chLatin_l, chLatin_u, chLatin_g, chLatin_u, chNull }, { chLatin_I, chLatin_s, chLatin_K, chLatin_a, chLatin_n, chLatin_n, chLatin_a, chLatin_d, chLatin_a, chNull }, { chLatin_I, chLatin_s, chLatin_M, chLatin_a, chLatin_l, chLatin_a, chLatin_y, chLatin_a, chLatin_l, chLatin_a, chLatin_m, chNull }, { chLatin_I, chLatin_s, chLatin_S, chLatin_i, chLatin_n, chLatin_h, chLatin_a, chLatin_l, chLatin_a, chNull }, { chLatin_I, chLatin_s, chLatin_T, chLatin_h, chLatin_a, chLatin_i, chNull }, { chLatin_I, chLatin_s, chLatin_L, chLatin_a, chLatin_o, chNull }, { chLatin_I, chLatin_s, chLatin_T, chLatin_i, chLatin_b, chLatin_e, chLatin_t, chLatin_a, chLatin_n, chNull }, { chLatin_I, chLatin_s, chLatin_M, chLatin_y, chLatin_a, chLatin_n, chLatin_m, chLatin_a, chLatin_r, chNull }, { chLatin_I, chLatin_s, chLatin_G, chLatin_e, chLatin_o, chLatin_r, chLatin_g, chLatin_i, chLatin_a, chLatin_n, chNull }, { chLatin_I, chLatin_s, chLatin_H, chLatin_a, chLatin_n, chLatin_g, chLatin_u, chLatin_l, chLatin_J, chLatin_a, chLatin_m, chLatin_o, chNull }, { chLatin_I, chLatin_s, chLatin_E, chLatin_t, chLatin_h, chLatin_i, chLatin_o, chLatin_p, chLatin_i, chLatin_c, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_h, chLatin_e, chLatin_r, chLatin_o, chLatin_k, chLatin_e, chLatin_e, chNull }, { chLatin_I, chLatin_s, chLatin_U, chLatin_n, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, chLatin_C, chLatin_a, chLatin_n, chLatin_a, chLatin_d, chLatin_i, chLatin_a, chLatin_n, chLatin_A, chLatin_b, chLatin_o, chLatin_r, chLatin_i, chLatin_g, chLatin_i, chLatin_n, chLatin_a, chLatin_l, chLatin_S, chLatin_y, chLatin_l, chLatin_l, chLatin_a, chLatin_b, chLatin_i, chLatin_c, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_O, chLatin_g, chLatin_h, chLatin_a, chLatin_m, chNull }, { chLatin_I, chLatin_s, chLatin_R, chLatin_u, chLatin_n, chLatin_i, chLatin_c, chNull }, { chLatin_I, chLatin_s, chLatin_K, chLatin_h, chLatin_m, chLatin_e, chLatin_r, chNull }, { chLatin_I, chLatin_s, chLatin_M, chLatin_o, chLatin_n, chLatin_g, chLatin_o, chLatin_l, chLatin_i, chLatin_a, chLatin_n, chNull }, { chLatin_I, chLatin_s, chLatin_L, chLatin_a, chLatin_t, chLatin_i, chLatin_n, chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chLatin_A, chLatin_d, chLatin_d, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_a, chLatin_l, chNull }, { chLatin_I, chLatin_s, chLatin_G, chLatin_r, chLatin_e, chLatin_e, chLatin_k, chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chNull }, { chLatin_I, chLatin_s, chLatin_G, chLatin_e, chLatin_n, chLatin_e, chLatin_r, chLatin_a, chLatin_l, chLatin_P, chLatin_u, chLatin_n, chLatin_c, chLatin_t, chLatin_u, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull }, { chLatin_I, chLatin_s, chLatin_S, chLatin_u, chLatin_p, chLatin_e, chLatin_r, chLatin_s, chLatin_c, chLatin_r, chLatin_i, chLatin_p, chLatin_t, chLatin_s, chLatin_a, chLatin_n, chLatin_d, chLatin_S, chLatin_u, chLatin_b, chLatin_s, chLatin_c, chLatin_r, chLatin_i, chLatin_p, chLatin_t, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_u, chLatin_r, chLatin_r, chLatin_e, chLatin_n, chLatin_c, chLatin_y, chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_o, chLatin_m, chLatin_b, chLatin_i, chLatin_n, chLatin_i, chLatin_n, chLatin_g, chLatin_M, chLatin_a, chLatin_r, chLatin_k, chLatin_s, chLatin_f, chLatin_o, chLatin_r, chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_L, chLatin_e, chLatin_t, chLatin_t, chLatin_e, chLatin_r, chLatin_l, chLatin_i, chLatin_k, chLatin_e, chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_N, chLatin_u, chLatin_m, chLatin_b, chLatin_e, chLatin_r, chLatin_F, chLatin_o, chLatin_r, chLatin_m, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_A, chLatin_r, chLatin_r, chLatin_o, chLatin_w, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_M, chLatin_a, chLatin_t, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_t, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_O, chLatin_p, chLatin_e, chLatin_r, chLatin_a, chLatin_t, chLatin_o, chLatin_r, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_M, chLatin_i, chLatin_s, chLatin_c, chLatin_e, chLatin_l, chLatin_l, chLatin_a, chLatin_n, chLatin_e, chLatin_o, chLatin_u, chLatin_s, chLatin_T, chLatin_e, chLatin_c, chLatin_h, chLatin_n, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_o, chLatin_n, chLatin_t, chLatin_r, chLatin_o, chLatin_l, chLatin_P, chLatin_i, chLatin_c, chLatin_t, chLatin_u, chLatin_r, chLatin_e, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_O, chLatin_p, chLatin_t, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_C, chLatin_h, chLatin_a, chLatin_r, chLatin_a, chLatin_c, chLatin_t, chLatin_e, chLatin_r, chLatin_R, chLatin_e, chLatin_c, chLatin_o, chLatin_g, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull }, { chLatin_I, chLatin_s, chLatin_E, chLatin_n, chLatin_c, chLatin_l, chLatin_o, chLatin_s, chLatin_e, chLatin_d, chLatin_A, chLatin_l, chLatin_p, chLatin_h, chLatin_a, chLatin_n, chLatin_u, chLatin_m, chLatin_e, chLatin_r, chLatin_i, chLatin_c, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_B, chLatin_o, chLatin_x, chLatin_D, chLatin_r, chLatin_a, chLatin_w, chLatin_i, chLatin_n, chLatin_g, chNull }, { chLatin_I, chLatin_s, chLatin_B, chLatin_l, chLatin_o, chLatin_c, chLatin_k, chLatin_E, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_G, chLatin_e, chLatin_o, chLatin_m, chLatin_e, chLatin_t, chLatin_r, chLatin_i, chLatin_c, chLatin_S, chLatin_h, chLatin_a, chLatin_p, chLatin_e, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_M, chLatin_i, chLatin_s, chLatin_c, chLatin_e, chLatin_l, chLatin_l, chLatin_a, chLatin_n, chLatin_e, chLatin_o, chLatin_u, chLatin_s, chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_D, chLatin_i, chLatin_n, chLatin_g, chLatin_b, chLatin_a, chLatin_t, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_B, chLatin_r, chLatin_a, chLatin_i, chLatin_l, chLatin_l, chLatin_e, chLatin_P, chLatin_a, chLatin_t, chLatin_t, chLatin_e, chLatin_r, chLatin_n, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_R, chLatin_a, chLatin_d, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_s, chLatin_S, chLatin_u, chLatin_p, chLatin_p, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull }, { chLatin_I, chLatin_s, chLatin_K, chLatin_a, chLatin_n, chLatin_g, chLatin_x, chLatin_i, chLatin_R, chLatin_a, chLatin_d, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_I, chLatin_d, chLatin_e, chLatin_o, chLatin_g, chLatin_r, chLatin_a, chLatin_p, chLatin_h, chLatin_i, chLatin_c, chLatin_D, chLatin_e, chLatin_s, chLatin_c, chLatin_r, chLatin_i, chLatin_p, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_C, chLatin_h, chLatin_a, chLatin_r, chLatin_a, chLatin_c, chLatin_t, chLatin_e, chLatin_r, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chLatin_a, chLatin_n, chLatin_d, chLatin_P, chLatin_u, chLatin_n, chLatin_c, chLatin_t, chLatin_u, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull }, { chLatin_I, chLatin_s, chLatin_H, chLatin_i, chLatin_r, chLatin_a, chLatin_g, chLatin_a, chLatin_n, chLatin_a, chNull }, { chLatin_I, chLatin_s, chLatin_K, chLatin_a, chLatin_t, chLatin_a, chLatin_k, chLatin_a, chLatin_n, chLatin_a, chNull }, { chLatin_I, chLatin_s, chLatin_B, chLatin_o, chLatin_p, chLatin_o, chLatin_m, chLatin_o, chLatin_f, chLatin_o, chNull }, { chLatin_I, chLatin_s, chLatin_H, chLatin_a, chLatin_n, chLatin_g, chLatin_u, chLatin_l, chLatin_C, chLatin_o, chLatin_m, chLatin_p, chLatin_a, chLatin_t, chLatin_i, chLatin_b, chLatin_i, chLatin_l, chLatin_i, chLatin_t, chLatin_y, chLatin_J, chLatin_a, chLatin_m, chLatin_o, chNull }, { chLatin_I, chLatin_s, chLatin_K, chLatin_a, chLatin_n, chLatin_b, chLatin_u, chLatin_n, chNull }, { chLatin_I, chLatin_s, chLatin_B, chLatin_o, chLatin_p, chLatin_o, chLatin_m, chLatin_o, chLatin_f, chLatin_o, chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chNull }, { chLatin_I, chLatin_s, chLatin_E, chLatin_n, chLatin_c, chLatin_l, chLatin_o, chLatin_s, chLatin_e, chLatin_d, chLatin_C, chLatin_J, chLatin_K, chLatin_L, chLatin_e, chLatin_t, chLatin_t, chLatin_e, chLatin_r, chLatin_s, chLatin_a, chLatin_n, chLatin_d, chLatin_M, chLatin_o, chLatin_n, chLatin_t, chLatin_h, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_C, chLatin_o, chLatin_m, chLatin_p, chLatin_a, chLatin_t, chLatin_i, chLatin_b, chLatin_i, chLatin_l, chLatin_i, chLatin_t, chLatin_y, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_U, chLatin_n, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, chLatin_I, chLatin_d, chLatin_e, chLatin_o, chLatin_g, chLatin_r, chLatin_a, chLatin_p, chLatin_h, chLatin_s, chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_s, chLatin_i, chLatin_o, chLatin_n, chLatin_A, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_U, chLatin_n, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, chLatin_I, chLatin_d, chLatin_e, chLatin_o, chLatin_g, chLatin_r, chLatin_a, chLatin_p, chLatin_h, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_Y, chLatin_i, chLatin_S, chLatin_y, chLatin_l, chLatin_l, chLatin_a, chLatin_b, chLatin_l, chLatin_e, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_Y, chLatin_i, chLatin_R, chLatin_a, chLatin_d, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_H, chLatin_a, chLatin_n, chLatin_g, chLatin_u, chLatin_l, chLatin_S, chLatin_y, chLatin_l, chLatin_l, chLatin_a, chLatin_b, chLatin_l, chLatin_e, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_P, chLatin_r, chLatin_i, chLatin_v, chLatin_a, chLatin_t, chLatin_e, chLatin_U, chLatin_s, chLatin_e, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_C, chLatin_o, chLatin_m, chLatin_p, chLatin_a, chLatin_t, chLatin_i, chLatin_b, chLatin_i, chLatin_l, chLatin_i, chLatin_t, chLatin_y, chLatin_I, chLatin_d, chLatin_e, chLatin_o, chLatin_g, chLatin_r, chLatin_a, chLatin_p, chLatin_h, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_A, chLatin_l, chLatin_p, chLatin_h, chLatin_a, chLatin_b, chLatin_e, chLatin_t, chLatin_i, chLatin_c, chLatin_P, chLatin_r, chLatin_e, chLatin_s, chLatin_e, chLatin_n, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_F, chLatin_o, chLatin_r, chLatin_m, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_A, chLatin_r, chLatin_a, chLatin_b, chLatin_i, chLatin_c, chLatin_P, chLatin_r, chLatin_e, chLatin_s, chLatin_e, chLatin_n, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_F, chLatin_o, chLatin_r, chLatin_m, chLatin_s, chDash, chLatin_A, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_o, chLatin_m, chLatin_b, chLatin_i, chLatin_n, chLatin_i, chLatin_n, chLatin_g, chLatin_H, chLatin_a, chLatin_l, chLatin_f, chLatin_M, chLatin_a, chLatin_r, chLatin_k, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_C, chLatin_o, chLatin_m, chLatin_p, chLatin_a, chLatin_t, chLatin_i, chLatin_b, chLatin_i, chLatin_l, chLatin_i, chLatin_t, chLatin_y, chLatin_F, chLatin_o, chLatin_r, chLatin_m, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_S, chLatin_m, chLatin_a, chLatin_l, chLatin_l, chLatin_F, chLatin_o, chLatin_r, chLatin_m, chLatin_V, chLatin_a, chLatin_r, chLatin_i, chLatin_a, chLatin_n, chLatin_t, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_A, chLatin_r, chLatin_a, chLatin_b, chLatin_i, chLatin_c, chLatin_P, chLatin_r, chLatin_e, chLatin_s, chLatin_e, chLatin_n, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_F, chLatin_o, chLatin_r, chLatin_m, chLatin_s, chDash, chLatin_B, chNull }, { chLatin_I, chLatin_s, chLatin_S, chLatin_p, chLatin_e, chLatin_c, chLatin_i, chLatin_a, chLatin_l, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_H, chLatin_a, chLatin_l, chLatin_f, chLatin_w, chLatin_i, chLatin_d, chLatin_t, chLatin_h, chLatin_a, chLatin_n, chLatin_d, chLatin_F, chLatin_u, chLatin_l, chLatin_l, chLatin_w, chLatin_i, chLatin_d, chLatin_t, chLatin_h, chLatin_F, chLatin_o, chLatin_r, chLatin_m, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_O, chLatin_l, chLatin_d, chLatin_I, chLatin_t, chLatin_a, chLatin_l, chLatin_i, chLatin_c, chNull }, { chLatin_I, chLatin_s, chLatin_G, chLatin_o, chLatin_t, chLatin_h, chLatin_i, chLatin_c, chNull }, { chLatin_I, chLatin_s, chLatin_D, chLatin_e, chLatin_s, chLatin_e, chLatin_r, chLatin_e, chLatin_t, chNull }, { chLatin_I, chLatin_s, chLatin_B, chLatin_y, chLatin_z, chLatin_a, chLatin_n, chLatin_t, chLatin_i, chLatin_n, chLatin_e, chLatin_M, chLatin_u, chLatin_s, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chNull }, { chLatin_M, chLatin_u, chLatin_s, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_M, chLatin_a, chLatin_t, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_t, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_A, chLatin_l, chLatin_p, chLatin_h, chLatin_a, chLatin_n, chLatin_u, chLatin_m, chLatin_e, chLatin_r, chLatin_i, chLatin_c, chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_U, chLatin_n, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, chLatin_I, chLatin_d, chLatin_e, chLatin_o, chLatin_g, chLatin_r, chLatin_a, chLatin_p, chLatin_h, chLatin_s, chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_s, chLatin_i, chLatin_o, chLatin_n, chLatin_B, chNull }, { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_C, chLatin_o, chLatin_m, chLatin_p, chLatin_a, chLatin_t, chLatin_i, chLatin_b, chLatin_i, chLatin_l, chLatin_i, chLatin_t, chLatin_y, chLatin_I, chLatin_d, chLatin_e, chLatin_o, chLatin_g, chLatin_r, chLatin_a, chLatin_p, chLatin_h, chLatin_s, chLatin_S, chLatin_u, chLatin_p, chLatin_p, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull }, { chLatin_I, chLatin_s, chLatin_T, chLatin_a, chLatin_g, chLatin_s, chNull }, }; const XMLInt32 blockRanges[] = { 0x0000,0x007F,0x0080,0x00FF,0x0100,0x017F,0x0180,0x024F,0x0250,0x02AF,0x02B0,0x02FF, 0x0300,0x036F,0x0370,0x03FF,0x0400,0x04FF,0x0530,0x058F,0x0590,0x05FF,0x0600,0x06FF, 0x0700,0x074F,0x0780,0x07BF,0x0900,0x097F,0x0980,0x09FF,0x0A00,0x0A7F,0x0A80,0x0AFF, 0x0B00,0x0B7F,0x0B80,0x0BFF,0x0C00,0x0C7F,0x0C80,0x0CFF,0x0D00,0x0D7F,0x0D80,0x0DFF, 0x0E00,0x0E7F,0x0E80,0x0EFF,0x0F00,0x0FFF,0x1000,0x109F,0x10A0,0x10FF,0x1100,0x11FF, 0x1200,0x137F,0x13A0,0x13FF,0x1400,0x167F,0x1680,0x169F,0x16A0,0x16FF,0x1780,0x17FF, 0x1800,0x18AF,0x1E00,0x1EFF,0x1F00,0x1FFF,0x2000,0x206F,0x2070,0x209F,0x20A0,0x20CF, 0x20D0,0x20FF,0x2100,0x214F,0x2150,0x218F,0x2190,0x21FF,0x2200,0x22FF,0x2300,0x23FF, 0x2400,0x243F,0x2440,0x245F,0x2460,0x24FF,0x2500,0x257F,0x2580,0x259F,0x25A0,0x25FF, 0x2600,0x26FF,0x2700,0x27BF,0x2800,0x28FF,0x2E80,0x2EFF,0x2F00,0x2FDF,0x2FF0,0x2FFF, 0x3000,0x303F,0x3040,0x309F,0x30A0,0x30FF,0x3100,0x312F,0x3130,0x318F,0x3190,0x319F, 0x31A0,0x31BF,0x3200,0x32FF,0x3300,0x33FF,0x3400,0x4DB5,0x4E00,0x9FFF,0xA000,0xA48F, 0xA490,0xA4CF,0xAC00,0xD7A3,0xE000,0xF8FF,0xF900,0xFAFF,0xFB00,0xFB4F,0xFB50,0xFDFF, 0xFE20,0xFE2F,0xFE30,0xFE4F,0xFE50,0xFE6F,0xFE70,0xFEFE,0xFEFF,0xFEFF,0xFF00,0xFFEF, 0x10300,0x1032F,0x10330,0x1034F,0x10400,0x1044F,0x1D000,0x1D0FF,0x1D100,0x1D1FF, 0x1D400,0x1D7FF,0x20000,0x2A6D6,0x2F800,0x2FA1F,0xE0000,0xE007F, chNull }; // --------------------------------------------------------------------------- // BlockRangeFactory: Constructors and Destructor // --------------------------------------------------------------------------- BlockRangeFactory::BlockRangeFactory() { } BlockRangeFactory::~BlockRangeFactory() { } // --------------------------------------------------------------------------- // BlockRangeFactory: Range creation methods // --------------------------------------------------------------------------- void BlockRangeFactory::buildRanges(RangeTokenMap *rangeTokMap) { if (fRangesCreated) return; if (!fKeywordsInitialized) { initializeKeywordMap(rangeTokMap); } TokenFactory* tokFactory = rangeTokMap->getTokenFactory(); //for performance, once the desired specials and private use are found //don't need to compareString anymore bool foundSpecial = false; bool foundPrivate = false; for (int i=0; i < BLOCKNAMESIZE; i++) { RangeToken* tok = tokFactory->createRange(); tok->addRange(blockRanges[i*2], blockRanges[(i*2)+1]); if (!foundSpecial && XMLString::equals((XMLCh*)fgBlockNames[i] , (XMLCh*) fgBlockIsSpecials)) { tok->addRange(0xFFF0, 0xFFFD); foundSpecial = true; } if (!foundPrivate && XMLString::equals((XMLCh*)fgBlockNames[i] , (XMLCh*) fgBlockIsPrivateUse)) { tok->addRange(0xF0000, 0xFFFFD); tok->addRange(0x100000, 0x10FFFD); foundPrivate = true; } // Build the internal map. tok->createMap(); rangeTokMap->setRangeToken(fgBlockNames[i], tok); tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory); // Build the internal map. tok->createMap(); rangeTokMap->setRangeToken(fgBlockNames[i], tok , true); } fRangesCreated = true; } // --------------------------------------------------------------------------- // BlockRangeFactory: Range creation methods // --------------------------------------------------------------------------- void BlockRangeFactory::initializeKeywordMap(RangeTokenMap *rangeTokMap) { if (fKeywordsInitialized) return; for (int i=0; i< BLOCKNAMESIZE; i++) { rangeTokMap->addKeywordMap(fgBlockNames[i], fgBlockCategory); } fKeywordsInitialized = true; } XERCES_CPP_NAMESPACE_END /** * End of file BlockRangeFactory.cpp */
[ "Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57" ]
[ [ [ 1, 368 ] ] ]
2c0f58ccc12179dea4b4e1770f7f5eb566a43b9a
36fea6c98ecabcd5e932f2b7854b3282cdb571ee
/plugins/stringEditor/debug/moc_qtpropertybrowser.cpp
d2a7e946a739036d309b3f0f3aeb142dc8019f15
[]
no_license
doomfrawen/visualcommand
976adaae69303d8b4ffc228106a1db9504e4a4e4
f7bc1d590444ff6811f84232f5c6480449228e19
refs/heads/master
2016-09-06T17:40:57.775379
2009-07-28T22:48:23
2009-07-28T22:48:23
32,345,504
0
0
null
null
null
null
UTF-8
C++
false
false
9,446
cpp
/**************************************************************************** ** Meta object code from reading C++ file 'qtpropertybrowser.h' ** ** Created: Fri Jun 19 11:29:04 2009 ** by: The Qt Meta Object Compiler version 61 (Qt 4.5.1) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "../../../src/qtpropertybrowser.h" #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'qtpropertybrowser.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 61 #error "This file was generated using the moc from 4.5.1. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE static const uint qt_meta_data_QtAbstractPropertyManager[] = { // content: 2, // revision 0, // classname 0, 0, // classinfo 4, 12, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors // signals: signature, parameters, type, tag, flags 49, 27, 26, 26, 0x05, 112, 103, 26, 26, 0x05, 157, 141, 26, 26, 0x05, 198, 103, 26, 26, 0x05, 0 // eod }; static const char qt_meta_stringdata_QtAbstractPropertyManager[] = { "QtAbstractPropertyManager\0\0" "property,parent,after\0" "propertyInserted(QtProperty*,QtProperty*,QtProperty*)\0" "property\0propertyChanged(QtProperty*)\0" "property,parent\0" "propertyRemoved(QtProperty*,QtProperty*)\0" "propertyDestroyed(QtProperty*)\0" }; const QMetaObject QtAbstractPropertyManager::staticMetaObject = { { &QObject::staticMetaObject, qt_meta_stringdata_QtAbstractPropertyManager, qt_meta_data_QtAbstractPropertyManager, 0 } }; const QMetaObject *QtAbstractPropertyManager::metaObject() const { return &staticMetaObject; } void *QtAbstractPropertyManager::qt_metacast(const char *_clname) { if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_QtAbstractPropertyManager)) return static_cast<void*>(const_cast< QtAbstractPropertyManager*>(this)); return QObject::qt_metacast(_clname); } int QtAbstractPropertyManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: propertyInserted((*reinterpret_cast< QtProperty*(*)>(_a[1])),(*reinterpret_cast< QtProperty*(*)>(_a[2])),(*reinterpret_cast< QtProperty*(*)>(_a[3]))); break; case 1: propertyChanged((*reinterpret_cast< QtProperty*(*)>(_a[1]))); break; case 2: propertyRemoved((*reinterpret_cast< QtProperty*(*)>(_a[1])),(*reinterpret_cast< QtProperty*(*)>(_a[2]))); break; case 3: propertyDestroyed((*reinterpret_cast< QtProperty*(*)>(_a[1]))); break; default: ; } _id -= 4; } return _id; } // SIGNAL 0 void QtAbstractPropertyManager::propertyInserted(QtProperty * _t1, QtProperty * _t2, QtProperty * _t3) { void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)) }; QMetaObject::activate(this, &staticMetaObject, 0, _a); } // SIGNAL 1 void QtAbstractPropertyManager::propertyChanged(QtProperty * _t1) { void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; QMetaObject::activate(this, &staticMetaObject, 1, _a); } // SIGNAL 2 void QtAbstractPropertyManager::propertyRemoved(QtProperty * _t1, QtProperty * _t2) { void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) }; QMetaObject::activate(this, &staticMetaObject, 2, _a); } // SIGNAL 3 void QtAbstractPropertyManager::propertyDestroyed(QtProperty * _t1) { void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; QMetaObject::activate(this, &staticMetaObject, 3, _a); } static const uint qt_meta_data_QtAbstractEditorFactoryBase[] = { // content: 2, // revision 0, // classname 0, 0, // classinfo 1, 12, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors // slots: signature, parameters, type, tag, flags 37, 29, 28, 28, 0x09, 0 // eod }; static const char qt_meta_stringdata_QtAbstractEditorFactoryBase[] = { "QtAbstractEditorFactoryBase\0\0manager\0" "managerDestroyed(QObject*)\0" }; const QMetaObject QtAbstractEditorFactoryBase::staticMetaObject = { { &QObject::staticMetaObject, qt_meta_stringdata_QtAbstractEditorFactoryBase, qt_meta_data_QtAbstractEditorFactoryBase, 0 } }; const QMetaObject *QtAbstractEditorFactoryBase::metaObject() const { return &staticMetaObject; } void *QtAbstractEditorFactoryBase::qt_metacast(const char *_clname) { if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_QtAbstractEditorFactoryBase)) return static_cast<void*>(const_cast< QtAbstractEditorFactoryBase*>(this)); return QObject::qt_metacast(_clname); } int QtAbstractEditorFactoryBase::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: managerDestroyed((*reinterpret_cast< QObject*(*)>(_a[1]))); break; default: ; } _id -= 1; } return _id; } static const uint qt_meta_data_QtAbstractPropertyBrowser[] = { // content: 2, // revision 0, // classname 0, 0, // classinfo 8, 12, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors // signals: signature, parameters, type, tag, flags 27, 26, 26, 26, 0x05, // slots: signature, parameters, type, tag, flags 86, 77, 62, 26, 0x0a, 134, 111, 62, 26, 0x0a, 174, 77, 26, 26, 0x0a, 205, 202, 26, 26, 0x08, 265, 263, 26, 26, 0x08, 310, 26, 26, 26, 0x08, 345, 26, 26, 26, 0x08, 0 // eod }; static const char qt_meta_stringdata_QtAbstractPropertyBrowser[] = { "QtAbstractPropertyBrowser\0\0" "currentItemChanged(QtBrowserItem*)\0" "QtBrowserItem*\0property\0" "addProperty(QtProperty*)\0" "property,afterProperty\0" "insertProperty(QtProperty*,QtProperty*)\0" "removeProperty(QtProperty*)\0,,\0" "slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*)\0" ",\0slotPropertyRemoved(QtProperty*,QtProperty*)\0" "slotPropertyDestroyed(QtProperty*)\0" "slotPropertyDataChanged(QtProperty*)\0" }; const QMetaObject QtAbstractPropertyBrowser::staticMetaObject = { { &QWidget::staticMetaObject, qt_meta_stringdata_QtAbstractPropertyBrowser, qt_meta_data_QtAbstractPropertyBrowser, 0 } }; const QMetaObject *QtAbstractPropertyBrowser::metaObject() const { return &staticMetaObject; } void *QtAbstractPropertyBrowser::qt_metacast(const char *_clname) { if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_QtAbstractPropertyBrowser)) return static_cast<void*>(const_cast< QtAbstractPropertyBrowser*>(this)); return QWidget::qt_metacast(_clname); } int QtAbstractPropertyBrowser::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: currentItemChanged((*reinterpret_cast< QtBrowserItem*(*)>(_a[1]))); break; case 1: { QtBrowserItem* _r = addProperty((*reinterpret_cast< QtProperty*(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QtBrowserItem**>(_a[0]) = _r; } break; case 2: { QtBrowserItem* _r = insertProperty((*reinterpret_cast< QtProperty*(*)>(_a[1])),(*reinterpret_cast< QtProperty*(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< QtBrowserItem**>(_a[0]) = _r; } break; case 3: removeProperty((*reinterpret_cast< QtProperty*(*)>(_a[1]))); break; case 4: d_func()->slotPropertyInserted((*reinterpret_cast< QtProperty*(*)>(_a[1])),(*reinterpret_cast< QtProperty*(*)>(_a[2])),(*reinterpret_cast< QtProperty*(*)>(_a[3]))); break; case 5: d_func()->slotPropertyRemoved((*reinterpret_cast< QtProperty*(*)>(_a[1])),(*reinterpret_cast< QtProperty*(*)>(_a[2]))); break; case 6: d_func()->slotPropertyDestroyed((*reinterpret_cast< QtProperty*(*)>(_a[1]))); break; case 7: d_func()->slotPropertyDataChanged((*reinterpret_cast< QtProperty*(*)>(_a[1]))); break; default: ; } _id -= 8; } return _id; } // SIGNAL 0 void QtAbstractPropertyBrowser::currentItemChanged(QtBrowserItem * _t1) { void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; QMetaObject::activate(this, &staticMetaObject, 0, _a); } QT_END_MOC_NAMESPACE
[ "flouger@13a168e0-7ae3-11de-a146-1f7e517e55b8" ]
[ [ [ 1, 255 ] ] ]
16db52e7c30273de14e1cd75bd1b1c32b710e467
885fc5f6e056abe95996b4fc6eebef06a94d50ce
/src/FFMpegCanvas.cpp
93b1e2553363af64d42c0bde692be0afb01be694
[]
no_license
jdzyzh/ffmpeg-wrapper
bdf0a6f15db2625b2707cbac57d5bfaca6396e3d
5185bb3695df9adda59f7f849095314f16b2bd48
refs/heads/master
2021-01-10T08:58:06.519741
2011-11-30T06:32:50
2011-11-30T06:32:50
54,611,386
1
0
null
null
null
null
UTF-8
C++
false
false
4,285
cpp
#include <RealFFMpegBitmapConverter.h> #include <RealFFMpegCanvas.h> #include <FFMpegCanvas.h> RealFFMpegCanvas::RealFFMpegCanvas(int w,int h,PixelFormat fmt) { m_w = w; m_h = h; m_fmt = fmt; int ret = avpicture_alloc(&m_picture,m_fmt,m_w,m_h); if (ret) printf("FFMpegCanvas failed to alloc avpicture! ret=%d,dim=%dx%d\n",ret,m_w,m_h); } RealFFMpegCanvas::~RealFFMpegCanvas(void) { avpicture_free(&m_picture); } int RealFFMpegCanvas::draw(PixelFormat fmt,AVPicture *pPic, int x, int y, int imageW,int imageH) { if (fmt != m_fmt) return -1; bool bFmtSupported = true; int x_shift = 0; int y_shift = 0; switch (fmt) { case PIX_FMT_YUVJ420P: case PIX_FMT_YUV420P: x_shift = 1; y_shift = 1; break; case PIX_FMT_YUVJ422P: x_shift = 1; y_shift = 0; break; case PIX_FMT_YUVJ444P: x_shift = 0; y_shift = 0; break; default: bFmtSupported = false; } if (bFmtSupported == false) return -2; unsigned char* ptrY = m_picture.data[0]; unsigned char* ptrU = m_picture.data[1] + (y >> y_shift) * m_picture.linesize[1] + (x >> x_shift); unsigned char* ptrV = m_picture.data[2] + (y >> y_shift) * m_picture.linesize[2] + (x >> x_shift); unsigned char* ptrY2 = pPic->data[0]; unsigned char* ptrU2 = pPic->data[1]; unsigned char* ptrV2 = pPic->data[2]; if (imageW > m_w) imageW = m_w; for (int h=0;h<imageH;h++) { memcpy(m_picture.data[0]+(y+h)*m_picture.linesize[0]+x, pPic->data[0]+h*pPic->linesize[0], imageW); memcpy(m_picture.data[1]+((y+h) >> y_shift)*m_picture.linesize[1]+(x >> x_shift), pPic->data[1]+(h >> y_shift)*pPic->linesize[1], imageW >> x_shift); memcpy(m_picture.data[2]+((y+h) >> y_shift)*m_picture.linesize[2]+(x >> x_shift), pPic->data[2]+(h >> y_shift)*pPic->linesize[2], imageW >> x_shift); /* memcpy(ptrY,ptrY2,imageW); memcpy(ptrU,ptrU2,imageW >> x_shift); memcpy(ptrV,ptrV2,imageW >> x_shift); ptrY += m_picture.linesize[0]; ptrU += m_picture.linesize[1] * (1 >> y_shift); ptrV += m_picture.linesize[2] * (1 >> y_shift); ptrY2 += pPic->linesize[0]; ptrU2 += pPic->linesize[1] * (1 >> y_shift); ptrV2 += pPic->linesize[2] * (1 >> y_shift); */ } } AVPicture* RealFFMpegCanvas::getPicture() { return &m_picture; } AVPicture* RealFFMpegCanvas::copyPicture() { AVPicture *pic_ret = (AVPicture*)malloc(sizeof(AVPicture)); av_picture_copy(pic_ret,&m_picture,m_fmt,m_w,m_h); return pic_ret; } void RealFFMpegCanvas::clear() { unsigned char* rgb = (unsigned char*)malloc(m_w * m_h * 3); for (int h=0;h<m_h;h++) { for (int x=0;x<m_w;x++) { rgb[h*m_w*3+x*3] = 0x00; rgb[h*m_w*3+x*3+1] = 0x00; rgb[h*m_w*3+x*3+2] = 0x00; } } AVPicture rgbPic; rgbPic.data[0] = rgb; rgbPic.linesize[0] = m_w * 3; RealFFMpegBitmapConverter *pConv = new RealFFMpegBitmapConverter(m_w, m_h, PIX_FMT_RGB24, m_w, m_h, m_fmt); AVPicture *picConverted = pConv->convertVideo(&rgbPic); draw(m_fmt, picConverted, 0,0, m_w, m_h); free(rgb); delete pConv; } FFMpegCanvas::FFMpegCanvas(int w, int h, char* fmtName) { PixelFormat fmt = av_get_pix_fmt(fmtName); _delegate = new RealFFMpegCanvas(w,h,fmt); } FFMpegCanvas::~FFMpegCanvas() { delete ((RealFFMpegCanvas*) _delegate); } int FFMpegCanvas::draw(char *fmtStr, FFMpegFrame *pFrame, int x, int y, int imageW, int imageH) { PixelFormat fmt = av_get_pix_fmt(fmtStr); return ((RealFFMpegCanvas*) _delegate)->draw(fmt,(AVPicture*)pFrame,x,y,imageW,imageH); } void FFMpegCanvas::clear() { return ((RealFFMpegCanvas*) _delegate)->clear(); } const char* FFMpegCanvas::getFmtStr() { PixelFormat fmt = ((RealFFMpegCanvas*) _delegate)->m_fmt; return avcodec_get_pix_fmt_name(fmt); } FFMpegFrame FFMpegCanvas::getPicture() { AVPicture *pPic = ((RealFFMpegCanvas*) _delegate)->getPicture(); FFMpegFrame frame; for (int i=0;i<4;i++) { frame.data[i] = (char*)pPic->data[i]; frame.linesize[i] = pPic->linesize[i]; } return frame; } int FFMpegCanvas::getWidth() { return ((RealFFMpegCanvas*) _delegate)->m_w; } int FFMpegCanvas::getHeight() { return ((RealFFMpegCanvas*) _delegate)->m_h; }
[ "ransomhmc@6544afd8-f103-2cf2-cfd9-24e348754d5f", "[email protected]" ]
[ [ [ 1, 1 ], [ 8, 17 ], [ 19, 22 ], [ 24, 64 ], [ 67, 97 ], [ 99, 102 ], [ 104, 109 ], [ 111, 125 ], [ 128, 128 ], [ 180, 180 ] ], [ [ 2, 7 ], [ 18, 18 ], [ 23, 23 ], [ 65, 66 ], [ 98, 98 ], [ 103, 103 ], [ 110, 110 ], [ 126, 127 ], [ 129, 179 ] ] ]
0cf0f9eeca4e302ad0875752182b1f4f5c571fb7
3b70a7b1d647a401c69c10b39ca75e38ee8741cb
/ofxArgosUI/src/ofxArgosUI_Parameter.h
93d39e2cea277f470dac108512bdef5aa860ecc6
[]
no_license
nuigroup/argos-interface-builder
dc4e2daea0e318052165432f09a08b2c2285e516
dc231f73a04b7bad23fb03c8f4eca4dcfc3d8fd8
refs/heads/master
2020-05-19T09:20:38.019073
2010-05-30T05:41:34
2010-05-30T05:41:34
8,322,636
3
0
null
null
null
null
UTF-8
C++
false
false
2,634
h
/*********************************************************************** Copyright (c) 2009, 2010 Dimitri Diakopoulos, http://www.dimitridiakopoulos.com/ Portions Copyright (c) 2008, 2009 Memo Aktens, http://www.memo.tv/ -> Based on ofxSimpleGuiToo Portions Copyright (c) 2008 Todd Vanderlin, http://toddvanderlin.com/ -> Inspired by ofxSimpleGui API Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NOEVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, 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. *************************************************************************/ #pragma once #include "ofTypes.h" class ofxArgosUI_Parameter { public: /* typedef map<string, string> properties; properties p; void addProperty(string key, string defValue){ p.insert (pair<string,string>(key,defValue) ); } */ int textColor; int textOverColor; int textBGColor; int textBGOverColor; int fullColor; int fullOverColor; int fullActiveColor; int emptyColor; int borderColor; int panelColor; int panelBorderColor; ofxArgosUI_Parameter() { textColor = 0x000000; textOverColor = 0x000000; textBGColor = 0x4d5bc6; textBGOverColor = 0x3647c7; fullColor = 0xefefef; fullOverColor = 0xefefef; fullActiveColor = 0xefefef; emptyColor = 0x2a2f39; borderColor = 0xe3e3e3; } };
[ "eliftherious@85a45124-5891-11de-8d7d-01d876f1962d" ]
[ [ [ 1, 90 ] ] ]
e39484b20f807d14f7cabf4eb88980ce3490a84c
b22c254d7670522ec2caa61c998f8741b1da9388
/common/GameEvents.h
cd468ce5a27d62e629a21f534a0e9cdacf9e3833
[]
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
19,813
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_GAME_EVENTS_H__ #define __LBANET_GAME_EVENTS_H__ #include <map> #include "WorldInfo.h" #include <LbaTypes.h> /* ************************************************************************************************************************ * class GameEvent ************************************************************************************************************************ */ class GameEvent { public: int GetType() { return _type;} protected: int _type; }; /* ************************************************************************************************************************ * class LoginEvent * * class used during login ************************************************************************************************************************ */ class LoginEvent : public GameEvent { public: //! constructor LoginEvent(const std::string &Name, const std::string &Password, bool Local) : _Name(Name), _Password(Password), _Local(Local) { _type = 1; } std::string _Name; std::string _Password; bool _Local; }; /* ************************************************************************************************************************ * class GuiExitEvent * * used when the active gui is being quitted by the user ************************************************************************************************************************ */ class GuiExitEvent : public GameEvent { public: //! constructor GuiExitEvent() { _type = 2; } }; /* ************************************************************************************************************************ * class ChangeWorldEvent * * used when the user is changing world ************************************************************************************************************************ */ class ChangeWorldEvent : public GameEvent { public: //! constructor ChangeWorldEvent(const std::string & NewWorldName, const std::string & NewWorldFileName) : _NewWorldName(NewWorldName), _NewWorldFileName(NewWorldFileName) { _type = 3; } std::string _NewWorldName; std::string _NewWorldFileName; }; /* ************************************************************************************************************************ * class DisplayGUIEvent * * used when the user is switching gui ************************************************************************************************************************ */ class DisplayGUIEvent : public GameEvent { public: //! constructor DisplayGUIEvent(int GuiNumber) : _GuiNumber(GuiNumber) { _type = 4; } int _GuiNumber; }; /* ************************************************************************************************************************ * class ScreenResEvent * * used when the user is changing screen resolution ************************************************************************************************************************ */ class ScreenResEvent : public GameEvent { public: //! constructor ScreenResEvent(int screenX, int screenY, bool fullscreen) : _screenX(screenX), _screenY(screenY), _fullscreen(fullscreen) { _type = 5; } int _screenX; int _screenY; bool _fullscreen; }; /* ************************************************************************************************************************ * class DisplayFPSEvent * * used when the user is changing screen resolution ************************************************************************************************************************ */ class DisplayFPSEvent : public GameEvent { public: //! constructor DisplayFPSEvent(bool display) : _display(display) { _type = 6; } bool _display; }; /* ************************************************************************************************************************ * class ChangeMainBodyEvent * * used when the user is changing screen resolution ************************************************************************************************************************ */ class ChangeMainBodyEvent : public GameEvent { public: //! constructor ChangeMainBodyEvent(bool plus) : _plus(plus) { _type = 7; } bool _plus; }; /* ************************************************************************************************************************ * class NewFontSizeEvent * * used when the user is changing screen resolution ************************************************************************************************************************ */ class NewFontSizeEvent : public GameEvent { public: //! constructor NewFontSizeEvent() { _type = 8; } }; /* ************************************************************************************************************************ * class TeleportEvent * * used when the user is changing screen resolution ************************************************************************************************************************ */ class TeleportEvent : public GameEvent { public: //! constructor TeleportEvent(const std::string &NewMap, const std::string &Spawning) : _NewMap(NewMap), _Spawning(Spawning) { _type = 9; } std::string _NewMap; std::string _Spawning; }; /* ************************************************************************************************************************ * class ChangeMainBodyColorEvent * * used when the user is changing screen resolution ************************************************************************************************************************ */ class ChangeMainBodyColorEvent : public GameEvent { public: //! constructor ChangeMainBodyColorEvent(bool plus) : _plus(plus) { _type = 10; } bool _plus; }; /* ************************************************************************************************************************ * class DisplayGameTextEvent * * used when the user has activated a text in game ************************************************************************************************************************ */ class DisplayGameTextEvent : public GameEvent { public: //! constructor DisplayGameTextEvent(long textid) : _textid(textid) { _type = 11; } long _textid; }; /* ************************************************************************************************************************ * struct PlayerScriptPart * * used for scripted event ************************************************************************************************************************ */ struct PlayerScriptPart { int Type; //0 = rotation - 1=translation - 2=animation - 3=inform targetA - // 4=wait fo signal -5= wait number of ms // 6= do a curve // 7= hide - 8=show // 9= change player stance // 10= attach player to actor // 11= detach player from actor int Animation; int Sound; int SoundNum; float ValueA; float ValueB; float ValueC; bool Flag; std::string NewMap; std::string Spawning; bool AutoMoveY; float Speed; }; /* ************************************************************************************************************************ * class MainPlayerScriptedEvent * * used when the user has activated a scripted event in game ************************************************************************************************************************ */ class MainPlayerScriptedEvent : public GameEvent { public: //! constructor MainPlayerScriptedEvent(const std::vector<PlayerScriptPart> &script) : _script(script) { _type = 12; } std::vector<PlayerScriptPart> _script; }; /* ************************************************************************************************************************ * class GameSignalvent * * used when the user has activated a scripted event in game ************************************************************************************************************************ */ //1 -> open door signal //2 -> close door signal //3 -> animation finished signal //4 -> switch open/close door signal //6 to 10 -> reserved to inform main player of events class GameSignalvent : public GameEvent { public: //! constructor GameSignalvent(long signal, const std::vector<long> &targets) : _signal(signal), _targets(targets) { _type = 13; } long _signal; std::vector<long> _targets; }; /* ************************************************************************************************************************ * class TeleportEvent * * used when the user is changing screen resolution ************************************************************************************************************************ */ class TeleportAnyEvent : public GameEvent { public: //! constructor TeleportAnyEvent(const std::string &NewMap, float X, float Y, float Z) : _NewMap(NewMap), _X(X), _Y(Y), _Z(Z) { _type = 14; } std::string _NewMap; float _X; float _Y; float _Z; }; /* ************************************************************************************************************************ * class ChangePerspectiveEvent * * used when the user is changing screen resolution ************************************************************************************************************************ */ class ChangePerspectiveEvent : public GameEvent { public: //! constructor ChangePerspectiveEvent(bool perspective) : _perspective(perspective) { _type = 15; } bool _perspective; }; /* ************************************************************************************************************************ * class DisplayExitsEvent * * used when the user is changing screen resolution ************************************************************************************************************************ */ class DisplayExitsEvent : public GameEvent { public: //! constructor DisplayExitsEvent(bool display) : _display(display) { _type = 16; } bool _display; }; /* ************************************************************************************************************************ * class PlayerHurtEvent * * used when the user is changing screen resolution ************************************************************************************************************************ */ class PlayerHurtEvent : public GameEvent { public: //! constructor PlayerHurtEvent(long fromactorid) : _fromactorid(fromactorid) { _type = 17; } long _fromactorid; }; /* ************************************************************************************************************************ * class DoFullCheckEvent * * used to ask engine to do a full position check on the map ************************************************************************************************************************ */ class DoFullCheckEvent : public GameEvent { public: //! constructor DoFullCheckEvent() { _type = 18; } }; /* ************************************************************************************************************************ * class PlayerLifeChangedEvent * * used to update player life ************************************************************************************************************************ */ class PlayerLifeChangedEvent : public GameEvent { public: //! constructor PlayerLifeChangedEvent(float CurLife, float MaxLife, float CurMana, float MaxMana, bool Hurt) : _CurLife(CurLife), _MaxLife(MaxLife), _CurMana(CurMana), _MaxMana(MaxMana), _Hurt(Hurt) { _type = 19; } float _CurLife; float _MaxLife; float _CurMana; float _MaxMana; bool _Hurt; }; /* ************************************************************************************************************************ * class PlayerNameColorChangedEvent * * used to update player life ************************************************************************************************************************ */ class PlayerNameColorChangedEvent : public GameEvent { public: //! constructor PlayerNameColorChangedEvent(int R, int G, int B) : _R(R), _G(G), _B(B) { _type = 20; } int _R; int _G; int _B; }; /* ************************************************************************************************************************ * class ChangeStanceEvent * * used to update player life ************************************************************************************************************************ */ class ChangeStanceEvent : public GameEvent { public: //! constructor ChangeStanceEvent(int stance) : _stance(stance) { _type = 21; } int _stance; }; /* ************************************************************************************************************************ * class InventoryObjectUsedEvent * * used to update player life ************************************************************************************************************************ */ class InventoryObjectUsedEvent : public GameEvent { public: //! constructor InventoryObjectUsedEvent(long ObjectId) : _ObjectId(ObjectId) { _type = 22; } int _ObjectId; }; /* ************************************************************************************************************************ * class FocusChatEvent * * used to update player life ************************************************************************************************************************ */ class FocusChatEvent : public GameEvent { public: //! constructor FocusChatEvent() { _type = 23; } }; /* ************************************************************************************************************************ * class DisplayDialogEvent * * used to display NPC dialog ************************************************************************************************************************ */ class DisplayDialogEvent : public GameEvent { public: //! constructor DisplayDialogEvent(long ActorId, const std::string & ActorName, DialogHandlerPtr Dialog, bool Show, const std::map<long, TraderItem> &inventory) : _ActorId(ActorId), _ActorName(ActorName), _Show(Show), _inventory(inventory), _Dialog(Dialog) { _type = 24; } long _ActorId; std::string _ActorName; DialogHandlerPtr _Dialog; bool _Show; std::map<long, TraderItem> _inventory; }; /* ************************************************************************************************************************ * class ObjectUpdateEvent * * used to display NPC dialog ************************************************************************************************************************ */ class ObjectUpdateEvent : public GameEvent { public: //! constructor ObjectUpdateEvent(long ObjectId, bool Received, int Number) : _ObjectId(ObjectId), _Received(Received), _Number(Number) { _type = 25; } long _ObjectId; bool _Received; int _Number; }; /* ************************************************************************************************************************ * class DieEvent * * player should die ************************************************************************************************************************ */ class DieEvent : public GameEvent { public: //! constructor DieEvent() { _type = 26; } }; /* ************************************************************************************************************************ * class DisplayMailEvent * * DisplayMailEvent ************************************************************************************************************************ */ class DisplayMailEvent : public GameEvent { public: //! constructor DisplayMailEvent(const std::vector<LbaNet::PMInfo> &pms) : _pms(pms) { _type = 27; } std::vector<LbaNet::PMInfo> _pms; }; /* ************************************************************************************************************************ * class CloseMailEvent * * CloseMailEvent ************************************************************************************************************************ */ class CloseMailEvent : public GameEvent { public: //! constructor CloseMailEvent() { _type = 28; } }; /* ************************************************************************************************************************ * class AttachActorToActorEvent * * AttachActorToActorEvent ************************************************************************************************************************ */ class AttachActorToActorEvent : public GameEvent { public: //! constructor AttachActorToActorEvent(Actor * toattach, long attachingid) { _type = 29; _toattach = toattach; _attachingid = attachingid; } Actor * _toattach; long _attachingid; }; #endif
[ "vdelage@3806491c-8dad-11de-9a8c-6d5b7d1e4d13" ]
[ [ [ 1, 720 ] ] ]
456476984f5d9b0eea53afe18c0e1f85323078ab
5ac13fa1746046451f1989b5b8734f40d6445322
/minimangalore/Nebula2/code/mangalore/game/manager.cc
9e42f8272ec31b3ebf1f7f7048578da6f837c686
[]
no_license
moltenguy1/minimangalore
9f2edf7901e7392490cc22486a7cf13c1790008d
4d849672a6f25d8e441245d374b6bde4b59cbd48
refs/heads/master
2020-04-23T08:57:16.492734
2009-08-01T09:13:33
2009-08-01T09:13:33
35,933,330
0
0
null
null
null
null
UTF-8
C++
false
false
2,294
cc
//------------------------------------------------------------------------------ // game/manager.cc // (C) 2005 Radon Labs GmbH //------------------------------------------------------------------------------ #include "game/manager.h" #include "message/server.h" namespace Game { ImplementRtti(Game::Manager, Message::Port); //------------------------------------------------------------------------------ /** */ Manager::Manager() : isActive(false) { // empty } //------------------------------------------------------------------------------ /** */ Manager::~Manager() { // empty } //------------------------------------------------------------------------------ /** This method is called when the manager is attached to the game server. The manager base class will register its message port with the message server. */ void Manager::OnActivate() { n_assert(!this->isActive); this->isActive = true; Message::Server::Instance()->RegisterPort(this); } //------------------------------------------------------------------------------ /** This method is called when the manager is removed from the game server. It will unregister its message port from the message server at this point. */ void Manager::OnDeactivate() { n_assert(this->isActive); Message::Server::Instance()->UnregisterPort(this); this->isActive = false; } //------------------------------------------------------------------------------ /** The manager base class will invoke the HandlePendingMessages() method to process any queued messages. */ void Manager::OnFrame() { this->HandlePendingMessages(); } //------------------------------------------------------------------------------ /** */ void Manager::OnLoad() { // empty } //------------------------------------------------------------------------------ /** */ void Manager::OnRenderDebug() { // empty } //------------------------------------------------------------------------------ /** */ void Manager::OnSave() { // empty } //------------------------------------------------------------------------------ /** */ void Manager::OnStart() { // empty } } // namespace Game
[ "BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c" ]
[ [ [ 1, 103 ] ] ]
f125208e99205caa2f3036684ba15ec448ed120e
296387b2289a05b29cf72e276e0fc9c9db82e42f
/hardlink_identical_files/hardlink_identical_files.cpp
ba598e398c45ece7bb3e08fd06f96d778881af1c
[]
no_license
jaykrell/jsvn
c469435ece6e8b11a4a9e6dd5bb4e500574b17ac
474b5afe0a515fe384de4bfb16f7483a25ead6ca
refs/heads/master
2020-04-01T19:27:12.846133
2011-10-16T22:16:03
2011-10-16T22:16:03
60,684,877
1
0
null
null
null
null
UTF-8
C++
false
false
8,349
cpp
/* cl /MD /Z7 /GX hardlink_identical_files.cpp /link /incremental:no usage: hardlink_identical_files <directory> Enumerate the current working directory and the specified directory, not recursively. Any files that have the same contents, print commands to delete one and hardlink it to the other. */ #include "..\jk_prefix.h" #include <stdio.h> #include <windows.h> #include <string.h> #if (_MSC_VER >= 1020) || defined(__WATCOMC__) #include <set> #include <vector> #include <string> typedef BASIC_STRING1(wchar_t) stringW; #ifdef UNICODE typedef BASIC_STRING1(wchar_t) stringT; #else typedef BASIC_STRING1(TCHAR) stringT; #endif #else #include <set.h> #include <vector.h> #include <bstring.h> #include <function.h> typedef BASIC_STRING1(wchar_t) stringW; typedef basic_string<TCHAR> stringT; #endif typedef const TCHAR* PCTSTR; #pragma hdrstop stringT FileAttributesToString( DWORD dw ) { stringT s; PCTSTR e = TEXT(""); /* empty */ s += ((dw & FILE_ATTRIBUTE_READONLY) ? TEXT("readonly") : e); s += ((dw & FILE_ATTRIBUTE_HIDDEN) ? TEXT("hidden") : e); s += ((dw & FILE_ATTRIBUTE_SYSTEM) ? TEXT("system") : e); s += ((dw & FILE_ATTRIBUTE_DIRECTORY) ? TEXT("directory") : e); s += ((dw & FILE_ATTRIBUTE_ARCHIVE) ? TEXT("archive") : e); s += ((dw & FILE_ATTRIBUTE_NORMAL) ? TEXT("normal") : e); s += ((dw & FILE_ATTRIBUTE_TEMPORARY) ? TEXT("temporary") : e); s += ((dw & FILE_ATTRIBUTE_COMPRESSED) ? TEXT("compressed") : e); //s += ((dw & FILE_ATTRIBUTE_OFFLINE) ? TEXT("offline") : e); return s; } struct FileInfo_t { ULARGE_INTEGER Size; ULARGE_INTEGER FileId; DWORD Attributes; stringW Path; }; bool operator<(const FileInfo_t& a, const FileInfo_t& b) { return (a.Path < b.Path); } void Lowercase( PWSTR s ) { WCHAR ch; while ((ch = *s) != 0) { if (ch >= L'A' && ch <= L'Z') { ch = (WCHAR) (ch - L'A' + L'a'); *s = ch; } s += 1; } } void CollectFiles( stringW Directory, SET1(FileInfo_t)& Files ) { WIN32_FIND_DATAW FindData = { 0 }; Directory += L"\\"; // wprintf(L"rem %u %c %ls %ls\n", __LINE__, (char) Directory[0], Directory.c_str(), FindData.cFileName); HANDLE FindHandle = FindFirstFileW((Directory + stringW(L"*")).c_str(), &FindData); // wprintf(L"rem %u %ls %ls %ls %p\n", __LINE__, Directory.c_str(), (Directory + stringW(L"*")).c_str(), FindData.cFileName, FindHandle); if (FindHandle != INVALID_HANDLE_VALUE) { // wprintf(L"rem %u %ls\n", __LINE__, FindData.cFileName); do { // wprintf(L"rem %u %ls\n", __LINE__, FindData.cFileName); if ((FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) { stringW FilePath = (Directory + FindData.cFileName); HANDLE FileHandle = CreateFileW(FilePath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (FileHandle == INVALID_HANDLE_VALUE) { wprintf(L"rem open %ls failed\n", FilePath.c_str()); } else { BY_HANDLE_FILE_INFORMATION ByHandleFileInformation = { 0 }; if (!GetFileInformationByHandle(FileHandle, &ByHandleFileInformation)) { wprintf(L"rem GetFileInformationByHandle %ls failed\n", FilePath.c_str()); } else { FileInfo_t FileInfo; CloseHandle(FileHandle); FileInfo.Size.HighPart = ByHandleFileInformation.nFileSizeHigh; FileInfo.Size.LowPart = ByHandleFileInformation.nFileSizeLow; if (FileInfo.Size.QuadPart != 0) { FileInfo.Attributes = ByHandleFileInformation.dwFileAttributes; FileInfo.Path = FilePath; FileInfo.FileId.LowPart = ByHandleFileInformation.nFileIndexLow; FileInfo.FileId.HighPart = ByHandleFileInformation.nFileIndexHigh; Files.insert(Files.end(), FileInfo); // wprintf(L"rem %u %ls\n", __LINE__, FindData.cFileName); } } } } } while (FindNextFileW(FindHandle, &FindData)); FindClose(FindHandle); } } void HandleFilePair( const FileInfo_t& File1, const FileInfo_t& File2 ) { HANDLE FileHandle1 = INVALID_HANDLE_VALUE; HANDLE FileHandle2 = INVALID_HANDLE_VALUE; VECTOR1(BYTE) Buffer1; VECTOR1(BYTE) Buffer2; unsigned BufferSize = 0; ULONG BytesRead1 = 0; ULONG BytesRead2 = 0; if (sizeof(unsigned) == 2) { BufferSize = (4 * 1024); } else { BufferSize = (256 * 1024); } if (File1.Size.QuadPart != File2.Size.QuadPart) { // wprintf(L"rem %u %ls\n", __LINE__, File1.Path.c_str()); goto Exit; } if (File1.Size.QuadPart == 0) { // wprintf(L"rem %u %ls\n", __LINE__, File1.Path.c_str()); goto Exit; } if (File1.Path == File2.Path) { // wprintf(L"rem %u %ls\n", __LINE__, File1.Path.c_str()); goto Exit; } // wprintf(L"rem %u %ls %ls\n", __LINE__, File1.Path.c_str(), File2.Path.c_str()); if (File1.FileId.QuadPart == File2.FileId.QuadPart) { wprintf(L"rem %ls %ls already linked\n", File1.Path.c_str(), File2.Path.c_str()); goto Exit; } FileHandle1 = CreateFileW(File1.Path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (FileHandle1 == INVALID_HANDLE_VALUE) { wprintf(L"rem open %ls failed\n", File1.Path.c_str()); goto Exit; } FileHandle2 = CreateFileW(File2.Path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (FileHandle2 == INVALID_HANDLE_VALUE) { wprintf(L"rem open %ls failed\n", File2.Path.c_str()); goto Exit; } Buffer1 = VECTOR1(BYTE)(BufferSize); Buffer2 = VECTOR1(BYTE)(BufferSize); while (true) { if (!ReadFile(FileHandle1, &Buffer1[0], BufferSize, &BytesRead1, NULL)) if (GetLastError() == ERROR_HANDLE_EOF) goto Exit; if (!ReadFile(FileHandle2, &Buffer2[0], BufferSize, &BytesRead2, NULL)) if (GetLastError() == ERROR_HANDLE_EOF) goto Exit; if (BytesRead1 != BytesRead2) goto Exit; if (memcmp(&Buffer1[0], &Buffer2[0], BytesRead1) != 0) goto Exit; if (BytesRead1 == 0) break; } if (File1.Attributes != File2.Attributes) { wprintf( L"rem %ls and %ls the same except for attributes (0x%lx vs. 0x%lx) (%ls vs. %ls)\n", File1.Path.c_str(), File2.Path.c_str(), File1.Attributes, File2.Attributes, FileAttributesToString(File1.Attributes).c_str(), FileAttributesToString(File2.Attributes).c_str() ); goto Exit; } wprintf(L"del /f /a \"%ls\"\n", File2.Path.c_str()); //wprintf(L"fsutil hardlink create %ls %ls\n", File2.Path.c_str(), File1.Path.c_str()); wprintf(L"hardlink \"%ls\" \"%ls\"\n", File1.Path.c_str(), File2.Path.c_str()); Exit: if (FileHandle1 != INVALID_HANDLE_VALUE) CloseHandle(FileHandle1); if (FileHandle2 != INVALID_HANDLE_VALUE) CloseHandle(FileHandle2); } void Main( int argc, wchar_t** argv ) { typedef SET1(FileInfo_t) Files_t; Files_t Files; ULONG Length = GetCurrentDirectoryW(0, NULL); if (Length < 2) exit(-__LINE__); VECTOR1(WCHAR) CurrentDirectory(Length); // wprintf(L"rem %u %u\n", __LINE__, (unsigned) CurrentDirectory.size()); Length = GetCurrentDirectoryW(Length, &CurrentDirectory[0]); if (Length != (CurrentDirectory.size() - 1)) exit(-__LINE__); // wprintf(L"rem %u %ls\n", __LINE__, &CurrentDirectory[0]); Lowercase(&CurrentDirectory[0]); // wprintf(L"rem %u %ls\n", __LINE__, &CurrentDirectory[0]); //stringW s; //s.assign(&CurrentDirectory[0]); // wprintf(L"rem %u %ls\n", __LINE__, s.c_str()); CollectFiles(&CurrentDirectory[0], Files); if (argc == 2) { Lowercase(argv[1]); stringW arg1 = argv[1]; if (arg1 != L"." && arg1 != &CurrentDirectory[0]) { CollectFiles(stringW(&arg1[0]), Files); } } // wprintf(L"rem %u %u\n", __LINE__, (unsigned) Files.size()); for (Files_t::const_iterator i1 = Files.begin() ; i1 != Files.end() ; ++i1) { for (Files_t::const_iterator i2 = i1 ; i2 != Files.end() ; ++i2) { if (i1 != i2) HandleFilePair(*i1, *i2); } } } extern "C" int __cdecl wmain( int argc, wchar_t** argv ) { Main(argc, argv); return 0; }
[ [ [ 1, 312 ] ] ]
5b29dfbfdb36ffc33d3559ce9d17840cc7c7140e
90aa2eebb1ab60a2ac2be93215a988e3c51321d7
/castor/branches/boost/libs/castor/test/test_max_of.cpp
0d87126a9378ff40de1308a0700136289f0dd562
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
roshannaik/castor
b9f4ea138a041fe8bccf2d8fc0dceeb13bcca5a6
e86e2bf893719bf3164f9da9590217c107cbd913
refs/heads/master
2021-04-18T19:24:38.612073
2010-08-18T05:10:39
2010-08-18T05:10:39
126,150,539
0
0
null
null
null
null
UTF-8
C++
false
false
2,190
cpp
#include <boost/castor.h> #include <boost/test/minimal.hpp> #include "test_aggregate.h" using namespace castor; int test_main(int, char * []) { std::string arr[] = { "Prolog", "Leda", "castor", "C#" }; lref<std::vector<std::string> > v = std::vector<std::string>(arr, arr + 4); { // basic - gen lref<std::string> m; relation r = max_of(v, m); BOOST_CHECK(r()); BOOST_CHECK(*m == "castor"); BOOST_CHECK(!r()); BOOST_CHECK(!m.defined()); } { // basic - test lref<std::string> m = "castor"; relation r = max_of(v, m); BOOST_CHECK(r()); BOOST_CHECK(*m == "castor"); BOOST_CHECK(!r()); BOOST_CHECK(m.defined()); // failure test #ifdef __GNUG__ r = max_of<std::vector<std::string> >(v,"Prolog") ; #else r = max_of(v,"Prolog") ; #endif BOOST_CHECK(!r()); } { // basic - empty container lref<std::string> m; lref<std::vector<std::string> > v2 = std::vector<std::string>(); relation r = max_of(v2, m); BOOST_CHECK(!r()); BOOST_CHECK(!m.defined()); } { // with group_by lref<int> i, m; lref<group<bool, int> > g; relation r = (range(i, 1, 100) >>= group_by(i, isEven, g)) && max_of(g, m); BOOST_CHECK(r()); BOOST_CHECK(*m == 99); BOOST_CHECK(r()); BOOST_CHECK(*m == 100); BOOST_CHECK(!r()); BOOST_CHECK(!m.defined()); } { // test - with cmp #ifdef __GNUG__ relation r = max_of<std::vector<std::string> >(v,"C#", std::greater<std::string>() ) ; #else relation r = max_of(v,"C#", std::greater<std::string>() ) ; #endif BOOST_CHECK(r()); } {// basic - gen - with const container lref<std::string> m; lref<const std::vector<std::string> > cv = std::vector<std::string>(arr, arr+4); relation r = max_of(cv,m); BOOST_CHECK(r()); BOOST_CHECK(*m=="castor"); BOOST_CHECK(!r()); BOOST_CHECK(!m.defined()); } return 0; }
[ [ [ 1, 34 ], [ 36, 36 ], [ 40, 66 ], [ 68, 68 ], [ 70, 70 ], [ 72, 74 ], [ 76, 78 ], [ 85, 86 ] ], [ [ 35, 35 ], [ 37, 39 ], [ 67, 67 ], [ 69, 69 ], [ 71, 71 ], [ 75, 75 ], [ 79, 84 ] ] ]
1836087624e2567457ae10262053ec03b93f8b85
36bf908bb8423598bda91bd63c4bcbc02db67a9d
/Library/mfcapi.cpp
91262117ebf23f81662e6793d4f762bd7046377c
[]
no_license
code4bones/crawlpaper
edbae18a8b099814a1eed5453607a2d66142b496
f218be1947a9791b2438b438362bc66c0a505f99
refs/heads/master
2021-01-10T13:11:23.176481
2011-04-14T11:04:17
2011-04-14T11:04:17
44,686,513
0
1
null
null
null
null
UTF-8
C++
false
false
1,165
cpp
/* mfcapi.c Implementazione di quanto omesso dall' API (MFC). Luca Piergentili, 13/09/98 [email protected] */ #include "env.h" #include "pragma.h" #include "macro.h" #include "window.h" #include "mfcapi.h" #include "traceexpr.h" //#define _TRACE_FLAG _TRFLAG_TRACEOUTPUT //#define _TRACE_FLAG _TRFLAG_NOTRACE #define _TRACE_FLAG _TRFLAG_NOTRACE #define _TRACE_FLAG_INFO _TRFLAG_NOTRACE #define _TRACE_FLAG_WARN _TRFLAG_NOTRACE #define _TRACE_FLAG_ERR _TRFLAG_NOTRACE #if (defined(_DEBUG) && defined(_WINDOWS)) && (defined(_AFX) || defined(_AFXDLL)) #ifdef PRAGMA_MESSAGE_VERBOSE #pragma message("\t\t\t"__FILE__"("STR(__LINE__)"): using DEBUG_NEW macro") #endif #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif /* AppendFileType() Aggiunge il tipo file alla stringa utilizzata dalla shell. */ void AppendFileType(CString& strFilter,CString& strTypeFilter,LPCSTR lpcszDesc,LPCSTR lpcszExt) { strFilter += lpcszDesc; strFilter += '\0'; strFilter += lpcszExt; strFilter += '\0'; if(!strTypeFilter.IsEmpty()) strTypeFilter += ';'; strTypeFilter += lpcszExt; }
[ [ [ 1, 44 ] ] ]
3770d76bf81fefdf1f1f63b51c284bb7f979c2cc
82afdf1a0de48235b75a9b6ca61c9dbcfefcfafa
/TypeConversion.h
b40a7e15dddad7865b58e00449ab50b67d79afea
[]
no_license
shilrobot/shilscript_plus_plus
eec85d01074ec379da63abe00562d7663c664398
09dbdbdadc28d131fa3c8026b14015336a55ed62
refs/heads/master
2021-01-25T00:17:10.004698
2009-12-16T22:45:52
2009-12-16T22:45:52
2,589,159
0
0
null
null
null
null
UTF-8
C++
false
false
702
h
#ifndef SS_TYPECONVERSION_H #define SS_TYPECONVERSION_H #include "Prereqs.h" namespace SS { class Type; enum ConversionType { CONV_IDENTICAL, CONV_IMPLICIT, CONV_EXPLICIT, CONV_ILLEGAL }; enum ConversionComparison { CC_A_BETTER, CC_B_BETTER, CC_NEITHER_BETTER }; extern ConversionType GetConversionType(const Type* const from, const Type* const to); extern bool CanExplicitlyConvert(const Type* const from, const Type* const to); extern bool CanImplicitlyConvert(const Type* const from, const Type* const to); extern ConversionComparison CompareConversions(const Type* const src, const Type* const a, const Type* const b); } #endif // SS_TYPECONVERSION_H
[ "shilbert@6dcb506c-49f4-8c44-b148-53dce8eab73e" ]
[ [ [ 1, 32 ] ] ]
5c9782b3938d51136558d073a026fee61559017e
49935c0e711e0f9fda45bf9f397059fceb2b616a
/DispozPropoz/inc/Transaction.h
8f3a999af34958cbb1c00729c2942b9846166513
[]
no_license
Arkezis/dispozpropoz
d8262055b64c06d4b4e0253f717abf2c99fb1e92
2db2a20e8de43f15547440f610197d87560a7213
refs/heads/master
2021-01-13T02:36:10.790311
2011-10-16T15:25:15
2011-10-16T15:25:15
32,145,788
0
0
null
null
null
null
UTF-8
C++
false
false
825
h
/* * Transaction.h * * Created on: 15 Oct 2011 * Author: vj */ #ifndef TRANSACTION_H_ #define TRANSACTION_H_ #include <FBase.h> using namespace Osp::Base; class Transaction { public: Transaction(); virtual ~Transaction(); public: //Create transaction information. Return false if there is an error. static Transaction CreateTransaction(Integer itemId, Integer proposerId, Integer borrowerId, String comment, Integer rating); //Load the transaction information corresponding to this id. static Transaction GetTransaction(Integer id); //private: //svj: decided to make this public for now to avoid getters/setters public: Integer itemId; Integer proposerId; Integer borrowerId; String comment; Integer rating; Integer id; }; #endif /* TRANSACTION_H_ */
[ "[email protected]@5a97ccac-b474-ded1-4a52-e8af14ae9110" ]
[ [ [ 1, 39 ] ] ]
f9b01f50d8fd8907e55c4825751cb7526073d64e
33cdd09e352529963fe8b28b04e0d2e33483777b
/trunk/LMPlugin/TEmpty_Cedents_Recordset.cpp
d328bc0a08870563cb1d4bced46fe5b256fcd6b4
[]
no_license
BackupTheBerlios/reportasistent-svn
20e386c86b6990abafb679eeb9205f2aef1af1ac
209650c8cbb0c72a6e8489b0346327374356b57c
refs/heads/master
2020-06-04T16:28:21.972009
2010-05-18T12:06:48
2010-05-18T12:06:48
40,804,982
0
0
null
null
null
null
UTF-8
C++
false
false
5,124
cpp
// TEmpty_Cedents_Recordset.cpp : implementation file // /* This file is part of LM Report Asistent. Authors: Jan Dedek, Jan Kodym, Martin Chrz, Iva Bartunkova LM Report Asistent 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. LM Report Asistent 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 LM Report Asistent; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "TEmpty_Cedents_Recordset.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // TEmpty_Cedents_Recordset IMPLEMENT_DYNAMIC(TEmpty_Cedents_Recordset, CRecordset) TEmpty_Cedents_Recordset::TEmpty_Cedents_Recordset(CDatabase* pdb) : CRecordset(pdb) { //{{AFX_FIELD_INIT(TEmpty_Cedents_Recordset) m_TaskID = 0; m_Name = _T(""); m_TaskSubTypeID = 0; m_TaskGroupID = 0; m_UserID = 0; m_MatrixID = 0; m_ParamBASE = 0; m_ParamBASERelativ = FALSE; m_ReadOnly = FALSE; m_HypothesisGenerated = FALSE; m_GenerationInterrupted = FALSE; m_GenerationNrOfTests = 0; m_GenerationTotalTime = 0; m_Notice = _T(""); m_CedentDID = 0; m_TaskID2 = 0; m_CedentTypeID = 0; m_Name2 = _T(""); m_Ord = 0; m_MinLen = 0; m_MaxLen = 0; m_Notice2 = _T(""); m_MatrixID2 = 0; m_Name3 = _T(""); m_Initialised = FALSE; m_RecordCount = 0; m_Notice3 = _T(""); m_wSavedCountUsed = 0; m_CedentTypeID2 = 0; m_Name4 = _T(""); m_ShortName = _T(""); m_Ord2 = 0; m_Notice4 = _T(""); m_TaskSubTypeID2 = 0; m_Name5 = _T(""); m_ShortName2 = _T(""); m_Ord3 = 0; m_Notice5 = _T(""); m_nFields = 39; //}}AFX_FIELD_INIT m_nDefaultType = snapshot; } CString TEmpty_Cedents_Recordset::GetDefaultSQL() { return _T("[taTask],[tdCedentD],[tmMatrix],[tsCedentType],[tsTaskSubType]"); } void TEmpty_Cedents_Recordset::DoFieldExchange(CFieldExchange* pFX) { //{{AFX_FIELD_MAP(TEmpty_Cedents_Recordset) pFX->SetFieldType(CFieldExchange::outputColumn); RFX_Long(pFX, _T("[taTask].[TaskID]"), m_TaskID); RFX_Text(pFX, _T("[taTask].[Name]"), m_Name); RFX_Long(pFX, _T("[taTask].[TaskSubTypeID]"), m_TaskSubTypeID); RFX_Long(pFX, _T("[TaskGroupID]"), m_TaskGroupID); RFX_Long(pFX, _T("[UserID]"), m_UserID); RFX_Long(pFX, _T("[taTask].[MatrixID]"), m_MatrixID); RFX_Long(pFX, _T("[ParamBASE]"), m_ParamBASE); RFX_Bool(pFX, _T("[ParamBASERelativ]"), m_ParamBASERelativ); RFX_Bool(pFX, _T("[ReadOnly]"), m_ReadOnly); RFX_Bool(pFX, _T("[HypothesisGenerated]"), m_HypothesisGenerated); RFX_Bool(pFX, _T("[GenerationInterrupted]"), m_GenerationInterrupted); RFX_Long(pFX, _T("[GenerationNrOfTests]"), m_GenerationNrOfTests); RFX_Date(pFX, _T("[GenerationStartTime]"), m_GenerationStartTime); RFX_Long(pFX, _T("[GenerationTotalTime]"), m_GenerationTotalTime); RFX_Text(pFX, _T("[taTask].[Notice]"), m_Notice); RFX_Long(pFX, _T("[CedentDID]"), m_CedentDID); RFX_Long(pFX, _T("[tdCedentD].[TaskID]"), m_TaskID2); RFX_Long(pFX, _T("[tdCedentD].[CedentTypeID]"), m_CedentTypeID); RFX_Text(pFX, _T("[tdCedentD].[Name]"), m_Name2); RFX_Long(pFX, _T("[tdCedentD].[Ord]"), m_Ord); RFX_Long(pFX, _T("[MinLen]"), m_MinLen); RFX_Long(pFX, _T("[MaxLen]"), m_MaxLen); RFX_Text(pFX, _T("[tdCedentD].[Notice]"), m_Notice2); RFX_Long(pFX, _T("[tmMatrix].[MatrixID]"), m_MatrixID2); RFX_Text(pFX, _T("[tmMatrix].[Name]"), m_Name3); RFX_Bool(pFX, _T("[Initialised]"), m_Initialised); RFX_Long(pFX, _T("[RecordCount]"), m_RecordCount); RFX_Text(pFX, _T("[tmMatrix].[Notice]"), m_Notice3); RFX_Long(pFX, _T("[wSavedCountUsed]"), m_wSavedCountUsed); RFX_Long(pFX, _T("[tsCedentType].[CedentTypeID]"), m_CedentTypeID2); RFX_Text(pFX, _T("[tsCedentType].[Name]"), m_Name4); RFX_Text(pFX, _T("[tsCedentType].[ShortName]"), m_ShortName); RFX_Long(pFX, _T("[tsCedentType].[Ord]"), m_Ord2); RFX_Text(pFX, _T("[tsCedentType].[Notice]"), m_Notice4); RFX_Long(pFX, _T("[tsTaskSubType].[TaskSubTypeID]"), m_TaskSubTypeID2); RFX_Text(pFX, _T("[tsTaskSubType].[Name]"), m_Name5); RFX_Text(pFX, _T("[tsTaskSubType].[ShortName]"), m_ShortName2); RFX_Long(pFX, _T("[tsTaskSubType].[Ord]"), m_Ord3); RFX_Text(pFX, _T("[tsTaskSubType].[Notice]"), m_Notice5); //}}AFX_FIELD_MAP } ///////////////////////////////////////////////////////////////////////////// // TEmpty_Cedents_Recordset diagnostics #ifdef _DEBUG void TEmpty_Cedents_Recordset::AssertValid() const { CRecordset::AssertValid(); } void TEmpty_Cedents_Recordset::Dump(CDumpContext& dc) const { CRecordset::Dump(dc); } #endif //_DEBUG
[ "chrzm@fded5620-0c03-0410-a24c-85322fa64ba0" ]
[ [ [ 1, 146 ] ] ]
1d9d1a8b893e6e4090447403f7bb04bc064b1ce8
8a3fce9fb893696b8e408703b62fa452feec65c5
/GServerEngine/GameAi/GameAi/Engine/Public/Vector2D.h
5639511bb474c26ff15e720ce5483bfd00084d07
[]
no_license
win18216001/tpgame
bb4e8b1a2f19b92ecce14a7477ce30a470faecda
d877dd51a924f1d628959c5ab638c34a671b39b2
refs/heads/master
2021-04-12T04:51:47.882699
2011-03-08T10:04:55
2011-03-08T10:04:55
42,728,291
0
2
null
null
null
null
GB18030
C++
false
false
4,392
h
/* * File : * Brief : 一个2维向量 * Author: Expter * Creat Date: [2010/2/24] */ #pragma once #include <limits> #include <cmath> #define pi 3.1415926 #define tol 0.0000001 //(std::numeric_limits<double>::min)() class Vector2D { public: Vector2D(): x(0.0),y(0.0) { } Vector2D(double a ,double b ) : x ( a ) , y ( b ) { } Vector2D(const Vector2D& rhs ) { x = rhs.x , y = rhs.y ; } void Zero(); bool IsZero() const ; /// 求模的大小 inline double Length() const ; /// inline double LengthSq() const; /// 格式化 inline void Normalize(); /// 点乘 inline double Dot( const Vector2D& v2) const; /// 根据v2向量在当前向量的上还是下方 inline int Sign(const Vector2D& v2) const; /// 返回当前向量的垂直向量 inline Vector2D Perp()const; /// 切取向量长度小于等于max inline void Truncate( double max ); /// 计算距离2个向量距离 inline double Distance( const Vector2D& v2 )const; inline double DistanceSq( const Vector2D& v2)const; /// 根据v2计算得到反射向量 inline void Reflect( const Vector2D& v2) ; /// 得到反向量 inline Vector2D GetReverse() const; Vector2D& operator+= ( const Vector2D& rhs ); Vector2D& operator-= ( const Vector2D& rhs ); Vector2D& operator/= ( double rhs ); Vector2D& operator*= ( double rhs ); bool operator!= ( const Vector2D& rhs ); bool operator== ( const Vector2D& rhs ); friend Vector2D operator * (const Vector2D& a , double vsys ); friend Vector2D operator * ( double vsys , const Vector2D& b ); friend Vector2D operator / (const Vector2D& a , double vsys ); friend Vector2D operator + (const Vector2D& a , const Vector2D& b ); friend Vector2D operator - (const Vector2D& a , const Vector2D& b ); private: public: double x , y; /// x,y坐标 double z ; /// 代表方向 }; inline Vector2D Vec2DNormalize(const Vector2D &v) { Vector2D vec = v; double vector_length = vec.Length(); if (vector_length > std::numeric_limits<double>::epsilon()) { vec.x /= vector_length; vec.y /= vector_length; } return vec; } inline double Vec2DDistance(const Vector2D &v1, const Vector2D &v2) { double ySeparation = v2.y - v1.y; double xSeparation = v2.x - v1.x; return sqrt(ySeparation*ySeparation + xSeparation*xSeparation); } inline double Vec2DDistanceSq(const Vector2D &v1, const Vector2D &v2) { double ySeparation = v2.y - v1.y; double xSeparation = v2.x - v1.x; return ySeparation*ySeparation + xSeparation*xSeparation; } inline double Vec2DLength(const Vector2D& v) { return sqrt(v.x*v.x + v.y*v.y); } inline double Vec2DLengthSq(const Vector2D& v) { return (v.x*v.x + v.y*v.y); } inline Vector2D POINTStoVector(const POINTS& p) { return Vector2D(p.x, p.y); } inline Vector2D POINTtoVector(const POINT& p) { return Vector2D((double)p.x, (double)p.y); } inline POINTS VectorToPOINTS(const Vector2D& v) { POINTS p; p.x = (short)v.x; p.y = (short)v.y; return p; } inline POINT VectorToPOINT(const Vector2D& v) { POINT p; p.x = (long)v.x; p.y = (long)v.y; return p; } inline void WrapAround(Vector2D &pos, int MaxX, int MaxY) { if (pos.x > MaxX) {pos.x = 0.0;} if (pos.x < 0) {pos.x = (double)MaxX;} if (pos.y < 0) {pos.y = (double)MaxY;} if (pos.y > MaxY) {pos.y = 0.0;} } /// p不在top_left,bot_rgt内 inline bool NotInsideRegion(Vector2D p, Vector2D top_left, Vector2D bot_rgt) { return (p.x < top_left.x) || (p.x > bot_rgt.x) || (p.y < top_left.y) || (p.y > bot_rgt.y); } /// p在top_left,bot_rgt内 inline bool InsideRegion(Vector2D p, Vector2D top_left, Vector2D bot_rgt) { return !NotInsideRegion(p,top_left,bot_rgt); } /// p在top,left,bot,rgt内 inline bool InsideRegion(Vector2D p, int left, int top, int right, int bottom) { return !( (p.x < left) || (p.x > right) || (p.y < top) || (p.y > bottom) ); } inline bool isSecondInFOVOfFirst(Vector2D posFirst, Vector2D facingFirst, Vector2D posSecond, double fov) { Vector2D toTarget = Vec2DNormalize(posSecond - posFirst); return facingFirst.Dot(toTarget) >= cos(fov/2.0); }
[ [ [ 1, 208 ] ] ]
05410659ee1936dbb970c41304197d32b8e061e2
3d7d8969d540b99a1e53e00c8690e32e4d155749
/EngInc/IEEngineImp.h
24b96aada30f73206d42d6fc9ad196741e0028cc
[]
no_license
SymbianSource/oss.FCL.sf.incubator.photobrowser
50c4ea7142102068f33fc62e36baab9d14f348f9
818b5857895d2153c4cdd653eb0e10ba6477316f
refs/heads/master
2021-01-11T02:45:51.269916
2010-10-15T01:18:29
2010-10-15T01:18:29
70,931,013
0
0
null
null
null
null
UTF-8
C++
false
false
5,366
h
/* * 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: Juha Kauppinen, Mika Hokkanen * * Description: Photo Browser * */ #ifndef __IEENGINEIMP_H__ #define __IEENGINEIMP_H__ #define _FACEBROWSING // Include files #include <e32cons.h> #include <e32base.h> #include <F32file.h> #include <FBS.h> #include <IEEngine.h> #include <IEImageProcessing.h>//thumbnail client #include <exifmodify.h> #ifdef IMAGE_EDITOR #include "IEEditor.h" #endif #include "IEBitmapLoader.h" #include "IEFileloader.h" #include "IEBgpsController.h" #include "ImagicConsts.h" #include "IEEngineUtils.h" //#ifdef _S60_5x_ACCELEROMETER_ #include "IESensorMonitor.h" //#endif // Forward class declarations #ifdef IMAGE_EDITOR class CIEEditor; #endif class CIEFileLoader; class CIEBitmapLoader; class CIETNController; class CIEImageProcessing; class CImageData; class CIEEngineUtils; class MBitmapLoaderObserver; //#ifdef _S60_5x_ACCELEROMETER_ //class TSensrvOrientationData; //#endif // Class declaration class CIEEngineImp : public CIEEngine, public MBitmapLoaderObserver , public MIEBgpsControllerObserver #ifdef _ACCELEROMETER_SUPPORTED_ ,public MIESensorMonitorObserver #endif #ifdef IMAGE_EDITOR , public MIEObserver #endif { public: // First phase constructor and destructor static CIEEngineImp* NewL(MIEEngineObserver& aObserver); ~CIEEngineImp(); private: // Second phase constructot and C++ default constructor void ConstructL(); CIEEngineImp(MIEEngineObserver& aObserver); public: // From CIEEngine // General Functions void SetDBChanged(CImageData* aImageData); TInt GetTotalNumOfImages(); void GetTotalNumOfImages(TInt& aNumOfImages, TInt& aNumOfFaces); TInt DeleteFile(TInt aIndex); TInt GetImageName(const TInt aIndex, TFileName& aFileName, TThumbSize aThumbRes); void GetBitmapL(CImageData* aImageData, CFbsBitmap* aBitmap, TThumbSize aThumbRes); void SetImageDataMode(TImageArrayMode aMode); void AppUIReady(); void CancelFullSizeLoading(); //New functions for handling UI access to Filename array CImageData* GetImageData(TInt aIndex); void SetImageData(TInt aIndex, CImageData* aGridData); TBool IsScanningFiles() const; CIEImageList& GetImageList(); // TN related functions void GetFileNameL(const TInt aIndex, TThumbSize aThumbRes, TFileName& aFilename); void StopTNGeneration(TInt &aValue); TReal GetAspectRatio(TInt aIndex); TReal GetFacesAspectRatio(TInt aIndex); void GenerateThumbNailL(const TDes &aOrgFile, TThumbSize aTNResolution); // Face Detection related functions void GetFaceCoordinates(const TFileName a128x128TNFileName, RArray<TRect>& aFaceCoordinateArray); void RemoveFaceCoordinate(const TFileName a128x128TNFileName, RArray<TRect>& aCordArray); void GetSingleFaceCoordinates(TInt aIndex, const TFileName aTNFileName, RArray<TRect>& aFaceCoordinateArray); public: //From MBitmapLoaderObserver CIEFileLoader* GetFileLoader(); void BitmapsLoadedL(TInt aError); public: // From inline void Something(){}; void TNGenerationComplete(TThumbSize aTNRes); void SingleTNGenerationComplete(TInt aIndex, TThumbSize aTNRes); void FaceDetectionComplete(); void SingleFaceDetectionComplete(); void SetGridRotationAngle(TReal aAngle); TBool IsAccelerometerExists(); #ifdef _ACCELEROMETER_SUPPORTED_ void SensorDataAvailable(TImagicDeviceOrientation aOrientation, TBool aValue); void SetImageRotation(TInt aIndex); TImagicDeviceOrientation GetDeviceOrientation(); void SetDeviceOrientation(TImagicDeviceOrientation aOrientation); void StartAccSensorMonitoring(); void StopAccSensorMonitoring(); #endif public: // New public functions CIEEngineUtils *GetEngineUtils(); void AllFilesAddedToFilenameArrayL(); MIEEngineObserver& GetObserver(); TInt GetSelectedImageIndex(); void Stop(); TBool IsRunning(); TInt GetGleMaxRes(); private: void AddImageToFaceNameArray(); private: MIEEngineObserver& iEngineObserver; RFs iFileServer; #ifdef IMAGE_EDITOR CIEEditor* iImageEditor; #endif CIEFileLoader* iFileLoader; CIEBitmapLoader* iBitmapLoader; CIEEngineUtils iIEEngineUtils; CIEBgpsController* iIEBgpsController; TBool iAllFilesScanned; #ifdef _ACCELEROMETER_SUPPORTED_ CIESensorMonitor* iSensorMonitor; TImagicDeviceOrientation iPrevDeviceOrientation; TImagicDeviceOrientation iDeviceOrientation; #endif TIEEditingMode iEditingMode; TIEEditingMode iCurrentEditingMode; TBool iImageEdited; CIEImageProcessing* iIEBgpsClient; RCriticalSection iCritical; TFileName iSavedFileName; TImageArrayMode iImageArrayMode; RArray<TFileName> iCroppedFilenames; }; #endif // __IEENGINEIMP_H__
[ "none@none" ]
[ [ [ 1, 172 ] ] ]