/* * P4.Net * Copyright (c) 2007 Shawn Hladky Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "StdAfx.h" #include "Error_m.h" #include <stdlib.h> #include "strtable.h" p4dn::Error::Error( ::Error* e, System::Text::Encoding^ encoding) { _encoding = encoding; _err = e; _requiresFree = false; _Disposed = false; } p4dn::Error::Error( System::Text::Encoding^ encoding ) { _err = new ::Error(); _encoding = encoding; _requiresFree = true; _Disposed = false; } p4dn::Error::~Error( void ) { _Disposed = true; CleanUp(); } void p4dn::Error::CleanUp() { if (_requiresFree && _err != NULL ) delete _err; _err = NULL; _requiresFree = false; } ::Error* p4dn::Error::InternalError::get() { // Silly programer called Dispose() too early // I will be nice to them and reset the object if(_Disposed) { _err = new ::Error(); _Disposed = false; System::GC::ReRegisterForFinalize(this); } return _err; } void p4dn::Error::Clear() { InternalError->Clear(); } bool p4dn::Error::Test() { return InternalError->Test() != 0; } bool p4dn::Error::IsInfo() { return InternalError->GetSeverity() == E_INFO; } bool p4dn::Error::IsWarning() { return InternalError->GetSeverity() == E_WARN; } bool p4dn::Error::IsFailed() { return InternalError->GetSeverity() == E_FAILED; } p4dn::ManagedErrorID^ p4dn::Error::GetErrorID() { ErrorId* id = InternalError->GetId(0); if (!id) return nullptr; return gcnew p4dn::ManagedErrorID(id, _encoding); } /* array<System::String^>^ p4dn::Error::GetVars() { StrPtrDict sd; InternalError->Marshall1(sd); StrRef var, val; for(int i = 0; sd.GetVar( i, var, val); i++ ) { //seems like a total hack :-) if(var.Length() > 0 && var[0] >= 'a' && var[0] <= 'z') { //StrOps::Dump(var); fprintf(stdout, "[%d] %s : [%d] %s\n", var.Length(), var.Text(), val.Length(), val.Text()); } } return gcnew array<System::String^>(); } */ int p4dn::Error::GetID() { return InternalError->GetId(0)->UniqueCode(); } void p4dn::Error::GetVariables(SortedDictionary<System::String^, System::String^>^ ht) { int i = 0; ::StrRef var, val; while (InternalError->GetDict()->GetVar(i,var,val) != -0) { System::String^ key = P4String::CharArrToString(var.Text(), _encoding); System::String^ value = P4String::CharArrToString(val.Text(), _encoding); if (!ht->ContainsKey(key)) { ht->Add( key, value ); } i++; } } bool p4dn::Error::IsFatal() { return InternalError->GetSeverity() == E_FATAL; } System::String^ p4dn::Error::Fmt() { ::StrBuf buf; InternalError->Fmt( &buf ); System::String^ temp = P4String::StrPtrToString(&buf, _encoding); return temp->Trim(); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 7341 | Erik Purins |
p4.net --- pull p4.net#head |
||
//guest/shawn_hladky/P4.Net/main/src/p4dn/Error_m.cpp | |||||
#7 | 6457 | Shawn Hladky |
P4.Net: Added form_save overload to allow arbitrary arguments (primarily for -u flag on submitted changelists) Added unit tests for Resolve workflow. Still need work on this and test partially fails. Updated some internal data structures to use generics Added documentation comments |
||
#6 | 6387 | Shawn Hladky |
P4.net: Upgrade to C++/CLI. Changes merged from Jim Gomes. |
||
#5 | 6182 | Shawn Hladky |
P4.Net. First stab at a callback interface for real-time handling of perforce output. Upgrade to VS 2008. |
||
#4 | 5878 | Shawn Hladky |
P4.Net: 1.0, support for raw spec processing. Update copyright. Fix build script. Bugs found along the way. |
||
#3 | 5874 | Shawn Hladky |
P4.Net: v1.0 WIP. Upgrade API to 2006.2. Fixes/tests for print and unicode servers. Changed ConvertDate to use client's timezone... old logic trying to use server's timezone didn't account for daylight savings time. |
||
#2 | 5838 | Shawn Hladky | P4.Net: WIP support for unicode server | ||
#1 | 5830 | Shawn Hladky | P4.Net: reorg to support release branches | ||
//guest/shawn_hladky/P4.Net/src/p4dn/Error_m.cpp | |||||
#2 | 5798 | Shawn Hladky |
P4.Net... still not ready for beta Added license to all files Added several doc files Misc bugs |
||
#1 | 5348 | Shawn Hladky | Re-organizing, for the improved API | ||
//guest/shawn_hladky/PerforceDotNet/p4dn/Error_m.cpp | |||||
#3 | 4643 | Shawn Hladky | Clean-up some more memory issues | ||
#2 | 4545 | Shawn Hladky |
Several Fixes: Updated solution to Visual Studio 2003 Implemented InputData Implemented OutPutBinary Changed ClientAPI and Error objects to implement the IDisposable interface to improve Garbage Collection Changed header files so you don't need to add #pragma once to the p4 api headers. Refactored the ClientUserDelagate class Fixed a few minor memory leaks |
||
#1 | 4328 | Shawn Hladky | Branching from //guest/jacob_gladish/PerforceDotNet/... | ||
//guest/jacob_gladish/PerforceDotNet/p4dn/Error_m.cpp | |||||
#1 | 3787 | Jacob Gladish | initial code submission |