p4result.h #1

  • //
  • guest/
  • perforce_software/
  • p4ruby/
  • main/
  • p4result.h
  • View
  • Commits
  • Open Download .zip Download (3 KB)
/*******************************************************************************

Copyright (c) 1997-2004, Perforce Software, Inc.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1.  Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

2.  Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTR
IBUTORS "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 PERFORCE SOFTWARE, INC. 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.

*******************************************************************************/

/*******************************************************************************
 * Name		: p4result.h
 *
 * Author	: Tony Smith <[email protected]> or <[email protected]>
 *
 * Description	: C++ class for holding results of Perforce commands 
 *
 ******************************************************************************/

class P4Result
{
    public:

    P4Result();
    
    // Setting
    void	AddOutput( const char *msg );
    void	AddOutput( VALUE out );
    void	AddError( Error *e );

    // Getting
    VALUE	GetOutput()	{ return output;	}
    VALUE	GetErrors()	{ return errors;	}
    VALUE	GetWarnings()	{ return warnings;	}

    // Get errors/warnings as a formatted string
    void	FmtErrors( StrBuf &buf );
    void	FmtWarnings( StrBuf &buf );

    // Testing
    int		ErrorCount();
    int		WarningCount();

    // Clear previous results
    void	Reset();

    // Ruby garbage collection
    void	GCMark();

    private:
    int		Length( VALUE ary );
    void	Fmt( const char *label, VALUE ary, StrBuf &buf );

    VALUE	output;
    VALUE	warnings;
    VALUE	errors;
};
# Change User Description Committed
#8 14682 Git Fusion Git Fusion branch management

Imported from Git
 ghost-of-change-num: 960958
 ghost-of-sha1: 005052ae424bd69f426f7209e741ca1c8c3253c7
 ghost-precedes-sha1: ad052c71a568ef12165e143a6866ad9ceffbb4a1
 parent-branch: None@960958
 push-state: incomplete
#7 14622 jmistry Pull 10.2 changes to main

Pick up missing changes in p10.2 and integrate to main.

As part of the integrate I also moved the unit tests '16_streams.rb' and
'17_streaming_handler.rb' because the integration introduced collisions with
the unit test names. Updated MANIFEST with new names for unit tests and also
added '98_unicode.rb', which was missing from it.
#6 14589 Sven Erik Knop Pulled P4Ruby p10.2 changes back to main.
#5 14583 psoccard Added support for -Ztrack
#4 14579 tony Make new class P4::Message for returning Error objects
to the user. Currently handles errors and warnings, but
could potentially be used for output too (might bloat
people's code though).

Essentially, if you're using a 2010.2 or later client,
or if you've set your api_level to 68 or higher, the
P4#errors and P4#warnings arrays will be populated
with P4::Message objects instead of strings. Users of
older API's, or those who set their api_level to 67
or lower in their scripts will get the old behaviour.

P4::Message objects have the following methods:

  severity() - returns the severity
  generic()  - returns the generic code
  to_s()     - converts the message to a string
  inspect()  - returns a string showing the message details.

User-visible enhancement documented in p4rubynotes.txt
#3 14541 tony Copyright notice housekeeping: update all notices to 2008, and
correct start date from 1997 to 2001 when P4Ruby was first released
from the public depot.

No functional change
#2 14521 tony Update copyright notices in all applicable P4Ruby files.
#1 14480 tony Add P4Ruby 1.5944 to main as start-point for the first
productized release of P4Ruby