Feature #1664

Buffer class improvements (Get method that replace ~operator), count and empty methods.

Added by Zbigniew Rebacz almost 5 years ago. Updated almost 5 years ago.

Status:ApprovedStart date:03/26/2017
Priority:NormalDue date:
Assignee:Zbigniew Rebacz% Done:

0%

Category:CoreSpent time:-
Target version:Release 2017.2

Description

Buffer should also offer alternative method (Get) to ~operator that returns raw pointer.

The size could also be remembered and we should introduce Count() and IsEmpty() approach.
Something like:

dword length = ::GetShortPathName(static_cast<LPCTSTR>(path), nullptr, 0);
if(length == 0)
    return path;
Buffer<char> shortPathBuffer(length);

Could be easily refactor to:

Buffer<char> GetBufferForShortPath(const String& path)
{
    dword length = ::GetShortPathName(static_cast<LPCTSTR>(path), nullptr, 0);
    return Buffer<char> shortPathBuffer(length);
}

// The in the code:
Buffer<char> shortPathBuffer = GetBufferForShortPath(path);
if (shortPathBuffer.IsEmpty())
   return path;
else
    // Do something with the buffer...

History

#1 Updated by Zbigniew Rebacz almost 5 years ago

  • Description updated (diff)

#2 Updated by Zbigniew Rebacz almost 5 years ago

  • Subject changed from Buffer should offer Get method similar to One's method to Buffer should offer Get method similar to One's method. Coutn and IsEmpty should also be added.

#3 Updated by Zbigniew Rebacz almost 5 years ago

  • Subject changed from Buffer should offer Get method similar to One's method. Coutn and IsEmpty should also be added. to Buffer class improvements (Get method that replace ~operator), count and empty methods.
  • Description updated (diff)

#4 Updated by Zbigniew Rebacz almost 5 years ago

  • Description updated (diff)

#5 Updated by Miroslav Fidler almost 5 years ago

  • Status changed from New to Ready for QA
  • Assignee changed from Miroslav Fidler to Zbigniew Rebacz

I disagree about Count. Rest is implemented.

#6 Updated by Zbigniew Rebacz almost 5 years ago

  • Status changed from Ready for QA to Approved

OK - without count it could be. Approved!

Also available in: Atom PDF