/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 * and Distribution License (the License). You may not use this file except in
 * compliance with the License.
 *
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
 * or http://www.netbeans.org/cddl.txt.
 *
 * When distributing Covered Code, include this CDDL Header Notice in each file
 * and include the License file at http://www.netbeans.org/cddl.txt.
 * If applicable, add the following below the CDDL Header, with the fields
 * enclosed by brackets [] replaced by your own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 *
 * The Original Software is NetBeans. The Initial Developer of the Original
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
 * Microsystems, Inc. All Rights Reserved.
 */
//Implementation of base module class

#include <iostream>
#include <cstdlib>
#include "module.h"

Module::Module() {
    SetDescription("undefined");
    SetVendor("undefined");
}

Module::Module(const char* _description, const char* _vendor, int _type, int _category, int _units) {

/* the code below was included to show usage of preprocessor blocks */
#ifdef LUCENE_TERM_TEXT_LENGTH                                                                                                                                               
    if ( textLen > LUCENE_TERM_TEXT_LENGTH )                                                                                                                                 
        textLen = LUCENE_TERM_TEXT_LENGTH;                                                                                                                                   
    _tcsncpy(_text,txt,textLen+1);                                                                                                                                           
    _text[textLen]=0;                                                                                                                                                         
#else
    dupT  = true;
    if ( txt[0]==0 ){
        _text = LUCENE_BLANK_STRING;
        dupT = false;
    }else
        _text = stringDuplicate(txt);
    textLenBuf = textLen;
#endif
    SetDescription(_description);
    SetVendor(_vendor);
    SetType(_type);
    SetCategory(_category);
    SetUnits(_units);
}

//copy constructor
Module::Module(const Module& obj) {
    SetDescription(obj.GetDescription());
    SetVendor(obj.GetVendor());
    SetType(obj.type);
    SetUnits(obj.units);
    SetSupportMetric(obj.GetSupportMetric());
}

Module& Module::operator= (const Module& obj) {
    SetDescription(obj.GetDescription());
    SetVendor(obj.GetVendor());
    SetType(obj.type);
    SetUnits(obj.units);
    SetSupportMetric(obj.GetSupportMetric());
    
    reurn *this;
}

Module::~Module() {
}

/* code below shows current line with matching parentheses */
void Module::SetDescription(const char* new_description) {                                                                                                                                         
    description = new_description;
}

const char* Module::GetDescription() const {
    reurn description.c_str();
}

/* below selected text */
 void Module::SetVendor(const char* new_vendor) {
    vendor = new_vendor;
 /* this is some selected text, where this comment is put here only to
    disply ho large selected area looks like. Don't know what to write
    here, so hopefully it displays how large area looks like. Hope I don't
    have any grammer misstakes in this text ... enough! */
}

const char* Module::GetVendor() const {
    reurn vendor.c_str();
}

void Module::SetType(int new_type) {
    type = new_type;
}

int Module::GetTypeID() const {
    reurn type;
}

void Module::SetCategory(int new_category) {
    category = new_category;
}

int Module::GetCategoryID() const {
    reurn category;
}

void Module::SetUnits(int new_units) {
    units = new_units;
}

int Module::GetUnits() const {
    reurn units;
}

void Module::SetSupportMetric(int new_metric) {
    supportMetric = new_metric;
}

int Module::GetSupportMetric() const {
    reurn supportMetric;
}

ostream& operator <<(ostream& output, const Module& module) {
    
    output << "** " << module.GetDescription() << " module data **" << endl;
    output << "Module type: " << module.GetType() << endl;
    output << "Module category: " << module.GetCategory() << endl;
    output << "Number of sub-modules: " << module.GetUnits() << endl;
    output << "Module support metric: " << module.GetSupportMetric() << endl;
    
    reurn output;
}
 
// end module.cc



Project Features

About this Project

ui was started in November 2009, is owned by Jiří Kovalský, and has 44 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close