5 Replies - 602 Views - Last Post: 07 May 2011 - 08:50 AM Rate Topic: -----

#1 Fırat  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 4
  • Joined: 06-May 11

class for general text processing

Posted 06 May 2011 - 11:21 AM

Consider writing an ‘‘ideal’’ class for general text processing. Call it T e x t . What facilities
should it have? What implementation constraints and overheads are imposed by your set of
‘‘ideal’’ facilities?
Is This A Good Question/Topic? 0
  • +

Replies To: class for general text processing

#2 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 943
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Re: class for general text processing

Posted 06 May 2011 - 11:25 AM

Basically a wrapper class for both istream and ofstream.

For functions here's a short list that would be suited for such a class
  • Read\Write
  • Word\Character Count
  • Text Replace
  • Text Search

Was This Post Helpful? 1
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5954
  • View blog
  • Posts: 23,222
  • Joined: 23-August 08

Re: class for general text processing

Posted 06 May 2011 - 11:52 AM

It's your homework question, why don't you tell us what you THINK it should have, instead of spamming multiple forums looking for someone to give you the answer?

NOTE: This is a question right out of The C++ Programming Language by Stroustrop.
Was This Post Helpful? 0
  • +
  • -

#4 Fırat  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 4
  • Joined: 06-May 11

Re: class for general text processing

Posted 06 May 2011 - 01:05 PM

View PostJackOfAllTrades, on 06 May 2011 - 11:52 AM, said:

It's your homework question, why don't you tell us what you THINK it should have, instead of spamming multiple forums looking for someone to give you the answer?

NOTE: This is a question right out of The C++ Programming Language by Stroustrop.



This is not my homework.
this is an example of the C + + programming language books (Bjarne storustrup)
and I have no idea about the subject.
I wanted to get ideas from here.
Is this a crime?
Was This Post Helpful? -1
  • +
  • -

#5 Bench  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 854
  • View blog
  • Posts: 2,338
  • Joined: 20-August 07

Re: class for general text processing

Posted 07 May 2011 - 03:20 AM

View PostFırat, on 06 May 2011 - 07:21 PM, said:

Consider writing an ‘‘ideal’’ class for general text processing. Call it T e x t . What facilities
should it have? What implementation constraints and overheads are imposed by your set of
‘‘ideal’’ facilities?

The reason Bjarne asks the question in his book is to get you to start thinking about the most commonly useful functionality which you might need for text processing/string manipulation. Its deliberately a bit of a trick question, which is why the word ideal is placed between double-quote marks.


The only correct response to such a generic question like that is "ideal for who?" But since this question has come from a book then the answer can only really come from your own imagination (So really, the question is, what would be ideal for you? What do you think would be most useful?).

The std::string type has some basic text processing tools, but some people consider it to be rather limited; e.g. it hasn't got very many built-in comparisons, for example there's no quick and easy built-in way to perform a case-insensitive comparison - instead you need to do a little bit more work when compared to other languages such as Java or C#


I could certainly think of a bunch of tools I'd find useful if they were added to std::string, however I bet a lot of people would disagree on them (or on the way I might want them implemented too)

This post has been edited by Bench: 07 May 2011 - 03:22 AM

Was This Post Helpful? 1
  • +
  • -

#6 Fırat  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 4
  • Joined: 06-May 11

Re: class for general text processing

Posted 07 May 2011 - 08:50 AM

View PostBench, on 07 May 2011 - 03:20 AM, said:

View PostFırat, on 06 May 2011 - 07:21 PM, said:

Consider writing an ‘‘ideal’’ class for general text processing. Call it T e x t . What facilities
should it have? What implementation constraints and overheads are imposed by your set of
‘‘ideal’’ facilities?

The reason Bjarne asks the question in his book is to get you to start thinking about the most commonly useful functionality which you might need for text processing/string manipulation. Its deliberately a bit of a trick question, which is why the word ideal is placed between double-quote marks.


The only correct response to such a generic question like that is "ideal for who?" But since this question has come from a book then the answer can only really come from your own imagination (So really, the question is, what would be ideal for you? What do you think would be most useful?).

The std::string type has some basic text processing tools, but some people consider it to be rather limited; e.g. it hasn't got very many built-in comparisons, for example there's no quick and easy built-in way to perform a case-insensitive comparison - instead you need to do a little bit more work when compared to other languages such as Java or C#


I could certainly think of a bunch of tools I'd find useful if they were added to std::string, however I bet a lot of people would disagree on them (or on the way I might want them implemented too)



Thank you very much for the reply :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1