Exemple #1
0
 // Copy Constructor
 Good::Good(const Good& other) {
   upc(other._upc);
   name(other._name);
   price(other._price);
   qtyNeeded(other._qtyNeeded);
   taxed(other._taxed);
   quantity(other._quantity);
 }
Exemple #2
0
 Good::Good(const char* u, const char* n, double p, int q, bool t) {
   upc(u);
   name(n);
   price(p);
   qtyNeeded(q);
   taxed(t);
   quantity(0);
 }
Exemple #3
0
  // operator=
   Item& Item::operator=(const Item& RO){
      upc(RO._upc);
      name(RO._name);
      price(RO._price);
      quantity(RO._quantity);
      taxed(RO._taxed);
      qtyNeeded(RO._qtyNeeded);

      return *this;
   }
Exemple #4
0
 // Assignment Operator=
 Good& Good::operator=(const Good& other) {
   if (this != &other) {
     upc(other._upc);
     name(other._name);
     price(other._price);
     qtyNeeded(other._qtyNeeded);
     taxed(other._taxed);
     quantity(other._quantity);
   }
   return *this;
 }
Exemple #5
0
static Popot po_stristr(Popot s1, Popot s2)
/*****************************************************************************
 * char *stristr(char *string, char *substring)
 ****************************************************************************/
{
	char *p1 = NULL, *p2 = NULL;
	char *res;

	if (s1.pt == NULL || s2.pt == NULL)
		{
		builtin_err = Err_null_ref;
		goto ERR;
		}
	if ((p1 = clone_string(s1.pt)) == NULL)
		{
		builtin_err = Err_no_memory;
		goto ERR;
		}
	if ((p2 = clone_string(s2.pt)) == NULL)
		{
		builtin_err = Err_no_memory;
		goto ERR;
		}
	upc(p1);
	upc(p2);
	if ((res = strstr(p1,p2)) == NULL)
		goto ERR;
	s1.pt = OPTR(s1.pt,res-p1);
	goto OUT;
ERR:
	s1.pt = s1.min = s1.max = NULL;
OUT:
	pj_gentle_free(p1);
	pj_gentle_free(p2);
	return(s1);
}
Exemple #6
0
    //==================================================
    // copyFromSource
    //
    // This function deeps copy data from the source into this object. Can be used for copy constructor and
    // assignment operators
    //==================================================
    Good& Good::copyFromSource (const Good& source) {
        char tmpUpc  [MAX_UPC_LEN + 1];
        char tmpName [2000];

        strncpy (tmpUpc,  source.upc  (), MAX_UPC_LEN);
        strncpy (tmpName, source.name (), 2000);

        upc       (tmpUpc);
        name      (tmpName);
        price     (source.price     ());
        quantity  (source.quantity  ());
        taxed     (source.taxed     ());
        qtyNeeded (source.qtyNeeded ());

        return *this;
    }
Exemple #7
0
 //==================================================
 // Member operators
 //==================================================
 bool Good::operator == (const char* upcToCompare) {
     return (strcmp (upcToCompare, upc ()) == 0);
 }