home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 February / PCO_0299.ISO / filesbbs / dos / indigo01.exe / FIDO.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-21  |  1.4 KB  |  55 lines

  1. // This program is free software; you can redistribute it and/or modify it
  2. // under the terms of the GNU General Public License as published by the Free
  3. // Software Foundation; either version 2 of the License, or (at your option)
  4. // any later version.
  5.  
  6. // You should have received a copy of the GNU General Public License along
  7. // with this program; if not, write to the Free Software Foundation, Inc., 675
  8. // Mass Ave, Cambridge, MA 02139, USA.
  9.  
  10. // fido.cpp
  11. // Routines for Fidonet addresses.
  12.  
  13. #include "fido.h"
  14.  
  15. // constructor
  16. // Initializes address to zero.
  17. FidoAddress::FidoAddress()
  18. {
  19.     zone = net = node = point = 0;
  20. }
  21.  
  22. // constructor
  23. // Initializes address to the one given.
  24. FidoAddress::FidoAddress(unsigned z, unsigned n, unsigned f, unsigned p)
  25.     : zone(z), net(n), node(f), point(p)
  26. {
  27.     // null
  28. }
  29.  
  30. // method: =
  31. // Assignes an address from another address.
  32. void FidoAddress::operator=(FidoAddress &addr)
  33. {
  34.     zone = addr.zone;
  35.     net = addr.net;
  36.     node = addr.node;
  37.     point = addr.point;
  38. }
  39.  
  40. // method: ==
  41. // Compares two addresses.
  42. int FidoAddress::operator==(FidoAddress &addr)
  43. {
  44.     return zone == addr.zone && net == addr.net && node == addr.node &&
  45.            point == addr.point;
  46. }
  47.  
  48. // Routine to print address on a stream.
  49. ostream &operator<<(ostream &stream, FidoAddress &addr)
  50. {
  51.     stream << addr.zone << ':' << addr.net << '/' << addr.node
  52.            << '.' << addr.point;
  53.     return stream;
  54. }
  55.