"Fossies" - the Fresh Open Source Software Archive

Member "cups-2.3rc1/ppdc/ppdc-mediasize.cxx" (21 May 2019, 1599 Bytes) of package /linux/misc/cups-2.3rc1-source.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ppdc-mediasize.cxx" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.2.11_vs_2.3b8.

    1 //
    2 // Shared media size class for the CUPS PPD Compiler.
    3 //
    4 // Copyright 2007-2009 by Apple Inc.
    5 // Copyright 2002-2005 by Easy Software Products.
    6 //
    7 // Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
    8 //
    9 
   10 //
   11 // Include necessary headers...
   12 //
   13 
   14 #include "ppdc-private.h"
   15 
   16 
   17 //
   18 // 'ppdcMediaSize::ppdcMediaSize()' - Create a new media size.
   19 //
   20 
   21 ppdcMediaSize::ppdcMediaSize(const char *n, // I - Name of media size
   22                              const char *t, // I - Text of media size
   23                  float      w,  // I - Width in points
   24                  float      l,  // I - Length in points
   25                              float      lm, // I - Left margin in points
   26                  float      bm, // I - Bottom margin in points
   27                  float      rm, // I - Right margin in points
   28                  float      tm, // I - Top margin in points
   29                  const char *sc,    // I - PageSize code, if any
   30                  const char *rc)    // I - PageRegion code, if any
   31   : ppdcShared()
   32 {
   33   PPDC_NEW;
   34 
   35   name        = new ppdcString(n);
   36   text        = new ppdcString(t);
   37   width       = w;
   38   length      = l;
   39   left        = lm;
   40   bottom      = bm;
   41   right       = rm;
   42   top         = tm;
   43   size_code   = new ppdcString(sc);
   44   region_code = new ppdcString(rc);
   45 
   46   if (left < 0.0f)
   47     left = 0.0f;
   48   if (bottom < 0.0f)
   49     bottom = 0.0f;
   50   if (right < 0.0f)
   51     right = 0.0f;
   52   if (top < 0.0f)
   53     top = 0.0f;
   54 }
   55 
   56 
   57 //
   58 // 'ppdcMediaSize::~ppdcMediaSize()' - Destroy a media size.
   59 //
   60 
   61 ppdcMediaSize::~ppdcMediaSize()
   62 {
   63   PPDC_DELETE;
   64 
   65   name->release();
   66   text->release();
   67   size_code->release();
   68   region_code->release();
   69 }