/* * Copyright (c) 2002 by Cliff Green. All rights reserved. Individual files * may be covered by other copyrights (as noted in the file itself). * * Redistribution and use in source and binary forms are permitted * provided that this entire copyright notice is duplicated in all such * copies. * * This software is provided "as is" and without any expressed or implied * warranties, including, without limitation, the implied warranties of * merchantibility and fitness for any particular purpose. */ //---------------------------------------------------------------------- // Source file: pal.h // Written by: Cliff Green, 2002 // Compiler: Metrowerks CodeWarrior Pro 6, g++ 3.0.4 // History: // Modified: Mar. 5, 2002 // By: Cliff Green // Comments: Minor changes, mostly newer const declarations. //---------------------------------------------------------------------- // This commentheader supports documentation tools such as Doc++ and // Doxygen: http://www.doxygen.org/ //---------------------------------------------------------------------- /// PalCtr class, performs palindrome detection and counting. /** * Keeps track of how many palindromes have been detected * by calling the isPalindrome method. * * Pre-condition for isPalindrome - parameter is a valid pointer to * a nul-char terminated C string (array of characters). * * Pre-condition for strlen_alpha - same as isPalindrome. */ #ifndef PAL_H #define PAL_H // dtor, copy ctor, and assign op are defaulted class PalCtr { public: PalCtr() : mCnt(0) { } // ~PalCtr(); // implicit - generated by compiler if needed // PalCtr(PalCtr const& rhs); // implicit // PalCtr& operator=(PalCtr const& rhs); // implicit bool isPalindrome (char const* str); unsigned int getCnt() const { return mCnt; } private: unsigned int mCnt; }; int strlen_alpha (char const* str); #endif